Fix even more errors

This commit is contained in:
Scott Gould 2024-09-19 00:17:22 -04:00
parent 1855a6a8ea
commit 13cc83ed62
No known key found for this signature in database
3 changed files with 11 additions and 3 deletions

View file

@ -7,6 +7,10 @@ import fetch from "node-fetch";
import path from "path"; import path from "path";
import { observe, uptime } from "./stats.js"; import { observe, uptime } from "./stats.js";
import { getApiUrls, inviteResponse } from "./utils.js"; import { getApiUrls, inviteResponse } from "./utils.js";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
interface Instance { interface Instance {
name: string; name: string;
@ -14,7 +18,7 @@ interface Instance {
} }
const app = express(); const app = express();
import instances from "./webpage/instances.json"; import instances from "./webpage/instances.json" assert { type: "json" };
const instanceNames = new Map<string, Instance>(); const instanceNames = new Map<string, Instance>();
for (const instance of instances) { for (const instance of instances) {
@ -28,7 +32,7 @@ async function updateInstances(): Promise<void> {
const response = await fetch( const response = await fetch(
"https://raw.githubusercontent.com/spacebarchat/spacebarchat/master/instances/instances.json" "https://raw.githubusercontent.com/spacebarchat/spacebarchat/master/instances/instances.json"
); );
const json = await response.json() as Instance[]; const json = (await response.json()) as Instance[];
for (const instance of json) { for (const instance of json) {
if (!instanceNames.has(instance.name)) { if (!instanceNames.has(instance.name)) {
instances.push(instance as any); instances.push(instance as any);

View file

@ -2,6 +2,10 @@ import fs from "node:fs";
import path from "path"; import path from "path";
import fetch from "node-fetch"; import fetch from "node-fetch";
import { getApiUrls } from "./utils.js"; import { getApiUrls } from "./utils.js";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
interface UptimeEntry { interface UptimeEntry {
time: number; time: number;

View file

@ -11,7 +11,7 @@
"esnext", "esnext",
"DOM" "DOM"
], ],
"module": "ES2022", "module": "ESNext",
"moduleResolution": "Bundler", "moduleResolution": "Bundler",
"newLine": "lf", "newLine": "lf",
"noEmitHelpers": false, "noEmitHelpers": false,