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
This commit is contained in:
gitee-bot
2026-06-10 11:50:21 +00:00
parent e84c1d86bf
commit 9e8758b5f2
3 changed files with 17 additions and 1 deletions
+1
View File
@@ -26,6 +26,7 @@ linux:
Categories: "System;"
mimeTypes:
- "x-scheme-handler/spk"
- "x-scheme-handler/apt"
target:
- "AppImage"
- "deb"
+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(() => {
// Set User-Agent for client
session.defaultSession.webRequest.onBeforeSendHeaders((details, callback) => {
@@ -10,4 +10,4 @@ Keywords=appstore;
Terminal=false
StartupNotify=true
StartupWMClass=spark-store
MimeType=x-scheme-handler/spk
MimeType=x-scheme-handler/spk;x-scheme-handler/apt