Mika-/torrent-control

Safari Support?

austinarchibald opened this issue · 5 comments

I'm trying to port this to Safari, using the Safari Extension Converter. Don't really know what I'm doing, but converted with no further edits to the code. It successfully built and installed as an extension in Safari. Settings page works, added server info, gave permission to work on every website, and pressing the button in Safari successfully loads the transmission web interface. However, when I right click on a magnet or torrent link > Torrent Control > Add torrent (or Add torrent (Advanced)), nothing happens.

When I load the web inspector for the extension, this is the js error I see after trying to add a torrent:

[Error] Unhandled Promise Rejection: TypeError: Argument 1 ('blob') to FileReader.readAsText must be an instance of Blob
	(anonymous function) (util.js:270)
	enqueueJob
	then
	(anonymous function) — index.js:126

Any suggestions? If I figure this out, I can fork and post releases for anyone wanting this capability on Safari (Mac & iOS). This repo seemed like a simple and reliable extension with updates and various client support. There are no torrent extensions for Safari that I could find.

Mika- commented

Error indicates that content script returns something other than a blob in content-script.js:17, or the FileReader API works a bit different way. Thats most likely due some differences in Safari.

Extension is written in cross-compatible way and works in Chrome, so it should work in Safari and Explorer as well. Atleast for a while, as it almost completely breaks after manifest v3 lands.

Hmm. Any suggestions of something I can try to fix this?

There was also this when I first ran the converter, in case helpful:

austin@MacBook torrent-control % xcrun safari-web-extension-converter src/                                              
Xcode Project Location: /Users/austin/Downloads/torrent-control
App Name: Torrent Control
App Bundle Identifier: com.yourCompany.Torrent-Control
Platform: All
Language: Swift
Warning: The following keys in your manifest.json are not supported by your current version of Safari. If these are critical to your extension, you should review your code to see if you need to make changes to support Safari:
	protocol_handlers
	browser_style
	webRequestBlocking
	theme_icons
	default_area
	notifications
Warning: Persistent background pages are not supported on iOS and iPadOS. You will need to make changes to support a non-persistent background page.

Hi, just following up in case you had any ideas/suggestions of things to try. Thanks!

Mika- commented

You need to remove or try to find alternative methods to implement features that are relying those unsupported apis.
Note that those significally limit extensions usefulness as there would be no magnet link catching, no automatic torrent catching or notifications about failure/success.