mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-21 09:52:38 +01:00
Update some patches, switch to node-fetch-commonjs, more updates
This commit is contained in:
parent
a2ffc536aa
commit
168758924c
53110
assets/schemas.json
53110
assets/schemas.json
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,3 @@
|
||||
{
|
||||
"npmDepsHash": "sha256-7dAZmZ8yLaUsDavaX9Fw2RYK/lV4Yy4PIDqfLjh29cg="
|
||||
"npmDepsHash": "sha256-KuKvhybhYGxC6oiVUxyjdEQD4xalXZ3OxT4KJ49ROAw="
|
||||
}
|
||||
|
96
package-lock.json
generated
96
package-lock.json
generated
@ -13,7 +13,7 @@
|
||||
"@aws-sdk/client-s3": "^3.629.0",
|
||||
"@sentry/integrations": "^7.66.0",
|
||||
"@sentry/node": "^7.66.0",
|
||||
"ajv": "8.6.2",
|
||||
"ajv": "^8.6.2",
|
||||
"ajv-formats": "2.1.1",
|
||||
"amqplib": "^0.10.3",
|
||||
"bcrypt": "^5.1.0",
|
||||
@ -39,7 +39,7 @@
|
||||
"multer": "^1.4.5-lts.1",
|
||||
"murmurhash-js": "^1.0.0",
|
||||
"node-2fa": "^2.0.3",
|
||||
"node-fetch": "^2.7.0",
|
||||
"node-fetch-commonjs": "^3.3.2",
|
||||
"node-os-utils": "^1.3.7",
|
||||
"nodemailer": "^6.9.14",
|
||||
"picocolors": "^1.0.0",
|
||||
@ -1901,6 +1901,26 @@
|
||||
"node-pre-gyp": "bin/node-pre-gyp"
|
||||
}
|
||||
},
|
||||
"node_modules/@mapbox/node-pre-gyp/node_modules/node-fetch": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
|
||||
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"whatwg-url": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.x || >=6.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"encoding": "^0.1.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"encoding": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@nodelib/fs.scandir": {
|
||||
"version": "2.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
||||
@ -6612,6 +6632,27 @@
|
||||
"whatwg-fetch": "^3.4.1"
|
||||
}
|
||||
},
|
||||
"node_modules/isomorphic-fetch/node_modules/node-fetch": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
|
||||
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"whatwg-url": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.x || >=6.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"encoding": "^0.1.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"encoding": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/jackspeak": {
|
||||
"version": "3.4.3",
|
||||
"resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz",
|
||||
@ -7621,24 +7662,40 @@
|
||||
"integrity": "sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/node-fetch": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
|
||||
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
|
||||
"node_modules/node-domexception": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz",
|
||||
"integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/jimmywarting"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://paypal.me/jimmywarting"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/node-fetch-commonjs": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch-commonjs/-/node-fetch-commonjs-3.3.2.tgz",
|
||||
"integrity": "sha512-VBlAiynj3VMLrotgwOS3OyECFxas5y7ltLcK4t41lMUZeaK15Ym4QRkqN0EQKAFL42q9i21EPKjzLUPfltR72A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"whatwg-url": "^5.0.0"
|
||||
"node-domexception": "^1.0.0",
|
||||
"web-streams-polyfill": "^3.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.x || >=6.0.0"
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"encoding": "^0.1.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"encoding": {
|
||||
"optional": true
|
||||
}
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/node-fetch"
|
||||
}
|
||||
},
|
||||
"node_modules/node-gyp": {
|
||||
@ -10811,6 +10868,15 @@
|
||||
"node": ">=6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/web-streams-polyfill": {
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz",
|
||||
"integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/webcrypto-core": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/webcrypto-core/-/webcrypto-core-1.8.1.tgz",
|
||||
|
@ -69,7 +69,7 @@
|
||||
"@aws-sdk/client-s3": "^3.629.0",
|
||||
"@sentry/integrations": "^7.66.0",
|
||||
"@sentry/node": "^7.66.0",
|
||||
"ajv": "8.6.2",
|
||||
"ajv": "^8.6.2",
|
||||
"ajv-formats": "2.1.1",
|
||||
"amqplib": "^0.10.3",
|
||||
"bcrypt": "^5.1.0",
|
||||
@ -95,7 +95,7 @@
|
||||
"multer": "^1.4.5-lts.1",
|
||||
"murmurhash-js": "^1.0.0",
|
||||
"node-2fa": "^2.0.3",
|
||||
"node-fetch": "^2.7.0",
|
||||
"node-fetch-commonjs": "^3.3.2",
|
||||
"node-os-utils": "^1.3.7",
|
||||
"nodemailer": "^6.9.14",
|
||||
"picocolors": "^1.0.0",
|
||||
|
@ -1,5 +1,5 @@
|
||||
diff --git a/node_modules/body-parser/lib/types/json.js b/node_modules/body-parser/lib/types/json.js
|
||||
index c2745be..17c2cfe 100644
|
||||
index 59f3f7e..604f8b1 100644
|
||||
--- a/node_modules/body-parser/lib/types/json.js
|
||||
+++ b/node_modules/body-parser/lib/types/json.js
|
||||
@@ -18,6 +18,7 @@ var createError = require('http-errors')
|
||||
@ -10,7 +10,7 @@ index c2745be..17c2cfe 100644
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
@@ -86,7 +87,7 @@ function json (options) {
|
||||
@@ -89,7 +90,7 @@ function json (options) {
|
||||
|
||||
try {
|
||||
debug('parse json')
|
||||
@ -19,16 +19,16 @@ index c2745be..17c2cfe 100644
|
||||
} catch (e) {
|
||||
throw normalizeJsonSyntaxError(e, {
|
||||
message: e.message,
|
||||
@@ -157,7 +158,7 @@ function createStrictSyntaxError (str, char) {
|
||||
: ''
|
||||
@@ -166,7 +167,7 @@ function createStrictSyntaxError (str, char) {
|
||||
}
|
||||
|
||||
try {
|
||||
- JSON.parse(partial); /* istanbul ignore next */ throw new SyntaxError('strict violation')
|
||||
+ JSONbig.parse(partial); /* istanbul ignore next */ throw new SyntaxError('strict violation')
|
||||
} catch (e) {
|
||||
return normalizeJsonSyntaxError(e, {
|
||||
message: e.message.replace('#', char),
|
||||
@@ -216,7 +217,7 @@ function normalizeJsonSyntaxError (error, obj) {
|
||||
message: e.message.replace(JSON_SYNTAX_REGEXP, function (placeholder) {
|
||||
@@ -227,7 +228,7 @@ function normalizeJsonSyntaxError (error, obj) {
|
||||
}
|
||||
|
||||
// replace stack before message for Node.js 0.10 and below
|
@ -1,5 +1,5 @@
|
||||
diff --git a/node_modules/express/lib/response.js b/node_modules/express/lib/response.js
|
||||
index dd7b3c8..a339896 100644
|
||||
index 2b654f4..60592b0 100644
|
||||
--- a/node_modules/express/lib/response.js
|
||||
+++ b/node_modules/express/lib/response.js
|
||||
@@ -27,7 +27,6 @@ var merge = require('utils-merge');
|
||||
@ -10,15 +10,16 @@ index dd7b3c8..a339896 100644
|
||||
var cookie = require('cookie');
|
||||
var send = require('send');
|
||||
var extname = path.extname;
|
||||
@@ -54,7 +53,6 @@ module.exports = res
|
||||
@@ -54,8 +53,6 @@ module.exports = res
|
||||
* @private
|
||||
*/
|
||||
|
||||
-var charsetRegExp = /;\s*charset\s*=/;
|
||||
var schemaAndHostRegExp = /^(?:[a-zA-Z][a-zA-Z0-9+.-]*:)?\/\/[^\\\/\?]+/;
|
||||
|
||||
-
|
||||
/**
|
||||
@@ -165,16 +163,6 @@ res.send = function send(body) {
|
||||
* Set status `code`.
|
||||
*
|
||||
@@ -164,16 +161,6 @@ res.send = function send(body) {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -35,7 +36,7 @@ index dd7b3c8..a339896 100644
|
||||
|
||||
// determine if ETag should be generated
|
||||
var etagFn = app.get('etag fn')
|
||||
@@ -781,17 +769,6 @@ res.header = function header(field, val) {
|
||||
@@ -780,17 +767,6 @@ res.header = function header(field, val) {
|
||||
? val.map(String)
|
||||
: String(val);
|
||||
|
@ -20,7 +20,7 @@ import { Config, JimpType } from "@spacebar/util";
|
||||
import { Request, Response } from "express";
|
||||
import { yellow } from "picocolors";
|
||||
import crypto from "crypto";
|
||||
import fetch from "node-fetch";
|
||||
import fetch from "node-fetch-commonjs";
|
||||
|
||||
let sharp: undefined | false | { default: typeof import("sharp") } = undefined;
|
||||
|
||||
|
@ -17,9 +17,14 @@
|
||||
*/
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { TenorMediaTypes, getGifApiKey, parseGifResult } from "@spacebar/util";
|
||||
import {
|
||||
TenorMediaTypes,
|
||||
getGifApiKey,
|
||||
parseGifResult,
|
||||
TenorGif,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import fetch from "node-fetch";
|
||||
import fetch from "node-fetch-commonjs";
|
||||
import { ProxyAgent } from "proxy-agent";
|
||||
|
||||
const router = Router();
|
||||
@ -68,7 +73,7 @@ router.get(
|
||||
},
|
||||
);
|
||||
|
||||
const { results } = await response.json();
|
||||
const { results } = (await response.json()) as { results: TenorGif[] };
|
||||
|
||||
res.json(results.map(parseGifResult)).status(200);
|
||||
},
|
||||
|
@ -17,9 +17,14 @@
|
||||
*/
|
||||
|
||||
import { route } from "@spacebar/api";
|
||||
import { TenorMediaTypes, getGifApiKey, parseGifResult } from "@spacebar/util";
|
||||
import {
|
||||
TenorMediaTypes,
|
||||
getGifApiKey,
|
||||
parseGifResult,
|
||||
TenorGif,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import fetch from "node-fetch";
|
||||
import fetch from "node-fetch-commonjs";
|
||||
import { ProxyAgent } from "proxy-agent";
|
||||
|
||||
const router = Router();
|
||||
@ -63,7 +68,7 @@ router.get(
|
||||
},
|
||||
);
|
||||
|
||||
const { results } = await response.json();
|
||||
const { results } = (await response.json()) as { results: TenorGif[] };
|
||||
|
||||
res.json(results.map(parseGifResult)).status(200);
|
||||
},
|
||||
|
@ -24,7 +24,7 @@ import {
|
||||
parseGifResult,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import fetch from "node-fetch";
|
||||
import fetch from "node-fetch-commonjs";
|
||||
import { ProxyAgent } from "proxy-agent";
|
||||
|
||||
const router = Router();
|
||||
|
@ -28,7 +28,7 @@ import {
|
||||
Template,
|
||||
} from "@spacebar/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import fetch from "node-fetch";
|
||||
import fetch from "node-fetch-commonjs";
|
||||
const router: Router = Router();
|
||||
|
||||
router.get(
|
||||
|
@ -48,7 +48,7 @@ import {
|
||||
} from "@spacebar/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { In } from "typeorm";
|
||||
import fetch from "node-fetch";
|
||||
import fetch from "node-fetch-commonjs";
|
||||
const allow_empty = false;
|
||||
// TODO: check webhook, application, system author, stickers
|
||||
// TODO: embed gifs/videos/images
|
||||
|
@ -19,7 +19,7 @@
|
||||
import { Config, Embed, EmbedImage, EmbedType } from "@spacebar/util";
|
||||
import * as cheerio from "cheerio";
|
||||
import crypto from "crypto";
|
||||
import fetch, { RequestInit } from "node-fetch";
|
||||
import fetch, { RequestInit } from "node-fetch-commonjs";
|
||||
import { yellow } from "picocolors";
|
||||
import probe from "probe-image-size";
|
||||
|
||||
@ -221,7 +221,7 @@ export const EmbedHandlers: {
|
||||
? {
|
||||
name: metas.site_name,
|
||||
url: url.origin,
|
||||
}
|
||||
}
|
||||
: undefined,
|
||||
};
|
||||
},
|
||||
@ -269,7 +269,27 @@ export const EmbedHandlers: {
|
||||
authorization: `Bearer ${token}`,
|
||||
},
|
||||
});
|
||||
const json = await response.json();
|
||||
const json = (await response.json()) as {
|
||||
errors?: never[];
|
||||
includes: {
|
||||
users: {
|
||||
profile_image_url: string;
|
||||
username: string;
|
||||
name: string;
|
||||
}[];
|
||||
media: {
|
||||
type: string;
|
||||
width: number;
|
||||
height: number;
|
||||
url: string;
|
||||
}[];
|
||||
};
|
||||
data: {
|
||||
text: string;
|
||||
created_at: string;
|
||||
public_metrics: { like_count: number; retweet_count: number };
|
||||
};
|
||||
};
|
||||
if (json.errors) return null;
|
||||
const author = json.includes.users[0];
|
||||
const text = json.data.text;
|
||||
@ -508,7 +528,7 @@ export const EmbedHandlers: {
|
||||
? {
|
||||
name: metas.author,
|
||||
// TODO: author channel url
|
||||
}
|
||||
}
|
||||
: undefined,
|
||||
};
|
||||
},
|
||||
@ -533,7 +553,7 @@ export const EmbedHandlers: {
|
||||
footer: hoverText
|
||||
? {
|
||||
text: hoverText,
|
||||
}
|
||||
}
|
||||
: undefined,
|
||||
};
|
||||
},
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
import { Config } from "@spacebar/util";
|
||||
import fetch from "node-fetch";
|
||||
import fetch from "node-fetch-commonjs";
|
||||
|
||||
export interface hcaptchaResponse {
|
||||
success: boolean;
|
||||
|
@ -19,7 +19,7 @@
|
||||
import { Config } from "@spacebar/util";
|
||||
import { Request } from "express";
|
||||
// use ipdata package instead of simple fetch because of integrated caching
|
||||
import fetch from "node-fetch";
|
||||
import fetch from "node-fetch-commonjs";
|
||||
|
||||
const exampleData = {
|
||||
ip: "",
|
||||
@ -85,7 +85,7 @@ export async function IPAnalysis(ip: string): Promise<typeof exampleData> {
|
||||
|
||||
return (
|
||||
await fetch(`https://api.ipdata.co/${ip}?api-key=${ipdataApiKey}`)
|
||||
).json();
|
||||
).json() as Promise<typeof exampleData>;
|
||||
}
|
||||
|
||||
export function isProxy(data: typeof exampleData) {
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
import "missing-native-js-functions";
|
||||
import fetch from "node-fetch";
|
||||
import fetch from "node-fetch-commonjs";
|
||||
import { ProxyAgent } from "proxy-agent";
|
||||
import readline from "readline";
|
||||
import fs from "fs/promises";
|
||||
@ -100,7 +100,7 @@ async function getLatestVersion(url: string) {
|
||||
try {
|
||||
const agent = new ProxyAgent();
|
||||
const response = await fetch(url, { agent });
|
||||
const content = await response.json();
|
||||
const content = (await response.json()) as { version: string };
|
||||
return content.version;
|
||||
} catch (error) {
|
||||
throw new Error("[Auto update] check failed for " + url);
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
import FormData from "form-data";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import fetch from "node-fetch";
|
||||
import fetch from "node-fetch-commonjs";
|
||||
import { Attachment } from "../entities";
|
||||
import { Config } from "./Config";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user