Remove GitHub update checks (API is rude)

This commit is contained in:
Tobias Berger 2021-09-30 21:17:46 +02:00
parent 7f705897f4
commit 5eca765646
2 changed files with 0 additions and 45 deletions

View file

@ -1,22 +1,3 @@
<script lang="ts" context="module">
async function getCurrentHash(): Promise<string> {
const response = await fetch(
"https://api.github.com/repos/Toby222/svelte-sharg/commits/main",
{
mode: "cors",
}
);
if (response.status < 200 || response.status > 299) {
throw new Error(response.statusText);
} else {
const result = (await response.json()).sha;
return result;
}
}
let CURRENT_HASH: string;
getCurrentHash().then((hash) => (CURRENT_HASH = hash));
</script>
<script lang="ts">
import Footer from "./components/Footer.svelte";
import Header from "./components/Header.svelte";
@ -31,7 +12,6 @@
let root: HTMLElement;
let unsubscribeSettings: Unsubscriber;
let updateInterval: ReturnType<typeof setInterval> | undefined;
onMount(() => {
root = document.documentElement;
@ -47,22 +27,6 @@
theme === settings.appearance.theme.current
);
});
if (settings.other.updateCheck.current && updateInterval === undefined) {
updateInterval = setInterval(async () => {
if (
CURRENT_HASH !== undefined &&
CURRENT_HASH !== (await getCurrentHash())
) {
console.log("Updoot");
}
}, 6 * 60 * 1000);
} else if (
!settings.other.updateCheck.current &&
updateInterval !== undefined
) {
clearInterval(updateInterval);
}
});
});

View file

@ -42,15 +42,6 @@ export class Settings extends StaticClass {
],
},
},
other: {
updateCheck: {
current: true,
default: true as const,
name: "Check for updates" as const,
description: "Whether to notify you of new updates" as const,
options: [true, false] as const,
},
},
// To test scrolling of the settings modal (gonna use them to test saving later, too)
nil: {
nil1: {