Update src/widgets/wgeasy/proxy.js
Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
parent
0dba883641
commit
1f62e11d88
@ -20,19 +20,18 @@ async function login(widget, service) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
let connectSidCookie;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
connectSidCookie = responseHeaders["set-cookie"]
|
const connectSidCookie = responseHeaders["set-cookie"]
|
||||||
.find((cookie) => cookie.startsWith("connect.sid="))
|
.find((cookie) => cookie.startsWith("connect.sid="))
|
||||||
.split(";")[0]
|
.split(";")[0]
|
||||||
.replace("connect.sid=", "");
|
.replace("connect.sid=", "");
|
||||||
cache.put(`${sessionSIDCacheKey}.${service}`);
|
cache.put(`${sessionSIDCacheKey}.${service}`);
|
||||||
|
return connectSidCookie;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error(`Error logging into wg-easy`);
|
logger.error(`Error logging into wg-easy`);
|
||||||
cache.del(`${sessionSIDCacheKey}.${service}`);
|
cache.del(`${sessionSIDCacheKey}.${service}`);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
return [status, connectSidCookie ?? null];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function wgeasyProxyHandler(req, res) {
|
export default async function wgeasyProxyHandler(req, res) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user