This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,59 @@
// Metro module 13980 (f13981).
import { Endpoints } from "../../Constants";
import { HTTP } from "../../_bundle/sendRequest";
import Dispatcher from "../../Dispatcher";
export async function fetchAuthSessions() {
let c27606_1;
c27606_1 = void 0;
let c30684_0 = await HTTP.get({
url: Endpoints.AUTH_SESSIONS,
rejectWithError: false
});
if (c30684_0?.ok && c30684_0.body?.user_sessions != null) {
Dispatcher.dispatch({
type: "FETCH_AUTH_SESSIONS_SUCCESS",
sessions: c30684_0.body.user_sessions
});
}
return c30684_0;
}
export function clearAuthSessions() {
Dispatcher.dispatch({
type: "FETCH_AUTH_SESSIONS_SUCCESS",
sessions: []
});
}
export async function logOutSessions(session_id_hashes) {
let session_id_hashes2;
let c27607_2;
let c30685_0, c30685_1;
L18: {
c27607_2 = void 0;
c30685_0 = session_id_hashes;
c30685_1 = void 0;
if (Array.isArray(session_id_hashes)) {
const length = session_id_hashes.length;
session_id_hashes2 = session_id_hashes;
if (length === 0) {
break L18;
}
} else {
session_id_hashes2 = [session_id_hashes];
c30685_0 = session_id_hashes2;
}
c30685_1 = await HTTP.post({
url: Endpoints.AUTH_SESSIONS_LOGOUT,
body: {
session_id_hashes: session_id_hashes2
},
rejectWithError: false
});
if (c30685_1?.ok) {
Dispatcher.dispatch({
type: "LOGOUT_AUTH_SESSIONS_SUCCESS",
sessionIdHashes: c30685_0
});
}
return c30685_1;
}
}
@@ -0,0 +1,45 @@
// Metro module 13767 (f13768).
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c9577_0;
const handleInit = function handleInit() {
c9577_0 = [];
};
c9577_0 = [];
class AuthSessionsStore extends Module589.Store {
static displayName = "AuthSessionsStore";
getSessions() {
return c9577_0;
}
}
const authSessionsStore = new AuthSessionsStore(Dispatcher, {
LOGOUT: handleInit,
LOGIN_SUCCESS: handleInit,
FETCH_AUTH_SESSIONS_SUCCESS: function handleFetchAuthSessionsSuccess(a0) {
c9577_0 = a0.sessions.map((session) => ({
...session,
approx_last_used_time: new Date(session.approx_last_used_time)
}));
},
LOGOUT_AUTH_SESSIONS_SUCCESS: function handleLogoutAuthSessionsSuccess({ sessionIdHashes }) {
const r1 = [...c9577_0];
let c20711_0 = r1;
let c20711_1 = false;
const _loop = function _loop(c27570_0) {
const r8 = c20711_0.findIndex((item) => item.id_hash === c27570_0);
if (r8 >= 0) {
c20711_0.splice(r8, 1);
c20711_1 = true;
}
};
for (const item of sessionIdHashes) {
_loop(item);
}
if (c20711_1) {
c9577_0 = r1;
return void 0;
}
return false;
}
});
export default authSessionsStore;
@@ -0,0 +1,28 @@
// Metro module 13766 (f13767).
import { useMemo } from "react";
import AuthenticationStore from "../../stores/AuthenticationStore";
import AuthSessionsStore from "./AuthSessionsStore";
import { useStateFromStoresObject } from "../../_bundle/Module589";
import { intl, t } from "../../intl/index.native";
import Module3771 from "../../_bundle/Module3771";
export function useAuthSessions() {
const stateFromStoresObject = useStateFromStoresObject([AuthSessionsStore], () => AuthSessionsStore.getSessions());
return useMemo(() => {
const otherSessions = [...stateFromStoresObject];
const authSessionIdHash = AuthenticationStore.getAuthSessionIdHash();
const r3 = authSessionIdHash != null;
let currentSession = null;
if (r3) {
const r17 = otherSessions.findIndex((otherSession) => otherSession.id_hash === authSessionIdHash);
currentSession = r17 >= 0 ? otherSessions.splice(r17, 1)[0] : null;
}
otherSessions.sort((a, b) => b.approx_last_used_time.valueOf() - a.approx_last_used_time.valueOf());
return {
currentSession,
otherSessions
};
}, [stateFromStoresObject]);
}
export function formatDate(a0) {
return (Date.now() - a0.valueOf()) / 1000 / 60 / 60 < 1 ? intl.string(t.TXCmfL) : Module3771(a0).fromNow();
}