Remove Node-Fetch
This commit is contained in:
parent
367b0b8fe6
commit
2b1644cc03
4 changed files with 19 additions and 24 deletions
|
@ -20,11 +20,10 @@
|
||||||
"compression": "^1.7.4",
|
"compression": "^1.7.4",
|
||||||
"eslint-plugin-html": "^8.1.1",
|
"eslint-plugin-html": "^8.1.1",
|
||||||
"express": "^4.19.2",
|
"express": "^4.19.2",
|
||||||
|
"gulp-sourcemaps": "^3.0.0",
|
||||||
"gulp-swc": "^2.2.0",
|
"gulp-swc": "^2.2.0",
|
||||||
"node-fetch": "^3.3.2",
|
|
||||||
"rimraf": "^6.0.1",
|
"rimraf": "^6.0.1",
|
||||||
"ts-to-jsdoc": "^2.2.0",
|
"ts-to-jsdoc": "^2.2.0"
|
||||||
"gulp-sourcemaps":"^3.0.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^9.10.0",
|
"@eslint/js": "^9.10.0",
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
import compression from"compression";
|
import compression from"compression";
|
||||||
import express, { Request, Response }from"express";
|
import express, { Request, Response }from"express";
|
||||||
import fs from"node:fs/promises";
|
import fs from"node:fs/promises";
|
||||||
import fetch from"node-fetch";
|
|
||||||
import path from"node:path";
|
import path from"node: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"node:url";
|
import{ fileURLToPath }from"node:url";
|
||||||
import process from"node:process";
|
import process from"node:process";
|
||||||
|
|
||||||
const devmode = (process.env.NODE_ENV || "development") === "development";
|
const devmode = (process.env.NODE_ENV || "development") === "development";
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
const __dirname = path.dirname(__filename);
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import fs from"node:fs";
|
import fs from"node:fs";
|
||||||
import path from"node:path";
|
import path from"node:path";
|
||||||
import fetch from"node-fetch";
|
|
||||||
import{ getApiUrls }from"./utils.js";
|
import{ getApiUrls }from"./utils.js";
|
||||||
import{ fileURLToPath }from"node:url";
|
import{ fileURLToPath }from"node:url";
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import fetch from"node-fetch";
|
|
||||||
import{ Request, Response }from"express";
|
import{ Request, Response }from"express";
|
||||||
|
|
||||||
interface ApiUrls {
|
interface ApiUrls {
|
||||||
|
@ -31,9 +30,7 @@ export async function getApiUrls(url: string): Promise<ApiUrls | null>{
|
||||||
const api = info.api;
|
const api = info.api;
|
||||||
const apiUrl = new URL(api);
|
const apiUrl = new URL(api);
|
||||||
const policies: any = await fetch(
|
const policies: any = await fetch(
|
||||||
`${api}${
|
`${api}${apiUrl.pathname.includes("api") ? "" : "api"}/policies/instance/domains`
|
||||||
apiUrl.pathname.includes("api") ? "" : "api"
|
|
||||||
}/policies/instance/domains`
|
|
||||||
).then(res=>res.json());
|
).then(res=>res.json());
|
||||||
return{
|
return{
|
||||||
api: policies.apiEndpoint,
|
api: policies.apiEndpoint,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue