Compare commits

...

3 Commits

Author SHA1 Message Date
gitee-bot 9e8758b5f2 feat(deeplink): add support for apt:// protocol handling
- Register apt protocol handler in Electron main process
- Add x-scheme-handler/apt MIME type to electron-builder config
- Update desktop entry to include apt MIME type support
- apt://pkgname links are now converted to spk://search/pkgname

refs #IJTPFP
2026-06-10 11:50:21 +00:00
shenmo7192 e84c1d86bf !394 新增 spark-store 支持处理 apt://包名 格式的链接,转成 spk://search/包名协议来处理
Merge pull request !394 from 球球代码研发助手/implement-33298693-hy0X
2026-06-10 11:46:22 +00:00
gitee-bot e39525901e feat(deeplink): add support for apt:// protocol conversion to spk://search
Add handling for apt://pkgname format links by converting them to
spk://search/pkgname protocol, allowing spark-store to process
apt package links seamlessly

refs #IJTPFP
2026-06-10 11:36:31 +00:00
4 changed files with 34 additions and 2 deletions
+1
View File
@@ -26,6 +26,7 @@ linux:
Categories: "System;" Categories: "System;"
mimeTypes: mimeTypes:
- "x-scheme-handler/spk" - "x-scheme-handler/spk"
- "x-scheme-handler/apt"
target: target:
- "AppImage" - "AppImage"
- "deb" - "deb"
+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}`);
+15
View File
@@ -318,6 +318,21 @@ ipcMain.handle("check-for-updates", async () => {
} }
}); });
// Register custom protocol handlers
if (process.defaultApp) {
if (process.argv.length >= 2) {
app.setAsDefaultProtocolClient("spk", process.execPath, [
path.resolve(process.argv[1]),
]);
app.setAsDefaultProtocolClient("apt", process.execPath, [
path.resolve(process.argv[1]),
]);
}
} else {
app.setAsDefaultProtocolClient("spk");
app.setAsDefaultProtocolClient("apt");
}
app.whenReady().then(() => { app.whenReady().then(() => {
// Set User-Agent for client // Set User-Agent for client
session.defaultSession.webRequest.onBeforeSendHeaders((details, callback) => { session.defaultSession.webRequest.onBeforeSendHeaders((details, callback) => {
@@ -10,4 +10,4 @@ Keywords=appstore;
Terminal=false Terminal=false
StartupNotify=true StartupNotify=true
StartupWMClass=spark-store StartupWMClass=spark-store
MimeType=x-scheme-handler/spk MimeType=x-scheme-handler/spk;x-scheme-handler/apt