1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-05 01:55:36 +02:00

refactor(frontend): anyを除去2 (#17092)

* wip

* fix types

* fix
This commit is contained in:
かっこかり
2026-01-14 14:45:45 +09:00
committed by GitHub
parent d8318c02a1
commit bd81a6c8ad
32 changed files with 164 additions and 93 deletions

View File

@@ -64,6 +64,7 @@ import {
packedMetaDetailedOnlySchema,
packedMetaDetailedSchema,
packedMetaLiteSchema,
packedMetaClientOptionsSchema,
} from '@/models/json-schema/meta.js';
import { packedUserWebhookSchema } from '@/models/json-schema/user-webhook.js';
import { packedSystemWebhookSchema } from '@/models/json-schema/system-webhook.js';
@@ -135,6 +136,7 @@ export const refs = {
MetaLite: packedMetaLiteSchema,
MetaDetailedOnly: packedMetaDetailedOnlySchema,
MetaDetailed: packedMetaDetailedSchema,
MetaClientOptions: packedMetaClientOptionsSchema,
UserWebhook: packedUserWebhookSchema,
SystemWebhook: packedSystemWebhookSchema,
AbuseReportNotificationRecipient: packedAbuseReportNotificationRecipientSchema,

View File

@@ -725,7 +725,11 @@ export class MiMeta {
@Column('jsonb', {
default: { },
})
public clientOptions: Record<string, any>;
public clientOptions: {
entrancePageStyle: 'classic' | 'simple';
showTimelineForVisitor: boolean;
showActivitiesForVisitor: boolean;
};
}
export type SoftwareSuspension = {

View File

@@ -72,8 +72,7 @@ export const packedMetaLiteSchema = {
optional: false, nullable: true,
},
clientOptions: {
type: 'object',
optional: false, nullable: false,
ref: 'MetaClientOptions',
},
disableRegistration: {
type: 'boolean',
@@ -397,3 +396,23 @@ export const packedMetaDetailedSchema = {
},
],
} as const;
export const packedMetaClientOptionsSchema = {
type: 'object',
optional: false, nullable: false,
properties: {
entrancePageStyle: {
type: 'string',
enum: ['classic', 'simple'],
optional: false, nullable: false,
},
showTimelineForVisitor: {
type: 'boolean',
optional: false, nullable: false,
},
showActivitiesForVisitor: {
type: 'boolean',
optional: false, nullable: false,
},
},
} as const;

View File

@@ -428,8 +428,7 @@ export const meta = {
optional: false, nullable: true,
},
clientOptions: {
type: 'object',
optional: false, nullable: false,
ref: 'MetaClientOptions',
},
description: {
type: 'string',

View File

@@ -3,7 +3,8 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { Injectable } from '@nestjs/common';
import { Injectable, Inject } from '@nestjs/common';
import { DI } from '@/di-symbols.js';
import type { MiMeta } from '@/models/Meta.js';
import { ModerationLogService } from '@/core/ModerationLogService.js';
import { Endpoint } from '@/server/api/endpoint-base.js';
@@ -67,7 +68,14 @@ export const paramDef = {
description: { type: 'string', nullable: true },
defaultLightTheme: { type: 'string', nullable: true },
defaultDarkTheme: { type: 'string', nullable: true },
clientOptions: { type: 'object', nullable: false },
clientOptions: {
type: 'object', nullable: false,
properties: {
entrancePageStyle: { type: 'string', nullable: false, enum: ['classic', 'simple'] },
showTimelineForVisitor: { type: 'boolean', nullable: false },
showActivitiesForVisitor: { type: 'boolean', nullable: false },
},
},
cacheRemoteFiles: { type: 'boolean' },
cacheRemoteSensitiveFiles: { type: 'boolean' },
emailRequiredForSignup: { type: 'boolean' },
@@ -217,6 +225,9 @@ export const paramDef = {
@Injectable()
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
constructor(
@Inject(DI.meta)
private serverSettings: MiMeta,
private metaService: MetaService,
private moderationLogService: ModerationLogService,
) {
@@ -329,7 +340,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}
if (ps.clientOptions !== undefined) {
set.clientOptions = ps.clientOptions;
set.clientOptions = {
...serverSettings.clientOptions,
...ps.clientOptions,
};
}
if (ps.cacheRemoteFiles !== undefined) {