decord/source/modules/auth_sessions/AuthSessionsUtils.tsx

51 lines
2 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 14160
// Function ID: 14161
2026-07-20 16:05:17 +00:00
// Name: useAuthSessions
2026-08-24 06:08:38 +00:00
// Dependencies: [19, 1218, 14161, 589, 1236, 3978, 2]
2026-07-20 16:05:17 +00:00
// Exports: formatDate, useAuthSessions
2026-08-24 06:08:38 +00:00
// Module 14160 (useAuthSessions)
import getSystemLocale from "getSystemLocale" /* 1236 */;
import tDefault from "t" /* 3978 */;
import closure_3 from "noop" /* 19 */;
import closure_4 from "fetchFingerprint" /* 1218 */;
import closure_5 from "handleInit" /* 14161 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
const result = require("set").fileFinishedImporting("modules/auth_sessions/AuthSessionsUtils.tsx");
2026-07-20 16:05:17 +00:00
export const useAuthSessions = function useAuthSessions() {
2026-08-24 06:08:38 +00:00
const items = [closure_5];
2026-07-29 08:29:29 +00:00
stateFromStoresObject = stateFromStoresObject(589).useStateFromStoresObject(items, () => sessions.getSessions());
2026-07-20 16:05:17 +00:00
const items1 = [stateFromStoresObject];
return React.useMemo(() => {
2026-07-29 08:29:29 +00:00
const otherSessions = [...authSessionIdHash];
2026-08-24 06:08:38 +00:00
authSessionIdHash = closure_1_4.getAuthSessionIdHash();
2026-07-29 08:29:29 +00:00
let currentSession = null;
2026-07-20 16:05:17 +00:00
if (null != authSessionIdHash) {
2026-07-29 08:29:29 +00:00
const findIndexResult = otherSessions.findIndex((id_hash) => id_hash.id_hash === authSessionIdHash);
currentSession = null;
2026-07-20 16:05:17 +00:00
if (findIndexResult >= 0) {
2026-07-29 08:29:29 +00:00
currentSession = otherSessions.splice(findIndexResult, 1)[0];
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
const sorted = otherSessions.sort((approx_last_used_time, approx_last_used_time2) => {
2026-07-20 16:05:17 +00:00
approx_last_used_time = approx_last_used_time2.approx_last_used_time;
approx_last_used_time2 = approx_last_used_time.approx_last_used_time;
return approx_last_used_time.valueOf() - approx_last_used_time2.valueOf();
});
2026-07-29 08:29:29 +00:00
return { currentSession, otherSessions };
2026-07-20 16:05:17 +00:00
}, items1);
};
export const formatDate = function formatDate(arg0) {
const timestamp = Date.now();
if ((timestamp - arg0.valueOf()) / 1000 / 60 / 60 < 1) {
2026-08-24 06:08:38 +00:00
const intl = getSystemLocale.intl;
let stringResult = intl.string(getSystemLocale.t.TXCmfL);
2026-07-20 16:05:17 +00:00
} else {
2026-08-24 06:08:38 +00:00
stringResult = tDefault(arg0).fromNow();
const obj = tDefault(arg0);
2026-07-20 16:05:17 +00:00
}
return stringResult;
};