mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-28 22:49:24 +09:00
remove digest prerender
This commit is contained in:
parent
434520a14e
commit
5f89b0a2a3
@ -12,7 +12,6 @@ import type { Config } from '@/config.js';
|
|||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import type { Antenna } from '@/server/api/endpoints/i/import-antennas.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 { DbQueue, DeliverQueue, EndedPollNotificationQueue, InboxQueue, ObjectStorageQueue, RelationshipQueue, SystemQueue, WebhookDeliverQueue } from './QueueModule.js';
|
||||||
import type { DbJobData, DeliverJobData, RelationshipJobData, ThinUser } from '../queue/types.js';
|
import type { DbJobData, DeliverJobData, RelationshipJobData, ThinUser } from '../queue/types.js';
|
||||||
import type * as Bull from 'bullmq';
|
import type * as Bull from 'bullmq';
|
||||||
@ -76,14 +75,12 @@ export class QueueService {
|
|||||||
if (to == null) return null;
|
if (to == null) return null;
|
||||||
|
|
||||||
const contentBody = JSON.stringify(content);
|
const contentBody = JSON.stringify(content);
|
||||||
const digest = ApRequestCreator.createDigest(contentBody);
|
|
||||||
|
|
||||||
const data: DeliverJobData = {
|
const data: DeliverJobData = {
|
||||||
user: {
|
user: {
|
||||||
id: user.id,
|
id: user.id,
|
||||||
},
|
},
|
||||||
content: contentBody,
|
content: contentBody,
|
||||||
digest,
|
|
||||||
to,
|
to,
|
||||||
isSharedInbox,
|
isSharedInbox,
|
||||||
};
|
};
|
||||||
@ -109,7 +106,6 @@ export class QueueService {
|
|||||||
public async deliverMany(user: ThinUser, content: IActivity | null, inboxes: Map<string, boolean>) {
|
public async deliverMany(user: ThinUser, content: IActivity | null, inboxes: Map<string, boolean>) {
|
||||||
if (content == null) return null;
|
if (content == null) return null;
|
||||||
const contentBody = JSON.stringify(content);
|
const contentBody = JSON.stringify(content);
|
||||||
const digest = ApRequestCreator.createDigest(contentBody);
|
|
||||||
|
|
||||||
const opts = {
|
const opts = {
|
||||||
attempts: this.config.deliverJobMaxAttempts ?? 12,
|
attempts: this.config.deliverJobMaxAttempts ?? 12,
|
||||||
@ -125,7 +121,6 @@ export class QueueService {
|
|||||||
data: {
|
data: {
|
||||||
user,
|
user,
|
||||||
content: contentBody,
|
content: contentBody,
|
||||||
digest,
|
|
||||||
to: d[0],
|
to: d[0],
|
||||||
isSharedInbox: d[1],
|
isSharedInbox: d[1],
|
||||||
} as DeliverJobData,
|
} as DeliverJobData,
|
||||||
|
@ -28,7 +28,7 @@ type PrivateKey = {
|
|||||||
keyId: string;
|
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 u = new URL(args.url);
|
||||||
const request: RequestLike = {
|
const request: RequestLike = {
|
||||||
url: u.href,
|
url: u.href,
|
||||||
@ -42,7 +42,7 @@ export function createSignedPost(args: { level: string; key: PrivateKey; url: st
|
|||||||
};
|
};
|
||||||
|
|
||||||
// TODO: levelによって処理を分ける
|
// TODO: levelによって処理を分ける
|
||||||
const digestHeader = args.digest ?? genRFC3230DigestHeader(args.body);
|
const digestHeader = genRFC3230DigestHeader(args.body);
|
||||||
request.headers['Digest'] = digestHeader;
|
request.headers['Digest'] = digestHeader;
|
||||||
|
|
||||||
const result = signAsDraftToRequest(request, args.key, ['(request-target)', 'date', 'host', 'digest']);
|
const result = signAsDraftToRequest(request, args.key, ['(request-target)', 'date', 'host', 'digest']);
|
||||||
@ -105,7 +105,7 @@ export class ApRequestService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@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 body = typeof object === 'string' ? object : JSON.stringify(object);
|
||||||
|
|
||||||
const req = createSignedPost({
|
const req = createSignedPost({
|
||||||
@ -113,7 +113,6 @@ export class ApRequestService {
|
|||||||
key: await this.getPrivateKey(user.id, level),
|
key: await this.getPrivateKey(user.id, level),
|
||||||
url,
|
url,
|
||||||
body,
|
body,
|
||||||
digest,
|
|
||||||
additionalHeaders: {
|
additionalHeaders: {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -76,7 +76,7 @@ export class DeliverProcessorService {
|
|||||||
await this.fetchInstanceMetadataService.fetchInstanceMetadata(_server).then(() => {});
|
await this.fetchInstanceMetadataService.fetchInstanceMetadata(_server).then(() => {});
|
||||||
const server = await this.federatedInstanceService.fetch(host);
|
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
|
// Update stats
|
||||||
if (server.isNotResponding) {
|
if (server.isNotResponding) {
|
||||||
|
@ -32,8 +32,6 @@ export type DeliverJobData = {
|
|||||||
user: ThinUser;
|
user: ThinUser;
|
||||||
/** Activity */
|
/** Activity */
|
||||||
content: string;
|
content: string;
|
||||||
/** Digest header */
|
|
||||||
digest: string;
|
|
||||||
/** inbox URL to deliver */
|
/** inbox URL to deliver */
|
||||||
to: string;
|
to: string;
|
||||||
/** whether it is sharedInbox */
|
/** whether it is sharedInbox */
|
||||||
|
Loading…
Reference in New Issue
Block a user