From 6c9950a690fe6983415d1a9f076b0d4d04ebbfb5 Mon Sep 17 00:00:00 2001 From: NimBold Date: Sat, 8 Aug 2026 13:10:58 +0330 Subject: [PATCH] fix(macos): declare standard BitTorrent file type --- scripts/app-associations.node-test.js | 31 +++++++++++++++++++++++++++ src-tauri/tauri.conf.json | 4 ++-- 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 scripts/app-associations.node-test.js diff --git a/scripts/app-associations.node-test.js b/scripts/app-associations.node-test.js new file mode 100644 index 0000000..4ff84ad --- /dev/null +++ b/scripts/app-associations.node-test.js @@ -0,0 +1,31 @@ +import assert from 'node:assert/strict'; +import fs from 'node:fs'; +import path from 'node:path'; +import test from 'node:test'; + +const repositoryRoot = path.resolve(import.meta.dirname, '..'); +const tauriConfig = JSON.parse( + fs.readFileSync(path.join(repositoryRoot, 'src-tauri', 'tauri.conf.json'), 'utf8') +); + +const torrentAssociation = tauriConfig.bundle.fileAssociations.find(association => + association.ext?.some(extension => extension.toLowerCase() === 'torrent') +); + +test('declares the native macOS BitTorrent content type', () => { + assert.ok(torrentAssociation, 'the bundle must declare a .torrent association'); + assert.equal(torrentAssociation.mimeType, 'application/x-bittorrent'); + assert.deepEqual(torrentAssociation.exportedType, { + identifier: 'org.bittorrent.torrent', + conformsTo: ['public.data', 'public.item'] + }); + assert.equal( + torrentAssociation.contentTypes, + undefined, + 'the UTI declaration supplies the extension and MIME tags for clean installs' + ); +}); + +test('declares magnet as a desktop deep-link scheme', () => { + assert.deepEqual(tauriConfig.plugins['deep-link'].desktop.schemes, ['firelink', 'magnet']); +}); diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 555b5ba..38853f5 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -48,8 +48,8 @@ "role": "Viewer", "rank": "Alternate", "exportedType": { - "identifier": "com.nimbold.firelink.torrent", - "conformsTo": ["public.data"] + "identifier": "org.bittorrent.torrent", + "conformsTo": ["public.data", "public.item"] } } ]