HabitRPG / habitica-chrome

Chrome extension for HabitRPG. Uses 3rd party productivity website events to trigger point gain/loss.
https://chrome.google.com/webstore/detail/habitrpg/pidkmpibnnnhneohdgjclfdjpijggmjj?hl=en-US
GNU General Public License v3.0
109 stars 47 forks source link

Firefox support #167

Open Mikaela opened 6 years ago

Mikaela commented 6 years ago

This extension looks interesting in my opinion and I hope that it would hopefully reward for staying on sites such as Duolingo and Memrise.

However I am using Firefox and thus cannot use this extension and I hope that it would be easily portable to Firefox which nowadays only uses WebExtensions that I have understood to be supposed to be easy to port.

But since every browser has an own extension structure it's not an easy task...

This part of the README was possibly written pre-WebExtensions as I think Opera and Edge are also using WE and thus should be similar task to port?

Mikaela commented 6 years ago

I forgot to say that I found https://github.com/lexa/habitrpg-mozilla but it appears to be unofficial and the link to Firefox extensions is 404 errors, so I imagine it wouldn't run on Firefox Quantum (57) anyway.

paglias commented 6 years ago

Right now we're not actively working on the extension but I'll be happy to merge any proposed PR

IliaMManolov commented 6 years ago

A possible workaround is this extension: https://addons.mozilla.org/en-US/firefox/addon/chrome-store-foxified/

I tried it out but it gives me an error that my api key/uuid are wrong despite the fact that they are correct. Otherwise nothing UI-based is broken so it seems that there's something small preventing the extension from working properly.

IliaMManolov commented 6 years ago

I did some debugging and the issue seems to be from this line. Looks like the standard is to use browser.runtime instead of chrome.extension as specified in the Firefox docs here.

I switched all the chrome objects with browser and replaced .extension with .runtime and the first time you open the extension menu everything works correctly but after closing it and reopening it the extension gives me the same "invalid api key/uuid" error. Opening up the debugger shows me the following errors. Full error log here.

I think the issue arises from the second and third errors. It seems that it is complaining about this line on the repo. I think that listeners[i] is dead for some reason which is why it can't listen for new data. That means that the object dies between the first and second listen.

I'll make a fork and I'll look into the issue later. Hopefully we can fix this so that we can get this to work on Opera and Edge as well. My knowledge of web languages is very limited so I'd appreciate it if someone could read and understand my error messages.

Himbiss commented 5 years ago

Hey! Is this repo still actively maintained? Lots of the stuff around here seems to be pretty old. I'm asking because I was tinkering with the chrome extension and made it partly work for firefox. Are you interested in a pull request with my code changes?

paglias commented 5 years ago

@Himbiss hi, right now we're not actively maintaining the repo but if we're open to contributors fixing bugs and in that case we'll be happy to publish the fixed version to Chrome and Firefox. But right now it's quite broken so before we can publish it to firefox we'd need the most serious bugs to be fixed