forked from FoundKeyGang/FoundKey
refactor: remove default export for Resolver
This commit is contained in:
parent
ae59ce51b0
commit
3ef1a4b0f9
24 changed files with 24 additions and 24 deletions
|
@ -9,7 +9,7 @@ import { apRequestChart, federationChart, instanceChart } from '@/services/chart
|
||||||
import { toPuny, extractDbHost } from '@/misc/convert-host.js';
|
import { toPuny, extractDbHost } from '@/misc/convert-host.js';
|
||||||
import { getApId } from '@/remote/activitypub/type.js';
|
import { getApId } from '@/remote/activitypub/type.js';
|
||||||
import { fetchInstanceMetadata } from '@/services/fetch-instance-metadata.js';
|
import { fetchInstanceMetadata } from '@/services/fetch-instance-metadata.js';
|
||||||
import Resolver from '@/remote/activitypub/resolver.js';
|
import { Resolver } from '@/remote/activitypub/resolver.js';
|
||||||
import { LdSignature } from '@/remote/activitypub/misc/ld-signature.js';
|
import { LdSignature } from '@/remote/activitypub/misc/ld-signature.js';
|
||||||
import { getAuthUser } from '@/remote/activitypub/misc/auth-user.js';
|
import { getAuthUser } from '@/remote/activitypub/misc/auth-user.js';
|
||||||
import { StatusError } from '@/misc/fetch.js';
|
import { StatusError } from '@/misc/fetch.js';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import promiseLimit from 'promise-limit';
|
||||||
import { CacheableRemoteUser, CacheableUser } from '@/models/entities/user.js';
|
import { CacheableRemoteUser, CacheableUser } from '@/models/entities/user.js';
|
||||||
import { unique, concat } from '@/prelude/array.js';
|
import { unique, concat } from '@/prelude/array.js';
|
||||||
import { resolvePerson } from './models/person.js';
|
import { resolvePerson } from './models/person.js';
|
||||||
import Resolver from './resolver.js';
|
import { Resolver } from './resolver.js';
|
||||||
import { ApObject, getApIds } from './type.js';
|
import { ApObject, getApIds } from './type.js';
|
||||||
|
|
||||||
type Visibility = 'public' | 'home' | 'followers' | 'specified';
|
type Visibility = 'public' | 'home' | 'followers' | 'specified';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { CacheableRemoteUser } from '@/models/entities/user.js';
|
import { CacheableRemoteUser } from '@/models/entities/user.js';
|
||||||
import { apLogger } from '@/remote/activitypub/logger.js';
|
import { apLogger } from '@/remote/activitypub/logger.js';
|
||||||
import Resolver from '@/remote/activitypub/resolver.js';
|
import { Resolver } from '@/remote/activitypub/resolver.js';
|
||||||
import { IAccept, isFollow, getApType } from '@/remote/activitypub/type.js';
|
import { IAccept, isFollow, getApType } from '@/remote/activitypub/type.js';
|
||||||
import acceptFollow from './follow.js';
|
import acceptFollow from './follow.js';
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { CacheableRemoteUser } from '@/models/entities/user.js';
|
||||||
import { addPinned } from '@/services/i/pin.js';
|
import { addPinned } from '@/services/i/pin.js';
|
||||||
import { resolveNote } from '@/remote/activitypub/models/note.js';
|
import { resolveNote } from '@/remote/activitypub/models/note.js';
|
||||||
import { IAdd } from '@/remote/activitypub/type.js';
|
import { IAdd } from '@/remote/activitypub/type.js';
|
||||||
import Resolver from '@/remote/activitypub/resolver.js';
|
import { Resolver } from '@/remote/activitypub/resolver.js';
|
||||||
|
|
||||||
export default async (actor: CacheableRemoteUser, activity: IAdd, resolver: Resolver): Promise<void> => {
|
export default async (actor: CacheableRemoteUser, activity: IAdd, resolver: Resolver): Promise<void> => {
|
||||||
if ('actor' in activity && actor.uri !== activity.actor) {
|
if ('actor' in activity && actor.uri !== activity.actor) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { CacheableRemoteUser } from '@/models/entities/user.js';
|
import { CacheableRemoteUser } from '@/models/entities/user.js';
|
||||||
import { apLogger } from '@/remote/activitypub/logger.js';
|
import { apLogger } from '@/remote/activitypub/logger.js';
|
||||||
import Resolver from '@/remote/activitypub/resolver.js';
|
import { Resolver } from '@/remote/activitypub/resolver.js';
|
||||||
import { IAnnounce, getApId } from '@/remote/activitypub/type.js';
|
import { IAnnounce, getApId } from '@/remote/activitypub/type.js';
|
||||||
import announceNote from './note.js';
|
import announceNote from './note.js';
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { Notes } from '@/models/index.js';
|
||||||
import { parseAudience } from '@/remote/activitypub/audience.js';
|
import { parseAudience } from '@/remote/activitypub/audience.js';
|
||||||
import { apLogger } from '@/remote/activitypub/logger.js';
|
import { apLogger } from '@/remote/activitypub/logger.js';
|
||||||
import { fetchNote, resolveNote } from '@/remote/activitypub/models/note.js';
|
import { fetchNote, resolveNote } from '@/remote/activitypub/models/note.js';
|
||||||
import Resolver from '@/remote/activitypub/resolver.js';
|
import { Resolver } from '@/remote/activitypub/resolver.js';
|
||||||
import { IAnnounce, getApId } from '@/remote/activitypub/type.js';
|
import { IAnnounce, getApId } from '@/remote/activitypub/type.js';
|
||||||
import { shouldBlockInstance } from '@/misc/should-block-instance.js';
|
import { shouldBlockInstance } from '@/misc/should-block-instance.js';
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { CacheableRemoteUser } from '@/models/entities/user.js';
|
import { CacheableRemoteUser } from '@/models/entities/user.js';
|
||||||
import { toArray, concat, unique } from '@/prelude/array.js';
|
import { toArray, concat, unique } from '@/prelude/array.js';
|
||||||
import Resolver from '../../resolver.js';
|
import { Resolver } from '@/remote/activitypub/resolver.js';
|
||||||
import { ICreate, getApId, isPost, getApType } from '../../type.js';
|
import { ICreate, getApId, isPost, getApType } from '../../type.js';
|
||||||
import { apLogger } from '../../logger.js';
|
import { apLogger } from '../../logger.js';
|
||||||
import createNote from './note.js';
|
import createNote from './note.js';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { CacheableRemoteUser } from '@/models/entities/user.js';
|
||||||
import { getApLock } from '@/misc/app-lock.js';
|
import { getApLock } from '@/misc/app-lock.js';
|
||||||
import { extractDbHost } from '@/misc/convert-host.js';
|
import { extractDbHost } from '@/misc/convert-host.js';
|
||||||
import { StatusError } from '@/misc/fetch.js';
|
import { StatusError } from '@/misc/fetch.js';
|
||||||
import Resolver from '@/remote/activitypub/resolver.js';
|
import { Resolver } from '@/remote/activitypub/resolver.js';
|
||||||
import { createNote, fetchNote } from '@/remote/activitypub/models/note.js';
|
import { createNote, fetchNote } from '@/remote/activitypub/models/note.js';
|
||||||
import { getApId, IObject, ICreate } from '@/remote/activitypub/type.js';
|
import { getApId, IObject, ICreate } from '@/remote/activitypub/type.js';
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { CacheableRemoteUser } from '@/models/entities/user.js';
|
import { CacheableRemoteUser } from '@/models/entities/user.js';
|
||||||
import { toArray } from '@/prelude/array.js';
|
import { toArray } from '@/prelude/array.js';
|
||||||
|
import { Resolver } from '@/remote/activitypub/resolver.js';
|
||||||
import { apLogger } from '../logger.js';
|
import { apLogger } from '../logger.js';
|
||||||
import Resolver from '../resolver.js';
|
|
||||||
import { IObject, isCreate, isDelete, isUpdate, isRead, isFollow, isAccept, isReject, isAdd, isRemove, isAnnounce, isLike, isUndo, isBlock, isCollectionOrOrderedCollection, isCollection, isFlag } from '../type.js';
|
import { IObject, isCreate, isDelete, isUpdate, isRead, isFollow, isAccept, isReject, isAdd, isRemove, isAnnounce, isLike, isUndo, isBlock, isCollectionOrOrderedCollection, isCollection, isFlag } from '../type.js';
|
||||||
import create from './create/index.js';
|
import create from './create/index.js';
|
||||||
import performDeleteActivity from './delete/index.js';
|
import performDeleteActivity from './delete/index.js';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { CacheableRemoteUser } from '@/models/entities/user.js';
|
import { CacheableRemoteUser } from '@/models/entities/user.js';
|
||||||
|
import { Resolver } from '@/remote/activitypub/resolver.js';
|
||||||
import { apLogger } from '../../logger.js';
|
import { apLogger } from '../../logger.js';
|
||||||
import { IReject, isFollow, getApType } from '../../type.js';
|
import { IReject, isFollow, getApType } from '../../type.js';
|
||||||
import Resolver from '../../resolver.js';
|
|
||||||
import rejectFollow from './follow.js';
|
import rejectFollow from './follow.js';
|
||||||
|
|
||||||
export default async (actor: CacheableRemoteUser, activity: IReject, resolver: Resolver): Promise<string> => {
|
export default async (actor: CacheableRemoteUser, activity: IReject, resolver: Resolver): Promise<string> => {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { CacheableRemoteUser } from '@/models/entities/user.js';
|
import { CacheableRemoteUser } from '@/models/entities/user.js';
|
||||||
import { removePinned } from '@/services/i/pin.js';
|
import { removePinned } from '@/services/i/pin.js';
|
||||||
|
import { Resolver } from '@/remote/activitypub/resolver.js';
|
||||||
import { IRemove } from '../../type.js';
|
import { IRemove } from '../../type.js';
|
||||||
import { resolveNote } from '../../models/note.js';
|
import { resolveNote } from '../../models/note.js';
|
||||||
import Resolver from '@/remote/activitypub/resolver.js';
|
|
||||||
|
|
||||||
export default async (actor: CacheableRemoteUser, activity: IRemove, resolver: Resolver): Promise<void> => {
|
export default async (actor: CacheableRemoteUser, activity: IRemove, resolver: Resolver): Promise<void> => {
|
||||||
if ('actor' in activity && actor.uri !== activity.actor) {
|
if ('actor' in activity && actor.uri !== activity.actor) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { CacheableRemoteUser } from '@/models/entities/user.js';
|
import { CacheableRemoteUser } from '@/models/entities/user.js';
|
||||||
import { apLogger } from '@/remote/activitypub/logger.js';
|
import { apLogger } from '@/remote/activitypub/logger.js';
|
||||||
import Resolver from '@/remote/activitypub/resolver.js';
|
import { Resolver } from '@/remote/activitypub/resolver.js';
|
||||||
import { IUndo, isFollow, isBlock, isLike, isAnnounce, getApType, isAccept } from '@/remote/activitypub/type.js';
|
import { IUndo, isFollow, isBlock, isLike, isAnnounce, getApType, isAccept } from '@/remote/activitypub/type.js';
|
||||||
import unfollow from './follow.js';
|
import unfollow from './follow.js';
|
||||||
import unblock from './block.js';
|
import unblock from './block.js';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { CacheableRemoteUser } from '@/models/entities/user.js';
|
||||||
import { getApType, IUpdate, isActor } from '@/remote/activitypub/type.js';
|
import { getApType, IUpdate, isActor } from '@/remote/activitypub/type.js';
|
||||||
import { apLogger } from '@/remote/activitypub/logger.js';
|
import { apLogger } from '@/remote/activitypub/logger.js';
|
||||||
import { updateQuestion } from '@/remote/activitypub/models/question.js';
|
import { updateQuestion } from '@/remote/activitypub/models/question.js';
|
||||||
import Resolver from '@/remote/activitypub/resolver.js';
|
import { Resolver } from '@/remote/activitypub/resolver.js';
|
||||||
import { updatePerson } from '@/remote/activitypub/models/person.js';
|
import { updatePerson } from '@/remote/activitypub/models/person.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { DriveFile } from '@/models/entities/drive-file.js';
|
||||||
import { DriveFiles } from '@/models/index.js';
|
import { DriveFiles } from '@/models/index.js';
|
||||||
import { truncate } from '@/misc/truncate.js';
|
import { truncate } from '@/misc/truncate.js';
|
||||||
import { DB_MAX_IMAGE_COMMENT_LENGTH } from '@/misc/hard-limits.js';
|
import { DB_MAX_IMAGE_COMMENT_LENGTH } from '@/misc/hard-limits.js';
|
||||||
import Resolver from '../resolver.js';
|
import { Resolver } from '@/remote/activitypub/resolver.js';
|
||||||
import { apLogger } from '../logger.js';
|
import { apLogger } from '../logger.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import promiseLimit from 'promise-limit';
|
import promiseLimit from 'promise-limit';
|
||||||
import { toArray, unique } from '@/prelude/array.js';
|
import { toArray, unique } from '@/prelude/array.js';
|
||||||
import { CacheableUser } from '@/models/entities/user.js';
|
import { CacheableUser } from '@/models/entities/user.js';
|
||||||
|
import { Resolver } from '@/remote/activitypub/resolver.js';
|
||||||
import { IObject, isMention, IApMention } from '../type.js';
|
import { IObject, isMention, IApMention } from '../type.js';
|
||||||
import Resolver from '../resolver.js';
|
|
||||||
import { resolvePerson } from './person.js';
|
import { resolvePerson } from './person.js';
|
||||||
|
|
||||||
export async function extractApMentions(tags: IObject | IObject[] | null | undefined, resolver: Resolver) {
|
export async function extractApMentions(tags: IObject | IObject[] | null | undefined, resolver: Resolver) {
|
||||||
|
|
|
@ -17,10 +17,10 @@ import { createMessage } from '@/services/messages/create.js';
|
||||||
import { StatusError } from '@/misc/fetch.js';
|
import { StatusError } from '@/misc/fetch.js';
|
||||||
import { fromHtml } from '@/mfm/from-html.js';
|
import { fromHtml } from '@/mfm/from-html.js';
|
||||||
import { shouldBlockInstance } from '@/misc/should-block-instance.js';
|
import { shouldBlockInstance } from '@/misc/should-block-instance.js';
|
||||||
|
import { Resolver } from '@/remote/activitypub/resolver.js';
|
||||||
import { parseAudience } from '../audience.js';
|
import { parseAudience } from '../audience.js';
|
||||||
import { IObject, getOneApId, getApId, getOneApHrefNullable, validPost, IPost, isEmoji, getApType } from '../type.js';
|
import { IObject, getOneApId, getApId, getOneApHrefNullable, validPost, IPost, isEmoji, getApType } from '../type.js';
|
||||||
import { DbResolver } from '../db-resolver.js';
|
import { DbResolver } from '../db-resolver.js';
|
||||||
import Resolver from '../resolver.js';
|
|
||||||
import { apLogger } from '../logger.js';
|
import { apLogger } from '../logger.js';
|
||||||
import { resolvePerson } from './person.js';
|
import { resolvePerson } from './person.js';
|
||||||
import { resolveImage } from './image.js';
|
import { resolveImage } from './image.js';
|
||||||
|
|
|
@ -24,9 +24,9 @@ import { uriPersonCache } from '@/services/user-cache.js';
|
||||||
import { publishInternalEvent } from '@/services/stream.js';
|
import { publishInternalEvent } from '@/services/stream.js';
|
||||||
import { db } from '@/db/postgre.js';
|
import { db } from '@/db/postgre.js';
|
||||||
import { fromHtml } from '@/mfm/from-html.js';
|
import { fromHtml } from '@/mfm/from-html.js';
|
||||||
|
import { Resolver } from '@/remote/activitypub/resolver.js';
|
||||||
import { apLogger } from '../logger.js';
|
import { apLogger } from '../logger.js';
|
||||||
import { isCollectionOrOrderedCollection, isCollection, IActor, getApId, getOneApHrefNullable, IObject, isPropertyValue, getApType, isActor } from '../type.js';
|
import { isCollectionOrOrderedCollection, isCollection, IActor, getApId, getOneApHrefNullable, IObject, isPropertyValue, getApType, isActor } from '../type.js';
|
||||||
import Resolver from '../resolver.js';
|
|
||||||
import { extractApHashtags } from './tag.js';
|
import { extractApHashtags } from './tag.js';
|
||||||
import { resolveNote, extractEmojis } from './note.js';
|
import { resolveNote, extractEmojis } from './note.js';
|
||||||
import { resolveImage } from './image.js';
|
import { resolveImage } from './image.js';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import config from '@/config/index.js';
|
import config from '@/config/index.js';
|
||||||
import { Notes, Polls } from '@/models/index.js';
|
import { Notes, Polls } from '@/models/index.js';
|
||||||
import { IPoll } from '@/models/entities/poll.js';
|
import { IPoll } from '@/models/entities/poll.js';
|
||||||
import Resolver from '../resolver.js';
|
import { Resolver } from '@/remote/activitypub/resolver.js';
|
||||||
import { IObject, IQuestion, isQuestion } from '../type.js';
|
import { IObject, IQuestion, isQuestion } from '../type.js';
|
||||||
import { apLogger } from '../logger.js';
|
import { apLogger } from '../logger.js';
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { DAY } from '@/const.js';
|
import { DAY } from '@/const.js';
|
||||||
import { CacheableRemoteUser } from '@/models/entities/user.js';
|
import { CacheableRemoteUser } from '@/models/entities/user.js';
|
||||||
|
import { Resolver } from '@/remote/activitypub/resolver.js';
|
||||||
import { IObject } from './type.js';
|
import { IObject } from './type.js';
|
||||||
import { performActivity } from './kernel/index.js';
|
import { performActivity } from './kernel/index.js';
|
||||||
import { updatePerson } from './models/person.js';
|
import { updatePerson } from './models/person.js';
|
||||||
import Resolver from './resolver.js';
|
|
||||||
|
|
||||||
export default async (actor: CacheableRemoteUser, activity: IObject, resolver: Resolver): Promise<void> => {
|
export default async (actor: CacheableRemoteUser, activity: IObject, resolver: Resolver): Promise<void> => {
|
||||||
await performActivity(actor, activity, resolver);
|
await performActivity(actor, activity, resolver);
|
||||||
|
|
|
@ -21,7 +21,7 @@ import { parseUri } from './db-resolver.js';
|
||||||
*
|
*
|
||||||
* As opposed to the DbResolver which will try to resolve an ActivityPub URI into a database object.
|
* As opposed to the DbResolver which will try to resolve an ActivityPub URI into a database object.
|
||||||
*/
|
*/
|
||||||
export default class Resolver {
|
export class Resolver {
|
||||||
private history: Set<string>;
|
private history: Set<string>;
|
||||||
private user?: ILocalUser;
|
private user?: ILocalUser;
|
||||||
private recursionLimit?: number;
|
private recursionLimit?: number;
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { Users } from '@/models/index.js';
|
||||||
import webFinger from './webfinger.js';
|
import webFinger from './webfinger.js';
|
||||||
import { createPerson, updatePerson } from './activitypub/models/person.js';
|
import { createPerson, updatePerson } from './activitypub/models/person.js';
|
||||||
import { remoteLogger } from './logger.js';
|
import { remoteLogger } from './logger.js';
|
||||||
import Resolver from './activitypub/resolver.js';
|
import { Resolver } from '@/remote/activitypub/resolver.js';
|
||||||
|
|
||||||
const logger = remoteLogger.createSubLogger('resolve-user');
|
const logger = remoteLogger.createSubLogger('resolve-user');
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import Resolver from '@/remote/activitypub/resolver.js';
|
import { Resolver } from '@/remote/activitypub/resolver.js';
|
||||||
import { HOUR } from '@/const.js';
|
import { HOUR } from '@/const.js';
|
||||||
import define from '../../define.js';
|
import define from '../../define.js';
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { createPerson } from '@/remote/activitypub/models/person.js';
|
import { createPerson } from '@/remote/activitypub/models/person.js';
|
||||||
import { createNote } from '@/remote/activitypub/models/note.js';
|
import { createNote } from '@/remote/activitypub/models/note.js';
|
||||||
import { DbResolver } from '@/remote/activitypub/db-resolver.js';
|
import { DbResolver } from '@/remote/activitypub/db-resolver.js';
|
||||||
import Resolver from '@/remote/activitypub/resolver.js';
|
import { Resolver } from '@/remote/activitypub/resolver.js';
|
||||||
import { extractDbHost } from '@/misc/convert-host.js';
|
import { extractDbHost } from '@/misc/convert-host.js';
|
||||||
import { Users, Notes } from '@/models/index.js';
|
import { Users, Notes } from '@/models/index.js';
|
||||||
import { Note } from '@/models/entities/note.js';
|
import { Note } from '@/models/entities/note.js';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import Resolver from '@/remote/activitypub/resolver.js';
|
import { Resolver } from '@/remote/activitypub/resolver.js';
|
||||||
import { updatePerson } from '@/remote/activitypub/models/person.js';
|
import { updatePerson } from '@/remote/activitypub/models/person.js';
|
||||||
import define from '../../define.js';
|
import define from '../../define.js';
|
||||||
import { getRemoteUser } from '../../common/getters.js';
|
import { getRemoteUser } from '../../common/getters.js';
|
||||||
|
|
Loading…
Reference in a new issue