diff --git a/studio/frontend/package-lock.json b/studio/frontend/package-lock.json index 1d5c09ba72..d2d103f68a 100644 --- a/studio/frontend/package-lock.json +++ b/studio/frontend/package-lock.json @@ -34,6 +34,7 @@ "@tanstack/react-virtual": "3.13.25", "@tauri-apps/api": "^2.10.1", "@tauri-apps/plugin-clipboard-manager": "^2.3.2", + "@tauri-apps/plugin-deep-link": "2.4.9", "@tauri-apps/plugin-notification": "^2.3.3", "@tauri-apps/plugin-opener": "^2.5.3", "@tauri-apps/plugin-process": "^2.3.1", @@ -6451,6 +6452,15 @@ "@tauri-apps/api": "^2.8.0" } }, + "node_modules/@tauri-apps/plugin-deep-link": { + "version": "2.4.9", + "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-deep-link/-/plugin-deep-link-2.4.9.tgz", + "integrity": "sha512-u0SKOUHnJ1wqeqXsDFq2+kASCBj9xxbG0g9XZWPy9SOmU4wXtp6b/wiYpm6oH6/5fBTQsLqnLhIvqLBRpgHJlA==", + "license": "MIT OR Apache-2.0", + "dependencies": { + "@tauri-apps/api": "^2.11.0" + } + }, "node_modules/@tauri-apps/plugin-notification": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-notification/-/plugin-notification-2.3.3.tgz", diff --git a/studio/frontend/package.json b/studio/frontend/package.json index 0fe20c2f16..45566d9686 100644 --- a/studio/frontend/package.json +++ b/studio/frontend/package.json @@ -44,6 +44,7 @@ "@tanstack/react-virtual": "3.13.25", "@tauri-apps/api": "^2.10.1", "@tauri-apps/plugin-clipboard-manager": "^2.3.2", + "@tauri-apps/plugin-deep-link": "2.4.9", "@tauri-apps/plugin-notification": "^2.3.3", "@tauri-apps/plugin-opener": "^2.5.3", "@tauri-apps/plugin-process": "^2.3.1", diff --git a/studio/frontend/src/app/provider.tsx b/studio/frontend/src/app/provider.tsx index 1cc3d1ee57..d746ed952c 100644 --- a/studio/frontend/src/app/provider.tsx +++ b/studio/frontend/src/app/provider.tsx @@ -15,6 +15,7 @@ import { TooltipProvider } from "@/components/ui/tooltip"; import { WebUpdateBanner } from "@/components/web/update-banner"; import { fetchDeviceType } from "@/config/env"; import { getTauriAuthFailure, tauriAutoAuth } from "@/features/auth"; +import { DeepLinkHandler } from "@/features/deep-links"; import { DownloadManagerPanel } from "@/features/hub/download-manager"; import { NativeIntentDrain } from "@/features/native-intents/native-intent-drain"; import { @@ -500,6 +501,7 @@ export function AppProvider({ children }: AppProviderProps) { + {children} 0) next.model = model; + const file = search.file; + if (next.model && typeof file === "string" && file.length > 0) + next.file = file; + + const intent = search.intent; + if ( + next.file && + typeof intent === "number" && + Number.isSafeInteger(intent) + ) { + next.intent = intent; + } const section = search.section; if ( section === "trending" || diff --git a/studio/frontend/src/features/deep-links/deep-link-handler.tsx b/studio/frontend/src/features/deep-links/deep-link-handler.tsx new file mode 100644 index 0000000000..4ad52259db --- /dev/null +++ b/studio/frontend/src/features/deep-links/deep-link-handler.tsx @@ -0,0 +1,92 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0 + +import { isTauri } from "@/lib/api-base"; +import { useNavigate } from "@tanstack/react-router"; +import { useEffect } from "react"; + +import { createDeepLinkIntentGate } from "./deep-link-intent"; +import { parseUnslothDeepLink } from "./parse-deep-link"; + +const acceptIntent = createDeepLinkIntentGate(2_000); + +async function restoreMainWindow(): Promise { + const { getCurrentWindow } = await import("@tauri-apps/api/window"); + const window = getCurrentWindow(); + await window.show(); + await window.unminimize(); + await window.setFocus(); +} + +export function DeepLinkHandler() { + const navigate = useNavigate(); + + useEffect(() => { + if (!isTauri) return; + + let disposed = false; + let receivedLiveIntent = false; + let unlisten: (() => void) | undefined; + + const handleUrls = (urls: string[]): boolean => { + if (disposed) return false; + + let hasValidIntent = false; + let intent: ReturnType = null; + + let intentSequence: number | null = null; + for (const rawUrl of urls) { + const parsed = parseUnslothDeepLink(rawUrl); + if (!parsed) continue; + hasValidIntent = true; + const sequence = acceptIntent(parsed.model, parsed.file); + if (sequence !== null) { + intent = parsed; + intentSequence = sequence; + } + } + if (!intent || intentSequence === null) return hasValidIntent; + + void restoreMainWindow().catch(() => undefined); + void navigate({ + to: "/hub", + search: { + tab: "discover", + kind: "models", + model: intent.model, + file: intent.file, + + intent: intentSequence, + }, + }); + return true; + }; + + async function subscribe() { + const { getCurrent, onOpenUrl } = + await import("@tauri-apps/plugin-deep-link"); + if (disposed) return; + + const cleanup = await onOpenUrl((urls) => { + if (handleUrls(urls)) receivedLiveIntent = true; + }); + if (disposed) { + cleanup(); + return; + } + unlisten = cleanup; + + const currentUrls = await getCurrent(); + if (currentUrls && !receivedLiveIntent) handleUrls(currentUrls); + } + + void subscribe().catch(() => undefined); + + return () => { + disposed = true; + unlisten?.(); + }; + }, [navigate]); + + return null; +} diff --git a/studio/frontend/src/features/deep-links/deep-link-intent.ts b/studio/frontend/src/features/deep-links/deep-link-intent.ts new file mode 100644 index 0000000000..7f310c0a6d --- /dev/null +++ b/studio/frontend/src/features/deep-links/deep-link-intent.ts @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0 + +export function createDeepLinkIntentGate( + deduplicationWindowMs: number, + now: () => number = Date.now, +) { + let lastIntent: { key: string; handledAt: number } | null = null; + let sequence = 0; + + return (model: string, file?: string): number | null => { + const handledAt = now(); + const key = `${model}\0${file ?? ""}`; + if ( + lastIntent?.key === key && + handledAt - lastIntent.handledAt < deduplicationWindowMs + ) { + return null; + } + lastIntent = { key, handledAt }; + sequence += 1; + return sequence; + }; +} diff --git a/studio/frontend/src/features/deep-links/index.ts b/studio/frontend/src/features/deep-links/index.ts new file mode 100644 index 0000000000..1f096aa8dd --- /dev/null +++ b/studio/frontend/src/features/deep-links/index.ts @@ -0,0 +1,4 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0 + +export { DeepLinkHandler } from "./deep-link-handler"; diff --git a/studio/frontend/src/features/deep-links/parse-deep-link.ts b/studio/frontend/src/features/deep-links/parse-deep-link.ts new file mode 100644 index 0000000000..4446eec734 --- /dev/null +++ b/studio/frontend/src/features/deep-links/parse-deep-link.ts @@ -0,0 +1,101 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0 + +const MAX_REPO_ID_SEGMENT_LENGTH = 96; +const MAX_GGUF_FILE_LENGTH = 512; +const REPO_SEGMENT = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/; +function hasControlCharacters(value: string): boolean { + return [...value].some((character) => { + const codePoint = character.codePointAt(0) ?? 0; + return codePoint <= 0x1f || codePoint === 0x7f; + }); +} + +export interface UnslothDeepLinkIntent { + model: string; + file?: string; +} + +function isValidRepoSegment(segment: string): boolean { + return ( + segment.length <= MAX_REPO_ID_SEGMENT_LENGTH && + REPO_SEGMENT.test(segment) && + !segment.includes("--") && + !segment.includes("..") + ); +} + +function isValidGgufFile(file: string): boolean { + if ( + file.length === 0 || + file.length > MAX_GGUF_FILE_LENGTH || + file !== file.trim() || + hasControlCharacters(file) || + file.includes("\\") || + file.startsWith("/") || + !file.toLowerCase().endsWith(".gguf") + ) { + return false; + } + return file + .split("/") + .every((segment) => segment !== "" && segment !== "." && segment !== ".."); +} + +export function parseUnslothDeepLink( + rawUrl: string, +): UnslothDeepLinkIntent | null { + const queryIndex = rawUrl.indexOf("?"); + const target = queryIndex === -1 ? rawUrl : rawUrl.slice(0, queryIndex); + if ( + target !== "unsloth://open_from_hf" && + target !== "unsloth://open_from_hf/" + ) { + return null; + } + + let url: URL; + try { + url = new URL(rawUrl); + } catch { + return null; + } + + if ( + url.protocol !== "unsloth:" || + url.hostname !== "open_from_hf" || + (url.pathname !== "" && url.pathname !== "/") || + url.username !== "" || + url.password !== "" || + url.port !== "" || + url.hash !== "" + ) { + return null; + } + + const keys = [...url.searchParams.keys()]; + if ( + keys.length < 1 || + keys.length > 2 || + !keys.includes("model") || + new Set(keys).size !== keys.length || + keys.some((key) => key !== "model" && key !== "file") + ) { + return null; + } + + const model = url.searchParams.get("model") ?? ""; + const segments = model.split("/"); + if ( + model.endsWith(".git") || + segments.length !== 2 || + !segments.every(isValidRepoSegment) + ) { + return null; + } + + const file = url.searchParams.get("file"); + if (file !== null && !isValidGgufFile(file)) return null; + + return file === null ? { model } : { model, file }; +} diff --git a/studio/frontend/src/features/hub/catalog/download-section.tsx b/studio/frontend/src/features/hub/catalog/download-section.tsx index b2dd4592a1..c3d3e6b538 100644 --- a/studio/frontend/src/features/hub/catalog/download-section.tsx +++ b/studio/frontend/src/features/hub/catalog/download-section.tsx @@ -15,6 +15,9 @@ export function DownloadSection({ canRun = true, isActive, activeQuant, + preferredGgufFile = null, + + preferredGgufFileIntent = 0, isLoadingThisModel, gpuGb, systemRamGb, @@ -35,6 +38,9 @@ export function DownloadSection({ canRun?: boolean; isActive: boolean; activeQuant: string | null; + preferredGgufFile?: string | null; + + preferredGgufFileIntent?: number; isLoadingThisModel: boolean; gpuGb?: number; systemRamGb?: number; @@ -46,12 +52,15 @@ export function DownloadSection({ onTrain?: () => void; onChange?: () => void; }) { - if (isGguf) { + if (isGguf || preferredGgufFile) { return ( (() => ({ repoId, quant: null })); + const preferredQuant = preferredFile + ? (variants?.find((variant) => + ggufFilenamesMatch(variant.filename, preferredFile), + )?.quant ?? null) + : null; const selectedQuantOverride = - selectedQuantState.repoId === repoId ? selectedQuantState.quant : null; + selectedQuantState.repoId === repoId && + ggufSelectionOverrideMatchesIntent( + preferredFile, + preferredFileIntent, + selectedQuantState.preferredFile, + selectedQuantState.preferredFileIntent, + ) + ? selectedQuantState.quant + : preferredQuant; const [open, setOpen] = useState(false); const [deleteTarget, setDeleteTarget] = useState(null); const [updateTarget, setUpdateTarget] = useState(null); @@ -732,10 +758,13 @@ export function GgufDownloadCard({ repoId, quant, userPicked: true, + preferredFile, + + preferredFileIntent, }); setOpen(false); }, - [repoId], + [preferredFile, preferredFileIntent, repoId], ); const handleDeleteVariant = useCallback((quant: string) => { setDeleteTarget(quant); diff --git a/studio/frontend/src/features/hub/catalog/local-on-device-card.tsx b/studio/frontend/src/features/hub/catalog/local-on-device-card.tsx index 9b508a5413..8f2672a706 100644 --- a/studio/frontend/src/features/hub/catalog/local-on-device-card.tsx +++ b/studio/frontend/src/features/hub/catalog/local-on-device-card.tsx @@ -38,6 +38,11 @@ import { deleteCachedModel, } from "../inventory"; import { formatBytes } from "../lib/format"; + +import { + ggufFilenamesMatch, + ggufSelectionOverrideMatchesIntent, +} from "../lib/gguf-filename"; import { ggufVariantDisplayLabel, sortLocalGgufVariants, @@ -87,6 +92,9 @@ interface LocalOnDeviceCardProps { activeGgufVariant?: string | null; isLoading: boolean; loadingPhase?: "downloading" | "starting"; + preferredFile?: string | null; + preferredFileIntent?: number; + gpuGb?: number; systemRamGb?: number; unsupportedReason?: string | null; @@ -207,6 +215,9 @@ export function LocalOnDeviceCard({ activeGgufVariant = null, isLoading, loadingPhase, + preferredFile = null, + preferredFileIntent = 0, + gpuGb, systemRamGb, unsupportedReason, @@ -281,6 +292,8 @@ export function LocalOnDeviceCard({ const [selectedVariantState, setSelectedVariantState] = useState<{ key: string; quant: string | null; + preferredFile?: string | null; + preferredFileIntent?: number; }>(() => ({ key: variantKey, quant: null, @@ -324,8 +337,21 @@ export function LocalOnDeviceCard({ systemRamGb, ], ); + const preferredQuant = preferredFile + ? (variants?.find((variant) => + ggufFilenamesMatch(variant.filename, preferredFile), + )?.quant ?? null) + : null; const selectedVariantOverride = - selectedVariantState.key === variantKey ? selectedVariantState.quant : null; + selectedVariantState.key === variantKey && + ggufSelectionOverrideMatchesIntent( + preferredFile, + preferredFileIntent, + selectedVariantState.preferredFile, + selectedVariantState.preferredFileIntent, + ) + ? selectedVariantState.quant + : preferredQuant; const selectedQuant = selectedVariantOverride && sortedVariants?.some((variant) => @@ -502,6 +528,9 @@ export function LocalOnDeviceCard({ setSelectedVariantState({ key: variantKey, quant: variant.quant, + + preferredFile, + preferredFileIntent, }); setVariantOpen(false); }} diff --git a/studio/frontend/src/features/hub/catalog/model-inspector.tsx b/studio/frontend/src/features/hub/catalog/model-inspector.tsx index c304738ab1..79e69e2f27 100644 --- a/studio/frontend/src/features/hub/catalog/model-inspector.tsx +++ b/studio/frontend/src/features/hub/catalog/model-inspector.tsx @@ -409,6 +409,9 @@ export const ModelInspector = memo(function ModelInspector({ model, runtime, actions, + preferredGgufFile = null, + + preferredGgufFileIntent = 0, isDataset = false, metadataUnavailable = false, selectionHiddenByFilters = false, @@ -417,6 +420,9 @@ export const ModelInspector = memo(function ModelInspector({ isDataset?: boolean; metadataUnavailable?: boolean; selectionHiddenByFilters?: boolean; + preferredGgufFile?: string | null; + + preferredGgufFileIntent?: number; runtime: ModelInspectorRuntime; actions: ModelInspectorActions; }) { @@ -693,6 +699,9 @@ export const ModelInspector = memo(function ModelInspector({ loadingPhase={loadingPhase} gpuGb={gpuGb} systemRamGb={systemRamGb} + + preferredFile={preferredGgufFile} + preferredFileIntent={preferredGgufFileIntent} unsupportedReason={ unslothSupport.status === "unsupported" ? (unslothSupport.reason ?? "Unsupported format") @@ -717,6 +726,9 @@ export const ModelInspector = memo(function ModelInspector({ canRun={canRunModel} isActive={isActive} activeQuant={isActive ? (activeGgufVariant ?? null) : null} + preferredGgufFile={preferredGgufFile} + + preferredGgufFileIntent={preferredGgufFileIntent} isLoadingThisModel={isLoadingThisModel} gpuGb={gpuGb} systemRamGb={systemRamGb} diff --git a/studio/frontend/src/features/hub/hub-page.tsx b/studio/frontend/src/features/hub/hub-page.tsx index 6259f6c8a2..36879097d0 100644 --- a/studio/frontend/src/features/hub/hub-page.tsx +++ b/studio/frontend/src/features/hub/hub-page.tsx @@ -339,7 +339,9 @@ export function ModelsPage() { const deviceType = usePlatformStore((s) => s.deviceType); const hubSearch = useSearch({ from: "/hub" }); const urlModel = hubSearch.model ?? null; + const preferredGgufFile = hubSearch.file ?? null; + const preferredGgufFileIntent = hubSearch.intent ?? 0; const { selectModel, loadingModel, loadProgress, ejectModel } = useChatModelRuntime(); const checkpoint = useChatRuntimeStore((s) => s.params.checkpoint); @@ -1031,7 +1033,7 @@ export function ModelsPage() { setSelected(id); void navigate({ to: "/hub", - search: (prev) => ({ ...prev, model: id }), + search: (prev) => ({ ...prev, model: id, file: undefined }), }); }, [setSelected, navigate], @@ -1117,7 +1119,7 @@ export function ModelsPage() { setSelected(firstId); void navigate({ to: "/hub", - search: (prev) => ({ ...prev, model: firstId }), + search: (prev) => ({ ...prev, model: firstId, file: undefined }), replace: true, }); }, [ @@ -1604,6 +1606,9 @@ export function ModelsPage() {
None: + if shutil.which("node") is None: + pytest.skip("node not available") + probe = subprocess.run( + ["node", "--experimental-strip-types", "--version"], + capture_output = True, + text = True, + timeout = 5, + ) + if probe.returncode != 0: + pytest.skip("node --experimental-strip-types not available") + + (tmp_path / "parse-deep-link.ts").write_text( + PARSER.read_text(encoding = "utf-8"), encoding = "utf-8" + ) + + (tmp_path / "gguf-filename.ts").write_text( + GGUF_FILENAME.read_text(encoding = "utf-8"), encoding = "utf-8" + ) + + (tmp_path / "deep-link-intent.ts").write_text( + INTENT_GATE.read_text(encoding = "utf-8"), encoding = "utf-8" + ) + script = textwrap.dedent(""" + import assert from "node:assert/strict"; + import { parseUnslothDeepLink } from "./parse-deep-link.ts"; + + import { createDeepLinkIntentGate } from "./deep-link-intent.ts"; + import { + ggufFilenamesMatch, + ggufSelectionOverrideMatchesIntent, + } from "./gguf-filename.ts"; + + const valid = new Map([ + [ + "unsloth://open_from_hf?model=unsloth/Laguna-S-2.1-GGUF", + { model: "unsloth/Laguna-S-2.1-GGUF" }, + ], + [ + "unsloth://open_from_hf/?model=org/repo_name", + { model: "org/repo_name" }, + ], + [ + "unsloth://open_from_hf?model=org%2Frepo", + { model: "org/repo" }, + ], + [ + "unsloth://open_from_hf?model=unsloth/Laguna-S-2.1-GGUF&file=Laguna-S-2.1-UD-IQ3_XXS.gguf", + { + model: "unsloth/Laguna-S-2.1-GGUF", + file: "Laguna-S-2.1-UD-IQ3_XXS.gguf", + }, + ], + [ + "unsloth://open_from_hf?file=weights%2Fmodel-Q4_K_M.gguf&model=org/repo", + { model: "org/repo", file: "weights/model-Q4_K_M.gguf" }, + ], + [ + `unsloth://open_from_hf?model=${"a".repeat(96)}/${"b".repeat(96)}`, + { model: `${"a".repeat(96)}/${"b".repeat(96)}` }, + ], + ]); + for (const [url, intent] of valid) { + assert.deepEqual(parseUnslothDeepLink(url), intent, url); + } + + assert.equal( + ggufFilenamesMatch( + "weights/model-Q4_K_M-00002-of-00002.gguf", + "weights/model-Q4_K_M-00001-of-00002.gguf", + ), + true, + ); + assert.equal( + ggufFilenamesMatch("model-Q4_K_M.GGUF", "model-q4_k_m.gguf"), + true, + ); + assert.equal(ggufFilenamesMatch("mmproj-F16.gguf", "model-F16.gguf"), false); + + assert.equal(ggufSelectionOverrideMatchesIntent("a.gguf", 2, "a.gguf", 2), true); + assert.equal(ggufSelectionOverrideMatchesIntent("a.gguf", 2, "a.gguf", 1), false); + + let now = 1_000; + const acceptIntent = createDeepLinkIntentGate(2_000, () => now); + assert.equal(acceptIntent("org/repo", "a.gguf"), 1); + assert.equal(acceptIntent("org/repo", "a.gguf"), null); + assert.equal(acceptIntent("org/repo", "b.gguf"), 2); + now = 3_000; + assert.equal(acceptIntent("org/repo", "b.gguf"), 3); + + + const invalid = [ + "", + "https://open_from_hf?model=org/repo", + "UNSLOTH://open_from_hf?model=org/repo", + "unsloth://OPEN_FROM_HF?model=org/repo", + "unsloth://open_from_hf/path?model=org/repo", + "unsloth://open_from_hf/%2e%2e?model=org/repo", + "unsloth://user@open_from_hf?model=org/repo", + "unsloth://open_from_hf:42?model=org/repo", + "unsloth://open_from_hf?model=org/repo#fragment", + "unsloth://open_from_hf?model=org/repo&download=true", + + "unsloth://open_from_hf?model=org/repo&file=model.gguf&file=other.gguf", + "unsloth://open_from_hf?model=org/repo&file=", + "unsloth://open_from_hf?model=org/repo&file=../model.gguf", + "unsloth://open_from_hf?model=org/repo&file=%2Fmodel.gguf", + "unsloth://open_from_hf?model=org/repo&file=model.safetensors", + "unsloth://open_from_hf?model=org/repo&model=other/repo", + "unsloth://open_from_hf?model=repo", + "unsloth://open_from_hf?model=org/repo/extra", + "unsloth://open_from_hf?model=-org/repo", + "unsloth://open_from_hf?model=org/repo.", + + "unsloth://open_from_hf?model=org/repo.git", + "unsloth://open_from_hf?model=org/repo--name", + "unsloth://open_from_hf?model=org/repo..name", + ]; + for (const url of invalid) { + assert.equal(parseUnslothDeepLink(url), null, url); + } + """) + result = subprocess.run( + ["node", "--experimental-strip-types", "--no-warnings", "--input-type=module"], + input = script, + cwd = tmp_path, + capture_output = True, + text = True, + timeout = 30, + ) + assert result.returncode == 0, f"stderr: {result.stderr}\nstdout: {result.stdout}" + + +def test_tauri_registers_only_the_unsloth_scheme() -> None: + cargo = tomllib.loads((TAURI / "Cargo.toml").read_text(encoding = "utf-8")) + dependencies = cargo["dependencies"] + assert "tauri-plugin-deep-link" in dependencies + single_instance = dependencies["tauri-plugin-single-instance"] + assert isinstance(single_instance, dict) + assert "deep-link" in single_instance.get("features", []) + + config = json.loads((TAURI / "tauri.conf.json").read_text(encoding = "utf-8")) + assert config["plugins"]["deep-link"]["desktop"]["schemes"] == ["unsloth"] + + capabilities = json.loads((TAURI / "capabilities/default.json").read_text(encoding = "utf-8")) + assert "deep-link:default" in capabilities["permissions"] + assert "core:window:allow-unminimize" in capabilities["permissions"] + + main = (TAURI / "src/main.rs").read_text(encoding = "utf-8") + assert main.index("tauri_plugin_single_instance::init") < main.index( + "tauri_plugin_deep_link::init()" + ) + assert "DeepLinkExt" in main + assert "if let Err(error) = app.deep_link().register_all()" in main + assert 'warn!("Failed to register deep-link handlers: {error}")' in main + assert 'target_os = "linux"' in main + desktop_template = TAURI / "linux/unsloth.desktop" + assert config["bundle"]["linux"]["deb"]["desktopTemplate"] == "./linux/unsloth.desktop" + desktop = desktop_template.read_text(encoding = "utf-8") + assert "Exec={{exec}} %u" in desktop + assert "MimeType=x-scheme-handler/unsloth;" in desktop