!394 新增 spark-store 支持处理 apt://包名 格式的链接,转成 spk://search/包名协议来处理

Merge pull request !394 from 球球代码研发助手/implement-33298693-hy0X
This commit is contained in:
2026-06-10 11:46:22 +00:00
committed by Gitee
+17 -1
View File
@@ -45,7 +45,7 @@ class ListenersMap {
} }
} }
const protocols = ["spk"]; const protocols = ["spk", "apt"];
const listeners = new ListenersMap(); const listeners = new ListenersMap();
export const deepLink = { export const deepLink = {
@@ -81,6 +81,22 @@ export function handleCommandLine(commandLine: string[]) {
try { try {
const url = new URL(target); const url = new URL(target);
// Handle apt:// protocol: convert to spk://search/pkgname
if (url.protocol === "apt:") {
// Format: apt://pkgname
const pkgname = url.hostname || url.pathname.split("/").filter(Boolean)[0];
if (pkgname) {
const query: Query = { pkgname };
logger.info(`Deep link: apt protocol converted to search: ${pkgname}`);
listeners.emit("search", query);
} else {
logger.warn(
`Deep link: invalid apt format, expected //pkgname, got ${target}`,
);
}
return;
}
const action = url.hostname; // 'search' const action = url.hostname; // 'search'
logger.info(`Deep link: action found: ${action}`); logger.info(`Deep link: action found: ${action}`);