Skip to content

Instantly share code, notes, and snippets.

@mkody
Last active March 28, 2024 12:42
Show Gist options
  • Save mkody/27a64fcc6ad6ee8ea84343b7010de097 to your computer and use it in GitHub Desktop.
Save mkody/27a64fcc6ad6ee8ea84343b7010de097 to your computer and use it in GitHub Desktop.
Automail patch for donators

Automail patch for donators

  1. Clone https://github.com/hohMiyazawa/Automail.git
  2. Put the refresh.sh and allowDonators.patch in the root Automail directory
  3. chmod +x refresh.sh and ./refresh.sh
  4. Put a cron like 0 * * * * cd /path/to/Automail && ./refresh.sh > cron.log 2>&1 to keep it updated

Find my builds at https://s.kdy.ch/Automail/

diff --git a/src/modules/settingsPage.js b/src/modules/settingsPage.js
index 2b18a29..2484db3 100644
--- a/src/modules/settingsPage.js
+++ b/src/modules/settingsPage.js
@@ -57,6 +57,9 @@ exportModule({
let sVersion = create("p",false,false,scriptStats);
create("span",false,translate("$settings_version"),sVersion);
create("span","hohStatValue",scriptInfo.version,sVersion);
+ let sPatched = create("p",false,"You're using the patched version for donators: ",scriptStats);
+ let sPatchedLink = create("a","external","https://s.kdy.ch/Automail/",sPatched);
+ sPatchedLink.href = "https://s.kdy.ch/Automail/";
let sHome = create("p",false,translate("$settings_homepage"),scriptStats);
let sHomeLink = create("a","external",scriptInfo.link,sHome);
sHomeLink.href = scriptInfo.link;
diff --git a/src/settings.js b/src/settings.js
index 33de2dc..223a84b 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -148,14 +148,6 @@ else{
}
}
-//Script is boneless: enable
-//User is mod: enable
-//user is hoh: enable
-if(script_type !== "Boneless" && userObject && (userObject.donatorTier > 0 && (new Date()).valueOf() > (new Date('2020-09-01T03:24:00')).valueOf()) && userObject.name !== "hoh" && !userObject.moderatorStatus){
- alert("Sorry, " + script_type + " does not work for donators")
- return
-}
-
if(document.hohTypeScriptRunning){
console.warn("Duplicate script detected. Please make sure you don't have more than one instance of " + script_type + " or similar installed");
return
#!/bin/bash
# 0 * * * * ./refresh.sh
# Cleanup
git checkout -- src/
# Check for updates
git fetch origin
reslog=$(git log HEAD..origin/master --oneline)
if [[ "${reslog}" != "" ]] ; then
# Get latest version
git pull
# Apply our patch
set -e
git apply allowDonators.patch
set +e
cd src/
# Update version
printf -v date '%(%Y%m%d%H%M)T' -1
hash=$(git rev-parse --short HEAD)
sed -i -E "s/AUTOMAIL_VERSION,([0-9\.\-]*)/AUTOMAIL_VERSION,\1.$date-$hash/g" automail.m4
sed -i -E "s/BONELESS_VERSION,([0-9\.\-]*)/BONELESS_VERSION,\1.$date-$hash/g" boneless.m4
sed -i -E "s/\"version\": \"([0-9\.\-]*)/\"version\": \"\1.$date-$hash/g" manifest.json
# Build and move it
make all
mv -f build/automail.user.js ../automail.user.js
mv -f build/firefox_addon.zip ../firefox_addon.zip
echo -e "\n\nBuilt version: .$date-$hash"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment