diff --git a/index.html b/index.html
index 2ccc161d96..8b541de791 100644
--- a/index.html
+++ b/index.html
@@ -18,6 +18,7 @@
+
diff --git a/js/game.js b/js/game.js
index 3d6d989152..f6e10b85a0 100644
--- a/js/game.js
+++ b/js/game.js
@@ -8,6 +8,7 @@ let gameInfo = {
discordName: "",
discordLink: "",
initialStartPoints: new Decimal (10), // Used for hard resets and new players
+ githackBranch: "",
offlineLimit: 1, // In hours
}
diff --git a/js/technical/githack-redirect.js b/js/technical/githack-redirect.js
new file mode 100644
index 0000000000..fea8c3e2f5
--- /dev/null
+++ b/js/technical/githack-redirect.js
@@ -0,0 +1,22 @@
+if (gameInfo.githackBranch && window.location.hostname === "rawcdn.githack.com") {
+ // Parse the current user and repo from the URL
+ const parts = window.location.pathname.split('/');
+ const user = parts[1];
+ const repo = parts[2];
+
+ // Find latest commit on specified branch
+ fetch(`https://api.github.com/repos/${user}/${repo}/commits/${gameInfo.githackBranch}`)
+ .then(response => response.json())
+ .then(response => {
+ // Calculate the URL for the latest version of the mod
+ const updatedURL = `https://rawcdn.githack.com/${user}/${repo}/${response.sha}/index.html?min=1`;
+
+ // Do nothing if we're already on that URL
+ if (updatedURL === window.location.href) {
+ return;
+ }
+
+ // Redirect to the latest version of the mod
+ window.location.href = updatedURL;
+ });
+}