diff --git a/Client/index.html b/Client/index.html index 48933f5..7ecbc5a 100644 --- a/Client/index.html +++ b/Client/index.html @@ -4,7 +4,7 @@ - Sign in + CCStart
diff --git a/Client/src/assets/startpage/Night.webp b/Client/src/assets/startpage/Night.webp new file mode 100644 index 0000000..9b55d17 Binary files /dev/null and b/Client/src/assets/startpage/Night.webp differ diff --git a/Client/src/assets/startpage/No.1.webp b/Client/src/assets/startpage/No.1.webp new file mode 100644 index 0000000..81ba760 Binary files /dev/null and b/Client/src/assets/startpage/No.1.webp differ diff --git a/Client/src/assets/startpage/No.2.webp b/Client/src/assets/startpage/No.2.webp new file mode 100644 index 0000000..db7d056 Binary files /dev/null and b/Client/src/assets/startpage/No.2.webp differ diff --git a/Client/src/assets/startpage/No.3.webp b/Client/src/assets/startpage/No.3.webp new file mode 100644 index 0000000..7288973 Binary files /dev/null and b/Client/src/assets/startpage/No.3.webp differ diff --git a/Client/src/assets/startpage/No.4.webp b/Client/src/assets/startpage/No.4.webp new file mode 100644 index 0000000..558482d Binary files /dev/null and b/Client/src/assets/startpage/No.4.webp differ diff --git a/Client/src/assets/startpage/No.5.webp b/Client/src/assets/startpage/No.5.webp new file mode 100644 index 0000000..8416017 Binary files /dev/null and b/Client/src/assets/startpage/No.5.webp differ diff --git a/Client/src/assets/startpage/dark.png b/Client/src/assets/startpage/dark.png deleted file mode 100644 index f6d077e..0000000 Binary files a/Client/src/assets/startpage/dark.png and /dev/null differ diff --git a/Client/src/assets/startpage/light.jpg b/Client/src/assets/startpage/light.jpg deleted file mode 100644 index ac16957..0000000 Binary files a/Client/src/assets/startpage/light.jpg and /dev/null differ diff --git a/Client/src/components/LoginForm.tsx b/Client/src/components/LoginForm.tsx index d2a50b1..e54aa82 100644 --- a/Client/src/components/LoginForm.tsx +++ b/Client/src/components/LoginForm.tsx @@ -40,7 +40,7 @@ export function LoginForm({ onSignIn }: LoginFormProps) { className="flex w-full max-w-md flex-col justify-center px-8 py-14 sm:px-12 lg:px-16" > -

Sign in

+

CCStart

Enter your details to continue.

diff --git a/Client/src/components/StartPage.tsx b/Client/src/components/StartPage.tsx index b56eb5a..2c80721 100644 --- a/Client/src/components/StartPage.tsx +++ b/Client/src/components/StartPage.tsx @@ -7,8 +7,8 @@ import { SearchBar } from './start/SearchBar' import { CategoryDock } from './start/CategoryDock' import { WeatherFx } from './start/WeatherFx' -// 背景图:放 src/assets/startpage/ 下。按昼夜选 light / dark; -// 缺这两张时回退到目录里排序第一张,再无则用渐变。说明见该目录 README。 +// 背景图:放 src/assets/startpage/ 下。6:00–24:00 从 No.1~No.5 里随机取一张; +// 0:00–6:00 用 Night。缺图时互相回退,再无则用渐变。说明见该目录 README。 const bgFiles = import.meta.glob('../assets/startpage/*.{jpg,jpeg,png,webp}', { eager: true, query: '?url', @@ -19,24 +19,16 @@ function bgByName(name: string): string | undefined { return Object.entries(bgFiles).find(([p]) => p.toLowerCase().includes(`/${name}.`))?.[1] } -const lightBg = bgByName('light') -const darkBg = bgByName('dark') -const anyBg = Object.entries(bgFiles) +// 白天候选:No.1~No.5(按编号排序);夜间:Night。 +const dayBgs = Object.entries(bgFiles) + .filter(([p]) => /\/no\.\d+\./i.test(p)) .sort(([a], [b]) => a.localeCompare(b)) - .map(([, url]) => url)[0] + .map(([, url]) => url) +const nightBg = bgByName('night') -// 和风图标码中能区分昼夜的子集(晴/多云/阵雨)。其余码无昼夜之分。 -const NIGHT_ICONS = new Set(['150', '151', '152', '153', '350', '351', '456', '457']) -const DAY_ICONS = new Set(['100', '101', '102', '103', '300', '301', '400', '401']) - -// 昼夜判断:图标码优先,判断不了的码用本地时间兜底(18:00–06:00 为夜)。 -function isNight(icon?: string): boolean { - if (icon) { - if (NIGHT_ICONS.has(icon)) return true - if (DAY_ICONS.has(icon)) return false - } - const h = new Date().getHours() - return h < 6 || h >= 18 +// 昼夜判断:纯按本地时间,0:00–6:00 为夜。 +function isNight(): boolean { + return new Date().getHours() < 6 } // 动态效果类型:只做雨/雪两类,其余静态。 @@ -64,14 +56,18 @@ export function StartPage() { const icon = wx.data && wx.data.ok ? wx.data.icon : undefined + // 白天随机选一张,整页生命周期内固定,避免每分钟一拍时背景乱跳。 + const [dayIdx] = useState(() => Math.floor(Math.random() * Math.max(dayBgs.length, 1))) + // 开发预览(仅 DEV):?bg=light|dark 强制背景;?fx=rain|snow|thunder|none 强制动效。 // 例:http://localhost:5173/?bg=dark&fx=snow const ov = import.meta.env.DEV ? new URLSearchParams(window.location.search) : null const ovBg = ov?.get('bg') const ovFx = ov?.get('fx') - const night = ovBg ? ovBg === 'dark' : isNight(icon) - const bg = (night ? darkBg : lightBg) ?? lightBg ?? darkBg ?? anyBg + const night = ovBg ? ovBg === 'dark' : isNight() + const dayBg = dayBgs[dayIdx] ?? dayBgs[0] + const bg = (night ? nightBg : dayBg) ?? dayBg ?? nightBg let kind = fxKind(icon) let thunder = isThunder(icon) diff --git a/docs/superpowers/plans/2026-06-18-deploy.md b/docs/superpowers/plans/2026-06-18-deploy.md index e8a3dd1..8348785 100644 --- a/docs/superpowers/plans/2026-06-18-deploy.md +++ b/docs/superpowers/plans/2026-06-18-deploy.md @@ -230,3 +230,27 @@ ssh root@8.130.143.54 "tail -f /opt/internet-project/server.log" **Redeploy after code changes:** Re-run Tasks 1–4. For frontend-only changes, skip Task 2. + +**Frontend-only redeploy (verified 2026-06-22):** +The active WSL checkout is at `/home/cc/InternetProject` (not the `/mnt/f/...` +path in the original tasks above). Since the Rust process serves `static/` from +disk, a frontend-only change needs **no server restart** — just rebuild and +replace the static files: +```bash +cd /home/cc/InternetProject/Client +npm run build +# clear stale hashed assets so old bundles don't accumulate +ssh root@8.130.143.54 "rm -rf /opt/internet-project/static/assets && mkdir -p /opt/internet-project/static" +scp -r dist/* root@8.130.143.54:/opt/internet-project/static/ +# verify live +curl -s http://8.130.143.54:8548/ | grep -o '[^<]*' +curl -s -o /dev/null -w '%{http_code}\n' http://8.130.143.54:8548/api/client/health +``` + +**Restart the Rust binary (backend changes):** +A helper exists on the server: `/opt/internet-project/restart_rust.sh`. The +previous binary is kept as `RustServer.bak` for rollback. + +> Startpage backgrounds: large PNG/JPG source images are pre-compressed to WebP +> (max width 2560, quality ~82) before building — keeps each background under +> ~400 KB for the 3 Mbps server link.