move codeberg fetch to backend

This commit is contained in:
ThatOneCalculator 2022-09-15 15:23:08 -07:00
parent 4206f46cf4
commit 92150c575f
4 changed files with 14 additions and 11 deletions

View file

@ -1,6 +1,6 @@
{
"name": "calckey",
"version": "12.119.0-calc.1-rc.6",
"version": "12.119.0-calc.1-rc.7",
"codename": "aqua",
"repository": {
"type": "git",

View file

@ -272,6 +272,7 @@ import * as ep___recommendedInstances from './endpoints/recommended-instances.js
import * as ep___pinnedUsers from './endpoints/pinned-users.js';
import * as ep___customMOTD from './endpoints/custom-motd.js';
import * as ep___customSplashIcons from './endpoints/custom-splash-icons.js';
import * as ep___latestVersion from './endpoints/latest-version.js';
import * as ep___promo_read from './endpoints/promo/read.js';
import * as ep___requestResetPassword from './endpoints/request-reset-password.js';
import * as ep___resetDb from './endpoints/reset-db.js';
@ -592,7 +593,8 @@ const eps = [
['pinned-users', ep___pinnedUsers],
['recommended-instances', ep___recommendedInstances],
['custom-motd', ep___customMOTD],
['custom-motd', ep___customSplashIcons],
['custom-splash-icons', ep___customSplashIcons],
['latest-version', ep___latestVersion],
['promo/read', ep___promo_read],
['request-reset-password', ep___requestResetPassword],
['reset-db', ep___resetDb],

View file

@ -0,0 +1,7 @@
export async function getLatestVersion(): Promise<string> {
let tag_name = 'v12.119.0-calc';
fetch('https://codeberg.org/api/v1/repos/thatonecalculator/calckey/releases?draft=false&pre-release=false&page=1&limit=1')
.then((response) => response.json())
.then((data) => { tag_name = data[0].tag_name; });
return tag_name;
}

View file

@ -68,15 +68,9 @@ os.api('admin/abuse-user-reports', {
if (reports?.length > 0) thereIsUnresolvedAbuseReport = true;
});
await fetch('https://codeberg.org/api/v1/repos/thatonecalculator/calckey/releases?draft=false&pre-release=false&page=1&limit=1')
.then((response) => response.json())
.then((data) => {
console.log(data);
console.log(data[0]);
if (data[0].tag_name !== version) {
updateAvailable = true;
}
});
os.api('latest-version').then(res => {
console.log(res);
});
const NARROW_THRESHOLD = 600;
const ro = new ResizeObserver((entries, observer) => {