forkbomb DOS mitigation
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import config from '@/config/index.js';
|
||||
import { Notes, Polls } from '@/models/index.js';
|
||||
import { IPoll } from '@/models/entities/poll.js';
|
||||
import Resolver from '../resolver.js';
|
||||
import { IObject, IQuestion, isQuestion } from '../type.js';
|
||||
import { apLogger } from '../logger.js';
|
||||
import { Notes, Polls } from '@/models/index.js';
|
||||
import { IPoll } from '@/models/entities/poll.js';
|
||||
|
||||
export async function extractPollFromQuestion(source: string | IObject, resolver?: Resolver): Promise<IPoll> {
|
||||
if (resolver == null) resolver = new Resolver();
|
||||
@@ -40,7 +40,7 @@ export async function extractPollFromQuestion(source: string | IObject, resolver
|
||||
* @param uri URI of AP Question object
|
||||
* @returns true if updated
|
||||
*/
|
||||
export async function updateQuestion(value: any) {
|
||||
export async function updateQuestion(value: any, resolver?: Resolver) {
|
||||
const uri = typeof value === 'string' ? value : value.id;
|
||||
|
||||
// URIがこのサーバーを指しているならスキップ
|
||||
@@ -55,7 +55,7 @@ export async function updateQuestion(value: any) {
|
||||
//#endregion
|
||||
|
||||
// resolve new Question object
|
||||
const resolver = new Resolver();
|
||||
if (resolver == null) resolver = new Resolver();
|
||||
const question = await resolver.resolve(value) as IQuestion;
|
||||
apLogger.debug(`fetched question: ${JSON.stringify(question, null, 2)}`);
|
||||
|
||||
|
Reference in New Issue
Block a user