fix: magic link JWT (?token=) を先頭スクリプトで localStorage に保存

Made-with: Cursor
This commit is contained in:
posimai 2026-04-21 09:16:38 +09:00
parent 2a8bfb7306
commit 13c76e3a9f
1 changed files with 8 additions and 1 deletions

View File

@ -6,11 +6,18 @@
<script>
(function () {
const p = new URLSearchParams(location.search);
const tk = p.get('token');
if (tk) {
localStorage.setItem('posimai_token', tk);
p.delete('token');
}
const k = p.get('init_key');
if (k) {
localStorage.setItem('posimai-brief-apikey', k);
p.delete('init_key');
const u = location.pathname + (p.toString() ? '?' + p : '');
}
if (tk || k) {
const u = location.pathname + (p.toString() ? '?' + p.toString() : '') + location.hash;
history.replaceState({}, '', u);
}
const t = localStorage.getItem('posimai-brief-theme') || 'system';