This commit is contained in:
llama 2025-10-18 10:52:00 +08:00
parent 4f52a2c0d6
commit 6f06f81f06
No known key found for this signature in database
GPG key ID: 0B7543854B9413C3
7 changed files with 9 additions and 18 deletions

View file

@ -4,7 +4,7 @@
#[cfg(all(unix, not(target_os = "macos")))]
pub mod unix;
// #[cfg(target_os = "macos")]
#[cfg(target_os = "macos")]
pub mod mac;
#[cfg(target_os = "windows")]

View file

@ -73,6 +73,7 @@ impl From<NormalState> for State {
pub enum State {
LaunchAnki(Arc<uv::Paths>),
#[allow(dead_code)] // TODO: use
Error(anyhow::Error),
Uninstall(Arc<uv::Paths>),
Normal(NormalState),
@ -94,10 +95,6 @@ impl State {
_ => Err(anyhow!("unexpected state")),
}
}
pub fn should_launch_anki(&self) -> bool {
matches!(self, State::LaunchAnki(_))
}
}
impl NormalState {

View file

@ -4,7 +4,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
<script lang="ts">
import { tr } from "./stores";
import { ExistingVersions, Versions } from "@generated/anki/launcher_pb";
import type { ExistingVersions, Versions } from "@generated/anki/launcher_pb";
import Row from "$lib/components/Row.svelte";
import EnumSelector from "$lib/components/EnumSelector.svelte";
@ -20,7 +20,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
choose: (version: string, existing: boolean, current?: string) => void;
} = $props();
const availableVersions = $derived(
let availableVersions = $derived(
releases.all
.filter((v) => allowBetas || !v.isPrerelease)
.map((v) => ({ label: v.version, value: v.version })),
@ -30,7 +30,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
let selected = $derived(availableVersions[0]?.value ?? null);
let current = $derived(existing.current?.version);
let pyprojectModified = existing.pyprojectModifiedByUser;
let pyprojectModified = $derived(existing.pyprojectModifiedByUser);
function _choose(version: string, keepExisting: boolean = false) {
choose(version, keepExisting, current);

View file

@ -27,7 +27,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import Options from "./Options.svelte";
import Term from "./Term.svelte";
import AnkiWillStart from "./AnkiWillStart.svelte";
import { Terminal } from "@xterm/xterm";
import type { Terminal } from "@xterm/xterm";
let {
langs,

View file

@ -1,8 +1,8 @@
// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import * as _tr from "@generated/ftl-launcher";
import type { GetLangsResponse_Pair, GetMirrorsResponse_Pair, GetVersionsResponse } from "@generated/anki/launcher_pb";
import * as _tr from "@generated/ftl-launcher";
import { writable } from "svelte/store";
export const zoomFactor = writable(1.2);

View file

@ -1,8 +1,6 @@
// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import { isWindows } from "@tslib/platform";
export interface PostProtoOptions {
/** True by default. Shows a dialog with the error message, then rethrows. */
alertOnError?: boolean;
@ -10,7 +8,8 @@ export interface PostProtoOptions {
customProtocol?: boolean;
}
const CUSTOM_PROTOCOL_URI = isWindows() ? "http://anki.localhost" : "anki://localhost" ;
const IS_WINDOWS = navigator.platform.startsWith("Win");
const CUSTOM_PROTOCOL_URI = IS_WINDOWS ? "http://anki.localhost" : "anki://localhost";
export async function postProto<T>(
method: string,

View file

@ -10,11 +10,6 @@ export function isApplePlatform(): boolean {
);
}
export function isWindows(): boolean {
const platform = window.navigator["platform" + ""];
return platform.startsWith("Win");
}
export function isDesktop(): boolean {
return !(/iphone|ipad|ipod|android/i.test(window.navigator.userAgent));
}