2024-09-27 15:28:32 +08:00
|
|
|
|
"use client"
|
2025-03-17 11:48:30 +08:00
|
|
|
|
import { useAppStore } from "@/store/app"
|
2025-03-23 23:25:28 +08:00
|
|
|
|
import { Switch } from "@heroui/react"
|
2025-11-05 11:19:43 +08:00
|
|
|
|
import { UpdateChecker } from "@/components/cstb/UpdateChecker"
|
2024-09-27 15:28:32 +08:00
|
|
|
|
|
2024-10-28 10:42:42 +08:00
|
|
|
|
export default function Page() {
|
2025-03-17 11:48:30 +08:00
|
|
|
|
const app = useAppStore()
|
2024-09-27 15:28:32 +08:00
|
|
|
|
|
2025-11-05 11:19:43 +08:00
|
|
|
|
// 从环境变量或配置中获取更新服务器地址
|
|
|
|
|
|
// 这里可以改为从 store 或配置文件中读取
|
|
|
|
|
|
const customEndpoint = process.env.NEXT_PUBLIC_UPDATE_ENDPOINT || ""
|
|
|
|
|
|
const githubRepo = process.env.NEXT_PUBLIC_GITHUB_REPO || ""
|
|
|
|
|
|
|
2024-09-27 15:28:32 +08:00
|
|
|
|
return (
|
2025-11-05 11:19:43 +08:00
|
|
|
|
<div className="flex flex-col items-start gap-4 pt-2 pb-1">
|
|
|
|
|
|
<div className="space-y-2">
|
|
|
|
|
|
<p className="text-sm">版本号:{app.state.version}</p>
|
|
|
|
|
|
<p className="text-sm">是否有更新:{app.state.hasUpdate ? "有" : "无"}</p>
|
|
|
|
|
|
<p className="text-sm">是否使用镜像源:{app.state.useMirror ? "是" : "否"}</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div className="w-full border-t border-zinc-200 dark:border-zinc-800 pt-4">
|
|
|
|
|
|
<h3 className="text-sm font-semibold mb-3">更新检查</h3>
|
|
|
|
|
|
<UpdateChecker customEndpoint={customEndpoint} githubRepo={githubRepo} />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div className="w-full border-t border-zinc-200 dark:border-zinc-800 pt-4 space-y-3">
|
|
|
|
|
|
<h3 className="text-sm font-semibold mb-3">启动设置</h3>
|
|
|
|
|
|
<Switch
|
|
|
|
|
|
isSelected={app.state.autoStart}
|
|
|
|
|
|
size="sm"
|
|
|
|
|
|
onChange={(e) => app.setAutoStart(e.target.checked)}
|
|
|
|
|
|
>
|
|
|
|
|
|
开机自启动 {app.state.autoStart ? "开" : "关"}
|
|
|
|
|
|
</Switch>
|
|
|
|
|
|
<Switch
|
|
|
|
|
|
isSelected={app.state.startHidden}
|
|
|
|
|
|
size="sm"
|
|
|
|
|
|
onChange={(e) => app.setStartHidden(e.target.checked)}
|
|
|
|
|
|
>
|
|
|
|
|
|
静默启动 {app.state.startHidden ? "开" : "关"}
|
|
|
|
|
|
</Switch>
|
|
|
|
|
|
<Switch
|
|
|
|
|
|
isSelected={app.state.hiddenOnClose}
|
|
|
|
|
|
size="sm"
|
|
|
|
|
|
onChange={(e) => app.setHiddenOnClose(e.target.checked)}
|
|
|
|
|
|
>
|
|
|
|
|
|
关闭时最小化到托盘 {app.state.hiddenOnClose ? "开" : "关"}
|
|
|
|
|
|
</Switch>
|
|
|
|
|
|
</div>
|
2024-09-27 15:28:32 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
)
|
2024-10-28 10:42:42 +08:00
|
|
|
|
}
|