ge-ku / AutoJoin-for-SteamGifts

Automatically enters giveaways from Steamgifts.com
https://chrome.google.com/webstore/detail/autojoin-for-steamgifts/bchhlccjhoedhhegglilngpbnldfcidc
GNU General Public License v2.0
105 stars 22 forks source link

Firefox Support #18

Closed Nodens- closed 7 years ago

Nodens- commented 7 years ago

Now that Firefox is switching to WebExtensions perhaps the required APIs are in place to build a FF version too?

ge-ku commented 7 years ago

You're probably right! And at the very least I will port what's already on AMO to WebExtensions. As far as I know I have time till November. I recently published another add-on and it takes a lot of time to review, maybe WebExtensions is a reason as people are publishing their ports? Previously it took me a couple of days, now it's more than a week. I will start figuring this one out after I get that one published.

Nodens- commented 7 years ago

Mozzila's plan for switching to WebExtentions is exactly the ability to cross-develop addons (among a few other things). As long as the APIs you use in AutoJoin-for-SteamGifts are in place, porting should be very very easy. If something you need is still not there you can request for the API so checking what's already in place currently is a good idea :)

Here's the resource for what's already available: https://developer.mozilla.org/en-US/Add-ons/WebExtensions And list of approved but still not implemented APIs: https://bugzilla.mozilla.org/buglist.cgi?f1=status_whiteboard&o1=substring&query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&v1=[design-decision-approved]&component=WebExtensions:%20Android&component=WebExtensions:%20Compatibility&component=WebExtensions:%20Developer%20tools&component=WebExtensions:%20Experiments&component=WebExtensions:%20Frontend&component=WebExtensions:%20General&component=WebExtensions:%20Request%20Handling&component=WebExtensions:%20Untriaged&product=Toolkit&list_id=13258296

Also yeah I guess the review process must be crawling currently as due to deprecation in November, everyone is porting existing addons to WebExtensions or porting Chrome addons directly (eg complicated addons like Tampermonkey are already ported).

ge-ku commented 7 years ago

Just tried it "as is", only added one line in manifest.json as I use chrome.storage.sync that requires specifying application id in Firefox. Background tasks work fine, however content-script mostly does not. Seems like requests sent from content-script are actually being sent from background page. So all relative URLs do not work, it should be easy to add 'https://www.steamgifts.com/' in front of every request.

ge-ku commented 7 years ago

After a bunch of small tweaks it seems to work fine. However, unlike old simple version, it doesn't work on Android.

EDIT: Oh, they allow separate file uploads for different platforms, so I can port old extension to WebExtensions and publish it for Android only :)

Just uploaded version for desktops, review queue is very small for updating old extensions (3 instead of 120), so hopefully it will be available soon.

ge-ku commented 7 years ago

Wow, it was really fast. Already published. https://addons.mozilla.org/firefox/addon/autojoin Feel free to create new issues if you notice problems.

Nodens- commented 7 years ago

Sorry for the slow response, was out of the city. Will test extensively and open new issue if I find any problem. Been running it for a bit and it's working great. Regarding Android that is because Android FF is lacking behind in several areas (eg it doesn't even support lazy tab load yet). Achieving complete addon parity will probably take them a while considering WebExtensions implementation is not even nearly in "production" status yet :)

ge-ku commented 7 years ago

Well, looks like a bad time for making a port, I suggest you to disable background autojoin! https://www.steamgifts.com/discussion/ZIVso/autojoin-scripts

Nodens- commented 7 years ago

For clarification: a) The Autojoin button works even if the tab has no focus, correct? b) The Autojoin every x hours if page is open option does not need to be checked for autojoin to keep working correct? It is just an option to increase the periodic timer from default right?

Adding an option for a configurable rand addition to the timer will make this far more difficult to detect by parsing logs: "Random timer to append to autojoin timer" with min and max values in seconds. As long as the interval is not fixed and the random value is configurable ( so it's not always the same range for all users) it should be impossible to detect.

ge-ku commented 7 years ago

Yes, button should work even when tab has no focus. "Autojoin every x hours if page is open" option is a very old feature, it was implemented before background autojoin, since then it basically has no use, what it does is reload page content and press Autojoin button every X hours. Maybe I'll remove this option completely now.

As for a random timer - that's a good idea, it already randomizes time a bit between each giveaway in one batch. For now I suggest not to use autojoin function at all (including Autojoin button) as we still have no idea how exactly will it be detected and how severe new suspensions will be.

Nodens- commented 7 years ago

Perhaps you should not remove it and leave if as a fallback in case something breaks the background mode. But mark it as such with a tooltip or in the wiki.

The post claims log data parsing. Mentioning 4x the amount of entered GAs. Doing an educated guess the only way to really detect and automate suspensions is detecting the fixed intervals. If they don't exist, there's no reliable way to do it that won't suspend thousands of non-automating users.