Log invalid deliveries
ci/woodpecker/tag/ociImageTag Pipeline is running
Details
ci/woodpecker/tag/ociImageTag Pipeline is running
Details
This commit is contained in:
parent
e7ff3a81bb
commit
3fe46dc6f9
|
@ -1,11 +1,11 @@
|
||||||
import type httpSignature from "@peertube/http-signature";
|
import type httpSignature from "@peertube/http-signature";
|
||||||
import { v4 as uuid } from "uuid";
|
import {v4 as uuid} from "uuid";
|
||||||
|
|
||||||
import config from "@/config/index.js";
|
import config from "@/config/index.js";
|
||||||
import type { DriveFile } from "@/models/entities/drive-file.js";
|
import type {DriveFile} from "@/models/entities/drive-file.js";
|
||||||
import type { IActivity } from "@/remote/activitypub/type.js";
|
import type {IActivity} from "@/remote/activitypub/type.js";
|
||||||
import type { Webhook, webhookEventTypes } from "@/models/entities/webhook.js";
|
import type {Webhook, webhookEventTypes} from "@/models/entities/webhook.js";
|
||||||
import { envOption } from "../env.js";
|
import {envOption} from "../env.js";
|
||||||
|
|
||||||
import processDeliver from "./processors/deliver.js";
|
import processDeliver from "./processors/deliver.js";
|
||||||
import processInbox from "./processors/inbox.js";
|
import processInbox from "./processors/inbox.js";
|
||||||
|
@ -14,20 +14,21 @@ import processObjectStorage from "./processors/object-storage/index.js";
|
||||||
import processSystemQueue from "./processors/system/index.js";
|
import processSystemQueue from "./processors/system/index.js";
|
||||||
import processWebhookDeliver from "./processors/webhook-deliver.js";
|
import processWebhookDeliver from "./processors/webhook-deliver.js";
|
||||||
import processBackground from "./processors/background/index.js";
|
import processBackground from "./processors/background/index.js";
|
||||||
import { endedPollNotification } from "./processors/ended-poll-notification.js";
|
import {endedPollNotification} from "./processors/ended-poll-notification.js";
|
||||||
import { queueLogger } from "./logger.js";
|
import {queueLogger} from "./logger.js";
|
||||||
import { getJobInfo } from "./get-job-info.js";
|
import {getJobInfo} from "./get-job-info.js";
|
||||||
import {
|
import {
|
||||||
systemQueue,
|
backgroundQueue,
|
||||||
dbQueue,
|
dbQueue,
|
||||||
deliverQueue,
|
deliverQueue,
|
||||||
|
endedPollNotificationQueue,
|
||||||
inboxQueue,
|
inboxQueue,
|
||||||
objectStorageQueue,
|
objectStorageQueue,
|
||||||
endedPollNotificationQueue,
|
systemQueue,
|
||||||
webhookDeliverQueue,
|
webhookDeliverQueue,
|
||||||
backgroundQueue,
|
|
||||||
} from "./queues.js";
|
} from "./queues.js";
|
||||||
import type { ThinUser } from "./types.js";
|
import type {ThinUser} from "./types.js";
|
||||||
|
import {URL} from "node:url";
|
||||||
|
|
||||||
function renderError(e: Error): any {
|
function renderError(e: Error): any {
|
||||||
return {
|
return {
|
||||||
|
@ -169,6 +170,13 @@ export function deliver(user: ThinUser, content: unknown, to: string | null) {
|
||||||
to,
|
to,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
new URL(data.to);
|
||||||
|
} catch (e) {
|
||||||
|
deliverLogger.error(`Failed URL parse, incorrect data: ${JSON.stringify(data)}`);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return deliverQueue.add(data, {
|
return deliverQueue.add(data, {
|
||||||
attempts: config.deliverJobMaxAttempts || 12,
|
attempts: config.deliverJobMaxAttempts || 12,
|
||||||
timeout: 1 * 60 * 1000, // 1min
|
timeout: 1 * 60 * 1000, // 1min
|
||||||
|
|
Loading…
Reference in New Issue