@kenhkl/agent-moss 0.17.0 → 0.17.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/static/index.html +12 -0
- package/package.json +1 -1
package/dist/static/index.html
CHANGED
|
@@ -344,6 +344,18 @@ document.documentElement.lang = isEn ? 'en' : 'zh-CN';
|
|
|
344
344
|
|
|
345
345
|
// ===== API client =====
|
|
346
346
|
const TOKEN_KEY = 'am_console_token';
|
|
347
|
+
// ?token=xxx:桌面端(OpenDesk)用 iframe 嵌入时注入。iframe 与父页面不同源,
|
|
348
|
+
// localStorage 不共享,只能走 URL;读到后立刻从地址栏移除,避免留在历史记录里。
|
|
349
|
+
(function adoptTokenFromUrl() {
|
|
350
|
+
try {
|
|
351
|
+
const u = new URL(location.href);
|
|
352
|
+
const t_ = u.searchParams.get('token');
|
|
353
|
+
if (!t_) return;
|
|
354
|
+
localStorage.setItem(TOKEN_KEY, t_);
|
|
355
|
+
u.searchParams.delete('token');
|
|
356
|
+
history.replaceState(null, '', u.pathname + (u.search || '') + u.hash);
|
|
357
|
+
} catch (e) { /* 受限环境:忽略 */ }
|
|
358
|
+
})();
|
|
347
359
|
function getToken() { return localStorage.getItem(TOKEN_KEY) || ''; }
|
|
348
360
|
function authHeaders() {
|
|
349
361
|
const t_ = getToken();
|