Page 1 of 2

Email Notification Workaround

Posted: Sun Aug 07, 2016 2:24 pm
by Zinal
Hello everyone!

The mod portal doesn't officially support email notification on updated mods/discussions (yet), so I decided to create a little workaround.

I have a web server setup to pool information on any subscribed mod. Whenever a mod/discussion changes an email notification will be sent out to any subscribed user.

It's easy to subscribe for email notifications.

1. Navigate to http://factoriomods.zinals.nu/index.php/

This form should appear:
FactorioModsSubscribeWindow.png
FactorioModsSubscribeWindow.png (7.6 KiB) Viewed 9138 times
2. Fill in the url of the mod (for example: https://mods.factorio.com/mods/Zinal/SP_Respawn) in the first field (Mod Url). The second field should automatically detect the mod name (in this case: SP_Respawn)
3. Fill in your email address. This email will get notifications whenever the mod is updated.
4. Check your inbox, an email containing a confirmation link should soon appear.
5. Click the link and you'll get an email whenever the mod is updated!

I've also created both a Greasemonkey script (for Firefox users) and a Tampermonkey script (for Chrome users). These scripts will add a "Subscribe to mod" button on a mod's page. Clicking the button should automatically open the form mentioned in step 1 and the url for the mod (step 2) should already be filled out. (Sorry IE users, no button for you).

Edit:
The scripts also makes it possible to open the thumbnails in a bigger view, just a little bonus ;) .

You can click these links to auto-install the scripts if you have Greasemonkey or Tampermonkey installed:
Greasemonkey Script: http://factoriomods.zinals.nu/resources ... pt.user.js
Tampermonkey Script: http://factoriomods.zinals.nu/resources ... pt.user.js

The button looks like this:
FactorioModsSubscribeButton.png
FactorioModsSubscribeButton.png (20.8 KiB) Viewed 9138 times

Re: Email Notification Workaround

Posted: Mon Aug 08, 2016 1:02 am
by Nexela
Well I suppose I will take the plunge and give this a try.

Re: Email Notification Workaround

Posted: Mon Aug 08, 2016 3:28 am
by Zinal
Nexela wrote:Well I suppose I will take the plunge and give this a try.
I would appreciate it!

Do note that this workaround is still a work-in-progress.
It works as it should (at least for me) but I'm still adding new functionality to it all the time.

I would love to get some suggestions on how to develop this even further :)

Re: Email Notification Workaround

Posted: Mon Aug 08, 2016 4:45 am
by Nexela
Bug #1 for auto installing script change GreasemonkeyFactorioModsScript.js to GreasemonkeyFactorioModsScript.user.js

Re: Email Notification Workaround

Posted: Mon Aug 08, 2016 4:52 am
by Nexela
Bug #2 using greasemonkey - doesn't work correctly on author page.

Goto the author page: https://mods.factorio.com/mods/icedevml
select subribe to mod on a mod: (I used signposts)
The subscribe button gets duplicated on the mods below it.

Re: Email Notification Workaround

Posted: Mon Aug 08, 2016 5:23 am
by Zinal
Bug #1
Fixed. I actually forgot that you could auto install scripts using the .user.js extension.

Bug #2

The scripts didn't take into account that multiple mods could be listed at the same time.
Fixed in the new version (attachments to the first post are updated). The script will now add the buttons to every mod, even in the "Recently Updated" list.

Edit:
Also included direct links to my uploaded scripts since the attachment system doesn't seem to work with the auto-install.

Re: Email Notification Workaround

Posted: Mon Aug 08, 2016 5:54 am
by Nexela
Awesome on the bug fixes! Really liking this. Just received my first notification from myself So far so good!

Bug 3 and 4 - Releated to images


#3 Images show up at the top of page not the top of the browser (noticeable if you are scrolled down on a page) Maybe have displayed in the center of screen if that is do able.

#4 Some mods images are showing broken link when clicking on (maybe size issue?) as an example: https://mods.factorio.com/mods/Superche ... n%20Cannon
the first picture shows up as broken, the second one shows up correctly.

Re: Email Notification Workaround

Posted: Mon Aug 08, 2016 6:13 am
by Zinal
Bug #3
Fixed. Images are now centered and will stay in the middle of the screen (Also added a dimmer effect on the background).

Bug #4
I'm unable to fix this since it's a problem with the mod portal itself. (The original image doesn't exist)
I believe that whenever an image is uploaded, two images are created. One "thumbnail" (the small image you usually see) and the original.
Some original images doesn't exist anymore (I don't know why, perhaps the mod portal automatically deletes them after a while, since they are not currently used?)

I'm removing the attachments in favor of the now updated direct links (Easier to maintain)

Re: Email Notification Workaround

Posted: Mon Aug 08, 2016 6:33 am
by Nexela
#5 related to #3 The first time an image is loaded it seems to be putting the top_left corner in the center, opening the image a second time put the center in the center correctly.

#4 - Hmmmmm.... Using orbital ion cannon's first image as refrence. If you click on the thumbnail your script loads the broken image icon. but if you click on the thumbnail and then click on the image in the mods title bar it loads the correct image in the portal (this is how it loads normally without your script)

Links for refrence:
THUMB https://mods-data.factorio.com/pub_data ... .thumb.png
MAIN https://mods-data.factorio.com/pub_data ... dUX7Ww.jpg

Re: Email Notification Workaround

Posted: Mon Aug 08, 2016 6:36 am
by Nexela
Bug #6 related to 3 fix also the Dimmer effect doesn't dim the bottom of the screen if you are scrolled down. Possible to have dimmer effect the whole page?


Also if you keep up with this Wube is gonna recruit you for their web designer :)

Re: Email Notification Workaround

Posted: Mon Aug 08, 2016 7:21 am
by Zinal
Bug #5
This should now be fixed, if it's not then I might have to add a delay to when the image is actually centered.

Bug #4 - Fix
It seems all thumbnails are stored as .png files while the original can be something different (like .jpg).
I've made a little workaround to get the correct extension of the original file.

Bug #6
Fixed. The dimmer will now scroll with the page itself (same as the image).
Nexela wrote:Also if you keep up with this Wube is gonna recruit you for their web designer :)
I wish :lol:

Re: Email Notification Workaround

Posted: Mon Aug 08, 2016 9:09 am
by Nexela
Nice and smooth now.

login - I noticed there is a button to log in but it requires a password and I don't see this anywhere. I was able to add a few mods without having to re enter my email / activate but after time or possible because I closed the mods.factorio site I had to re-activate through email to add another subscription. At this point I was able to manage my subscriptions. My guess is cookie related?

Feature Idea - replace [subscribe to mod] with [edit subscription] if you are subscribed to a mod.

Re: Email Notification Workaround

Posted: Mon Aug 08, 2016 9:14 am
by Zinal
Nexela wrote:Nice and smooth now.

login - I noticed there is a button to log in but it requires a password and I don't see this anywhere. I was able to add a few mods without having to re enter my email / activate but after time or possible because I closed the mods.factorio site I had to re-activate through email to add another subscription. At this point I was able to manage my subscriptions. My guess is cookie related?

Feature Idea - replace [subscribe to mod] with [edit subscription] if you are subscribed to a mod.
Yeah, the user-system is still a work in progress.. I added a link on the login page to send a new password to your email ("I lost/didn't receive my password").
It will generate a new password for you but I'll soon add a "change password" section to the "Manage Subscriptions " page (will soon be renamed to "Manage Account").

I like the idea about the button... Just need to make the necessary ajax calls (to see if the user is logged in & is subscribed).

Re: Email Notification Workaround

Posted: Mon Aug 08, 2016 10:31 am
by Zinal
Nexela wrote:Feature Idea - replace [subscribe to mod] with [edit subscription] if you are subscribed to a mod.
Added in the newest script update. Currently the popup just navigates to the manage page, but I'll add a small popup window to edit subscribe settings per mod.

Re: Email Notification Workaround

Posted: Tue Aug 09, 2016 4:07 am
by Nexela
Really loving this script. It should be stickied!


More things I have noticed.

#7 https://mods.factorio.com/mods/Mooncat/color-picker/
I received 2 notifications about "New Release" (3:10pm est and 3:30pm est) however when I checked there was no noticeable updates. Not sure if maybe Mooncat Edited something and that's what caused it or not.

#8 (while logged in) on the main mods.factorio.com page scroll down until you can [edit subscription] if you edit the subscription the mod page scrolls back to the top. This behavior does not happen with [subscribe to mod].

#8 (while logged in) Clicking on [subscribe to mod] should add the subscription without the popup if you are logged in (not sure what the limitations are on the script side).

#10 (while logged in) [edit subscrption] It is possible for the mods to scroll off the bottom of the window if you have 8 or more and there are no scroll bars. as a workaround you can drag resize the window though. [edit reread previous post] Minor issue as this will be changed to be a per mod edit eventually.

You don't have to wish! http://www.factorio.com/job/python-developer

Re: Email Notification Workaround

Posted: Tue Aug 09, 2016 7:03 am
by Zinal
#7
I'm actually not sure why this happens. I've also received updates without any visual difference..
The "New Release" email should only be sent if the number of releases is different from my local cache.. Perhaps a reupload of a release caused this?

#8
Fixed. (A typo in the code)

#9?
I decided to still use the popup to see if the mod name and such was sent correctly to my server. Will be changed in the future (if logged in, of course).

#10
Fixed. The size of the popup was the same as for when you subscribe for the first time. It's now dynamic in height so it shouldn't be a problem until I fix "per mod".
Nexela wrote:You don't have to wish! http://www.factorio.com/job/python-developer
Too bad they are looking for a python developer (I'm doing everything in PHP). Also, I'm no where near Prague so this is a no-go.

EDIT:
I actually forgot to upload the updated scripts to the server!
Uploaded now

Re: Email Notification Workaround

Posted: Tue Aug 09, 2016 11:45 am
by Zinal
Another update!
The "Edit Subscription" button will now open a small window to edit the options for that mods subscription (instead of displaying the whole subscription list).

EDIT:
I think I found the cause for Bug #7.
The mod portal's API seems to be a bit unstable.. Sometimes the server doesn't return anything and when my script compared it to the local cache it was different (duh!).
I think I fixed it (if the server doesn't return a valid json object, ignore that mod for now).

Re: Email Notification Workaround

Posted: Thu Aug 11, 2016 12:37 pm
by Nexela
Everything is working great so far! Very usefull And this is also just a shameless bump so more people see it :)

Re: Email Notification Workaround

Posted: Fri Aug 12, 2016 3:35 am
by Nexela
I have come up with another wild idea for the script side.

If you are logged in and you create/reply to a discussion then subscribe to that mods discussion.

This could be further expanded with even more changes. By automatically subscribing to "just" that discussion if your user name matches your mod portal username.

Re: Email Notification Workaround

Posted: Fri Aug 12, 2016 3:01 pm
by Zinal
Nexela wrote:If you are logged in and you create/reply to a discussion then subscribe to that mods discussion.
This shouldn't be to hard.. I'll see what I can do.
Nexela wrote:This could be further expanded with even more changes. By automatically subscribing to "just" that discussion if your user name matches your mod portal username.
Currently it's only possible to subscribe to the mod itself, not a specific discussion and I would need to separate username from email in my system, since the username is the email right now.. I would need to rewrite the whole system to make this work.. Perhaps I will but I need to look into it some more first (See what needs to be done, etc)