Merge pull request #934 from fosscord/master

Merge master into dev/endpoints-in-ping
This commit is contained in:
Madeline
2023-01-16 17:00:32 +11:00
committed by GitHub
4 changed files with 34 additions and 20 deletions

View File

@@ -223,6 +223,7 @@ export async function postHandleMessage(message: Message) {
data.embeds.push(embed);
}
} catch (e) {
console.error(`[Embeds] Error while generating embed`, e);
Sentry.captureException(e, (scope) => {
scope.clear();
scope.setContext("request", { url });

View File

@@ -3,6 +3,7 @@ import fetch, { Response } from "node-fetch";
import * as cheerio from "cheerio";
import probe from "probe-image-size";
import crypto from "crypto";
import { yellow } from "picocolors";
export const DEFAULT_FETCH_OPTIONS: any = {
redirect: "follow",
@@ -16,6 +17,8 @@ export const DEFAULT_FETCH_OPTIONS: any = {
method: "GET",
};
let hasWarnedAboutImagor = false;
export const getProxyUrl = (
url: URL,
width: number,
@@ -41,11 +44,17 @@ export const getProxyUrl = (
return `${imagorServerUrl}/${hash}/${path}`;
}
// TODO: Imagor documentation
console.log(
"Imagor has not been set up correctly. docs.fosscord.com/set/up/a/page/about/this",
);
return "";
if (!hasWarnedAboutImagor) {
hasWarnedAboutImagor = true;
console.log(
"[Embeds]",
yellow(
"Imagor has not been set up correctly. https://docs.fosscord.com/setup/server/configuration/imagor/",
),
);
}
return url.toString();
};
const getMeta = ($: cheerio.CheerioAPI, name: string): string | undefined => {