Skip to content

Commit 42d913c

Browse files
committed
chore(sync): remove manual token UX
1 parent 2ed3d90 commit 42d913c

5 files changed

Lines changed: 6 additions & 52 deletions

File tree

app/src/lib/apps/SyncPanel.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
function requireGithubToken() {
118118
const token = get(githubToken);
119119
if (!token) {
120-
gistStatus = t('panels.sync.statuses.tokenRequired');
120+
gistStatus = t('panels.sync.statuses.requireLogin');
121121
}
122122
return token;
123123
}

app/src/lib/i18n/keys.json

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"/Users/linull/Documents/gits/SHU-Course-Scheduler/app/src/lib/i18n/locales/zh-CN.ts",
44
"/Users/linull/Documents/gits/SHU-Course-Scheduler/app/src/lib/i18n/locales/en-US.ts"
55
],
6-
"count": 1122,
6+
"count": 1113,
77
"keys": [
88
"api.loginSuccess",
99
"calendar.description",
@@ -908,7 +908,6 @@
908908
"panels.sync.confirm.importBody",
909909
"panels.sync.confirm.importConfirm",
910910
"panels.sync.confirm.importTitle",
911-
"panels.sync.copyButton",
912911
"panels.sync.currentTerm",
913912
"panels.sync.exportButton",
914913
"panels.sync.exportDescription",
@@ -953,8 +952,6 @@
953952
"panels.sync.statuses.syncSuccess",
954953
"panels.sync.statuses.syncing",
955954
"panels.sync.statuses.termStateMissing",
956-
"panels.sync.statuses.tokenRequired",
957-
"panels.sync.statuses.tokenSaved",
958955
"panels.sync.storageCollapse",
959956
"panels.sync.storageCrossCampus",
960957
"panels.sync.storageDescription",
@@ -966,12 +963,6 @@
966963
"panels.sync.storageTimeTemplates",
967964
"panels.sync.storageTitle",
968965
"panels.sync.title",
969-
"panels.sync.tokenHide",
970-
"panels.sync.tokenHint",
971-
"panels.sync.tokenLabel",
972-
"panels.sync.tokenPlaceholder",
973-
"panels.sync.tokenSave",
974-
"panels.sync.tokenShow",
975966
"panels.sync.uploadButton",
976967
"prompts.selectionMode.allowOverflow",
977968
"prompts.selectionMode.close",

app/src/lib/i18n/locales/en-US.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,6 @@ export const enUS = {
950950
exportDescription: 'Generate a Base64 snapshot (includes term/version) for copying or sharing.',
951951
exportPlaceholder: 'Click the button below to create Base64',
952952
exportButton: 'Generate Base64',
953-
copyButton: 'Copy',
954953
importTitle: 'Import selection state',
955954
importDescription: 'Paste a Base64 snapshot to restore selected/wishlist lists.',
956955
importPlaceholder: 'Paste Base64 string',
@@ -963,13 +962,7 @@ export const enUS = {
963962
gistLoggedIn: 'GitHub logged in',
964963
loginHint: 'OAuth login (PKCE, opens a popup).',
965964
loginUnavailableHint: 'GitHub OAuth is not configured for this deployment. Set PUBLIC_GITHUB_CLIENT_ID in build/deploy env.',
966-
tokenLabel: 'GitHub token (local only)',
967-
tokenPlaceholder: 'Paste a token (requires Gist access)',
968-
tokenShow: 'Show',
969-
tokenHide: 'Hide',
970-
tokenSave: 'Save token',
971965
closeWindow: 'Close window',
972-
tokenHint: 'Token stays in your browser localStorage and is never included in the bundle.',
973966
gistIdLabel: 'Gist ID (optional)',
974967
gistIdPlaceholder: 'Existing Gist ID for incremental updates',
975968
noteLabel: 'Note',
@@ -996,8 +989,6 @@ export const enUS = {
996989
githubAuthorizing: 'Completing GitHub login...',
997990
githubLoginSuccess: 'GitHub login successful',
998991
requireLogin: 'Log in to GitHub first',
999-
tokenRequired: 'Paste a GitHub token first',
1000-
tokenSaved: 'Token saved locally',
1001992
termStateMissing: 'TermState not loaded yet. Please retry.',
1002993
syncing: 'Building snapshot and syncing...',
1003994
syncSuccess: 'Sync success: {url}',

app/src/lib/i18n/locales/zh-CN.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,6 @@ export const zhCN = {
938938
exportDescription: '生成 Base64 快照(包含学期/版本),方便复制或贴到 Issue/Gist。',
939939
exportPlaceholder: '点击下方按钮生成 Base64',
940940
exportButton: '生成 Base64',
941-
copyButton: '复制',
942941
importTitle: '导入选课状态',
943942
importDescription: '粘贴 Base64 快照,恢复“已选 / 待选”列表。',
944943
importPlaceholder: '粘贴 Base64 字符串',
@@ -951,13 +950,7 @@ export const zhCN = {
951950
gistLoggedIn: '已登录 GitHub',
952951
loginHint: '使用 OAuth 登录(PKCE,会打开弹窗)。',
953952
loginUnavailableHint: '此部署未配置 GitHub OAuth。请在构建/部署环境中设置 PUBLIC_GITHUB_CLIENT_ID。',
954-
tokenLabel: 'GitHub token(仅本地保存)',
955-
tokenPlaceholder: '仅开发/调试:输入 token(需要 Gist 权限)',
956-
tokenShow: '显示',
957-
tokenHide: '隐藏',
958-
tokenSave: '保存 token',
959953
closeWindow: '关闭窗口',
960-
tokenHint: 'token 仅保存在本机浏览器 localStorage,不会被打包进同步内容。',
961954
gistIdLabel: 'Gist ID(可选)',
962955
gistIdPlaceholder: '已存在的 Gist ID,用于增量更新',
963956
noteLabel: '备注 / Note',
@@ -984,8 +977,6 @@ export const zhCN = {
984977
githubAuthorizing: '正在完成 GitHub 登录...',
985978
githubLoginSuccess: 'GitHub 登录成功',
986979
requireLogin: '请先登录 GitHub',
987-
tokenRequired: '请先登录 GitHub',
988-
tokenSaved: 'token 已保存到本地',
989980
termStateMissing: 'TermState 未加载,请稍后重试',
990981
syncing: '正在生成快照并同步...',
991982
syncSuccess: '同步成功:{url}',

app/src/routes/auth/callback/+page.svelte

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
$: t = $translator;
1313
1414
let status = '';
15-
let token: string | null = null;
1615
let closeBlocked = false;
1716
1817
onMount(async () => {
@@ -38,9 +37,8 @@
3837
return;
3938
}
4039
41-
token = result.token;
4240
status = t('panels.sync.statuses.githubLoginSuccess');
43-
deliverToken(token);
41+
deliverToken(result.token);
4442
tryCloseOrFallback();
4543
});
4644
@@ -119,35 +117,18 @@
119117
}, 400);
120118
}
121119
122-
async function copyToken() {
123-
if (!token) return;
124-
try {
125-
await navigator.clipboard.writeText(token);
126-
status = t('panels.sync.statuses.copySuccess');
127-
} catch {
128-
status = token;
129-
}
130-
}
131120
</script>
132121

133122
<main class="min-h-dvh flex items-center justify-center bg-[var(--app-color-bg)] p-6">
134123
<section class="w-full max-w-[560px] rounded-[var(--app-radius-lg)] border border-[color:var(--app-color-border-subtle)] bg-[var(--app-color-bg-elevated)] p-5 shadow-[var(--app-shadow-soft)]">
135124
<h1 class="m-0 text-[var(--app-text-lg)] font-semibold text-[var(--app-color-fg)]">{t('panels.sync.gistTitle')}</h1>
136125
<p class="mt-2 text-[var(--app-text-sm)] text-[var(--app-color-fg-muted)]">{status}</p>
137126

138-
{#if token}
127+
{#if closeBlocked}
139128
<div class="mt-4 flex flex-wrap items-center gap-2">
140-
<AppButton type="button" variant="primary" size="sm" on:click={copyToken}>
141-
{t('panels.sync.copyButton')}
129+
<AppButton type="button" variant="secondary" size="sm" on:click={tryCloseOrFallback}>
130+
{t('panels.sync.closeWindow')}
142131
</AppButton>
143-
{#if closeBlocked}
144-
<AppButton type="button" variant="secondary" size="sm" on:click={tryCloseOrFallback}>
145-
{t('panels.sync.closeWindow')}
146-
</AppButton>
147-
{/if}
148-
<span class="text-[var(--app-text-xs)] text-[var(--app-color-fg-muted)]">
149-
{t('panels.sync.tokenHint')}
150-
</span>
151132
</div>
152133
{/if}
153134
</section>

0 commit comments

Comments
 (0)