FreeTubeApp / freetube-redirect

Browser extension to open YouTube links into FreeTube
MIT License
56 stars 12 forks source link

Does not work on Linux #5

Open ilu33 opened 5 years ago

ilu33 commented 5 years ago

The addon does not work (at least not on Debian9 Linux). It tries to open the freetube:// link in a browser window which results in a "adress not known, no registered protocol" message - which is correct, the protocol is not registered in firefox.

I can't find any addon code that registers the protocol. Is that code integrated in freetube? That would be a design flaw since freetube can't know which browser profile is located where and which browser profile has the addon.

I could try to debug if you pointed me to the code that actually registers the protocol with firefox. Edit: I've found code in https://github.com/FreeTubeApp/FreeTube/blob/development/src/js/init.js but that's only working inside freetube, isn't it? I think you at least missed this: https://github.com/electron/electron/issues/4857#issuecomment-201124281 while configuring the deb file. I don't know whether this takes care of the problem inside firefox.

I still think the addon should register the protocol in the browser profile where the addon is installed (and only there). Which I think is what was suggested here: https://github.com/FreeTubeApp/FreeTube/issues/44#issuecomment-396980988

filipkemuel commented 5 years ago

The protocol handler is registered via the desktop file on Linux. (at least on Gnome)

So adding MimeType=x-scheme-handler/freetube; to the freetube.desktop file will make the extension work.

So it should look something like this:

[Desktop Entry]
Name=FreeTube
GenericName=YouTube Player
Comment=An open source desktop YouTube player built with privacy in mind.
Exec=freetube %U
Terminal=false
Type=Application
Icon=freetube
Categories=Network;
MimeType=x-scheme-handler/freetube;

After adding the line to the desktop file one should run update-desktop-database from a terminal or restart the session/computer to activate the protocol.

Ronkn commented 4 years ago

Doesn't work for me either. Ubuntu 18.04 in Brave (chromium based) browser. I click youtube links and it opens as normal in the browser. The extension seemingly does nothing. I have Freetube desktop app installed via Flatpak.

Ronkn commented 4 years ago

The protocol handler is registered via the desktop file on Linux. (at least on Gnome)

So adding MimeType=x-scheme-handler/freetube; to the freetube.desktop file will make the extension work.

So where do I find this freetube.desktop file? Ubuntu 18.04 Gnome DE

filipkemuel commented 4 years ago

@boggle247 It depends on how you installed FreeTube.

If installed as a normal system package via your package-manager be in: /usr/share/applications

It might be named differently depending on how it was packaged.

If you installed it as a flatpak it should be in either: ~/.local/share/flatpak/exports/share/applications (for user-installed flatpak) or: /var/lib/flatpak/exports/share/applications (for system-installed flatpak) With flatpak the desktop file is called: io.freetubeapp.FreeTube.desktop

You can copy the file to ~/.local/share/applications and then edit it. This should ensure that the edit persists through updates.

However this shouldn't be necessary anymore, at least for the flatpak, since the MimeType-line has already been added upstream.

The app works for me now even without changes. I don't use brave but downloaded it, installed the extension and it worked like it should on my machine.

Ronkn commented 4 years ago

@filipkemuel I'll give this a shot

ShellCode33 commented 4 years ago

@filipkemuel Adding MimeType=x-scheme-handler/freetube; to the desktop file does work indeed, but FreeTube doesn't seem to handle the freetube:// scheme correctly. The application sets the search bar input to "freetube-bin" and nothing more seems to happen. I'm running Arch and installed FreeTube from the AUR.

EDIT: I managed to make it work : I had configured Firefox to run the freetube binary (which firefox suggested by default). Under Preferences -> General -> Applications I changed it to use xdg-open instead, now everything works fine !

Ronkn commented 4 years ago

It now seems to work fine without tweaks. As someone above mentioned about a fix added upstream, perhaps this is what solved it.

sith-on-mars commented 4 years ago

Adding MimeType=x-scheme-handler/freetube let me opens only the application, but not the video

WillPower3309 commented 4 years ago

@filipkemuel Adding MimeType=x-scheme-handler/freetube; to the desktop file does work indeed, but FreeTube doesn't seem to handle the freetube:// scheme correctly. The application sets the search bar input to "freetube-bin" and nothing more seems to happen. I'm running Arch and installed FreeTube from the AUR.

EDIT: I managed to make it work : I had configured Firefox to run the freetube binary (which firefox suggested by default). Under Preferences -> General -> Applications I changed it to use xdg-open instead, now everything works fine !

This worked perfectly for me! To those wondering, to change to xdg-open, click on 'use other' and select /bin/xdg-open

sith-on-mars commented 4 years ago

@filipkemuel Adding MimeType=x-scheme-handler/freetube; to the desktop file does work indeed, but FreeTube doesn't seem to handle the freetube:// scheme correctly. The application sets the search bar input to "freetube-bin" and nothing more seems to happen. I'm running Arch and installed FreeTube from the AUR. EDIT: I managed to make it work : I had configured Firefox to run the freetube binary (which firefox suggested by default). Under Preferences -> General -> Applications I changed it to use xdg-open instead, now everything works fine !

This worked perfectly for me! To those wondering, to change to xdg-open, click on 'use other' and select /bin/xdg-open

I changed the setting to xdg-open. Unfortunately it's still the same. The apps opens, but doesn't jump to the video link.

WillPower3309 commented 4 years ago

Unfortunately ive had the same observation as @stevenfang1997, for me the app loads the video if it is already open but if the link runs the app it will not load the video

sith-on-mars commented 4 years ago

I have some new observations. I added MimeType=x-scheme-handler/freetube in the desktop file, and changed the Firefox preference to xdg-open. After opening a Youtube link, I saw a error message "File not found: freetube://(link to the Youtube Video)".

I'm using freetube-bin from AUR repository.

sith-on-mars commented 4 years ago

According to the app developer, this problem seems to exist exclusively in the AUR and portable versions. In the non AUR and portable versions, you just need to disable "Grab Videos Locally" in the settings and it should be good to go.

calm3285 commented 4 years ago

i tried /bin/xdg-open freetube://[URL] in the terminal and doesnt open the video

githubtefo commented 3 years ago

I Added MimeType=x-scheme-handler/freetube; to /usr/share/applications/freetube-bin.desktop and configured Firefox to open freetube protocol with /bin/xdg-open

It still gives me an error Unable to create io-slave. klauncher said: Unknown protocol 'freetube'.

I'm using freetube-bin from AUR repository.