mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-10 15:28:47 +00:00
starting of widget refactoring
This commit is contained in:
parent
d6f6ea9dba
commit
562235f828
42 changed files with 337 additions and 301 deletions
|
@ -12,15 +12,15 @@ async function login(widget, params) {
|
|||
return fetch(loginUrl, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
||||
body: loginBody
|
||||
body: loginBody,
|
||||
})
|
||||
.then(async response => {
|
||||
addCookieToJar(loginUrl, response.headers);
|
||||
setCookieHeader(loginUrl, params);
|
||||
const data = await response.text();
|
||||
return ([response.status, data]);
|
||||
})
|
||||
.catch(err => ([500, err]));
|
||||
.then(async (response) => {
|
||||
addCookieToJar(loginUrl, response.headers);
|
||||
setCookieHeader(loginUrl, params);
|
||||
const data = await response.text();
|
||||
return [response.status, data];
|
||||
})
|
||||
.catch((err) => [500, err]);
|
||||
}
|
||||
|
||||
export default async function qbittorrentProxyHandler(req, res) {
|
||||
|
@ -46,7 +46,7 @@ export default async function qbittorrentProxyHandler(req, res) {
|
|||
if (status !== 200) {
|
||||
return res.status(status).end(data);
|
||||
}
|
||||
if (data.toString() !== 'Ok.') {
|
||||
if (data.toString() !== "Ok.") {
|
||||
return res.status(401).end(data);
|
||||
}
|
||||
}
|
||||
|
@ -55,4 +55,4 @@ export default async function qbittorrentProxyHandler(req, res) {
|
|||
|
||||
if (contentType) res.setHeader("Content-Type", contentType);
|
||||
return res.status(status).send(data);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue