MCPcopy Create free account
hub / github.com/Tron521/codex-console-temp / saveManualSessionToken

Function saveManualSessionToken

static/js/payment.js:292–321  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

290}
291
292async function saveManualSessionToken() {
293 const accountId = Number(document.getElementById("account-select")?.value || 0);
294 if (!accountId) {
295 toast.warning("请先选择账号");
296 return;
297 }
298 const sessionToken = String(document.getElementById("manual-session-token-input")?.value || "").trim();
299 if (!sessionToken) {
300 toast.warning("请先粘贴 session_token");
301 return;
302 }
303
304 setButtonLoading("save-session-token-btn", "保存中...", true);
305 try {
306 const data = await api.post(`/payment/accounts/${accountId}/session-token`, {
307 session_token: sessionToken,
308 merge_cookie: true,
309 });
310 if (data?.success) {
311 toast.success(`Session Token 已保存(len=${data?.session_token_len || 0})`);
312 await runSessionDiagnostic();
313 return;
314 }
315 toast.warning(data?.message || "保存完成,但未返回 success");
316 } catch (error) {
317 toast.error(`保存 Session Token 失败: ${formatErrorMessage(error)}`);
318 } finally {
319 setButtonLoading("save-session-token-btn", "保存中...", false);
320 }
321}
322
323function getInputValue(id) {
324 return (document.getElementById(id)?.value || "").trim();

Callers

nothing calls this directly

Calls 7

setButtonLoadingFunction · 0.85
runSessionDiagnosticFunction · 0.85
formatErrorMessageFunction · 0.85
warningMethod · 0.80
successMethod · 0.80
errorMethod · 0.80
postMethod · 0.45

Tested by

no test coverage detected