mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
fix: 🚨 Fix Deepsource warnings
This commit is contained in:
parent
2fffbcbede
commit
870b6dbe85
13 changed files with 58 additions and 59 deletions
|
|
@ -180,19 +180,19 @@ export class Instance extends BaseInterface<typeof Instances> {
|
|||
|
||||
// Go to endpoint, then follow the links to the actual metadata
|
||||
try {
|
||||
const { json, ok, status } = await fetch(wellKnownUrl, {
|
||||
const result = await fetch(wellKnownUrl, {
|
||||
// @ts-expect-error Bun extension
|
||||
proxy: config.http.proxy_address,
|
||||
});
|
||||
|
||||
if (!ok) {
|
||||
if (!result.ok) {
|
||||
federationResolversLogger.error`Failed to fetch ActivityPub metadata for instance ${chalk.bold(
|
||||
origin,
|
||||
)} - HTTP ${status}`;
|
||||
)} - HTTP ${result.status}`;
|
||||
return null;
|
||||
}
|
||||
|
||||
const wellKnown = (await json()) as {
|
||||
const wellKnown = (await result.json()) as {
|
||||
links: { rel: string; href: string }[];
|
||||
};
|
||||
|
||||
|
|
@ -216,23 +216,19 @@ export class Instance extends BaseInterface<typeof Instances> {
|
|||
return null;
|
||||
}
|
||||
|
||||
const {
|
||||
json: json2,
|
||||
ok: ok2,
|
||||
status: status2,
|
||||
} = await fetch(metadataUrl.href, {
|
||||
const result2 = await fetch(metadataUrl.href, {
|
||||
// @ts-expect-error Bun extension
|
||||
proxy: config.http.proxy_address,
|
||||
});
|
||||
|
||||
if (!ok2) {
|
||||
if (!result2.ok) {
|
||||
federationResolversLogger.error`Failed to fetch ActivityPub metadata for instance ${chalk.bold(
|
||||
origin,
|
||||
)} - HTTP ${status2}`;
|
||||
)} - HTTP ${result2.status}`;
|
||||
return null;
|
||||
}
|
||||
|
||||
const metadata = (await json2()) as {
|
||||
const metadata = (await result2.json()) as {
|
||||
metadata: {
|
||||
nodeName?: string;
|
||||
title?: string;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ enum TimelineType {
|
|||
}
|
||||
|
||||
export class Timeline<Type extends Note | User | Notification> {
|
||||
public constructor(private type: TimelineType) {}
|
||||
public constructor(private readonly type: TimelineType) {}
|
||||
|
||||
public static getNoteTimeline(
|
||||
sql: SQL<unknown> | undefined,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue