1
0
réplica de https://github.com/karl0ss/homepage.git sincronizado 2025-10-21 02:34:00 +01:00

Fix: wg-easy threshold not properly computed (#3574)

Este cometimento está contido em:
Conner Hnatiuk 2024-06-03 15:52:58 -06:00 cometido por GitHub
ascendente 19c3ac0d7e
cometimento 67a69a5878
Não foi encontrada uma chave conhecida para esta assinatura, na base de dados
ID da chave GPG: B5690EEEBB952194
2 ficheiros modificados com 10 adições e 3 eliminações

Ver ficheiro

@ -28,7 +28,7 @@ export default function Component({ service }) {
const enabled = infoData.filter((item) => item.enabled).length;
const disabled = infoData.length - enabled;
const connectionThreshold = widget.threshold ?? 2 * 60 * 1000;
const connectionThreshold = (widget.threshold ?? 2) * 60 * 1000;
const currentTime = new Date();
const connected = infoData.filter(
(item) => currentTime - new Date(item.latestHandshakeAt) < connectionThreshold,

Ver ficheiro

@ -21,14 +21,21 @@ async function login(widget, service) {
});
try {
const connectSidCookie = responseHeaders["set-cookie"]
const connectSidCookie = responseHeaders["set-cookie"];
if (!connectSidCookie) {
const sid = cache.get(`${sessionSIDCacheKey}.${service}`);
if (sid) {
return sid;
}
}
connectSidCookie = connectSidCookie
.find((cookie) => cookie.startsWith("connect.sid="))
.split(";")[0]
.replace("connect.sid=", "");
cache.put(`${sessionSIDCacheKey}.${service}`, connectSidCookie);
return connectSidCookie;
} catch (e) {
logger.error(`Error logging into wg-easy`);
logger.error(`Error logging into wg-easy, error: ${e}`);
cache.del(`${sessionSIDCacheKey}.${service}`);
return null;
}