mirror of
https://github.com/ankitects/anki.git
synced 2025-11-07 13:17:12 -05:00
./check
This commit is contained in:
parent
4f52a2c0d6
commit
6f06f81f06
7 changed files with 9 additions and 18 deletions
|
|
@ -4,7 +4,7 @@
|
||||||
#[cfg(all(unix, not(target_os = "macos")))]
|
#[cfg(all(unix, not(target_os = "macos")))]
|
||||||
pub mod unix;
|
pub mod unix;
|
||||||
|
|
||||||
// #[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
pub mod mac;
|
pub mod mac;
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,7 @@ impl From<NormalState> for State {
|
||||||
|
|
||||||
pub enum State {
|
pub enum State {
|
||||||
LaunchAnki(Arc<uv::Paths>),
|
LaunchAnki(Arc<uv::Paths>),
|
||||||
|
#[allow(dead_code)] // TODO: use
|
||||||
Error(anyhow::Error),
|
Error(anyhow::Error),
|
||||||
Uninstall(Arc<uv::Paths>),
|
Uninstall(Arc<uv::Paths>),
|
||||||
Normal(NormalState),
|
Normal(NormalState),
|
||||||
|
|
@ -94,10 +95,6 @@ impl State {
|
||||||
_ => Err(anyhow!("unexpected state")),
|
_ => Err(anyhow!("unexpected state")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn should_launch_anki(&self) -> bool {
|
|
||||||
matches!(self, State::LaunchAnki(_))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl NormalState {
|
impl NormalState {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { tr } from "./stores";
|
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 Row from "$lib/components/Row.svelte";
|
||||||
import EnumSelector from "$lib/components/EnumSelector.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;
|
choose: (version: string, existing: boolean, current?: string) => void;
|
||||||
} = $props();
|
} = $props();
|
||||||
|
|
||||||
const availableVersions = $derived(
|
let availableVersions = $derived(
|
||||||
releases.all
|
releases.all
|
||||||
.filter((v) => allowBetas || !v.isPrerelease)
|
.filter((v) => allowBetas || !v.isPrerelease)
|
||||||
.map((v) => ({ label: v.version, value: v.version })),
|
.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 selected = $derived(availableVersions[0]?.value ?? null);
|
||||||
let current = $derived(existing.current?.version);
|
let current = $derived(existing.current?.version);
|
||||||
|
|
||||||
let pyprojectModified = existing.pyprojectModifiedByUser;
|
let pyprojectModified = $derived(existing.pyprojectModifiedByUser);
|
||||||
|
|
||||||
function _choose(version: string, keepExisting: boolean = false) {
|
function _choose(version: string, keepExisting: boolean = false) {
|
||||||
choose(version, keepExisting, current);
|
choose(version, keepExisting, current);
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
import Options from "./Options.svelte";
|
import Options from "./Options.svelte";
|
||||||
import Term from "./Term.svelte";
|
import Term from "./Term.svelte";
|
||||||
import AnkiWillStart from "./AnkiWillStart.svelte";
|
import AnkiWillStart from "./AnkiWillStart.svelte";
|
||||||
import { Terminal } from "@xterm/xterm";
|
import type { Terminal } from "@xterm/xterm";
|
||||||
|
|
||||||
let {
|
let {
|
||||||
langs,
|
langs,
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// 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 type { GetLangsResponse_Pair, GetMirrorsResponse_Pair, GetVersionsResponse } from "@generated/anki/launcher_pb";
|
||||||
|
import * as _tr from "@generated/ftl-launcher";
|
||||||
import { writable } from "svelte/store";
|
import { writable } from "svelte/store";
|
||||||
|
|
||||||
export const zoomFactor = writable(1.2);
|
export const zoomFactor = writable(1.2);
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import { isWindows } from "@tslib/platform";
|
|
||||||
|
|
||||||
export interface PostProtoOptions {
|
export interface PostProtoOptions {
|
||||||
/** True by default. Shows a dialog with the error message, then rethrows. */
|
/** True by default. Shows a dialog with the error message, then rethrows. */
|
||||||
alertOnError?: boolean;
|
alertOnError?: boolean;
|
||||||
|
|
@ -10,7 +8,8 @@ export interface PostProtoOptions {
|
||||||
customProtocol?: boolean;
|
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>(
|
export async function postProto<T>(
|
||||||
method: string,
|
method: string,
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
export function isDesktop(): boolean {
|
||||||
return !(/iphone|ipad|ipod|android/i.test(window.navigator.userAgent));
|
return !(/iphone|ipad|ipod|android/i.test(window.navigator.userAgent));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue