release: v0.1.3

This commit is contained in:
2026-04-03 14:20:26 +08:00
parent 1396592141
commit 13f0be162b
10 changed files with 520 additions and 79 deletions

View File

@@ -6,10 +6,12 @@ import {
createMemo,
createResource,
createSignal,
onMount,
onCleanup,
} from "solid-js";
import { A, useLocation } from "@solidjs/router";
import Dialog from "~/components/dialog/Dialog";
import { updateDebugConfig } from "~/service/debugLog";
import {
RELEASES_PAGE_URL,
type LatestRelease,
@@ -23,6 +25,7 @@ import {
resolveReleaseLink,
} from "~/service/update";
import { versionApi } from "~/service/wk";
import { settingsStore } from "~/store/settings";
type DownloadState = "idle" | "downloading" | "done" | "error";
type UpdateCheckState =
@@ -155,7 +158,9 @@ const App: ParentComponent = (props) => {
const [downloadState, setDownloadState] = createSignal<DownloadState>("idle");
const [downloadProgress, setDownloadProgress] = createSignal(0);
const [downloadError, setDownloadError] = createSignal("");
const [settingsState, setSettingsState] = createSignal(settingsStore.getState());
let updateAbortController: AbortController | null = null;
let lastDebugSyncValue: boolean | undefined;
const isActive = (url: string) =>
location.pathname === url ||
@@ -170,9 +175,7 @@ const App: ParentComponent = (props) => {
const authorText = createMemo(() => version()?.data.GitAuthor ?? "unknown");
const emailText = createMemo(() => version()?.data.GitEmail ?? "unknown");
const modeText = createMemo(() => version()?.data.Mode ?? "unknown");
const isDebugMode = createMemo(
() => modeText().toLowerCase() === "debug",
);
const isDebugMode = createMemo(() => settingsState().debugEnabled);
const asideList = createMemo(() => {
const items = [
{ label: "账号", url: "/account" },
@@ -229,6 +232,16 @@ const App: ParentComponent = (props) => {
() => latestRelease()?.html_url || RELEASES_PAGE_URL,
);
onMount(() => {
const unsubscribe = settingsStore.subscribe((state) => {
setSettingsState(state);
});
onCleanup(() => {
unsubscribe();
});
});
const handleCopyVersion = async () => {
try {
await navigator.clipboard.writeText(versionPayloadText());
@@ -322,6 +335,17 @@ const App: ParentComponent = (props) => {
void performUpdateCheck(false);
});
createEffect(() => {
const enabled = settingsState().debugEnabled;
if (lastDebugSyncValue === enabled) {
return;
}
lastDebugSyncValue = enabled;
void updateDebugConfig(enabled).catch(() => {
// Keep the local preference and let settings page surface sync errors.
});
});
onCleanup(() => {
if (updateAbortController) {
updateAbortController.abort();
@@ -404,6 +428,9 @@ const App: ParentComponent = (props) => {
<p class="mt-1 text-xs text-zinc-500">
: {modeText()}
</p>
<p class="mt-1 text-xs text-zinc-500">
: {isDebugMode() ? "已开启" : "已关闭"}
</p>
<p class="mt-3 text-xs font-medium tracking-[0.18em] text-cyan-700/75 uppercase">
Runtime
</p>