diff --git a/packages/backend/src/config.ts b/packages/backend/src/config.ts index bc3173b89d7..61c5cea6537 100644 --- a/packages/backend/src/config.ts +++ b/packages/backend/src/config.ts @@ -72,7 +72,6 @@ type Source = { rootUserName?: string; rootPassword?: string; publishTarballInsteadOfProvideRepositoryUrl?: boolean; - objectStorage?: { useObjectStorage: boolean; objectStorageBaseUrl: string; @@ -205,7 +204,6 @@ export type Config = { version: string; publishTarballInsteadOfProvideRepositoryUrl: boolean; - setupPassword: string | undefined; host: string; hostname: string; scheme: string; @@ -310,7 +308,6 @@ export function loadConfig(): Config { version, publishTarballInsteadOfProvideRepositoryUrl: !!config.publishTarballInsteadOfProvideRepositoryUrl, - setupPassword: config.setupPassword, url: url.origin, port: config.port ?? parseInt(process.env.PORT ?? '', 10), socket: config.socket, diff --git a/packages/backend/src/core/CustomEmojiService.ts b/packages/backend/src/core/CustomEmojiService.ts index fb973767190..46ebb7be266 100644 --- a/packages/backend/src/core/CustomEmojiService.ts +++ b/packages/backend/src/core/CustomEmojiService.ts @@ -105,11 +105,9 @@ export class CustomEmojiService implements OnApplicationShutdown { .where('webhook.isActive = :isActive', { isActive: true }) .andWhere('webhook.on @> :eventName', { eventName: `{${eventType}}` }) .getMany(); - console.log({ emoji, user: (me ? me : null) }); activeSystemWebhooksWithCustomEmojiRequest.forEach(it => this.systemWebhookService.enqueueSystemWebhook( - it.id, eventType, - { emoji, user: (me ? me : null) }, + { emoji, user: me ?? null }, )); } @bindThis @@ -204,20 +202,20 @@ export class CustomEmojiService implements OnApplicationShutdown { public async update(data: ( { id: MiEmoji['id'], name?: string; } | { name: string; id?: MiEmoji['id'], } ) & { - originalUrl?: string; - publicUrl?: string; - fileType?: string; - category?: string | null; - aliases?: string[]; - license?: string | null; - isSensitive?: boolean; - localOnly?: boolean; - roleIdsThatCanBeUsedThisEmojiAsReaction?: MiRole['id'][]; - }, moderator?: MiUser): Promise< + originalUrl?: string; + publicUrl?: string; + fileType?: string; + category?: string | null; + aliases?: string[]; + license?: string | null; + isSensitive?: boolean; + localOnly?: boolean; + roleIdsThatCanBeUsedThisEmojiAsReaction?: MiRole['id'][]; + }, moderator?: MiUser): Promise< null | 'NO_SUCH_EMOJI' | 'SAME_NAME_EMOJI_EXISTS' - > { + > { const emoji = data.id ? await this.getEmojiById(data.id) : await this.getEmojiByName(data.name!); diff --git a/packages/backend/src/core/InboxRuleService.ts b/packages/backend/src/core/InboxRuleService.ts index 431a664648b..0bcd386b6aa 100644 --- a/packages/backend/src/core/InboxRuleService.ts +++ b/packages/backend/src/core/InboxRuleService.ts @@ -6,8 +6,8 @@ import { Inject, Injectable } from '@nestjs/common'; import { bindThis } from '@/decorators.js'; import type { MiRemoteUser } from '@/models/User.js'; import { IdService } from '@/core/IdService.js'; -import { isCreate, isNote } from '@/core/activitypub/type.js'; -import type { IObject, IPost } from '@/core/activitypub/type.js'; +import { isNote } from '@/core/activitypub/type.js'; +import type { IActivity } from '@/core/activitypub/type.js'; import type { InstancesRepository } from '@/models/_.js'; import { DI } from '@/di-symbols.js'; import { UtilityService } from '@/core/UtilityService.js'; @@ -35,7 +35,7 @@ export class InboxRuleService { } @bindThis - async evalCond(activity: IObject, user: MiRemoteUser, value: InboxRuleCondFormulaValue): Promise { + async evalCond(activity: IActivity, user: MiRemoteUser, value: InboxRuleCondFormulaValue): Promise { const instanceUnpack = await this.instancesRepository .findOneBy({ host: this.utilityService.toPuny(user.host) }); if (!instanceUnpack) { @@ -105,27 +105,29 @@ export class InboxRuleService { } // メンション数が指定値以上 case 'maxMentionsMoreThanOrEq': { - if (isNote(activity.object)) { - return activity.object?.tag - ? activity.object?.tag?.filter(t => t.type === 'Mention').length >= value.value - : false; + if (typeof activity.object === 'string') return false; + if (isNote(activity.object) && Array.isArray(activity.object.tag)) { + return activity.object.tag.filter((t: any) => t.type === 'Mention').length >= value.value; } return false; } // 添付ファイル数が指定値以上 case 'attachmentFileMoreThanOrEq': { + if (typeof activity.object === 'string') return false; if (isNote(activity.object)) { - return activity.object?.attachment?.length ? activity.object?.attachment.length >= value.value : false; + return activity.object.attachment?.length ? activity.object.attachment.length >= value.value : false; } return false; } case 'thisActivityIsNote': { + if (typeof activity.object === 'string') return false; return isNote(activity.object); } // 指定されたワードが含まれている case 'isIncludeThisWord': { + if (typeof activity.object === 'string') return false; if (isNote(activity.object)) { - return this.utilityService.isKeyWordIncluded(typeof activity.object?.content === 'string' ? activity.object?.content : '', [value.value]); + return this.utilityService.isKeyWordIncluded(typeof activity.object.content === 'string' ? activity.object.content : '', [value.value]); } return false; } diff --git a/packages/backend/src/core/SystemWebhookService.ts b/packages/backend/src/core/SystemWebhookService.ts index e320207fcba..53b5cead0d9 100644 --- a/packages/backend/src/core/SystemWebhookService.ts +++ b/packages/backend/src/core/SystemWebhookService.ts @@ -5,7 +5,7 @@ import { Inject, Injectable } from '@nestjs/common'; import * as Redis from 'ioredis'; -import type { MiUser, SystemWebhooksRepository } from '@/models/_.js'; +import type { MiEmoji, MiEmojiRequest, MiUser, SystemWebhooksRepository } from '@/models/_.js'; import { DI } from '@/di-symbols.js'; import { bindThis } from '@/decorators.js'; import { GlobalEvents, GlobalEventService } from '@/core/GlobalEventService.js'; @@ -13,8 +13,6 @@ import { MiSystemWebhook, type SystemWebhookEventType } from '@/models/SystemWeb import { IdService } from '@/core/IdService.js'; import { QueueService } from '@/core/QueueService.js'; import { ModerationLogService } from '@/core/ModerationLogService.js'; -import { LoggerService } from '@/core/LoggerService.js'; -import Logger from '@/logger.js'; import { Packed } from '@/misc/json-schema.js'; import { AbuseReportResolveType } from '@/models/AbuseUserReport.js'; import { ModeratorInactivityRemainingTime } from '@/queue/processors/CheckModeratorsActivityProcessorService.js'; @@ -37,16 +35,23 @@ export type AbuseReportPayload = { resolvedAs: AbuseReportResolveType | null; }; +export type CustomEmojiRequestPayload = { + emoji: MiEmoji | MiEmojiRequest; + user: MiUser | null +}; + export type InactiveModeratorsWarningPayload = { remainingTime: ModeratorInactivityRemainingTime; }; export type SystemWebhookPayload = T extends 'abuseReport' | 'abuseReportResolved' ? AbuseReportPayload : + T extends 'customEmojiRequest' | 'customEmojiRequestResolved' ? CustomEmojiRequestPayload : T extends 'userCreated' ? Packed<'UserLite'> : + T extends 'userRegistered' ? { username: string, email: string | null, host: string | null } : T extends 'inactiveModeratorsWarning' ? InactiveModeratorsWarningPayload : T extends 'inactiveModeratorsInvitationOnlyChanged' ? Record : - never; + never; @Injectable() export class SystemWebhookService implements OnApplicationShutdown { diff --git a/packages/backend/src/core/UtilityService.ts b/packages/backend/src/core/UtilityService.ts index 4b906cf0307..f4b3df5adbe 100644 --- a/packages/backend/src/core/UtilityService.ts +++ b/packages/backend/src/core/UtilityService.ts @@ -9,12 +9,16 @@ import RE2 from 're2'; import { DI } from '@/di-symbols.js'; import type { Config } from '@/config.js'; import { bindThis } from '@/decorators.js'; +import type { MiMeta } from '@/models/Meta.js'; @Injectable() export class UtilityService { constructor( @Inject(DI.config) private config: Config, + + @Inject(DI.meta) + private meta: MiMeta, ) { } @@ -117,18 +121,20 @@ export class UtilityService { return host; } - @bindThis - public isFederationAllowedHost(host: string): boolean { - if (this.meta.federation === 'none') return false; - if (this.meta.federation === 'specified' && !this.meta.federationHosts.some(x => `.${host.toLowerCase()}`.endsWith(`.${x}`))) return false; - if (this.isBlockedHost(this.meta.blockedHosts, host)) return false; - - return true; - } - - @bindThis - public isFederationAllowedUri(uri: string): boolean { - const host = this.extractDbHost(uri); - return this.isFederationAllowedHost(host); - } + //TODO 機能するように + // @bindThis + // public isFederationAllowedHost(host: string): boolean { + // if (this.meta.federation === 'none') return false; + // if (this.meta.federation === 'specified' && !this.meta.federationHosts.some(x => `.${host.toLowerCase()}`.endsWith(`.${x}`))) return false; + // if (this.isBlockedHost(this.meta.blockedHosts, host)) return false; + // + // return true; + // } + + //TODO 機能するように + // @bindThis + // public isFederationAllowedUri(uri: string): boolean { + // const host = this.extractDbHost(uri); + // return this.isFederationAllowedHost(host); + // } } diff --git a/packages/backend/src/core/WebhookTestService.ts b/packages/backend/src/core/WebhookTestService.ts index 5197d570ae5..a66f284d0b8 100644 --- a/packages/backend/src/core/WebhookTestService.ts +++ b/packages/backend/src/core/WebhookTestService.ts @@ -32,6 +32,8 @@ function generateAbuseReport(override?: Partial): AbuseReport reporterHost: null, resolvedAs: null, moderationNote: 'foo', + notes: [], + noteIds: [], ...override, }; @@ -88,6 +90,7 @@ function generateDummyUser(override?: Partial): MiUser { uri: null, followersUri: null, token: null, + getPoints: 0, ...override, }; } @@ -130,6 +133,9 @@ function generateDummyNote(override?: Partial): MiNote { replyUserHost: null, renoteUserId: null, renoteUserHost: null, + updatedAt: null, + updatedAtHistory: [], + noteEditHistory: [], ...override, }; } @@ -469,7 +475,7 @@ export class WebhookTestService { } default: { // eslint-disable-next-line @typescript-eslint/no-unused-vars - const _exhaustiveAssertion: never = params.type; + const _exhaustiveAssertion: never = params.type as never; return; } } diff --git a/packages/backend/src/core/activitypub/ApInboxService.ts b/packages/backend/src/core/activitypub/ApInboxService.ts index db249cb75ef..d5de044f465 100644 --- a/packages/backend/src/core/activitypub/ApInboxService.ts +++ b/packages/backend/src/core/activitypub/ApInboxService.ts @@ -819,16 +819,15 @@ export class ApInboxService { if (isActor(object)) { await this.apPersonService.updatePerson(actor.uri, resolver, object); return 'ok: Person updated'; - // eslint-disable-next-line brace-style - } /*else if (getApType(object) === 'Question') { - await this.apQuestionService.updateQuestion(object, actor, resolver).catch(err => console.error(err)); - return 'ok: Question updated'; - }*/ else if (getApType(object) === 'Note' || getApType(object) === 'Question') { + } else if (getApType(object) === 'Note' || getApType(object) === 'Question') { await this.updateNote(resolver, actor, object, false, activity); return 'ok: Note updated'; } else { return `skip: Unknown type: ${getApType(object)}`; - } + } /*else if (getApType(object) === 'Question') { + await this.apQuestionService.updateQuestion(object, actor, resolver).catch(err => console.error(err)); + return 'ok: Question updated'; + }*/ } @bindThis diff --git a/packages/backend/src/core/entities/MetaEntityService.ts b/packages/backend/src/core/entities/MetaEntityService.ts index c0161b2df23..5665109e98b 100644 --- a/packages/backend/src/core/entities/MetaEntityService.ts +++ b/packages/backend/src/core/entities/MetaEntityService.ts @@ -144,7 +144,7 @@ export class MetaEntityService { enableUrlPreview: instance.urlPreviewEnabled, noteSearchableScope: (this.config.meilisearch == null || this.config.meilisearch.scope !== 'local') ? 'global' : 'local', maxFileSize: this.config.maxFileSize, - federation: this.meta.federation, + // federation: this.meta.federation, //TODO 機能するように }; return packed; diff --git a/packages/backend/src/core/entities/UserEntityService.ts b/packages/backend/src/core/entities/UserEntityService.ts index 2380893dafa..25682a44414 100644 --- a/packages/backend/src/core/entities/UserEntityService.ts +++ b/packages/backend/src/core/entities/UserEntityService.ts @@ -491,7 +491,7 @@ export class UserEntityService implements OnModuleInit { isBot: user.isBot, isCat: user.isCat, makeNotesFollowersOnlyBefore: (user.host && user.makeNotesFollowersOnlyBefore) ?? undefined, - makeNotesHiddenBefore: (user.host && user.makeNotesHiddenBefore )?? undefined, + makeNotesHiddenBefore: (user.host && user.makeNotesHiddenBefore ) ?? undefined, instance: user.host ? this.federatedInstanceService.federatedInstanceCache.fetch(user.host).then(instance => instance ? { name: instance.name, softwareName: instance.softwareName, diff --git a/packages/backend/src/misc/json-schema.ts b/packages/backend/src/misc/json-schema.ts index c01db23b2c6..3fb8d069bb1 100644 --- a/packages/backend/src/misc/json-schema.ts +++ b/packages/backend/src/misc/json-schema.ts @@ -33,7 +33,7 @@ import { packedClipSchema } from '@/models/json-schema/clip.js'; import { packedFederationInstanceSchema } from '@/models/json-schema/federation-instance.js'; import { packedQueueCountSchema } from '@/models/json-schema/queue.js'; import { packedGalleryPostSchema } from '@/models/json-schema/gallery-post.js'; -import { packedEmojiDetailedSchema, packedEmojiRequestSimpleSchema, packedEmojiSimpleSchema, packedEmojiRequestDetailedSchema,packedEmojiDetailedAdminSchema } from '@/models/json-schema/emoji.js'; +import { packedEmojiDetailedSchema, packedEmojiRequestSimpleSchema, packedEmojiSimpleSchema, packedEmojiRequestDetailedSchema, packedEmojiDetailedAdminSchema } from '@/models/json-schema/emoji.js'; import { packedFlashSchema } from '@/models/json-schema/flash.js'; import { packedAnnouncementSchema } from '@/models/json-schema/announcement.js'; import { packedSigninSchema } from '@/models/json-schema/signin.js'; diff --git a/packages/backend/src/models/InboxRule.ts b/packages/backend/src/models/InboxRule.ts index 4aeb5f96988..fee98b2aee7 100644 --- a/packages/backend/src/models/InboxRule.ts +++ b/packages/backend/src/models/InboxRule.ts @@ -152,28 +152,28 @@ type CondFormulaValueServerIsSilenced = { }; type CondFormulaValueServerPubLessThanOrEq = { - type : 'serverPubLessThanOrEq' + type: 'serverPubLessThanOrEq' value: number; -} +}; type CondFormulaValueServerPubMoreThanOrEq = { - type : 'serverPubMoreThanOrEq' + type: 'serverPubMoreThanOrEq' value: number; -} +}; type CondFormulaValueServerSubLessThanOrEq = { - type : 'serverSubLessThanOrEq' + type: 'serverSubLessThanOrEq' value: number; -} +}; type CondFormulaValueServerSubMoreThanOrEq = { - type : 'serverSubMoreThanOrEq' + type: 'serverSubMoreThanOrEq' value: number; -} +}; type CondFormulaThisActivityIsNote = { - type : 'thisActivityIsNote' -} + type: 'thisActivityIsNote' +}; export type InboxRuleCondFormulaValue = { id: string } & ( CondFormulaValueAnd | @@ -207,7 +207,7 @@ export type InboxRuleCondFormulaValue = { id: string } & ( export type InboxRuleAction = { type: 'reject' | 'messageRewrite'; rewrite?: string | null | undefined; -} +}; import { PrimaryColumn, Entity, Column } from 'typeorm'; import { id } from './util/id.js'; diff --git a/packages/backend/src/models/json-schema/meta.ts b/packages/backend/src/models/json-schema/meta.ts index f06e1718529..d0cc2414a77 100644 --- a/packages/backend/src/models/json-schema/meta.ts +++ b/packages/backend/src/models/json-schema/meta.ts @@ -365,11 +365,11 @@ export const packedMetaLiteSchema = { type: 'number', optional: false, nullable: false, }, - federation: { - type: 'string', - enum: ['all', 'specified', 'none'], - optional: false, nullable: false, - }, + // federation: { + // type: 'string', + // enum: ['all', 'specified', 'none'], + // optional: false, nullable: false, + // }, }, } as const; diff --git a/packages/backend/src/queue/processors/SystemWebhookDeliverProcessorService.ts b/packages/backend/src/queue/processors/SystemWebhookDeliverProcessorService.ts index f09a2235a4e..ab88484fc3f 100644 --- a/packages/backend/src/queue/processors/SystemWebhookDeliverProcessorService.ts +++ b/packages/backend/src/queue/processors/SystemWebhookDeliverProcessorService.ts @@ -36,7 +36,7 @@ export class SystemWebhookDeliverProcessorService { public async process(job: Bull.Job): Promise { try { this.logger.debug(`delivering ${job.data.webhookId}`); - this.logger.debug( JSON.stringify({ + this.logger.debug(JSON.stringify({ server: this.config.url, hookId: job.data.webhookId, eventId: job.data.eventId, diff --git a/packages/backend/src/queue/types.ts b/packages/backend/src/queue/types.ts index 568096537d2..fc75932a257 100644 --- a/packages/backend/src/queue/types.ts +++ b/packages/backend/src/queue/types.ts @@ -114,8 +114,8 @@ export type EndedPollNotificationJobData = { }; export type ScheduleNotePostJobData = { - scheduledNoteId: MiNote['id']; -} + scheduledNoteId: MiNote['id']; +}; type MinimumUser = { id: MiUser['id']; diff --git a/packages/backend/src/server/ActivityPubServerService.ts b/packages/backend/src/server/ActivityPubServerService.ts index b1e1c957ed7..1e5992d7e06 100644 --- a/packages/backend/src/server/ActivityPubServerService.ts +++ b/packages/backend/src/server/ActivityPubServerService.ts @@ -751,7 +751,7 @@ export class ActivityPubServerService { }); // follow - fastify.get<{ Params: { followRequestId: string ; } }>('/follows/:followRequestId', async (request, reply) => { + fastify.get<{ Params: { followRequestId: string; } }>('/follows/:followRequestId', async (request, reply) => { // This may be used before the follow is completed, so we do not // check if the following exists and only check if the follow request exists. diff --git a/packages/backend/src/server/FileServerService.ts b/packages/backend/src/server/FileServerService.ts index a2462feffa2..eac240315b8 100644 --- a/packages/backend/src/server/FileServerService.ts +++ b/packages/backend/src/server/FileServerService.ts @@ -519,7 +519,7 @@ export class FileServerService { @bindThis private async downloadAndDetectTypeFromUrl(url: string): Promise< - { state: 'remote' ; mime: string; ext: string | null; path: string; cleanup: () => void; filename: string; } + { state: 'remote'; mime: string; ext: string | null; path: string; cleanup: () => void; filename: string; } > { const [path, cleanup] = await createTemp(); try { diff --git a/packages/backend/src/server/api/SignupApiService.ts b/packages/backend/src/server/api/SignupApiService.ts index 493159cc1c0..5ec96b83cfa 100644 --- a/packages/backend/src/server/api/SignupApiService.ts +++ b/packages/backend/src/server/api/SignupApiService.ts @@ -6,9 +6,8 @@ import { Inject, Injectable } from '@nestjs/common'; import bcrypt from 'bcryptjs'; import { IsNull } from 'typeorm'; -import ProxyCheck from 'proxycheck-ts'; import { DI } from '@/di-symbols.js'; -import type { RegistrationTicketsRepository, UsedUsernamesRepository, UserPendingsRepository, UserProfilesRepository, UsersRepository, MiRegistrationTicket, MiMeta ,SystemWebhooksRepository,} from '@/models/_.js'; +import type { RegistrationTicketsRepository, UsedUsernamesRepository, UserPendingsRepository, UserProfilesRepository, UsersRepository, MiRegistrationTicket, MiMeta, SystemWebhooksRepository } from '@/models/_.js'; import type { Config } from '@/config.js'; import { CaptchaService } from '@/core/CaptchaService.js'; import { IdService } from '@/core/IdService.js'; @@ -125,7 +124,6 @@ export class SignupApiService { .andWhere('webhook.on @> :eventName', { eventName: '{userRegistered}' }) .getMany(); activeSystemWebhooksWithUserRegistered.forEach(it => this.systemWebhookService.enqueueSystemWebhook( - it.id, 'userRegistered', { username, diff --git a/packages/backend/src/server/api/endpoint-list.ts b/packages/backend/src/server/api/endpoint-list.ts index ac887015ef8..3fa93737a51 100644 --- a/packages/backend/src/server/api/endpoint-list.ts +++ b/packages/backend/src/server/api/endpoint-list.ts @@ -415,5 +415,5 @@ export * as 'admin/inbox-rule/set' from './endpoints/admin/inbox-rule/set.js'; export * as 'admin/inbox-rule/delete' from './endpoints/admin/inbox-rule/delete.js'; export * as 'admin/inbox-rule/list' from './endpoints/admin/inbox-rule/list.js'; export * as 'users/lists/list-favorite' from './endpoints/users/lists/list-favorite.js'; -export * as 'notes/home-local-timeline' from './endpoints/notes/home-local-timeline.js' +export * as 'notes/home-local-timeline' from './endpoints/notes/home-local-timeline.js'; export * as 'point/send' from './endpoints/point/send.js'; diff --git a/packages/backend/src/server/api/endpoints/admin/accounts/create.ts b/packages/backend/src/server/api/endpoints/admin/accounts/create.ts index f3319f8831d..4d48d7d0f05 100644 --- a/packages/backend/src/server/api/endpoints/admin/accounts/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/accounts/create.ts @@ -51,7 +51,6 @@ export const paramDef = { properties: { username: localUsernameSchema, password: passwordSchema, - setupPassword: { type: 'string', nullable: true }, }, required: ['username', 'password'], } as const; @@ -73,19 +72,7 @@ export default class extends Endpoint { // eslint- const me = _me ? await this.usersRepository.findOneByOrFail({ id: _me.id }) : null; const realUsers = await this.instanceActorService.realLocalUsersPresent(); - if (!realUsers && me == null && token == null) { - // 初回セットアップの場合 - if (this.config.setupPassword != null) { - // 初期パスワードが設定されている場合 - if (ps.setupPassword !== this.config.setupPassword) { - // 初期パスワードが違う場合 - throw new ApiError(meta.errors.wrongInitialPassword); - } - } else if (ps.setupPassword != null && ps.setupPassword.trim() !== '') { - // 初期パスワードが設定されていないのに初期パスワードが入力された場合 - throw new ApiError(meta.errors.wrongInitialPassword); - } - } else if ((realUsers && !me?.isRoot) || token !== null) { + if ((realUsers && !me?.isRoot) || token !== null) { // 初回セットアップではなく、管理者でない場合 or 外部トークンを使用している場合 throw new ApiError(meta.errors.accessDenied); } diff --git a/packages/backend/src/server/api/endpoints/ap/show.ts b/packages/backend/src/server/api/endpoints/ap/show.ts index b646014e764..34278feee80 100644 --- a/packages/backend/src/server/api/endpoints/ap/show.ts +++ b/packages/backend/src/server/api/endpoints/ap/show.ts @@ -18,10 +18,10 @@ import { UserEntityService } from '@/core/entities/UserEntityService.js'; import { NoteEntityService } from '@/core/entities/NoteEntityService.js'; import { UtilityService } from '@/core/UtilityService.js'; import { bindThis } from '@/decorators.js'; -import { ApiError } from '../../error.js'; import { IdentifiableError } from '@/misc/identifiable-error.js'; import { MiMeta } from '@/models/_.js'; import { DI } from '@/di-symbols.js'; +import { ApiError } from '../../error.js'; export const meta = { tags: ['federation'], @@ -141,9 +141,10 @@ export default class extends Endpoint { // eslint- */ @bindThis private async fetchAny(uri: string, me: MiLocalUser | null | undefined): Promise | null> { - if (!this.utilityService.isFederationAllowedUri(uri)) { - throw new ApiError(meta.errors.federationNotAllowed); - } + //TODO 機能するように + // if (!this.utilityService.isFederationAllowedUri(uri)) { + // throw new ApiError(meta.errors.federationNotAllowed); + // } // ブロックしてたら中断 if (this.utilityService.isBlockedHost(this.serverSettings.blockedHosts, this.utilityService.extractDbHost(uri))) return null; diff --git a/packages/backend/src/server/web/ClientServerService.ts b/packages/backend/src/server/web/ClientServerService.ts index be87f2e7610..838a1913fee 100644 --- a/packages/backend/src/server/web/ClientServerService.ts +++ b/packages/backend/src/server/web/ClientServerService.ts @@ -44,7 +44,7 @@ import { GalleryPostEntityService } from '@/core/entities/GalleryPostEntityServi import { ClipEntityService } from '@/core/entities/ClipEntityService.js'; import { ChannelEntityService } from '@/core/entities/ChannelEntityService.js'; import type { - AnnouncementsRepository,ChannelsRepository, + AnnouncementsRepository, ChannelsRepository, ClipsRepository, FlashsRepository, GalleryPostsRepository, @@ -558,7 +558,6 @@ export class ClientServerService { usernameLower: username.toLowerCase(), host: host ?? IsNull(), isSuspended: false, - requireSigninToViewContents: false, }); return user && (await this.feedService.packFeed(user)); @@ -636,7 +635,7 @@ export class ClientServerService { const profile = await this.userProfilesRepository.findOneByOrFail({ userId: user.id, }); - const me = profile.fields + const me = profile.fields ? profile.fields .filter( (filed) => @@ -650,10 +649,10 @@ export class ClientServerService { reply.header('X-Robots-Tag', 'noimageai'); reply.header('X-Robots-Tag', 'noai'); } - const _user = await this.userEntityService.pack(user, null, { - schema: 'UserDetailed', - userProfile: profile, - }); return await reply.view('user', { + const _user = await this.userEntityService.pack(user, null, { + schema: 'UserDetailed', + userProfile: profile, + }); return await reply.view('user', { user, profile, me, @@ -661,9 +660,9 @@ export class ClientServerService { user.avatarUrl ?? this.userEntityService.getIdenticonUrl(user), sub: request.params.sub, ...(await this.generateCommonPugData(this.meta)), - clientCtx: htmlSafeJsonStringify({ - user: _user, - }), + clientCtx: htmlSafeJsonStringify({ + user: _user, + }), }); } else { // リモートユーザーなので @@ -702,36 +701,36 @@ export class ClientServerService { vary(reply.raw, 'Accept'); const note = await this.notesRepository.findOne({ - where: { - id: request.params.note, - visibility: In(['public', 'home']), - }, - relations: ['user'], - }); + where: { + id: request.params.note, + visibility: In(['public', 'home']), + }, + relations: ['user'], + }); - if (note ) { - const _note = await this.noteEntityService.pack(note); - const profile = await this.userProfilesRepository.findOneByOrFail({ userId: note.userId }); - reply.header('Cache-Control', 'public, max-age=15'); - if (profile.preventAiLearning) { - reply.header('X-Robots-Tag', 'noimageai'); - reply.header('X-Robots-Tag', 'noai'); - } - return await reply.view('note', { - note: _note, - profile, - avatarUrl: _note.user.avatarUrl, - // TODO: Let locale changeable by instance setting - summary: getNoteSummary(_note), - ...await this.generateCommonPugData(this.meta), - clientCtx: htmlSafeJsonStringify({ + if (note ) { + const _note = await this.noteEntityService.pack(note); + const profile = await this.userProfilesRepository.findOneByOrFail({ userId: note.userId }); + reply.header('Cache-Control', 'public, max-age=15'); + if (profile.preventAiLearning) { + reply.header('X-Robots-Tag', 'noimageai'); + reply.header('X-Robots-Tag', 'noai'); + } + return await reply.view('note', { note: _note, - }), - }); - } else { - return await renderBase(reply); - } - }); + profile, + avatarUrl: _note.user.avatarUrl, + // TODO: Let locale changeable by instance setting + summary: getNoteSummary(_note), + ...await this.generateCommonPugData(this.meta), + clientCtx: htmlSafeJsonStringify({ + note: _note, + }), + }); + } else { + return await renderBase(reply); + } + }); // Page fastify.get<{ Params: { user: string; page: string } }>( @@ -750,28 +749,28 @@ export class ClientServerService { userId: user.id, }); - if (page) { - const _page = await this.pageEntityService.pack(page); - const profile = await this.userProfilesRepository.findOneByOrFail({ userId: page.userId }); - if (['public'].includes(page.visibility)) { - reply.header('Cache-Control', 'public, max-age=15'); + if (page) { + const _page = await this.pageEntityService.pack(page); + const profile = await this.userProfilesRepository.findOneByOrFail({ userId: page.userId }); + if (['public'].includes(page.visibility)) { + reply.header('Cache-Control', 'public, max-age=15'); + } else { + reply.header('Cache-Control', 'private, max-age=0, must-revalidate'); + } + if (profile.preventAiLearning) { + reply.header('X-Robots-Tag', 'noimageai'); + reply.header('X-Robots-Tag', 'noai'); + } + return await reply.view('page', { + page: _page, + profile, + avatarUrl: _page.user.avatarUrl, + ...await this.generateCommonPugData(this.meta), + }); } else { - reply.header('Cache-Control', 'private, max-age=0, must-revalidate'); - } - if (profile.preventAiLearning) { - reply.header('X-Robots-Tag', 'noimageai'); - reply.header('X-Robots-Tag', 'noai'); + return await renderBase(reply); } - return await reply.view('page', { - page: _page, - profile, - avatarUrl: _page.user.avatarUrl, - ...await this.generateCommonPugData(this.meta), - }); - } else { - return await renderBase(reply); - } - }); + }); // Flash fastify.get<{ Params: { id: string } }>( @@ -781,24 +780,24 @@ export class ClientServerService { id: request.params.id, }); - if (flash) { - const _flash = await this.flashEntityService.pack(flash); - const profile = await this.userProfilesRepository.findOneByOrFail({ userId: flash.userId }); - reply.header('Cache-Control', 'public, max-age=15'); - if (profile.preventAiLearning) { - reply.header('X-Robots-Tag', 'noimageai'); - reply.header('X-Robots-Tag', 'noai'); + if (flash) { + const _flash = await this.flashEntityService.pack(flash); + const profile = await this.userProfilesRepository.findOneByOrFail({ userId: flash.userId }); + reply.header('Cache-Control', 'public, max-age=15'); + if (profile.preventAiLearning) { + reply.header('X-Robots-Tag', 'noimageai'); + reply.header('X-Robots-Tag', 'noai'); + } + return await reply.view('flash', { + flash: _flash, + profile, + avatarUrl: _flash.user.avatarUrl, + ...await this.generateCommonPugData(this.meta), + }); + } else { + return await renderBase(reply); } - return await reply.view('flash', { - flash: _flash, - profile, - avatarUrl: _flash.user.avatarUrl, - ...await this.generateCommonPugData(this.meta), - }); - } else { - return await renderBase(reply); - } - }); + }); // Clip fastify.get<{ Params: { clip: string } }>( @@ -808,27 +807,27 @@ export class ClientServerService { id: request.params.clip, }); - if (clip && clip.isPublic) { - const _clip = await this.clipEntityService.pack(clip); - const profile = await this.userProfilesRepository.findOneByOrFail({ userId: clip.userId }); - reply.header('Cache-Control', 'public, max-age=15'); - if (profile.preventAiLearning) { - reply.header('X-Robots-Tag', 'noimageai'); - reply.header('X-Robots-Tag', 'noai'); - } - return await reply.view('clip', { - clip: _clip, - profile, - avatarUrl: _clip.user.avatarUrl, - ...await this.generateCommonPugData(this.meta), - clientCtx: htmlSafeJsonStringify({ + if (clip && clip.isPublic) { + const _clip = await this.clipEntityService.pack(clip); + const profile = await this.userProfilesRepository.findOneByOrFail({ userId: clip.userId }); + reply.header('Cache-Control', 'public, max-age=15'); + if (profile.preventAiLearning) { + reply.header('X-Robots-Tag', 'noimageai'); + reply.header('X-Robots-Tag', 'noai'); + } + return await reply.view('clip', { clip: _clip, - }), - }); - } else { - return await renderBase(reply); - } - }); + profile, + avatarUrl: _clip.user.avatarUrl, + ...await this.generateCommonPugData(this.meta), + clientCtx: htmlSafeJsonStringify({ + clip: _clip, + }), + }); + } else { + return await renderBase(reply); + } + }); // Gallery post fastify.get<{ Params: { post: string } }>( @@ -838,24 +837,24 @@ export class ClientServerService { id: request.params.post, }); - if (post) { - const _post = await this.galleryPostEntityService.pack(post); - const profile = await this.userProfilesRepository.findOneByOrFail({ userId: post.userId }); - reply.header('Cache-Control', 'public, max-age=15'); - if (profile.preventAiLearning) { - reply.header('X-Robots-Tag', 'noimageai'); - reply.header('X-Robots-Tag', 'noai'); + if (post) { + const _post = await this.galleryPostEntityService.pack(post); + const profile = await this.userProfilesRepository.findOneByOrFail({ userId: post.userId }); + reply.header('Cache-Control', 'public, max-age=15'); + if (profile.preventAiLearning) { + reply.header('X-Robots-Tag', 'noimageai'); + reply.header('X-Robots-Tag', 'noai'); + } + return await reply.view('gallery-post', { + post: _post, + profile, + avatarUrl: _post.user.avatarUrl, + ...await this.generateCommonPugData(this.meta), + }); + } else { + return await renderBase(reply); } - return await reply.view('gallery-post', { - post: _post, - profile, - avatarUrl: _post.user.avatarUrl, - ...await this.generateCommonPugData(this.meta), - }); - } else { - return await renderBase(reply); - } - }); + }); // Channel fastify.get<{ Params: { channel: string } }>( diff --git a/packages/frontend/src/components/MkLaunchPad.vue b/packages/frontend/src/components/MkLaunchPad.vue index 496ee3a1ca8..00e8b7165ca 100644 --- a/packages/frontend/src/components/MkLaunchPad.vue +++ b/packages/frontend/src/components/MkLaunchPad.vue @@ -123,13 +123,25 @@ function close() { color: white; } - &:hover { - color: var(--MI_THEME-accent); + &::before { + content: ""; + display: block; + height: 100%; + aspect-ratio: 1; + margin: auto; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + border-radius: 16px; + opacity: 0; background: var(--MI_THEME-accentedBg); - text-decoration: none; + transition: opacity 0.2s ease; } > .icon { + opacity: 0.7; font-size: 24px; height: 24px; } @@ -141,6 +153,15 @@ function close() { text-align: center; } + &:hover, &.active, &:focus { + text-decoration: none; + color: var(--MI_THEME-accent); + + &::before { + opacity: 1; + } + } + > .indicatorWithValue { position: absolute; top: 32px; diff --git a/packages/frontend/src/pages/welcome.setup.vue b/packages/frontend/src/pages/welcome.setup.vue index 8c6ebf542fc..cb872352597 100644 --- a/packages/frontend/src/pages/welcome.setup.vue +++ b/packages/frontend/src/pages/welcome.setup.vue @@ -14,10 +14,6 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ i18n.ts.intro }}
- - - - @@ -51,7 +47,6 @@ import MkAnimBg from '@/components/MkAnimBg.vue'; const username = ref(''); const password = ref(''); -const setupPassword = ref(''); const submitting = ref(false); function submit() { @@ -61,7 +56,6 @@ function submit() { misskeyApi('admin/accounts/create', { username: username.value, password: password.value, - setupPassword: setupPassword.value === '' ? null : setupPassword.value, }).then(res => { return login(res.token); }).catch((err) => { diff --git a/packages/frontend/src/ui/_common_/navbar.vue b/packages/frontend/src/ui/_common_/navbar.vue index 01a51e87627..c31a6312774 100644 --- a/packages/frontend/src/ui/_common_/navbar.vue +++ b/packages/frontend/src/ui/_common_/navbar.vue @@ -949,7 +949,6 @@ function more(ev: MouseEvent) { opacity: 0; background: var(--MI_THEME-accentedBg); transition: opacity 0.2s ease; - } &:hover, &.active, &:focus {