remove digest prerender

This commit is contained in:
tamaina 2024-02-29 22:41:45 +00:00
parent 434520a14e
commit 5f89b0a2a3
4 changed files with 4 additions and 12 deletions

View File

@ -12,7 +12,6 @@ import type { Config } from '@/config.js';
import { DI } from '@/di-symbols.js';
import { bindThis } from '@/decorators.js';
import type { Antenna } from '@/server/api/endpoints/i/import-antennas.js';
import { ApRequestCreator } from '@/core/activitypub/ApRequestService.js';
import type { DbQueue, DeliverQueue, EndedPollNotificationQueue, InboxQueue, ObjectStorageQueue, RelationshipQueue, SystemQueue, WebhookDeliverQueue } from './QueueModule.js';
import type { DbJobData, DeliverJobData, RelationshipJobData, ThinUser } from '../queue/types.js';
import type * as Bull from 'bullmq';
@ -76,14 +75,12 @@ export class QueueService {
if (to == null) return null;
const contentBody = JSON.stringify(content);
const digest = ApRequestCreator.createDigest(contentBody);
const data: DeliverJobData = {
user: {
id: user.id,
},
content: contentBody,
digest,
to,
isSharedInbox,
};
@ -109,7 +106,6 @@ export class QueueService {
public async deliverMany(user: ThinUser, content: IActivity | null, inboxes: Map<string, boolean>) {
if (content == null) return null;
const contentBody = JSON.stringify(content);
const digest = ApRequestCreator.createDigest(contentBody);
const opts = {
attempts: this.config.deliverJobMaxAttempts ?? 12,
@ -125,7 +121,6 @@ export class QueueService {
data: {
user,
content: contentBody,
digest,
to: d[0],
isSharedInbox: d[1],
} as DeliverJobData,

View File

@ -28,7 +28,7 @@ type PrivateKey = {
keyId: string;
};
export function createSignedPost(args: { level: string; key: PrivateKey; url: string; body: string; digest?: string; additionalHeaders: Record<string, string> }) {
export function createSignedPost(args: { level: string; key: PrivateKey; url: string; body: string; additionalHeaders: Record<string, string> }) {
const u = new URL(args.url);
const request: RequestLike = {
url: u.href,
@ -42,7 +42,7 @@ export function createSignedPost(args: { level: string; key: PrivateKey; url: st
};
// TODO: levelによって処理を分ける
const digestHeader = args.digest ?? genRFC3230DigestHeader(args.body);
const digestHeader = genRFC3230DigestHeader(args.body);
request.headers['Digest'] = digestHeader;
const result = signAsDraftToRequest(request, args.key, ['(request-target)', 'date', 'host', 'digest']);
@ -105,7 +105,7 @@ export class ApRequestService {
}
@bindThis
public async signedPost(user: { id: MiUser['id'] }, url: string, object: unknown, level: string, digest?: string): Promise<void> {
public async signedPost(user: { id: MiUser['id'] }, url: string, object: unknown, level: string): Promise<void> {
const body = typeof object === 'string' ? object : JSON.stringify(object);
const req = createSignedPost({
@ -113,7 +113,6 @@ export class ApRequestService {
key: await this.getPrivateKey(user.id, level),
url,
body,
digest,
additionalHeaders: {
},
});

View File

@ -76,7 +76,7 @@ export class DeliverProcessorService {
await this.fetchInstanceMetadataService.fetchInstanceMetadata(_server).then(() => {});
const server = await this.federatedInstanceService.fetch(host);
await this.apRequestService.signedPost(job.data.user, job.data.to, job.data.content, server.httpMessageSignaturesImplementationLevel, job.data.digest);
await this.apRequestService.signedPost(job.data.user, job.data.to, job.data.content, server.httpMessageSignaturesImplementationLevel);
// Update stats
if (server.isNotResponding) {

View File

@ -32,8 +32,6 @@ export type DeliverJobData = {
user: ThinUser;
/** Activity */
content: string;
/** Digest header */
digest: string;
/** inbox URL to deliver */
to: string;
/** whether it is sharedInbox */