Merge branch 'develop' into followed-message
This commit is contained in:
commit
4fa35ab330
|
@ -40,8 +40,6 @@ jobs:
|
||||||
needs: [pnpm_install]
|
needs: [pnpm_install]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
env:
|
|
||||||
eslint-cache-version: v1
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
workspace:
|
workspace:
|
||||||
|
@ -49,6 +47,9 @@ jobs:
|
||||||
- frontend
|
- frontend
|
||||||
- sw
|
- sw
|
||||||
- misskey-js
|
- misskey-js
|
||||||
|
env:
|
||||||
|
eslint-cache-version: v1
|
||||||
|
eslint-cache-path: ${{ github.workspace }}/node_modules/.cache/eslint-${{ matrix.workspace }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.1.1
|
- uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
|
@ -64,11 +65,10 @@ jobs:
|
||||||
- name: Restore eslint cache
|
- name: Restore eslint cache
|
||||||
uses: actions/cache@v4.0.2
|
uses: actions/cache@v4.0.2
|
||||||
with:
|
with:
|
||||||
path: node_modules/.cache/eslint
|
path: ${{ env.eslint-cache-path }}
|
||||||
key: eslint-${{ env.eslint-cache-version }}-${{ hashFiles('/pnpm-lock.yaml') }}-${{ github.ref_name }}-${{ github.sha }}
|
key: eslint-${{ env.eslint-cache-version }}-${{ matrix.workspace }}-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ github.ref_name }}-${{ github.sha }}
|
||||||
restore-keys: |
|
restore-keys: eslint-${{ env.eslint-cache-version }}-${{ matrix.workspace }}-${{ hashFiles('**/pnpm-lock.yaml') }}-
|
||||||
eslint-${{ env.eslint-cache-version }}-${{ hashFiles('/pnpm-lock.yaml') }}-
|
- run: pnpm --filter ${{ matrix.workspace }} run eslint --cache --cache-location ${{ env.eslint-cache-path }} --cache-strategy content
|
||||||
- run: pnpm --filter ${{ matrix.workspace }} run eslint --cache --cache-location node_modules/.cache/eslint --cache-strategy content
|
|
||||||
|
|
||||||
typecheck:
|
typecheck:
|
||||||
needs: [pnpm_install]
|
needs: [pnpm_install]
|
||||||
|
@ -78,6 +78,7 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
workspace:
|
workspace:
|
||||||
- backend
|
- backend
|
||||||
|
- sw
|
||||||
- misskey-js
|
- misskey-js
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.1.1
|
- uses: actions/checkout@v4.1.1
|
||||||
|
@ -92,7 +93,7 @@ jobs:
|
||||||
- run: corepack enable
|
- run: corepack enable
|
||||||
- run: pnpm i --frozen-lockfile
|
- run: pnpm i --frozen-lockfile
|
||||||
- run: pnpm --filter misskey-js run build
|
- run: pnpm --filter misskey-js run build
|
||||||
if: ${{ matrix.workspace == 'backend' }}
|
if: ${{ matrix.workspace == 'backend' || matrix.workspace == 'sw' }}
|
||||||
- run: pnpm --filter misskey-reversi run build
|
- run: pnpm --filter misskey-reversi run build
|
||||||
if: ${{ matrix.workspace == 'backend' }}
|
if: ${{ matrix.workspace == 'backend' }}
|
||||||
- run: pnpm --filter ${{ matrix.workspace }} run typecheck
|
- run: pnpm --filter ${{ matrix.workspace }} run typecheck
|
||||||
|
|
|
@ -44,6 +44,7 @@ compose.yml
|
||||||
/build
|
/build
|
||||||
built
|
built
|
||||||
built-test
|
built-test
|
||||||
|
js-built
|
||||||
/data
|
/data
|
||||||
/.cache-loader
|
/.cache-loader
|
||||||
/db
|
/db
|
||||||
|
|
|
@ -4,10 +4,12 @@
|
||||||
- Feat: フォローされた際のメッセージを設定できるように
|
- Feat: フォローされた際のメッセージを設定できるように
|
||||||
|
|
||||||
### Client
|
### Client
|
||||||
-
|
- サイズ制限を超過するファイルをアップロードしようとした際にエラーを出すように
|
||||||
|
- Enhance: アイコンデコレーション管理画面にプレビューを追加
|
||||||
|
- Fix: サーバーメトリクスが2つ以上あるとリロード直後の表示がおかしくなる問題を修正
|
||||||
|
|
||||||
### Server
|
### Server
|
||||||
-
|
- ファイルがサイズの制限を超えてアップロードされた際にエラーを返さなかった問題を修正
|
||||||
|
|
||||||
|
|
||||||
## 2024.8.0
|
## 2024.8.0
|
||||||
|
|
|
@ -5068,6 +5068,10 @@ export interface Locale extends ILocale {
|
||||||
* 作成したアンテナ
|
* 作成したアンテナ
|
||||||
*/
|
*/
|
||||||
"createdAntennas": string;
|
"createdAntennas": string;
|
||||||
|
/**
|
||||||
|
* これ以上このクリップにノートを追加できません。
|
||||||
|
*/
|
||||||
|
"clipNoteLimitExceeded": string;
|
||||||
"_delivery": {
|
"_delivery": {
|
||||||
/**
|
/**
|
||||||
* 配信状態
|
* 配信状態
|
||||||
|
|
|
@ -1263,6 +1263,7 @@ confirmWhenRevealingSensitiveMedia: "センシティブなメディアを表示
|
||||||
sensitiveMediaRevealConfirm: "センシティブなメディアです。表示しますか?"
|
sensitiveMediaRevealConfirm: "センシティブなメディアです。表示しますか?"
|
||||||
createdLists: "作成したリスト"
|
createdLists: "作成したリスト"
|
||||||
createdAntennas: "作成したアンテナ"
|
createdAntennas: "作成したアンテナ"
|
||||||
|
clipNoteLimitExceeded: "これ以上このクリップにノートを追加できません。"
|
||||||
|
|
||||||
_delivery:
|
_delivery:
|
||||||
status: "配信状態"
|
status: "配信状態"
|
||||||
|
|
|
@ -133,7 +133,7 @@ export type Config = {
|
||||||
proxySmtp: string | undefined;
|
proxySmtp: string | undefined;
|
||||||
proxyBypassHosts: string[] | undefined;
|
proxyBypassHosts: string[] | undefined;
|
||||||
allowedPrivateNetworks: string[] | undefined;
|
allowedPrivateNetworks: string[] | undefined;
|
||||||
maxFileSize: number | undefined;
|
maxFileSize: number;
|
||||||
clusterLimit: number | undefined;
|
clusterLimit: number | undefined;
|
||||||
id: string;
|
id: string;
|
||||||
outgoingAddress: string | undefined;
|
outgoingAddress: string | undefined;
|
||||||
|
@ -250,7 +250,7 @@ export function loadConfig(): Config {
|
||||||
proxySmtp: config.proxySmtp,
|
proxySmtp: config.proxySmtp,
|
||||||
proxyBypassHosts: config.proxyBypassHosts,
|
proxyBypassHosts: config.proxyBypassHosts,
|
||||||
allowedPrivateNetworks: config.allowedPrivateNetworks,
|
allowedPrivateNetworks: config.allowedPrivateNetworks,
|
||||||
maxFileSize: config.maxFileSize,
|
maxFileSize: config.maxFileSize ?? 262144000,
|
||||||
clusterLimit: config.clusterLimit,
|
clusterLimit: config.clusterLimit,
|
||||||
outgoingAddress: config.outgoingAddress,
|
outgoingAddress: config.outgoingAddress,
|
||||||
outgoingAddressFamily: config.outgoingAddressFamily,
|
outgoingAddressFamily: config.outgoingAddressFamily,
|
||||||
|
|
|
@ -42,7 +42,7 @@ export class DownloadService {
|
||||||
|
|
||||||
const timeout = 30 * 1000;
|
const timeout = 30 * 1000;
|
||||||
const operationTimeout = 60 * 1000;
|
const operationTimeout = 60 * 1000;
|
||||||
const maxSize = this.config.maxFileSize ?? 262144000;
|
const maxSize = this.config.maxFileSize;
|
||||||
|
|
||||||
const urlObj = new URL(url);
|
const urlObj = new URL(url);
|
||||||
let filename = urlObj.pathname.split('/').pop() ?? 'untitled';
|
let filename = urlObj.pathname.split('/').pop() ?? 'untitled';
|
||||||
|
|
|
@ -65,21 +65,21 @@ export default class FederationChart extends Chart<typeof schema> { // eslint-di
|
||||||
this.followingsRepository.createQueryBuilder('following')
|
this.followingsRepository.createQueryBuilder('following')
|
||||||
.select('COUNT(DISTINCT following.followeeHost)')
|
.select('COUNT(DISTINCT following.followeeHost)')
|
||||||
.where('following.followeeHost IS NOT NULL')
|
.where('following.followeeHost IS NOT NULL')
|
||||||
.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'following.followeeHost NOT ILIKE ANY(ARRAY[:...blocked])', { blocked: meta.blockedHosts.flatMap(x => [x, `%.${x}`]) })
|
.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'following.followeeHost NOT ILIKE ALL(ARRAY[:...blocked])', { blocked: meta.blockedHosts.flatMap(x => [x, `%.${x}`]) })
|
||||||
.andWhere(`following.followeeHost NOT IN (${ suspendedInstancesQuery.getQuery() })`)
|
.andWhere(`following.followeeHost NOT IN (${ suspendedInstancesQuery.getQuery() })`)
|
||||||
.getRawOne()
|
.getRawOne()
|
||||||
.then(x => parseInt(x.count, 10)),
|
.then(x => parseInt(x.count, 10)),
|
||||||
this.followingsRepository.createQueryBuilder('following')
|
this.followingsRepository.createQueryBuilder('following')
|
||||||
.select('COUNT(DISTINCT following.followerHost)')
|
.select('COUNT(DISTINCT following.followerHost)')
|
||||||
.where('following.followerHost IS NOT NULL')
|
.where('following.followerHost IS NOT NULL')
|
||||||
.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'following.followerHost NOT ILIKE ANY(ARRAY[:...blocked])', { blocked: meta.blockedHosts.flatMap(x => [x, `%.${x}`]) })
|
.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'following.followerHost NOT ILIKE ALL(ARRAY[:...blocked])', { blocked: meta.blockedHosts.flatMap(x => [x, `%.${x}`]) })
|
||||||
.andWhere(`following.followerHost NOT IN (${ suspendedInstancesQuery.getQuery() })`)
|
.andWhere(`following.followerHost NOT IN (${ suspendedInstancesQuery.getQuery() })`)
|
||||||
.getRawOne()
|
.getRawOne()
|
||||||
.then(x => parseInt(x.count, 10)),
|
.then(x => parseInt(x.count, 10)),
|
||||||
this.followingsRepository.createQueryBuilder('following')
|
this.followingsRepository.createQueryBuilder('following')
|
||||||
.select('COUNT(DISTINCT following.followeeHost)')
|
.select('COUNT(DISTINCT following.followeeHost)')
|
||||||
.where('following.followeeHost IS NOT NULL')
|
.where('following.followeeHost IS NOT NULL')
|
||||||
.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'following.followeeHost NOT ILIKE ANY(ARRAY[:...blocked])', { blocked: meta.blockedHosts.flatMap(x => [x, `%.${x}`]) })
|
.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'following.followeeHost NOT ILIKE ALL(ARRAY[:...blocked])', { blocked: meta.blockedHosts.flatMap(x => [x, `%.${x}`]) })
|
||||||
.andWhere(`following.followeeHost NOT IN (${ suspendedInstancesQuery.getQuery() })`)
|
.andWhere(`following.followeeHost NOT IN (${ suspendedInstancesQuery.getQuery() })`)
|
||||||
.andWhere(`following.followeeHost IN (${ pubsubSubQuery.getQuery() })`)
|
.andWhere(`following.followeeHost IN (${ pubsubSubQuery.getQuery() })`)
|
||||||
.setParameters(pubsubSubQuery.getParameters())
|
.setParameters(pubsubSubQuery.getParameters())
|
||||||
|
@ -88,7 +88,7 @@ export default class FederationChart extends Chart<typeof schema> { // eslint-di
|
||||||
this.instancesRepository.createQueryBuilder('instance')
|
this.instancesRepository.createQueryBuilder('instance')
|
||||||
.select('COUNT(instance.id)')
|
.select('COUNT(instance.id)')
|
||||||
.where(`instance.host IN (${ subInstancesQuery.getQuery() })`)
|
.where(`instance.host IN (${ subInstancesQuery.getQuery() })`)
|
||||||
.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'instance.host NOT ILIKE ANY(ARRAY[:...blocked])', { blocked: meta.blockedHosts.flatMap(x => [x, `%.${x}`]) })
|
.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'instance.host NOT ILIKE ALL(ARRAY[:...blocked])', { blocked: meta.blockedHosts.flatMap(x => [x, `%.${x}`]) })
|
||||||
.andWhere('instance.suspensionState = \'none\'')
|
.andWhere('instance.suspensionState = \'none\'')
|
||||||
.andWhere('instance.isNotResponding = false')
|
.andWhere('instance.isNotResponding = false')
|
||||||
.getRawOne()
|
.getRawOne()
|
||||||
|
@ -96,7 +96,7 @@ export default class FederationChart extends Chart<typeof schema> { // eslint-di
|
||||||
this.instancesRepository.createQueryBuilder('instance')
|
this.instancesRepository.createQueryBuilder('instance')
|
||||||
.select('COUNT(instance.id)')
|
.select('COUNT(instance.id)')
|
||||||
.where(`instance.host IN (${ pubInstancesQuery.getQuery() })`)
|
.where(`instance.host IN (${ pubInstancesQuery.getQuery() })`)
|
||||||
.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'instance.host NOT ILIKE ANY(ARRAY[:...blocked])', { blocked: meta.blockedHosts.flatMap(x => [x, `%.${x}`]) })
|
.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'instance.host NOT ILIKE ALL(ARRAY[:...blocked])', { blocked: meta.blockedHosts.flatMap(x => [x, `%.${x}`]) })
|
||||||
.andWhere('instance.suspensionState = \'none\'')
|
.andWhere('instance.suspensionState = \'none\'')
|
||||||
.andWhere('instance.isNotResponding = false')
|
.andWhere('instance.isNotResponding = false')
|
||||||
.getRawOne()
|
.getRawOne()
|
||||||
|
|
|
@ -129,6 +129,7 @@ export class MetaEntityService {
|
||||||
mediaProxy: this.config.mediaProxy,
|
mediaProxy: this.config.mediaProxy,
|
||||||
enableUrlPreview: instance.urlPreviewEnabled,
|
enableUrlPreview: instance.urlPreviewEnabled,
|
||||||
noteSearchableScope: (this.config.meilisearch == null || this.config.meilisearch.scope !== 'local') ? 'global' : 'local',
|
noteSearchableScope: (this.config.meilisearch == null || this.config.meilisearch.scope !== 'local') ? 'global' : 'local',
|
||||||
|
maxFileSize: this.config.maxFileSize,
|
||||||
};
|
};
|
||||||
|
|
||||||
return packed;
|
return packed;
|
||||||
|
|
|
@ -144,7 +144,9 @@ export interface Schema extends OfSchema {
|
||||||
readonly type?: TypeStringef;
|
readonly type?: TypeStringef;
|
||||||
readonly nullable?: boolean;
|
readonly nullable?: boolean;
|
||||||
readonly optional?: boolean;
|
readonly optional?: boolean;
|
||||||
|
readonly prefixItems?: ReadonlyArray<Schema>;
|
||||||
readonly items?: Schema;
|
readonly items?: Schema;
|
||||||
|
readonly unevaluatedItems?: Schema | boolean;
|
||||||
readonly properties?: Obj;
|
readonly properties?: Obj;
|
||||||
readonly required?: ReadonlyArray<Extract<keyof NonNullable<this['properties']>, string>>;
|
readonly required?: ReadonlyArray<Extract<keyof NonNullable<this['properties']>, string>>;
|
||||||
readonly description?: string;
|
readonly description?: string;
|
||||||
|
@ -198,6 +200,7 @@ type UnionSchemaType<a extends readonly any[], X extends Schema = a[number]> = X
|
||||||
//type UnionObjectSchemaType<a extends readonly any[], X extends Schema = a[number]> = X extends any ? ObjectSchemaType<X> : never;
|
//type UnionObjectSchemaType<a extends readonly any[], X extends Schema = a[number]> = X extends any ? ObjectSchemaType<X> : never;
|
||||||
type UnionObjType<s extends Obj, a extends readonly any[], X extends ReadonlyArray<keyof s> = a[number]> = X extends any ? ObjType<s, X> : never;
|
type UnionObjType<s extends Obj, a extends readonly any[], X extends ReadonlyArray<keyof s> = a[number]> = X extends any ? ObjType<s, X> : never;
|
||||||
type ArrayUnion<T> = T extends any ? Array<T> : never;
|
type ArrayUnion<T> = T extends any ? Array<T> : never;
|
||||||
|
type ArrayToTuple<X extends ReadonlyArray<Schema>> = { [K in keyof X]: SchemaType<X[K]> };
|
||||||
|
|
||||||
type ObjectSchemaTypeDef<p extends Schema> =
|
type ObjectSchemaTypeDef<p extends Schema> =
|
||||||
p['ref'] extends keyof typeof refs ? Packed<p['ref']> :
|
p['ref'] extends keyof typeof refs ? Packed<p['ref']> :
|
||||||
|
@ -232,6 +235,12 @@ export type SchemaTypeDef<p extends Schema> =
|
||||||
p['items']['allOf'] extends ReadonlyArray<Schema> ? UnionToIntersection<UnionSchemaType<NonNullable<p['items']['allOf']>>>[] :
|
p['items']['allOf'] extends ReadonlyArray<Schema> ? UnionToIntersection<UnionSchemaType<NonNullable<p['items']['allOf']>>>[] :
|
||||||
never
|
never
|
||||||
) :
|
) :
|
||||||
|
p['prefixItems'] extends ReadonlyArray<Schema> ? (
|
||||||
|
p['items'] extends NonNullable<Schema> ? [...ArrayToTuple<p['prefixItems']>, ...SchemaType<p['items']>[]] :
|
||||||
|
p['items'] extends false ? ArrayToTuple<p['prefixItems']> :
|
||||||
|
p['unevaluatedItems'] extends false ? ArrayToTuple<p['prefixItems']> :
|
||||||
|
[...ArrayToTuple<p['prefixItems']>, ...unknown[]]
|
||||||
|
) :
|
||||||
p['items'] extends NonNullable<Schema> ? SchemaType<p['items']>[] :
|
p['items'] extends NonNullable<Schema> ? SchemaType<p['items']>[] :
|
||||||
any[]
|
any[]
|
||||||
) :
|
) :
|
||||||
|
|
|
@ -86,7 +86,7 @@ export type MiNotification = {
|
||||||
/**
|
/**
|
||||||
* アプリ通知のbody
|
* アプリ通知のbody
|
||||||
*/
|
*/
|
||||||
customBody: string | null;
|
customBody: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* アプリ通知のheader
|
* アプリ通知のheader
|
||||||
|
|
|
@ -253,6 +253,10 @@ export const packedMetaLiteSchema = {
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
default: 'local',
|
default: 'local',
|
||||||
},
|
},
|
||||||
|
maxFileSize: {
|
||||||
|
type: 'number',
|
||||||
|
optional: false, nullable: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { ACHIEVEMENT_TYPES } from '@/core/AchievementService.js';
|
||||||
import { notificationTypes } from '@/types.js';
|
import { notificationTypes } from '@/types.js';
|
||||||
|
|
||||||
const baseSchema = {
|
const baseSchema = {
|
||||||
|
@ -298,6 +299,7 @@ export const packedNotificationSchema = {
|
||||||
achievement: {
|
achievement: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
|
enum: ACHIEVEMENT_TYPES,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
|
@ -315,11 +317,11 @@ export const packedNotificationSchema = {
|
||||||
},
|
},
|
||||||
header: {
|
header: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: true,
|
||||||
},
|
},
|
||||||
icon: {
|
icon: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
|
|
|
@ -199,9 +199,18 @@ export class ApiCallService implements OnApplicationShutdown {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const [path] = await createTemp();
|
const [path, cleanup] = await createTemp();
|
||||||
await stream.pipeline(multipartData.file, fs.createWriteStream(path));
|
await stream.pipeline(multipartData.file, fs.createWriteStream(path));
|
||||||
|
|
||||||
|
// ファイルサイズが制限を超えていた場合
|
||||||
|
// なお truncated はストリームを読み切ってからでないと機能しないため、stream.pipeline より後にある必要がある
|
||||||
|
if (multipartData.file.truncated) {
|
||||||
|
cleanup();
|
||||||
|
reply.code(413);
|
||||||
|
reply.send();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const fields = {} as Record<string, unknown>;
|
const fields = {} as Record<string, unknown>;
|
||||||
for (const [k, v] of Object.entries(multipartData.fields)) {
|
for (const [k, v] of Object.entries(multipartData.fields)) {
|
||||||
fields[k] = typeof v === 'object' && 'value' in v ? v.value : undefined;
|
fields[k] = typeof v === 'object' && 'value' in v ? v.value : undefined;
|
||||||
|
|
|
@ -49,7 +49,7 @@ export class ApiServerService {
|
||||||
|
|
||||||
fastify.register(multipart, {
|
fastify.register(multipart, {
|
||||||
limits: {
|
limits: {
|
||||||
fileSize: this.config.maxFileSize ?? 262144000,
|
fileSize: this.config.maxFileSize,
|
||||||
files: 1,
|
files: 1,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -21,16 +21,15 @@ export const meta = {
|
||||||
items: {
|
items: {
|
||||||
type: 'array',
|
type: 'array',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
items: {
|
prefixItems: [
|
||||||
anyOf: [
|
{
|
||||||
{
|
type: 'string',
|
||||||
type: 'string',
|
},
|
||||||
},
|
{
|
||||||
{
|
type: 'number',
|
||||||
type: 'number',
|
},
|
||||||
},
|
],
|
||||||
],
|
unevaluatedItems: false,
|
||||||
},
|
|
||||||
},
|
},
|
||||||
example: [[
|
example: [[
|
||||||
'example.com',
|
'example.com',
|
||||||
|
|
|
@ -21,16 +21,15 @@ export const meta = {
|
||||||
items: {
|
items: {
|
||||||
type: 'array',
|
type: 'array',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
items: {
|
prefixItems: [
|
||||||
anyOf: [
|
{
|
||||||
{
|
type: 'string',
|
||||||
type: 'string',
|
},
|
||||||
},
|
{
|
||||||
{
|
type: 'number',
|
||||||
type: 'number',
|
},
|
||||||
},
|
],
|
||||||
],
|
unevaluatedItems: false,
|
||||||
},
|
|
||||||
},
|
},
|
||||||
example: [[
|
example: [[
|
||||||
'example.com',
|
'example.com',
|
||||||
|
|
|
@ -166,7 +166,7 @@
|
||||||
|
|
||||||
if (!errorsElement) {
|
if (!errorsElement) {
|
||||||
document.body.innerHTML = `
|
document.body.innerHTML = `
|
||||||
<svg class="icon-warning" xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-alert-triangle" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
<svg class="icon-warning" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||||
<path d="M12 9v2m0 4v.01"></path>
|
<path d="M12 9v2m0 4v.01"></path>
|
||||||
<path d="M5 19h14a2 2 0 0 0 1.84 -2.75l-7.1 -12.25a2 2 0 0 0 -3.5 0l-7.1 12.25a2 2 0 0 0 1.75 2.75"></path>
|
<path d="M5 19h14a2 2 0 0 0 1.84 -2.75l-7.1 -12.25a2 2 0 0 0 -3.5 0l-7.1 12.25a2 2 0 0 0 1.75 2.75"></path>
|
||||||
|
@ -176,10 +176,10 @@
|
||||||
<span class="button-label-big">Reload / リロード</span>
|
<span class="button-label-big">Reload / リロード</span>
|
||||||
</button>
|
</button>
|
||||||
<p><b>The following actions may solve the problem. / 以下を行うと解決する可能性があります。</b></p>
|
<p><b>The following actions may solve the problem. / 以下を行うと解決する可能性があります。</b></p>
|
||||||
<p>Clear the browser cache / ブラウザのキャッシュをクリアする</p>
|
|
||||||
<p>Update your os and browser / ブラウザおよびOSを最新バージョンに更新する</p>
|
<p>Update your os and browser / ブラウザおよびOSを最新バージョンに更新する</p>
|
||||||
<p>Disable an adblocker / アドブロッカーを無効にする</p>
|
<p>Disable an adblocker / アドブロッカーを無効にする</p>
|
||||||
<p>(Tor Browser) Set dom.webaudio.enabled to true / dom.webaudio.enabledをtrueに設定する</p>
|
<p>Clear the browser cache / ブラウザのキャッシュをクリアする</p>
|
||||||
|
<p>(Tor Browser) Set dom.webaudio.enabled to true / dom.webaudio.enabledをtrueに設定する</p>
|
||||||
<details style="color: #86b300;">
|
<details style="color: #86b300;">
|
||||||
<summary>Other options / その他のオプション</summary>
|
<summary>Other options / その他のオプション</summary>
|
||||||
<a href="/flush">
|
<a href="/flush">
|
||||||
|
@ -212,7 +212,7 @@
|
||||||
<summary>
|
<summary>
|
||||||
<code>ERROR CODE: ${code}</code>
|
<code>ERROR CODE: ${code}</code>
|
||||||
</summary>
|
</summary>
|
||||||
<code>${JSON.stringify(details)}</code>`;
|
<code>${details.toString()} ${JSON.stringify(details)}</code>`;
|
||||||
errorsElement.appendChild(detailsElement);
|
errorsElement.appendChild(detailsElement);
|
||||||
addStyle(`
|
addStyle(`
|
||||||
* {
|
* {
|
||||||
|
@ -320,6 +320,6 @@
|
||||||
#errorInfo {
|
#errorInfo {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
}
|
}
|
||||||
}`)
|
}`);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -36,8 +36,6 @@ html
|
||||||
link(rel='prefetch' href=serverErrorImageUrl)
|
link(rel='prefetch' href=serverErrorImageUrl)
|
||||||
link(rel='prefetch' href=infoImageUrl)
|
link(rel='prefetch' href=infoImageUrl)
|
||||||
link(rel='prefetch' href=notFoundImageUrl)
|
link(rel='prefetch' href=notFoundImageUrl)
|
||||||
//- https://github.com/misskey-dev/misskey/issues/9842
|
|
||||||
link(rel='stylesheet' href='/assets/tabler-icons/tabler-icons.min.css?v3.3.0')
|
|
||||||
link(rel='modulepreload' href=`/vite/${clientEntry.file}`)
|
link(rel='modulepreload' href=`/vite/${clientEntry.file}`)
|
||||||
|
|
||||||
if !config.clientManifestExists
|
if !config.clientManifestExists
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
// https://vitejs.dev/config/build-options.html#build-modulepreload
|
// https://vitejs.dev/config/build-options.html#build-modulepreload
|
||||||
import 'vite/modulepreload-polyfill';
|
import 'vite/modulepreload-polyfill';
|
||||||
|
|
||||||
|
import '@tabler/icons-webfont/dist/tabler-icons.scss';
|
||||||
|
|
||||||
import '@/style.scss';
|
import '@/style.scss';
|
||||||
import { mainBoot } from '@/boot/main-boot.js';
|
import { mainBoot } from '@/boot/main-boot.js';
|
||||||
import { subBoot } from '@/boot/sub-boot.js';
|
import { subBoot } from '@/boot/sub-boot.js';
|
||||||
|
|
|
@ -3,11 +3,6 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// devモードで起動される際(index.htmlを使うとき)はrouterが暴発してしまってうまく読み込めない。
|
|
||||||
// よって、devモードとして起動されるときはビルド時に組み込む形としておく。
|
|
||||||
// (pnpm start時はpugファイルの中で静的リソースとして読み込むようになっており、この問題は起こっていない)
|
|
||||||
import '@tabler/icons-webfont/dist/tabler-icons.scss';
|
|
||||||
|
|
||||||
await main();
|
await main();
|
||||||
|
|
||||||
import('@/_boot_.js');
|
import('@/_boot_.js');
|
||||||
|
|
|
@ -171,11 +171,11 @@ function onMousedown(evt: MouseEvent): void {
|
||||||
background: var(--accent);
|
background: var(--accent);
|
||||||
|
|
||||||
&:not(:disabled):hover {
|
&:not(:disabled):hover {
|
||||||
background: var(--X8);
|
background: hsl(from var(--accent) h s calc(l + 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
&:not(:disabled):active {
|
&:not(:disabled):active {
|
||||||
background: var(--X8);
|
background: hsl(from var(--accent) h s calc(l + 5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,11 +220,11 @@ function onMousedown(evt: MouseEvent): void {
|
||||||
background: linear-gradient(90deg, var(--buttonGradateA), var(--buttonGradateB));
|
background: linear-gradient(90deg, var(--buttonGradateA), var(--buttonGradateB));
|
||||||
|
|
||||||
&:not(:disabled):hover {
|
&:not(:disabled):hover {
|
||||||
background: linear-gradient(90deg, var(--X8), var(--X8));
|
background: linear-gradient(90deg, hsl(from var(--accent) h s calc(l + 5)), hsl(from var(--accent) h s calc(l + 5)));
|
||||||
}
|
}
|
||||||
|
|
||||||
&:not(:disabled):active {
|
&:not(:disabled):active {
|
||||||
background: linear-gradient(90deg, var(--X8), var(--X8));
|
background: linear-gradient(90deg, hsl(from var(--accent) h s calc(l + 5)), hsl(from var(--accent) h s calc(l + 5)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ const bannerStyle = computed(() => {
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 64px;
|
height: 64px;
|
||||||
background: linear-gradient(0deg, var(--panel), var(--X15));
|
background: linear-gradient(0deg, var(--panel), color(from var(--panel) srgb r g b / 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
> .name {
|
> .name {
|
||||||
|
|
|
@ -13,29 +13,8 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts">
|
||||||
/* eslint-disable id-denylist --
|
export type ChartSrc =
|
||||||
Chart.js has a `data` attribute in most chart definitions, which triggers the
|
|
||||||
id-denylist violation when setting it. This is causing about 60+ lint issues.
|
|
||||||
As this is part of Chart.js's API it makes sense to disable the check here.
|
|
||||||
*/
|
|
||||||
import { onMounted, ref, shallowRef, watch } from 'vue';
|
|
||||||
import { Chart } from 'chart.js';
|
|
||||||
import * as Misskey from 'misskey-js';
|
|
||||||
import { misskeyApiGet } from '@/scripts/misskey-api.js';
|
|
||||||
import { defaultStore } from '@/store.js';
|
|
||||||
import { useChartTooltip } from '@/scripts/use-chart-tooltip.js';
|
|
||||||
import { chartVLine } from '@/scripts/chart-vline.js';
|
|
||||||
import { alpha } from '@/scripts/color.js';
|
|
||||||
import date from '@/filters/date.js';
|
|
||||||
import bytes from '@/filters/bytes.js';
|
|
||||||
import { initChart } from '@/scripts/init-chart.js';
|
|
||||||
import { chartLegend } from '@/scripts/chart-legend.js';
|
|
||||||
import MkChartLegend from '@/components/MkChartLegend.vue';
|
|
||||||
|
|
||||||
initChart();
|
|
||||||
|
|
||||||
type ChartSrc =
|
|
||||||
| 'federation'
|
| 'federation'
|
||||||
| 'ap-request'
|
| 'ap-request'
|
||||||
| 'users'
|
| 'users'
|
||||||
|
@ -62,7 +41,30 @@ type ChartSrc =
|
||||||
| 'per-user-pv'
|
| 'per-user-pv'
|
||||||
| 'per-user-following'
|
| 'per-user-following'
|
||||||
| 'per-user-followers'
|
| 'per-user-followers'
|
||||||
| 'per-user-drive'
|
| 'per-user-drive';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
/* eslint-disable id-denylist --
|
||||||
|
Chart.js has a `data` attribute in most chart definitions, which triggers the
|
||||||
|
id-denylist violation when setting it. This is causing about 60+ lint issues.
|
||||||
|
As this is part of Chart.js's API it makes sense to disable the check here.
|
||||||
|
*/
|
||||||
|
import { onMounted, ref, shallowRef, watch } from 'vue';
|
||||||
|
import { Chart } from 'chart.js';
|
||||||
|
import * as Misskey from 'misskey-js';
|
||||||
|
import { misskeyApiGet } from '@/scripts/misskey-api.js';
|
||||||
|
import { defaultStore } from '@/store.js';
|
||||||
|
import { useChartTooltip } from '@/scripts/use-chart-tooltip.js';
|
||||||
|
import { chartVLine } from '@/scripts/chart-vline.js';
|
||||||
|
import { alpha } from '@/scripts/color.js';
|
||||||
|
import date from '@/filters/date.js';
|
||||||
|
import bytes from '@/filters/bytes.js';
|
||||||
|
import { initChart } from '@/scripts/init-chart.js';
|
||||||
|
import { chartLegend } from '@/scripts/chart-legend.js';
|
||||||
|
import MkChartLegend from '@/components/MkChartLegend.vue';
|
||||||
|
|
||||||
|
initChart();
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
src: ChartSrc;
|
src: ChartSrc;
|
||||||
|
|
|
@ -216,7 +216,7 @@ onUnmounted(() => {
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 64px;
|
height: 64px;
|
||||||
background: linear-gradient(0deg, var(--panel), var(--X15));
|
background: linear-gradient(0deg, var(--panel), color(from var(--panel) srgb r g b / 0));
|
||||||
|
|
||||||
> .fadeLabel {
|
> .fadeLabel {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
|
@ -94,12 +94,12 @@ defineExpose({
|
||||||
|
|
||||||
--root-margin: 24px;
|
--root-margin: 24px;
|
||||||
|
|
||||||
|
--headerHeight: 46px;
|
||||||
|
--headerHeightNarrow: 42px;
|
||||||
|
|
||||||
@media (max-width: 500px) {
|
@media (max-width: 500px) {
|
||||||
--root-margin: 16px;
|
--root-margin: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
--headerHeight: 46px;
|
|
||||||
--headerHeightNarrow: 42px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
|
|
|
@ -859,7 +859,7 @@ function emitUpdReaction(emoji: string, delta: number) {
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 64px;
|
height: 64px;
|
||||||
background: linear-gradient(0deg, var(--panel), var(--X15));
|
background: linear-gradient(0deg, var(--panel), color(from var(--panel) srgb r g b / 0));
|
||||||
|
|
||||||
&:hover > .collapsedLabel {
|
&:hover > .collapsedLabel {
|
||||||
background: var(--panelHighlight);
|
background: var(--panelHighlight);
|
||||||
|
|
|
@ -62,7 +62,7 @@ onUnmounted(() => {
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 64px;
|
height: 64px;
|
||||||
background: linear-gradient(0deg, var(--panel), var(--X15));
|
background: linear-gradient(0deg, var(--panel), color(from var(--panel) srgb r g b / 0));
|
||||||
|
|
||||||
> .fadeLabel {
|
> .fadeLabel {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
|
@ -245,7 +245,7 @@ const submitText = computed((): string => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const textLength = computed((): number => {
|
const textLength = computed((): number => {
|
||||||
return (text.value + imeText.value).trim().length;
|
return (text.value + imeText.value).length;
|
||||||
});
|
});
|
||||||
|
|
||||||
const maxTextLength = computed((): number => {
|
const maxTextLength = computed((): number => {
|
||||||
|
@ -1128,13 +1128,13 @@ defineExpose({
|
||||||
|
|
||||||
&:not(:disabled):hover {
|
&:not(:disabled):hover {
|
||||||
> .inner {
|
> .inner {
|
||||||
background: linear-gradient(90deg, var(--X8), var(--X8));
|
background: linear-gradient(90deg, hsl(from var(--accent) h s calc(l + 5)), hsl(from var(--accent) h s calc(l + 5)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&:not(:disabled):active {
|
&:not(:disabled):active {
|
||||||
> .inner {
|
> .inner {
|
||||||
background: linear-gradient(90deg, var(--X8), var(--X8));
|
background: linear-gradient(90deg, hsl(from var(--accent) h s calc(l + 5)), hsl(from var(--accent) h s calc(l + 5)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ const collapsed = ref(isLong);
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 64px;
|
height: 64px;
|
||||||
background: linear-gradient(0deg, var(--panel), var(--X15));
|
background: linear-gradient(0deg, var(--panel), color(from var(--panel) srgb r g b / 0));
|
||||||
|
|
||||||
> .fadeLabel {
|
> .fadeLabel {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
|
@ -100,14 +100,14 @@ defineProps<{
|
||||||
|
|
||||||
&.grid {
|
&.grid {
|
||||||
> .group {
|
> .group {
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 0;
|
||||||
|
|
||||||
& + .group {
|
& + .group {
|
||||||
padding-top: 0;
|
padding-top: 0;
|
||||||
border-top: none;
|
border-top: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
margin-left: 0;
|
|
||||||
margin-right: 0;
|
|
||||||
|
|
||||||
> .title {
|
> .title {
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
|
|
|
@ -508,10 +508,6 @@ defineExpose({
|
||||||
.header {
|
.header {
|
||||||
--height: 39px;
|
--height: 39px;
|
||||||
|
|
||||||
&.mini {
|
|
||||||
--height: 32px;
|
|
||||||
}
|
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
@ -524,6 +520,10 @@ defineExpose({
|
||||||
//border-bottom: solid 1px var(--divider);
|
//border-bottom: solid 1px var(--divider);
|
||||||
font-size: 90%;
|
font-size: 90%;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|
||||||
|
&.mini {
|
||||||
|
--height: 32px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.headerButton {
|
.headerButton {
|
||||||
|
|
|
@ -26,7 +26,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<template v-if="showDecoration">
|
<template v-if="showDecoration">
|
||||||
<img
|
<img
|
||||||
v-for="decoration in decorations ?? user.avatarDecorations"
|
v-for="decoration in decorations ?? user.avatarDecorations"
|
||||||
:class="[$style.decoration]"
|
:class="[$style.decoration, { [$style.decorationBlink]: decoration.blink }]"
|
||||||
:src="getDecorationUrl(decoration)"
|
:src="getDecorationUrl(decoration)"
|
||||||
:style="{
|
:style="{
|
||||||
rotate: getDecorationAngle(decoration),
|
rotate: getDecorationAngle(decoration),
|
||||||
|
@ -60,7 +60,7 @@ const props = withDefaults(defineProps<{
|
||||||
link?: boolean;
|
link?: boolean;
|
||||||
preview?: boolean;
|
preview?: boolean;
|
||||||
indicator?: boolean;
|
indicator?: boolean;
|
||||||
decorations?: Omit<Misskey.entities.UserDetailed['avatarDecorations'][number], 'id'>[];
|
decorations?: (Omit<Misskey.entities.UserDetailed['avatarDecorations'][number], 'id'> & { blink?: boolean; })[];
|
||||||
forceShowDecoration?: boolean;
|
forceShowDecoration?: boolean;
|
||||||
}>(), {
|
}>(), {
|
||||||
target: null,
|
target: null,
|
||||||
|
@ -330,4 +330,17 @@ watch(() => props.user.avatarBlurhash, () => {
|
||||||
width: 200%;
|
width: 200%;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.decorationBlink {
|
||||||
|
animation: blink 1s infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes blink {
|
||||||
|
0%, 100% {
|
||||||
|
filter: brightness(2);
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
filter: brightness(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -9,7 +9,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<MkSpacer :contentMax="900">
|
<MkSpacer :contentMax="900">
|
||||||
<div :class="$style.root" class="_gaps">
|
<div :class="$style.root" class="_gaps">
|
||||||
<div :class="$style.subMenus" class="_gaps">
|
<div :class="$style.subMenus" class="_gaps">
|
||||||
<MkButton link to="/admin/abuse-report-notification-recipient" primary>{{ "通知設定" }}</MkButton>
|
<MkButton link to="/admin/abuse-report-notification-recipient" primary>{{ i18n.ts.notificationSetting }}</MkButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div :class="$style.inputs" class="_gaps">
|
<div :class="$style.inputs" class="_gaps">
|
||||||
|
|
|
@ -36,7 +36,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { markRaw, onMounted, onUnmounted, ref, shallowRef } from 'vue';
|
import { markRaw, onMounted, onUnmounted, ref, shallowRef } from 'vue';
|
||||||
|
import * as Misskey from 'misskey-js';
|
||||||
import XChart from './overview.queue.chart.vue';
|
import XChart from './overview.queue.chart.vue';
|
||||||
|
import type { ApQueueDomain } from '@/pages/admin/queue.vue';
|
||||||
import number from '@/filters/number.js';
|
import number from '@/filters/number.js';
|
||||||
import { useStream } from '@/stream.js';
|
import { useStream } from '@/stream.js';
|
||||||
|
|
||||||
|
@ -52,10 +54,10 @@ const chartDelayed = shallowRef<InstanceType<typeof XChart>>();
|
||||||
const chartWaiting = shallowRef<InstanceType<typeof XChart>>();
|
const chartWaiting = shallowRef<InstanceType<typeof XChart>>();
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
domain: string;
|
domain: ApQueueDomain;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const onStats = (stats) => {
|
function onStats(stats: Misskey.entities.QueueStats) {
|
||||||
activeSincePrevTick.value = stats[props.domain].activeSincePrevTick;
|
activeSincePrevTick.value = stats[props.domain].activeSincePrevTick;
|
||||||
active.value = stats[props.domain].active;
|
active.value = stats[props.domain].active;
|
||||||
delayed.value = stats[props.domain].delayed;
|
delayed.value = stats[props.domain].delayed;
|
||||||
|
@ -65,13 +67,13 @@ const onStats = (stats) => {
|
||||||
chartActive.value.pushData(stats[props.domain].active);
|
chartActive.value.pushData(stats[props.domain].active);
|
||||||
chartDelayed.value.pushData(stats[props.domain].delayed);
|
chartDelayed.value.pushData(stats[props.domain].delayed);
|
||||||
chartWaiting.value.pushData(stats[props.domain].waiting);
|
chartWaiting.value.pushData(stats[props.domain].waiting);
|
||||||
};
|
}
|
||||||
|
|
||||||
const onStatsLog = (statsLog) => {
|
function onStatsLog(statsLog: Misskey.entities.QueueStatsLog) {
|
||||||
const dataProcess = [];
|
const dataProcess: Misskey.entities.QueueStats[ApQueueDomain]['activeSincePrevTick'][] = [];
|
||||||
const dataActive = [];
|
const dataActive: Misskey.entities.QueueStats[ApQueueDomain]['active'][] = [];
|
||||||
const dataDelayed = [];
|
const dataDelayed: Misskey.entities.QueueStats[ApQueueDomain]['delayed'][] = [];
|
||||||
const dataWaiting = [];
|
const dataWaiting: Misskey.entities.QueueStats[ApQueueDomain]['waiting'][] = [];
|
||||||
|
|
||||||
for (const stats of [...statsLog].reverse()) {
|
for (const stats of [...statsLog].reverse()) {
|
||||||
dataProcess.push(stats[props.domain].activeSincePrevTick);
|
dataProcess.push(stats[props.domain].activeSincePrevTick);
|
||||||
|
@ -84,7 +86,7 @@ const onStatsLog = (statsLog) => {
|
||||||
chartActive.value.setData(dataActive);
|
chartActive.value.setData(dataActive);
|
||||||
chartDelayed.value.setData(dataDelayed);
|
chartDelayed.value.setData(dataDelayed);
|
||||||
chartWaiting.value.setData(dataWaiting);
|
chartWaiting.value.setData(dataWaiting);
|
||||||
};
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
connection.on('stats', onStats);
|
connection.on('stats', onStats);
|
||||||
|
|
|
@ -47,14 +47,14 @@ useInterval(fetch, 1000 * 60, {
|
||||||
.root {
|
.root {
|
||||||
&:global {
|
&:global {
|
||||||
> .users {
|
> .users {
|
||||||
.chart-move {
|
|
||||||
transition: transform 1s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
||||||
grid-gap: 12px;
|
grid-gap: 12px;
|
||||||
|
|
||||||
|
.chart-move {
|
||||||
|
transition: transform 1s ease;
|
||||||
|
}
|
||||||
|
|
||||||
> .user:hover {
|
> .user:hover {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { markRaw, onMounted, onUnmounted, ref, shallowRef } from 'vue';
|
import { markRaw, onMounted, onUnmounted, ref, shallowRef } from 'vue';
|
||||||
|
import * as Misskey from 'misskey-js';
|
||||||
import XChart from './queue.chart.chart.vue';
|
import XChart from './queue.chart.chart.vue';
|
||||||
|
import type { ApQueueDomain } from '@/pages/admin/queue.vue';
|
||||||
import number from '@/filters/number.js';
|
import number from '@/filters/number.js';
|
||||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||||
import { useStream } from '@/stream.js';
|
import { useStream } from '@/stream.js';
|
||||||
|
@ -62,17 +64,17 @@ const activeSincePrevTick = ref(0);
|
||||||
const active = ref(0);
|
const active = ref(0);
|
||||||
const delayed = ref(0);
|
const delayed = ref(0);
|
||||||
const waiting = ref(0);
|
const waiting = ref(0);
|
||||||
const jobs = ref<(string | number)[][]>([]);
|
const jobs = ref<Misskey.Endpoints[`admin/queue/${ApQueueDomain}-delayed`]['res']>([]);
|
||||||
const chartProcess = shallowRef<InstanceType<typeof XChart>>();
|
const chartProcess = shallowRef<InstanceType<typeof XChart>>();
|
||||||
const chartActive = shallowRef<InstanceType<typeof XChart>>();
|
const chartActive = shallowRef<InstanceType<typeof XChart>>();
|
||||||
const chartDelayed = shallowRef<InstanceType<typeof XChart>>();
|
const chartDelayed = shallowRef<InstanceType<typeof XChart>>();
|
||||||
const chartWaiting = shallowRef<InstanceType<typeof XChart>>();
|
const chartWaiting = shallowRef<InstanceType<typeof XChart>>();
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
domain: string;
|
domain: ApQueueDomain;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const onStats = (stats) => {
|
function onStats(stats: Misskey.entities.QueueStats) {
|
||||||
activeSincePrevTick.value = stats[props.domain].activeSincePrevTick;
|
activeSincePrevTick.value = stats[props.domain].activeSincePrevTick;
|
||||||
active.value = stats[props.domain].active;
|
active.value = stats[props.domain].active;
|
||||||
delayed.value = stats[props.domain].delayed;
|
delayed.value = stats[props.domain].delayed;
|
||||||
|
@ -82,13 +84,13 @@ const onStats = (stats) => {
|
||||||
chartActive.value.pushData(stats[props.domain].active);
|
chartActive.value.pushData(stats[props.domain].active);
|
||||||
chartDelayed.value.pushData(stats[props.domain].delayed);
|
chartDelayed.value.pushData(stats[props.domain].delayed);
|
||||||
chartWaiting.value.pushData(stats[props.domain].waiting);
|
chartWaiting.value.pushData(stats[props.domain].waiting);
|
||||||
};
|
}
|
||||||
|
|
||||||
const onStatsLog = (statsLog) => {
|
function onStatsLog(statsLog: Misskey.entities.QueueStatsLog) {
|
||||||
const dataProcess = [];
|
const dataProcess: Misskey.entities.QueueStats[ApQueueDomain]['activeSincePrevTick'][] = [];
|
||||||
const dataActive = [];
|
const dataActive: Misskey.entities.QueueStats[ApQueueDomain]['active'][] = [];
|
||||||
const dataDelayed = [];
|
const dataDelayed: Misskey.entities.QueueStats[ApQueueDomain]['delayed'][] = [];
|
||||||
const dataWaiting = [];
|
const dataWaiting: Misskey.entities.QueueStats[ApQueueDomain]['waiting'][] = [];
|
||||||
|
|
||||||
for (const stats of [...statsLog].reverse()) {
|
for (const stats of [...statsLog].reverse()) {
|
||||||
dataProcess.push(stats[props.domain].activeSincePrevTick);
|
dataProcess.push(stats[props.domain].activeSincePrevTick);
|
||||||
|
@ -101,14 +103,12 @@ const onStatsLog = (statsLog) => {
|
||||||
chartActive.value.setData(dataActive);
|
chartActive.value.setData(dataActive);
|
||||||
chartDelayed.value.setData(dataDelayed);
|
chartDelayed.value.setData(dataDelayed);
|
||||||
chartWaiting.value.setData(dataWaiting);
|
chartWaiting.value.setData(dataWaiting);
|
||||||
};
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (props.domain === 'inbox' || props.domain === 'deliver') {
|
misskeyApi(`admin/queue/${props.domain}-delayed`).then(result => {
|
||||||
misskeyApi(`admin/queue/${props.domain}-delayed`).then(result => {
|
jobs.value = result;
|
||||||
jobs.value = result;
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
connection.on('stats', onStats);
|
connection.on('stats', onStats);
|
||||||
connection.on('statsLog', onStatsLog);
|
connection.on('statsLog', onStatsLog);
|
||||||
|
|
|
@ -16,7 +16,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed, type Ref } from 'vue';
|
||||||
import XQueue from './queue.chart.vue';
|
import XQueue from './queue.chart.vue';
|
||||||
import XHeader from './_header_.vue';
|
import XHeader from './_header_.vue';
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
|
@ -25,7 +25,9 @@ import { i18n } from '@/i18n.js';
|
||||||
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
import MkButton from '@/components/MkButton.vue';
|
||||||
|
|
||||||
const tab = ref('deliver');
|
export type ApQueueDomain = 'deliver' | 'inbox';
|
||||||
|
|
||||||
|
const tab: Ref<ApQueueDomain> = ref('deliver');
|
||||||
|
|
||||||
function clear() {
|
function clear() {
|
||||||
os.confirm({
|
os.confirm({
|
||||||
|
|
|
@ -12,19 +12,31 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<template #label>{{ avatarDecoration.name }}</template>
|
<template #label>{{ avatarDecoration.name }}</template>
|
||||||
<template #caption>{{ avatarDecoration.description }}</template>
|
<template #caption>{{ avatarDecoration.description }}</template>
|
||||||
|
|
||||||
<div class="_gaps_m">
|
<div :class="$style.editorRoot">
|
||||||
<MkInput v-model="avatarDecoration.name">
|
<div :class="$style.editorWrapper">
|
||||||
<template #label>{{ i18n.ts.name }}</template>
|
<div :class="$style.preview">
|
||||||
</MkInput>
|
<div :class="[$style.previewItem, $style.light]">
|
||||||
<MkTextarea v-model="avatarDecoration.description">
|
<MkAvatar style="width: 60px; height: 60px;" :user="$i" :decorations="[avatarDecoration]" forceShowDecoration/>
|
||||||
<template #label>{{ i18n.ts.description }}</template>
|
</div>
|
||||||
</MkTextarea>
|
<div :class="[$style.previewItem, $style.dark]">
|
||||||
<MkInput v-model="avatarDecoration.url">
|
<MkAvatar style="width: 60px; height: 60px;" :user="$i" :decorations="[avatarDecoration]" forceShowDecoration/>
|
||||||
<template #label>{{ i18n.ts.imageUrl }}</template>
|
</div>
|
||||||
</MkInput>
|
</div>
|
||||||
<div class="buttons _buttons">
|
<div class="_gaps_m">
|
||||||
<MkButton class="button" inline primary @click="save(avatarDecoration)"><i class="ti ti-device-floppy"></i> {{ i18n.ts.save }}</MkButton>
|
<MkInput v-model="avatarDecoration.name">
|
||||||
<MkButton v-if="avatarDecoration.id != null" class="button" inline danger @click="del(avatarDecoration)"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
|
<template #label>{{ i18n.ts.name }}</template>
|
||||||
|
</MkInput>
|
||||||
|
<MkTextarea v-model="avatarDecoration.description">
|
||||||
|
<template #label>{{ i18n.ts.description }}</template>
|
||||||
|
</MkTextarea>
|
||||||
|
<MkInput v-model="avatarDecoration.url">
|
||||||
|
<template #label>{{ i18n.ts.imageUrl }}</template>
|
||||||
|
</MkInput>
|
||||||
|
<div class="_buttons">
|
||||||
|
<MkButton inline primary @click="save(avatarDecoration)"><i class="ti ti-device-floppy"></i> {{ i18n.ts.save }}</MkButton>
|
||||||
|
<MkButton v-if="avatarDecoration.id != null" inline danger @click="del(avatarDecoration)"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</MkFolder>
|
</MkFolder>
|
||||||
|
@ -39,6 +51,7 @@ import * as Misskey from 'misskey-js';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
import MkButton from '@/components/MkButton.vue';
|
||||||
import MkInput from '@/components/MkInput.vue';
|
import MkInput from '@/components/MkInput.vue';
|
||||||
import MkTextarea from '@/components/MkTextarea.vue';
|
import MkTextarea from '@/components/MkTextarea.vue';
|
||||||
|
import { signinRequired } from '@/account.js';
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
|
@ -47,6 +60,8 @@ import MkFolder from '@/components/MkFolder.vue';
|
||||||
|
|
||||||
const avatarDecorations = ref<Misskey.entities.AdminAvatarDecorationsListResponse>([]);
|
const avatarDecorations = ref<Misskey.entities.AdminAvatarDecorationsListResponse>([]);
|
||||||
|
|
||||||
|
const $i = signinRequired();
|
||||||
|
|
||||||
function add() {
|
function add() {
|
||||||
avatarDecorations.value.unshift({
|
avatarDecorations.value.unshift({
|
||||||
_id: Math.random().toString(36),
|
_id: Math.random().toString(36),
|
||||||
|
@ -99,3 +114,55 @@ definePageMetadata(() => ({
|
||||||
icon: 'ti ti-sparkles',
|
icon: 'ti ti-sparkles',
|
||||||
}));
|
}));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" module>
|
||||||
|
.editorRoot {
|
||||||
|
container: editor / inline-size;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editorWrapper {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
grid-template-rows: auto auto;
|
||||||
|
gap: var(--margin);
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview {
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
grid-template-rows: 1fr;
|
||||||
|
gap: var(--margin);
|
||||||
|
}
|
||||||
|
|
||||||
|
.previewItem {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 160px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border-radius: var(--radius);
|
||||||
|
|
||||||
|
&.light {
|
||||||
|
background: #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.dark {
|
||||||
|
background: #222;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@container editor (min-width: 600px) {
|
||||||
|
.editorWrapper {
|
||||||
|
grid-template-columns: 200px 1fr;
|
||||||
|
grid-template-rows: 1fr;
|
||||||
|
gap: calc(var(--margin) * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
grid-template-rows: 1fr 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -310,7 +310,7 @@ definePageMetadata(() => ({
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 64px;
|
height: 64px;
|
||||||
background: linear-gradient(0deg, var(--panel), var(--X15));
|
background: linear-gradient(0deg, var(--panel), color(from var(--panel) srgb r g b / 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
.bannerStatus {
|
.bannerStatus {
|
||||||
|
|
|
@ -134,7 +134,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, computed, watch } from 'vue';
|
import { ref, computed, watch } from 'vue';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import MkChart from '@/components/MkChart.vue';
|
import MkChart, { type ChartSrc } from '@/components/MkChart.vue';
|
||||||
import MkObjectView from '@/components/MkObjectView.vue';
|
import MkObjectView from '@/components/MkObjectView.vue';
|
||||||
import FormLink from '@/components/form/link.vue';
|
import FormLink from '@/components/form/link.vue';
|
||||||
import MkLink from '@/components/MkLink.vue';
|
import MkLink from '@/components/MkLink.vue';
|
||||||
|
@ -150,7 +150,7 @@ import { iAmModerator, iAmAdmin } from '@/account.js';
|
||||||
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
import MkUserCardMini from '@/components/MkUserCardMini.vue';
|
import MkUserCardMini from '@/components/MkUserCardMini.vue';
|
||||||
import MkPagination from '@/components/MkPagination.vue';
|
import MkPagination, { type Paging } from '@/components/MkPagination.vue';
|
||||||
import MkHorizontalSwipe from '@/components/MkHorizontalSwipe.vue';
|
import MkHorizontalSwipe from '@/components/MkHorizontalSwipe.vue';
|
||||||
import { getProxiedImageUrlNullable } from '@/scripts/media-proxy.js';
|
import { getProxiedImageUrlNullable } from '@/scripts/media-proxy.js';
|
||||||
import { dateString } from '@/filters/date.js';
|
import { dateString } from '@/filters/date.js';
|
||||||
|
@ -162,7 +162,7 @@ const props = defineProps<{
|
||||||
|
|
||||||
const tab = ref('overview');
|
const tab = ref('overview');
|
||||||
|
|
||||||
const chartSrc = ref('instance-requests');
|
const chartSrc = ref<ChartSrc>('instance-requests');
|
||||||
const meta = ref<Misskey.entities.AdminMetaResponse | null>(null);
|
const meta = ref<Misskey.entities.AdminMetaResponse | null>(null);
|
||||||
const instance = ref<Misskey.entities.FederationInstance | null>(null);
|
const instance = ref<Misskey.entities.FederationInstance | null>(null);
|
||||||
const suspensionState = ref<'none' | 'manuallySuspended' | 'goneSuspended' | 'autoSuspendedForNotResponding'>('none');
|
const suspensionState = ref<'none' | 'manuallySuspended' | 'goneSuspended' | 'autoSuspendedForNotResponding'>('none');
|
||||||
|
@ -173,7 +173,7 @@ const faviconUrl = ref<string | null>(null);
|
||||||
const moderationNote = ref('');
|
const moderationNote = ref('');
|
||||||
|
|
||||||
const usersPagination = {
|
const usersPagination = {
|
||||||
endpoint: iAmModerator ? 'admin/show-users' : 'users' as const,
|
endpoint: iAmModerator ? 'admin/show-users' : 'users',
|
||||||
limit: 10,
|
limit: 10,
|
||||||
params: {
|
params: {
|
||||||
sort: '+updatedAt',
|
sort: '+updatedAt',
|
||||||
|
@ -181,11 +181,14 @@ const usersPagination = {
|
||||||
hostname: props.host,
|
hostname: props.host,
|
||||||
},
|
},
|
||||||
offsetMode: true,
|
offsetMode: true,
|
||||||
};
|
} satisfies Paging;
|
||||||
|
|
||||||
watch(moderationNote, async () => {
|
if (iAmModerator) {
|
||||||
await misskeyApi('admin/federation/update-instance', { host: instance.value.host, moderationNote: moderationNote.value });
|
watch(moderationNote, async () => {
|
||||||
});
|
if (instance.value == null) return;
|
||||||
|
await misskeyApi('admin/federation/update-instance', { host: instance.value.host, moderationNote: moderationNote.value });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async function fetch(): Promise<void> {
|
async function fetch(): Promise<void> {
|
||||||
if (iAmAdmin) {
|
if (iAmAdmin) {
|
||||||
|
@ -203,6 +206,7 @@ async function fetch(): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function toggleBlock(): Promise<void> {
|
async function toggleBlock(): Promise<void> {
|
||||||
|
if (!iAmAdmin) return;
|
||||||
if (!meta.value) throw new Error('No meta?');
|
if (!meta.value) throw new Error('No meta?');
|
||||||
if (!instance.value) throw new Error('No instance?');
|
if (!instance.value) throw new Error('No instance?');
|
||||||
const { host } = instance.value;
|
const { host } = instance.value;
|
||||||
|
@ -212,6 +216,7 @@ async function toggleBlock(): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function toggleSilenced(): Promise<void> {
|
async function toggleSilenced(): Promise<void> {
|
||||||
|
if (!iAmAdmin) return;
|
||||||
if (!meta.value) throw new Error('No meta?');
|
if (!meta.value) throw new Error('No meta?');
|
||||||
if (!instance.value) throw new Error('No instance?');
|
if (!instance.value) throw new Error('No instance?');
|
||||||
const { host } = instance.value;
|
const { host } = instance.value;
|
||||||
|
@ -222,6 +227,7 @@ async function toggleSilenced(): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function toggleMediaSilenced(): Promise<void> {
|
async function toggleMediaSilenced(): Promise<void> {
|
||||||
|
if (!iAmAdmin) return;
|
||||||
if (!meta.value) throw new Error('No meta?');
|
if (!meta.value) throw new Error('No meta?');
|
||||||
if (!instance.value) throw new Error('No instance?');
|
if (!instance.value) throw new Error('No instance?');
|
||||||
const { host } = instance.value;
|
const { host } = instance.value;
|
||||||
|
@ -232,6 +238,7 @@ async function toggleMediaSilenced(): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function stopDelivery(): Promise<void> {
|
async function stopDelivery(): Promise<void> {
|
||||||
|
if (!iAmModerator) return;
|
||||||
if (!instance.value) throw new Error('No instance?');
|
if (!instance.value) throw new Error('No instance?');
|
||||||
suspensionState.value = 'manuallySuspended';
|
suspensionState.value = 'manuallySuspended';
|
||||||
await misskeyApi('admin/federation/update-instance', {
|
await misskeyApi('admin/federation/update-instance', {
|
||||||
|
@ -241,6 +248,7 @@ async function stopDelivery(): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function resumeDelivery(): Promise<void> {
|
async function resumeDelivery(): Promise<void> {
|
||||||
|
if (!iAmModerator) return;
|
||||||
if (!instance.value) throw new Error('No instance?');
|
if (!instance.value) throw new Error('No instance?');
|
||||||
suspensionState.value = 'none';
|
suspensionState.value = 'none';
|
||||||
await misskeyApi('admin/federation/update-instance', {
|
await misskeyApi('admin/federation/update-instance', {
|
||||||
|
@ -250,6 +258,7 @@ async function resumeDelivery(): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshMetadata(): void {
|
function refreshMetadata(): void {
|
||||||
|
if (!iAmModerator) return;
|
||||||
if (!instance.value) throw new Error('No instance?');
|
if (!instance.value) throw new Error('No instance?');
|
||||||
misskeyApi('admin/federation/refresh-remote-instance-metadata', {
|
misskeyApi('admin/federation/refresh-remote-instance-metadata', {
|
||||||
host: instance.value.host,
|
host: instance.value.host,
|
||||||
|
|
|
@ -433,13 +433,12 @@ definePageMetadata(() => ({
|
||||||
.pageBannerTitleUser {
|
.pageBannerTitleUser {
|
||||||
--height: 32px;
|
--height: 32px;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
line-height: var(--height);
|
||||||
|
|
||||||
.avatar {
|
.avatar {
|
||||||
height: var(--height);
|
height: var(--height);
|
||||||
width: var(--height);
|
width: var(--height);
|
||||||
}
|
}
|
||||||
|
|
||||||
line-height: var(--height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.pageBannerTitleSubActions {
|
.pageBannerTitleSubActions {
|
||||||
|
|
|
@ -96,6 +96,7 @@ const decorationsForPreview = computed(() => {
|
||||||
flipH: flipH.value,
|
flipH: flipH.value,
|
||||||
offsetX: offsetX.value,
|
offsetX: offsetX.value,
|
||||||
offsetY: offsetY.value,
|
offsetY: offsetY.value,
|
||||||
|
blink: true,
|
||||||
};
|
};
|
||||||
const decorations = [...$i.avatarDecorations];
|
const decorations = [...$i.avatarDecorations];
|
||||||
if (props.usingIndex != null) {
|
if (props.usingIndex != null) {
|
||||||
|
|
|
@ -84,7 +84,7 @@ onUpdated(() => {
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 64px;
|
height: 64px;
|
||||||
background: linear-gradient(0deg, var(--panel), var(--X15));
|
background: linear-gradient(0deg, var(--panel), color(from var(--panel) srgb r g b / 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,11 @@ export async function getNoteClipMenu(props: {
|
||||||
});
|
});
|
||||||
if (props.currentClip?.id === clip.id) props.isDeleted.value = true;
|
if (props.currentClip?.id === clip.id) props.isDeleted.value = true;
|
||||||
}
|
}
|
||||||
|
} else if (err.id === 'f0dba960-ff73-4615-8df4-d6ac5d9dc118') {
|
||||||
|
os.alert({
|
||||||
|
type: 'error',
|
||||||
|
text: i18n.ts.clipNoteLimitExceeded,
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
os.alert({
|
os.alert({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
|
|
|
@ -137,7 +137,6 @@ export class I18n<T extends ILocale> {
|
||||||
return this.tsxCache = new Proxy(this.locale, new Handler()) as unknown as Tsx<T>;
|
return this.tsxCache = new Proxy(this.locale, new Handler()) as unknown as Tsx<T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
||||||
if (this.tsxCache) {
|
if (this.tsxCache) {
|
||||||
return this.tsxCache;
|
return this.tsxCache;
|
||||||
}
|
}
|
||||||
|
@ -244,51 +243,3 @@ export class I18n<T extends ILocale> {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (import.meta.vitest) {
|
|
||||||
const { describe, expect, it } = import.meta.vitest;
|
|
||||||
|
|
||||||
describe('i18n', () => {
|
|
||||||
it('t', () => {
|
|
||||||
const i18n = new I18n({
|
|
||||||
foo: 'foo',
|
|
||||||
bar: {
|
|
||||||
baz: 'baz',
|
|
||||||
qux: 'qux {0}' as unknown as ParameterizedString<'0'>,
|
|
||||||
quux: 'quux {0} {1}' as unknown as ParameterizedString<'0' | '1'>,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(i18n.t('foo')).toBe('foo');
|
|
||||||
expect(i18n.t('bar.baz')).toBe('baz');
|
|
||||||
expect(i18n.tsx.bar.qux({ 0: 'hoge' })).toBe('qux hoge');
|
|
||||||
expect(i18n.tsx.bar.quux({ 0: 'hoge', 1: 'fuga' })).toBe('quux hoge fuga');
|
|
||||||
});
|
|
||||||
it('ts', () => {
|
|
||||||
const i18n = new I18n({
|
|
||||||
foo: 'foo',
|
|
||||||
bar: {
|
|
||||||
baz: 'baz',
|
|
||||||
qux: 'qux {0}' as unknown as ParameterizedString<'0'>,
|
|
||||||
quux: 'quux {0} {1}' as unknown as ParameterizedString<'0' | '1'>,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(i18n.ts.foo).toBe('foo');
|
|
||||||
expect(i18n.ts.bar.baz).toBe('baz');
|
|
||||||
});
|
|
||||||
it('tsx', () => {
|
|
||||||
const i18n = new I18n({
|
|
||||||
foo: 'foo',
|
|
||||||
bar: {
|
|
||||||
baz: 'baz',
|
|
||||||
qux: 'qux {0}' as unknown as ParameterizedString<'0'>,
|
|
||||||
quux: 'quux {0} {1}' as unknown as ParameterizedString<'0' | '1'>,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(i18n.tsx.bar.qux({ 0: 'hoge' })).toBe('qux hoge');
|
|
||||||
expect(i18n.tsx.bar.quux({ 0: 'hoge', 1: 'fuga' })).toBe('quux hoge fuga');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ import { apiUrl } from '@/config.js';
|
||||||
import { $i } from '@/account.js';
|
import { $i } from '@/account.js';
|
||||||
import { alert } from '@/os.js';
|
import { alert } from '@/os.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
|
import { instance } from '@/instance.js';
|
||||||
|
|
||||||
type Uploading = {
|
type Uploading = {
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -39,6 +40,15 @@ export function uploadFile(
|
||||||
|
|
||||||
if (folder && typeof folder === 'object') folder = folder.id;
|
if (folder && typeof folder === 'object') folder = folder.id;
|
||||||
|
|
||||||
|
if (file.size > instance.maxFileSize) {
|
||||||
|
alert({
|
||||||
|
type: 'error',
|
||||||
|
title: i18n.ts.failedToUpload,
|
||||||
|
text: i18n.ts.cannotUploadBecauseExceedsFileSizeLimit,
|
||||||
|
});
|
||||||
|
return Promise.reject();
|
||||||
|
}
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const id = uuid();
|
const id = uuid();
|
||||||
|
|
||||||
|
|
|
@ -17,11 +17,11 @@
|
||||||
--minBottomSpacingMobile: calc(72px + max(12px, env(safe-area-inset-bottom, 0px)));
|
--minBottomSpacingMobile: calc(72px + max(12px, env(safe-area-inset-bottom, 0px)));
|
||||||
--minBottomSpacing: var(--minBottomSpacingMobile);
|
--minBottomSpacing: var(--minBottomSpacingMobile);
|
||||||
|
|
||||||
@media (max-width: 500px) {
|
//--ad: rgb(255 169 0 / 10%);
|
||||||
|
|
||||||
|
@media (max-width: 500px) {
|
||||||
--margin: var(--marginHalf);
|
--margin: var(--marginHalf);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--ad: rgb(255 169 0 / 10%);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
::selection {
|
::selection {
|
||||||
|
@ -248,11 +248,11 @@ rt {
|
||||||
background: var(--accent);
|
background: var(--accent);
|
||||||
|
|
||||||
&:not(:disabled):hover {
|
&:not(:disabled):hover {
|
||||||
background: var(--X8);
|
background: hsl(from var(--accent) h s calc(l + 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
&:not(:disabled):active {
|
&:not(:disabled):active {
|
||||||
background: var(--X9);
|
background: hsl(from var(--accent) h s calc(l - 5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,11 +262,11 @@ rt {
|
||||||
background: linear-gradient(90deg, var(--buttonGradateA), var(--buttonGradateB));
|
background: linear-gradient(90deg, var(--buttonGradateA), var(--buttonGradateB));
|
||||||
|
|
||||||
&:not(:disabled):hover {
|
&:not(:disabled):hover {
|
||||||
background: linear-gradient(90deg, var(--X8), var(--X8));
|
background: linear-gradient(90deg, hsl(from var(--accent) h s calc(l + 5)), hsl(from var(--accent) h s calc(l + 5)));
|
||||||
}
|
}
|
||||||
|
|
||||||
&:not(:disabled):active {
|
&:not(:disabled):active {
|
||||||
background: linear-gradient(90deg, var(--X8), var(--X8));
|
background: linear-gradient(90deg, hsl(from var(--accent) h s calc(l + 5)), hsl(from var(--accent) h s calc(l + 5)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,22 +78,14 @@
|
||||||
codeBoolean: '#c59eff',
|
codeBoolean: '#c59eff',
|
||||||
deckBg: '#000',
|
deckBg: '#000',
|
||||||
htmlThemeColor: '@bg',
|
htmlThemeColor: '@bg',
|
||||||
X2: ':darken<2<@panel',
|
|
||||||
X3: 'rgba(255, 255, 255, 0.05)',
|
X3: 'rgba(255, 255, 255, 0.05)',
|
||||||
X4: 'rgba(255, 255, 255, 0.1)',
|
X4: 'rgba(255, 255, 255, 0.1)',
|
||||||
X5: 'rgba(255, 255, 255, 0.05)',
|
X5: 'rgba(255, 255, 255, 0.05)',
|
||||||
X6: 'rgba(255, 255, 255, 0.15)',
|
X6: 'rgba(255, 255, 255, 0.15)',
|
||||||
X7: 'rgba(255, 255, 255, 0.05)',
|
X7: 'rgba(255, 255, 255, 0.05)',
|
||||||
X8: ':lighten<5<@accent',
|
|
||||||
X9: ':darken<5<@accent',
|
|
||||||
X10: ':alpha<0.4<@accent',
|
|
||||||
X11: 'rgba(0, 0, 0, 0.3)',
|
X11: 'rgba(0, 0, 0, 0.3)',
|
||||||
X12: 'rgba(255, 255, 255, 0.1)',
|
X12: 'rgba(255, 255, 255, 0.1)',
|
||||||
X13: 'rgba(255, 255, 255, 0.15)',
|
X13: 'rgba(255, 255, 255, 0.15)',
|
||||||
X14: ':alpha<0.5<@navBg',
|
|
||||||
X15: ':alpha<0<@panel',
|
|
||||||
X16: ':alpha<0.7<@panel',
|
|
||||||
X17: ':alpha<0.8<@bg',
|
|
||||||
},
|
},
|
||||||
|
|
||||||
codeHighlighter: {
|
codeHighlighter: {
|
||||||
|
|
|
@ -78,22 +78,14 @@
|
||||||
codeBoolean: '#62b70c',
|
codeBoolean: '#62b70c',
|
||||||
deckBg: ':darken<3<@bg',
|
deckBg: ':darken<3<@bg',
|
||||||
htmlThemeColor: '@bg',
|
htmlThemeColor: '@bg',
|
||||||
X2: ':darken<2<@panel',
|
|
||||||
X3: 'rgba(0, 0, 0, 0.05)',
|
X3: 'rgba(0, 0, 0, 0.05)',
|
||||||
X4: 'rgba(0, 0, 0, 0.1)',
|
X4: 'rgba(0, 0, 0, 0.1)',
|
||||||
X5: 'rgba(0, 0, 0, 0.05)',
|
X5: 'rgba(0, 0, 0, 0.05)',
|
||||||
X6: 'rgba(0, 0, 0, 0.25)',
|
X6: 'rgba(0, 0, 0, 0.25)',
|
||||||
X7: 'rgba(0, 0, 0, 0.05)',
|
X7: 'rgba(0, 0, 0, 0.05)',
|
||||||
X8: ':lighten<5<@accent',
|
|
||||||
X9: ':darken<5<@accent',
|
|
||||||
X10: ':alpha<0.4<@accent',
|
|
||||||
X11: 'rgba(0, 0, 0, 0.1)',
|
X11: 'rgba(0, 0, 0, 0.1)',
|
||||||
X12: 'rgba(0, 0, 0, 0.1)',
|
X12: 'rgba(0, 0, 0, 0.1)',
|
||||||
X13: 'rgba(0, 0, 0, 0.15)',
|
X13: 'rgba(0, 0, 0, 0.15)',
|
||||||
X14: ':alpha<0.5<@navBg',
|
|
||||||
X15: ':alpha<0<@panel',
|
|
||||||
X16: ':alpha<0.7<@panel',
|
|
||||||
X17: ':alpha<0.8<@bg',
|
|
||||||
},
|
},
|
||||||
|
|
||||||
codeHighlighter: {
|
codeHighlighter: {
|
||||||
|
|
|
@ -57,20 +57,13 @@
|
||||||
wallpaperOverlay: 'rgba(0, 0, 0, 0.5)',
|
wallpaperOverlay: 'rgba(0, 0, 0, 0.5)',
|
||||||
panelHeaderDivider: 'rgba(0, 0, 0, 0)',
|
panelHeaderDivider: 'rgba(0, 0, 0, 0)',
|
||||||
scrollbarHandleHover: 'rgba(255, 255, 255, 0.4)',
|
scrollbarHandleHover: 'rgba(255, 255, 255, 0.4)',
|
||||||
X2: ':darken<2<@panel',
|
|
||||||
X3: 'rgba(255, 255, 255, 0.05)',
|
X3: 'rgba(255, 255, 255, 0.05)',
|
||||||
X4: 'rgba(255, 255, 255, 0.1)',
|
X4: 'rgba(255, 255, 255, 0.1)',
|
||||||
X5: 'rgba(255, 255, 255, 0.05)',
|
X5: 'rgba(255, 255, 255, 0.05)',
|
||||||
X6: 'rgba(255, 255, 255, 0.15)',
|
X6: 'rgba(255, 255, 255, 0.15)',
|
||||||
X7: 'rgba(255, 255, 255, 0.05)',
|
X7: 'rgba(255, 255, 255, 0.05)',
|
||||||
X8: ':lighten<5<@accent',
|
|
||||||
X9: ':darken<5<@accent',
|
|
||||||
X10: ':alpha<0.4<@accent',
|
|
||||||
X11: 'rgba(0, 0, 0, 0.3)',
|
X11: 'rgba(0, 0, 0, 0.3)',
|
||||||
X12: 'rgba(255, 255, 255, 0.1)',
|
X12: 'rgba(255, 255, 255, 0.1)',
|
||||||
X13: 'rgba(255, 255, 255, 0.15)',
|
X13: 'rgba(255, 255, 255, 0.15)',
|
||||||
X14: ':alpha<0.5<@navBg',
|
|
||||||
X15: ':alpha<0<@panel',
|
|
||||||
X16: ':alpha<0.7<@panel',
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,14 +3,11 @@
|
||||||
base: 'dark',
|
base: 'dark',
|
||||||
name: 'Mi U0 Dark',
|
name: 'Mi U0 Dark',
|
||||||
props: {
|
props: {
|
||||||
X2: ':darken<2<@panel',
|
|
||||||
X3: 'rgba(255, 255, 255, 0.05)',
|
X3: 'rgba(255, 255, 255, 0.05)',
|
||||||
X4: 'rgba(255, 255, 255, 0.1)',
|
X4: 'rgba(255, 255, 255, 0.1)',
|
||||||
X5: 'rgba(255, 255, 255, 0.05)',
|
X5: 'rgba(255, 255, 255, 0.05)',
|
||||||
X6: 'rgba(255, 255, 255, 0.15)',
|
X6: 'rgba(255, 255, 255, 0.15)',
|
||||||
X7: 'rgba(255, 255, 255, 0.05)',
|
X7: 'rgba(255, 255, 255, 0.05)',
|
||||||
X8: ':lighten<5<@accent',
|
|
||||||
X9: ':darken<5<@accent',
|
|
||||||
bg: '#172426',
|
bg: '#172426',
|
||||||
fg: '#dadada',
|
fg: '#dadada',
|
||||||
X10: ':alpha<0.4<@accent',
|
X10: ':alpha<0.4<@accent',
|
||||||
|
|
|
@ -3,14 +3,11 @@
|
||||||
base: 'light',
|
base: 'light',
|
||||||
name: 'Mi U0 Light',
|
name: 'Mi U0 Light',
|
||||||
props: {
|
props: {
|
||||||
X2: ':darken<2<@panel',
|
|
||||||
X3: 'rgba(255, 255, 255, 0.05)',
|
X3: 'rgba(255, 255, 255, 0.05)',
|
||||||
X4: 'rgba(255, 255, 255, 0.1)',
|
X4: 'rgba(255, 255, 255, 0.1)',
|
||||||
X5: 'rgba(255, 255, 255, 0.05)',
|
X5: 'rgba(255, 255, 255, 0.05)',
|
||||||
X6: 'rgba(255, 255, 255, 0.15)',
|
X6: 'rgba(255, 255, 255, 0.15)',
|
||||||
X7: 'rgba(255, 255, 255, 0.05)',
|
X7: 'rgba(255, 255, 255, 0.05)',
|
||||||
X8: ':lighten<5<@accent',
|
|
||||||
X9: ':darken<5<@accent',
|
|
||||||
bg: '#e7e7eb',
|
bg: '#e7e7eb',
|
||||||
fg: '#5f5f5f',
|
fg: '#5f5f5f',
|
||||||
X10: ':alpha<0.4<@accent',
|
X10: ':alpha<0.4<@accent',
|
||||||
|
|
|
@ -60,21 +60,13 @@
|
||||||
fgTransparentWeak: ':alpha<0.75<@fg',
|
fgTransparentWeak: ':alpha<0.75<@fg',
|
||||||
panelHeaderDivider: '@divider',
|
panelHeaderDivider: '@divider',
|
||||||
scrollbarHandleHover: 'rgba(0, 0, 0, 0.4)',
|
scrollbarHandleHover: 'rgba(0, 0, 0, 0.4)',
|
||||||
X2: ':darken<2<@panel',
|
|
||||||
X3: 'rgba(0, 0, 0, 0.05)',
|
X3: 'rgba(0, 0, 0, 0.05)',
|
||||||
X4: 'rgba(0, 0, 0, 0.1)',
|
X4: 'rgba(0, 0, 0, 0.1)',
|
||||||
X5: 'rgba(0, 0, 0, 0.05)',
|
X5: 'rgba(0, 0, 0, 0.05)',
|
||||||
X6: 'rgba(0, 0, 0, 0.25)',
|
X6: 'rgba(0, 0, 0, 0.25)',
|
||||||
X7: 'rgba(0, 0, 0, 0.05)',
|
X7: 'rgba(0, 0, 0, 0.05)',
|
||||||
X8: ':lighten<5<@accent',
|
|
||||||
X9: ':darken<5<@accent',
|
|
||||||
X10: ':alpha<0.4<@accent',
|
|
||||||
X11: 'rgba(0, 0, 0, 0.1)',
|
X11: 'rgba(0, 0, 0, 0.1)',
|
||||||
X12: 'rgba(0, 0, 0, 0.1)',
|
X12: 'rgba(0, 0, 0, 0.1)',
|
||||||
X13: 'rgba(0, 0, 0, 0.15)',
|
X13: 'rgba(0, 0, 0, 0.15)',
|
||||||
X14: ':alpha<0.5<@navBg',
|
|
||||||
X15: ':alpha<0<@panel',
|
|
||||||
X16: ':alpha<0.7<@panel',
|
|
||||||
X17: ':alpha<0.8<@bg',
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,6 +82,8 @@ function more() {
|
||||||
|
|
||||||
<style lang="scss" module>
|
<style lang="scss" module>
|
||||||
.root {
|
.root {
|
||||||
|
--nav-bg-transparent: color-mix(in srgb, var(--navBg), transparent 50%);
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
@ -91,7 +93,7 @@ function more() {
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
padding: 20px 0;
|
padding: 20px 0;
|
||||||
background: var(--X14);
|
background: var(--nav-bg-transparent);
|
||||||
-webkit-backdrop-filter: var(--blur, blur(8px));
|
-webkit-backdrop-filter: var(--blur, blur(8px));
|
||||||
backdrop-filter: var(--blur, blur(8px));
|
backdrop-filter: var(--blur, blur(8px));
|
||||||
}
|
}
|
||||||
|
@ -125,7 +127,7 @@ function more() {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
padding: 20px 0;
|
padding: 20px 0;
|
||||||
background: var(--X14);
|
background: var(--nav-bg-transparent);
|
||||||
-webkit-backdrop-filter: var(--blur, blur(8px));
|
-webkit-backdrop-filter: var(--blur, blur(8px));
|
||||||
backdrop-filter: var(--blur, blur(8px));
|
backdrop-filter: var(--blur, blur(8px));
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,6 +111,7 @@ function more(ev: MouseEvent) {
|
||||||
.root {
|
.root {
|
||||||
--nav-width: 250px;
|
--nav-width: 250px;
|
||||||
--nav-icon-only-width: 80px;
|
--nav-icon-only-width: 80px;
|
||||||
|
--nav-bg-transparent: color-mix(in srgb, var(--navBg), transparent 50%);
|
||||||
|
|
||||||
flex: 0 0 var(--nav-width);
|
flex: 0 0 var(--nav-width);
|
||||||
width: var(--nav-width);
|
width: var(--nav-width);
|
||||||
|
@ -144,7 +145,7 @@ function more(ev: MouseEvent) {
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
padding: 20px 0;
|
padding: 20px 0;
|
||||||
background: var(--X14);
|
background: var(--nav-bg-transparent);
|
||||||
-webkit-backdrop-filter: var(--blur, blur(8px));
|
-webkit-backdrop-filter: var(--blur, blur(8px));
|
||||||
backdrop-filter: var(--blur, blur(8px));
|
backdrop-filter: var(--blur, blur(8px));
|
||||||
}
|
}
|
||||||
|
@ -187,7 +188,7 @@ function more(ev: MouseEvent) {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
padding-top: 20px;
|
padding-top: 20px;
|
||||||
background: var(--X14);
|
background: var(--nav-bg-transparent);
|
||||||
-webkit-backdrop-filter: var(--blur, blur(8px));
|
-webkit-backdrop-filter: var(--blur, blur(8px));
|
||||||
backdrop-filter: var(--blur, blur(8px));
|
backdrop-filter: var(--blur, blur(8px));
|
||||||
}
|
}
|
||||||
|
@ -378,7 +379,7 @@ function more(ev: MouseEvent) {
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
padding: 20px 0;
|
padding: 20px 0;
|
||||||
background: var(--X14);
|
background: var(--nav-bg-transparent);
|
||||||
-webkit-backdrop-filter: var(--blur, blur(8px));
|
-webkit-backdrop-filter: var(--blur, blur(8px));
|
||||||
backdrop-filter: var(--blur, blur(8px));
|
backdrop-filter: var(--blur, blur(8px));
|
||||||
}
|
}
|
||||||
|
@ -408,7 +409,7 @@ function more(ev: MouseEvent) {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
padding-top: 20px;
|
padding-top: 20px;
|
||||||
background: var(--X14);
|
background: var(--nav-bg-transparent);
|
||||||
-webkit-backdrop-filter: var(--blur, blur(8px));
|
-webkit-backdrop-filter: var(--blur, blur(8px));
|
||||||
backdrop-filter: var(--blur, blur(8px));
|
backdrop-filter: var(--blur, blur(8px));
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,14 @@ const XUserList = defineAsyncComponent(() => import('./statusbar-user-list.vue')
|
||||||
--nameMargin: 10px;
|
--nameMargin: 10px;
|
||||||
font-size: 0.85em;
|
font-size: 0.85em;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
vertical-align: bottom;
|
||||||
|
width: 100%;
|
||||||
|
line-height: var(--height);
|
||||||
|
height: var(--height);
|
||||||
|
overflow: clip;
|
||||||
|
contain: strict;
|
||||||
|
|
||||||
&.verySmall {
|
&.verySmall {
|
||||||
--nameMargin: 7px;
|
--nameMargin: 7px;
|
||||||
--height: 16px;
|
--height: 16px;
|
||||||
|
@ -64,14 +72,6 @@ const XUserList = defineAsyncComponent(() => import('./statusbar-user-list.vue')
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
}
|
}
|
||||||
|
|
||||||
display: flex;
|
|
||||||
vertical-align: bottom;
|
|
||||||
width: 100%;
|
|
||||||
line-height: var(--height);
|
|
||||||
height: var(--height);
|
|
||||||
overflow: clip;
|
|
||||||
contain: strict;
|
|
||||||
|
|
||||||
&.black {
|
&.black {
|
||||||
background: #000;
|
background: #000;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
|
|
@ -450,7 +450,7 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
background: var(--X2);
|
background: hsl(from var(--panel) h s calc(l - 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,11 +460,11 @@ body {
|
||||||
color: var(--fgOnAccent);
|
color: var(--fgOnAccent);
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: linear-gradient(90deg, var(--X8), var(--X8));
|
background: linear-gradient(90deg, hsl(from var(--accent) h s calc(l + 5)), hsl(from var(--accent) h s calc(l + 5)));
|
||||||
}
|
}
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
background: linear-gradient(90deg, var(--X8), var(--X8));
|
background: linear-gradient(90deg, hsl(from var(--accent) h s calc(l + 5)), hsl(from var(--accent) h s calc(l + 5)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -324,11 +324,11 @@ function onDrop(ev) {
|
||||||
|
|
||||||
> .body {
|
> .body {
|
||||||
background: transparent !important;
|
background: transparent !important;
|
||||||
|
scrollbar-color: var(--scrollbarHandle) transparent;
|
||||||
|
|
||||||
&::-webkit-scrollbar-track {
|
&::-webkit-scrollbar-track {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
}
|
}
|
||||||
scrollbar-color: var(--scrollbarHandle) transparent;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,11 +338,11 @@ function onDrop(ev) {
|
||||||
> .body {
|
> .body {
|
||||||
background: var(--bg) !important;
|
background: var(--bg) !important;
|
||||||
overflow-y: scroll !important;
|
overflow-y: scroll !important;
|
||||||
|
scrollbar-color: var(--scrollbarHandle) transparent;
|
||||||
|
|
||||||
&::-webkit-scrollbar-track {
|
&::-webkit-scrollbar-track {
|
||||||
background: inherit;
|
background: inherit;
|
||||||
}
|
}
|
||||||
scrollbar-color: var(--scrollbarHandle) transparent;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -423,10 +423,10 @@ function onDrop(ev) {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
container-type: size;
|
container-type: size;
|
||||||
background-color: var(--bg);
|
background-color: var(--bg);
|
||||||
|
scrollbar-color: var(--scrollbarHandle) var(--panel);
|
||||||
|
|
||||||
&::-webkit-scrollbar-track {
|
&::-webkit-scrollbar-track {
|
||||||
background: var(--panel);
|
background: var(--panel);
|
||||||
}
|
}
|
||||||
scrollbar-color: var(--scrollbarHandle) var(--panel);
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -427,7 +427,7 @@ $widgets-hide-threshold: 1090px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
background: var(--X2);
|
background: hsl(from var(--panel) h s calc(l - 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,11 +437,11 @@ $widgets-hide-threshold: 1090px;
|
||||||
color: var(--fgOnAccent);
|
color: var(--fgOnAccent);
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: linear-gradient(90deg, var(--X8), var(--X8));
|
background: linear-gradient(90deg, hsl(from var(--accent) h s calc(l + 5)), hsl(from var(--accent) h s calc(l + 5)));
|
||||||
}
|
}
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
background: linear-gradient(90deg, var(--X8), var(--X8));
|
background: linear-gradient(90deg, hsl(from var(--accent) h s calc(l + 5)), hsl(from var(--accent) h s calc(l + 5)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ function onStats(connStats: Misskey.entities.ServerStats) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onStatsLog(statsLog: Misskey.entities.ServerStatsLog) {
|
function onStatsLog(statsLog: Misskey.entities.ServerStatsLog) {
|
||||||
for (const revStats of statsLog.reverse()) {
|
for (const revStats of statsLog.toReversed()) {
|
||||||
onStats(revStats);
|
onStats(revStats);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ function onStats(connStats: Misskey.entities.ServerStats) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onStatsLog(statsLog: Misskey.entities.ServerStatsLog) {
|
function onStatsLog(statsLog: Misskey.entities.ServerStatsLog) {
|
||||||
for (const revStats of statsLog.reverse()) {
|
for (const revStats of statsLog.toReversed()) {
|
||||||
onStats(revStats);
|
onStats(revStats);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
|
import { I18n } from '@/scripts/i18n.js';
|
||||||
|
import { ParameterizedString } from '../../../locales/index.js';
|
||||||
|
|
||||||
|
describe('i18n', () => {
|
||||||
|
it('t', () => {
|
||||||
|
const i18n = new I18n({
|
||||||
|
foo: 'foo',
|
||||||
|
bar: {
|
||||||
|
baz: 'baz',
|
||||||
|
qux: 'qux {0}' as unknown as ParameterizedString<'0'>,
|
||||||
|
quux: 'quux {0} {1}' as unknown as ParameterizedString<'0' | '1'>,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(i18n.t('foo')).toBe('foo');
|
||||||
|
expect(i18n.t('bar.baz')).toBe('baz');
|
||||||
|
expect(i18n.tsx.bar.qux({ 0: 'hoge' })).toBe('qux hoge');
|
||||||
|
expect(i18n.tsx.bar.quux({ 0: 'hoge', 1: 'fuga' })).toBe('quux hoge fuga');
|
||||||
|
});
|
||||||
|
it('ts', () => {
|
||||||
|
const i18n = new I18n({
|
||||||
|
foo: 'foo',
|
||||||
|
bar: {
|
||||||
|
baz: 'baz',
|
||||||
|
qux: 'qux {0}' as unknown as ParameterizedString<'0'>,
|
||||||
|
quux: 'quux {0} {1}' as unknown as ParameterizedString<'0' | '1'>,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(i18n.ts.foo).toBe('foo');
|
||||||
|
expect(i18n.ts.bar.baz).toBe('baz');
|
||||||
|
});
|
||||||
|
it('tsx', () => {
|
||||||
|
const i18n = new I18n({
|
||||||
|
foo: 'foo',
|
||||||
|
bar: {
|
||||||
|
baz: 'baz',
|
||||||
|
qux: 'qux {0}' as unknown as ParameterizedString<'0'>,
|
||||||
|
quux: 'quux {0} {1}' as unknown as ParameterizedString<'0' | '1'>,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(i18n.tsx.bar.qux({ 0: 'hoge' })).toBe('qux hoge');
|
||||||
|
expect(i18n.tsx.bar.quux({ 0: 'hoge', 1: 'fuga' })).toBe('quux hoge fuga');
|
||||||
|
});
|
||||||
|
});
|
|
@ -96,15 +96,11 @@ async function generateEndpoints(
|
||||||
endpoint.request = req;
|
endpoint.request = req;
|
||||||
|
|
||||||
const reqType = new EndpointReqMediaType(path, req);
|
const reqType = new EndpointReqMediaType(path, req);
|
||||||
endpointReqMediaTypesSet.add(reqType.getMediaType());
|
if (reqType.getMediaType() !== 'application/json') {
|
||||||
endpointReqMediaTypes.push(reqType);
|
endpointReqMediaTypesSet.add(reqType.getMediaType());
|
||||||
} else {
|
endpointReqMediaTypes.push(reqType);
|
||||||
endpointReqMediaTypesSet.add('application/json');
|
}
|
||||||
endpointReqMediaTypes.push(new EndpointReqMediaType(path, undefined, 'application/json'));
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
endpointReqMediaTypesSet.add('application/json');
|
|
||||||
endpointReqMediaTypes.push(new EndpointReqMediaType(path, undefined, 'application/json'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operation.responses && isResponseObject(operation.responses['200']) && operation.responses['200'].content) {
|
if (operation.responses && isResponseObject(operation.responses['200']) && operation.responses['200'].content) {
|
||||||
|
@ -158,16 +154,19 @@ async function generateEndpoints(
|
||||||
endpointOutputLine.push('');
|
endpointOutputLine.push('');
|
||||||
|
|
||||||
function generateEndpointReqMediaTypesType() {
|
function generateEndpointReqMediaTypesType() {
|
||||||
return `Record<keyof Endpoints, ${[...endpointReqMediaTypesSet].map((t) => `'${t}'`).join(' | ')}>`;
|
return `{ [K in keyof Endpoints]?: ${[...endpointReqMediaTypesSet].map((t) => `'${t}'`).join(' | ')}; }`;
|
||||||
}
|
}
|
||||||
|
|
||||||
endpointOutputLine.push(`export const endpointReqTypes: ${generateEndpointReqMediaTypesType()} = {`);
|
endpointOutputLine.push(`/**
|
||||||
|
* NOTE: The content-type for all endpoints not listed here is application/json.
|
||||||
|
*/`);
|
||||||
|
endpointOutputLine.push('export const endpointReqTypes = {');
|
||||||
|
|
||||||
endpointOutputLine.push(
|
endpointOutputLine.push(
|
||||||
...endpointReqMediaTypes.map(it => '\t' + it.toLine()),
|
...endpointReqMediaTypes.map(it => '\t' + it.toLine()),
|
||||||
);
|
);
|
||||||
|
|
||||||
endpointOutputLine.push('};');
|
endpointOutputLine.push(`} as const satisfies ${generateEndpointReqMediaTypesType()};`);
|
||||||
endpointOutputLine.push('');
|
endpointOutputLine.push('');
|
||||||
|
|
||||||
await writeFile(endpointOutputPath, endpointOutputLine.join('\n'));
|
await writeFile(endpointOutputPath, endpointOutputLine.join('\n'));
|
||||||
|
|
|
@ -56,6 +56,10 @@ export class APIClient {
|
||||||
return obj !== null && typeof obj === 'object' && !Array.isArray(obj);
|
return obj !== null && typeof obj === 'object' && !Array.isArray(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private assertSpecialEpReqType(ep: keyof Endpoints): ep is keyof typeof endpointReqTypes {
|
||||||
|
return ep in endpointReqTypes;
|
||||||
|
}
|
||||||
|
|
||||||
public request<E extends keyof Endpoints, P extends Endpoints[E]['req']>(
|
public request<E extends keyof Endpoints, P extends Endpoints[E]['req']>(
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
params: P = {} as P,
|
params: P = {} as P,
|
||||||
|
@ -63,9 +67,10 @@ export class APIClient {
|
||||||
): Promise<SwitchCaseResponseType<E, P>> {
|
): Promise<SwitchCaseResponseType<E, P>> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let mediaType = 'application/json';
|
let mediaType = 'application/json';
|
||||||
if (endpoint in endpointReqTypes) {
|
if (this.assertSpecialEpReqType(endpoint) && endpointReqTypes[endpoint] != null) {
|
||||||
mediaType = endpointReqTypes[endpoint];
|
mediaType = endpointReqTypes[endpoint];
|
||||||
}
|
}
|
||||||
|
|
||||||
let payload: FormData | string = '{}';
|
let payload: FormData | string = '{}';
|
||||||
|
|
||||||
if (mediaType === 'application/json') {
|
if (mediaType === 'application/json') {
|
||||||
|
@ -100,7 +105,7 @@ export class APIClient {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: payload,
|
body: payload,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': endpointReqTypes[endpoint],
|
'Content-Type': mediaType,
|
||||||
},
|
},
|
||||||
credentials: 'omit',
|
credentials: 'omit',
|
||||||
cache: 'no-cache',
|
cache: 'no-cache',
|
||||||
|
|
|
@ -955,384 +955,9 @@ export type Endpoints = {
|
||||||
'reversi/verify': { req: ReversiVerifyRequest; res: ReversiVerifyResponse };
|
'reversi/verify': { req: ReversiVerifyRequest; res: ReversiVerifyResponse };
|
||||||
}
|
}
|
||||||
|
|
||||||
export const endpointReqTypes: Record<keyof Endpoints, 'application/json' | 'multipart/form-data'> = {
|
/**
|
||||||
'admin/meta': 'application/json',
|
* NOTE: The content-type for all endpoints not listed here is application/json.
|
||||||
'admin/abuse-user-reports': 'application/json',
|
*/
|
||||||
'admin/abuse-report/notification-recipient/list': 'application/json',
|
export const endpointReqTypes = {
|
||||||
'admin/abuse-report/notification-recipient/show': 'application/json',
|
|
||||||
'admin/abuse-report/notification-recipient/create': 'application/json',
|
|
||||||
'admin/abuse-report/notification-recipient/update': 'application/json',
|
|
||||||
'admin/abuse-report/notification-recipient/delete': 'application/json',
|
|
||||||
'admin/accounts/create': 'application/json',
|
|
||||||
'admin/accounts/delete': 'application/json',
|
|
||||||
'admin/accounts/find-by-email': 'application/json',
|
|
||||||
'admin/ad/create': 'application/json',
|
|
||||||
'admin/ad/delete': 'application/json',
|
|
||||||
'admin/ad/list': 'application/json',
|
|
||||||
'admin/ad/update': 'application/json',
|
|
||||||
'admin/announcements/create': 'application/json',
|
|
||||||
'admin/announcements/delete': 'application/json',
|
|
||||||
'admin/announcements/list': 'application/json',
|
|
||||||
'admin/announcements/update': 'application/json',
|
|
||||||
'admin/avatar-decorations/create': 'application/json',
|
|
||||||
'admin/avatar-decorations/delete': 'application/json',
|
|
||||||
'admin/avatar-decorations/list': 'application/json',
|
|
||||||
'admin/avatar-decorations/update': 'application/json',
|
|
||||||
'admin/delete-all-files-of-a-user': 'application/json',
|
|
||||||
'admin/unset-user-avatar': 'application/json',
|
|
||||||
'admin/unset-user-banner': 'application/json',
|
|
||||||
'admin/drive/clean-remote-files': 'application/json',
|
|
||||||
'admin/drive/cleanup': 'application/json',
|
|
||||||
'admin/drive/files': 'application/json',
|
|
||||||
'admin/drive/show-file': 'application/json',
|
|
||||||
'admin/emoji/add-aliases-bulk': 'application/json',
|
|
||||||
'admin/emoji/add': 'application/json',
|
|
||||||
'admin/emoji/copy': 'application/json',
|
|
||||||
'admin/emoji/delete-bulk': 'application/json',
|
|
||||||
'admin/emoji/delete': 'application/json',
|
|
||||||
'admin/emoji/import-zip': 'application/json',
|
|
||||||
'admin/emoji/list-remote': 'application/json',
|
|
||||||
'admin/emoji/list': 'application/json',
|
|
||||||
'admin/emoji/remove-aliases-bulk': 'application/json',
|
|
||||||
'admin/emoji/set-aliases-bulk': 'application/json',
|
|
||||||
'admin/emoji/set-category-bulk': 'application/json',
|
|
||||||
'admin/emoji/set-license-bulk': 'application/json',
|
|
||||||
'admin/emoji/update': 'application/json',
|
|
||||||
'admin/federation/delete-all-files': 'application/json',
|
|
||||||
'admin/federation/refresh-remote-instance-metadata': 'application/json',
|
|
||||||
'admin/federation/remove-all-following': 'application/json',
|
|
||||||
'admin/federation/update-instance': 'application/json',
|
|
||||||
'admin/get-index-stats': 'application/json',
|
|
||||||
'admin/get-table-stats': 'application/json',
|
|
||||||
'admin/get-user-ips': 'application/json',
|
|
||||||
'admin/invite/create': 'application/json',
|
|
||||||
'admin/invite/list': 'application/json',
|
|
||||||
'admin/promo/create': 'application/json',
|
|
||||||
'admin/queue/clear': 'application/json',
|
|
||||||
'admin/queue/deliver-delayed': 'application/json',
|
|
||||||
'admin/queue/inbox-delayed': 'application/json',
|
|
||||||
'admin/queue/promote': 'application/json',
|
|
||||||
'admin/queue/stats': 'application/json',
|
|
||||||
'admin/relays/add': 'application/json',
|
|
||||||
'admin/relays/list': 'application/json',
|
|
||||||
'admin/relays/remove': 'application/json',
|
|
||||||
'admin/reset-password': 'application/json',
|
|
||||||
'admin/resolve-abuse-user-report': 'application/json',
|
|
||||||
'admin/send-email': 'application/json',
|
|
||||||
'admin/server-info': 'application/json',
|
|
||||||
'admin/show-moderation-logs': 'application/json',
|
|
||||||
'admin/show-user': 'application/json',
|
|
||||||
'admin/show-users': 'application/json',
|
|
||||||
'admin/suspend-user': 'application/json',
|
|
||||||
'admin/unsuspend-user': 'application/json',
|
|
||||||
'admin/update-meta': 'application/json',
|
|
||||||
'admin/delete-account': 'application/json',
|
|
||||||
'admin/update-user-note': 'application/json',
|
|
||||||
'admin/roles/create': 'application/json',
|
|
||||||
'admin/roles/delete': 'application/json',
|
|
||||||
'admin/roles/list': 'application/json',
|
|
||||||
'admin/roles/show': 'application/json',
|
|
||||||
'admin/roles/update': 'application/json',
|
|
||||||
'admin/roles/assign': 'application/json',
|
|
||||||
'admin/roles/unassign': 'application/json',
|
|
||||||
'admin/roles/update-default-policies': 'application/json',
|
|
||||||
'admin/roles/users': 'application/json',
|
|
||||||
'admin/system-webhook/create': 'application/json',
|
|
||||||
'admin/system-webhook/delete': 'application/json',
|
|
||||||
'admin/system-webhook/list': 'application/json',
|
|
||||||
'admin/system-webhook/show': 'application/json',
|
|
||||||
'admin/system-webhook/update': 'application/json',
|
|
||||||
'announcements': 'application/json',
|
|
||||||
'announcements/show': 'application/json',
|
|
||||||
'antennas/create': 'application/json',
|
|
||||||
'antennas/delete': 'application/json',
|
|
||||||
'antennas/list': 'application/json',
|
|
||||||
'antennas/notes': 'application/json',
|
|
||||||
'antennas/show': 'application/json',
|
|
||||||
'antennas/update': 'application/json',
|
|
||||||
'ap/get': 'application/json',
|
|
||||||
'ap/show': 'application/json',
|
|
||||||
'app/create': 'application/json',
|
|
||||||
'app/show': 'application/json',
|
|
||||||
'auth/accept': 'application/json',
|
|
||||||
'auth/session/generate': 'application/json',
|
|
||||||
'auth/session/show': 'application/json',
|
|
||||||
'auth/session/userkey': 'application/json',
|
|
||||||
'blocking/create': 'application/json',
|
|
||||||
'blocking/delete': 'application/json',
|
|
||||||
'blocking/list': 'application/json',
|
|
||||||
'channels/create': 'application/json',
|
|
||||||
'channels/featured': 'application/json',
|
|
||||||
'channels/follow': 'application/json',
|
|
||||||
'channels/followed': 'application/json',
|
|
||||||
'channels/owned': 'application/json',
|
|
||||||
'channels/show': 'application/json',
|
|
||||||
'channels/timeline': 'application/json',
|
|
||||||
'channels/unfollow': 'application/json',
|
|
||||||
'channels/update': 'application/json',
|
|
||||||
'channels/favorite': 'application/json',
|
|
||||||
'channels/unfavorite': 'application/json',
|
|
||||||
'channels/my-favorites': 'application/json',
|
|
||||||
'channels/search': 'application/json',
|
|
||||||
'charts/active-users': 'application/json',
|
|
||||||
'charts/ap-request': 'application/json',
|
|
||||||
'charts/drive': 'application/json',
|
|
||||||
'charts/federation': 'application/json',
|
|
||||||
'charts/instance': 'application/json',
|
|
||||||
'charts/notes': 'application/json',
|
|
||||||
'charts/user/drive': 'application/json',
|
|
||||||
'charts/user/following': 'application/json',
|
|
||||||
'charts/user/notes': 'application/json',
|
|
||||||
'charts/user/pv': 'application/json',
|
|
||||||
'charts/user/reactions': 'application/json',
|
|
||||||
'charts/users': 'application/json',
|
|
||||||
'clips/add-note': 'application/json',
|
|
||||||
'clips/remove-note': 'application/json',
|
|
||||||
'clips/create': 'application/json',
|
|
||||||
'clips/delete': 'application/json',
|
|
||||||
'clips/list': 'application/json',
|
|
||||||
'clips/notes': 'application/json',
|
|
||||||
'clips/show': 'application/json',
|
|
||||||
'clips/update': 'application/json',
|
|
||||||
'clips/favorite': 'application/json',
|
|
||||||
'clips/unfavorite': 'application/json',
|
|
||||||
'clips/my-favorites': 'application/json',
|
|
||||||
'drive': 'application/json',
|
|
||||||
'drive/files': 'application/json',
|
|
||||||
'drive/files/attached-notes': 'application/json',
|
|
||||||
'drive/files/check-existence': 'application/json',
|
|
||||||
'drive/files/create': 'multipart/form-data',
|
'drive/files/create': 'multipart/form-data',
|
||||||
'drive/files/delete': 'application/json',
|
} as const satisfies { [K in keyof Endpoints]?: 'multipart/form-data'; };
|
||||||
'drive/files/find-by-hash': 'application/json',
|
|
||||||
'drive/files/find': 'application/json',
|
|
||||||
'drive/files/show': 'application/json',
|
|
||||||
'drive/files/update': 'application/json',
|
|
||||||
'drive/files/upload-from-url': 'application/json',
|
|
||||||
'drive/folders': 'application/json',
|
|
||||||
'drive/folders/create': 'application/json',
|
|
||||||
'drive/folders/delete': 'application/json',
|
|
||||||
'drive/folders/find': 'application/json',
|
|
||||||
'drive/folders/show': 'application/json',
|
|
||||||
'drive/folders/update': 'application/json',
|
|
||||||
'drive/stream': 'application/json',
|
|
||||||
'email-address/available': 'application/json',
|
|
||||||
'endpoint': 'application/json',
|
|
||||||
'endpoints': 'application/json',
|
|
||||||
'export-custom-emojis': 'application/json',
|
|
||||||
'federation/followers': 'application/json',
|
|
||||||
'federation/following': 'application/json',
|
|
||||||
'federation/instances': 'application/json',
|
|
||||||
'federation/show-instance': 'application/json',
|
|
||||||
'federation/update-remote-user': 'application/json',
|
|
||||||
'federation/users': 'application/json',
|
|
||||||
'federation/stats': 'application/json',
|
|
||||||
'following/create': 'application/json',
|
|
||||||
'following/delete': 'application/json',
|
|
||||||
'following/update': 'application/json',
|
|
||||||
'following/update-all': 'application/json',
|
|
||||||
'following/invalidate': 'application/json',
|
|
||||||
'following/requests/accept': 'application/json',
|
|
||||||
'following/requests/cancel': 'application/json',
|
|
||||||
'following/requests/list': 'application/json',
|
|
||||||
'following/requests/reject': 'application/json',
|
|
||||||
'gallery/featured': 'application/json',
|
|
||||||
'gallery/popular': 'application/json',
|
|
||||||
'gallery/posts': 'application/json',
|
|
||||||
'gallery/posts/create': 'application/json',
|
|
||||||
'gallery/posts/delete': 'application/json',
|
|
||||||
'gallery/posts/like': 'application/json',
|
|
||||||
'gallery/posts/show': 'application/json',
|
|
||||||
'gallery/posts/unlike': 'application/json',
|
|
||||||
'gallery/posts/update': 'application/json',
|
|
||||||
'get-online-users-count': 'application/json',
|
|
||||||
'get-avatar-decorations': 'application/json',
|
|
||||||
'hashtags/list': 'application/json',
|
|
||||||
'hashtags/search': 'application/json',
|
|
||||||
'hashtags/show': 'application/json',
|
|
||||||
'hashtags/trend': 'application/json',
|
|
||||||
'hashtags/users': 'application/json',
|
|
||||||
'i': 'application/json',
|
|
||||||
'i/2fa/done': 'application/json',
|
|
||||||
'i/2fa/key-done': 'application/json',
|
|
||||||
'i/2fa/password-less': 'application/json',
|
|
||||||
'i/2fa/register-key': 'application/json',
|
|
||||||
'i/2fa/register': 'application/json',
|
|
||||||
'i/2fa/update-key': 'application/json',
|
|
||||||
'i/2fa/remove-key': 'application/json',
|
|
||||||
'i/2fa/unregister': 'application/json',
|
|
||||||
'i/apps': 'application/json',
|
|
||||||
'i/authorized-apps': 'application/json',
|
|
||||||
'i/claim-achievement': 'application/json',
|
|
||||||
'i/change-password': 'application/json',
|
|
||||||
'i/delete-account': 'application/json',
|
|
||||||
'i/export-blocking': 'application/json',
|
|
||||||
'i/export-following': 'application/json',
|
|
||||||
'i/export-mute': 'application/json',
|
|
||||||
'i/export-notes': 'application/json',
|
|
||||||
'i/export-clips': 'application/json',
|
|
||||||
'i/export-favorites': 'application/json',
|
|
||||||
'i/export-user-lists': 'application/json',
|
|
||||||
'i/export-antennas': 'application/json',
|
|
||||||
'i/favorites': 'application/json',
|
|
||||||
'i/gallery/likes': 'application/json',
|
|
||||||
'i/gallery/posts': 'application/json',
|
|
||||||
'i/import-blocking': 'application/json',
|
|
||||||
'i/import-following': 'application/json',
|
|
||||||
'i/import-muting': 'application/json',
|
|
||||||
'i/import-user-lists': 'application/json',
|
|
||||||
'i/import-antennas': 'application/json',
|
|
||||||
'i/notifications': 'application/json',
|
|
||||||
'i/notifications-grouped': 'application/json',
|
|
||||||
'i/page-likes': 'application/json',
|
|
||||||
'i/pages': 'application/json',
|
|
||||||
'i/pin': 'application/json',
|
|
||||||
'i/read-all-unread-notes': 'application/json',
|
|
||||||
'i/read-announcement': 'application/json',
|
|
||||||
'i/regenerate-token': 'application/json',
|
|
||||||
'i/registry/get-all': 'application/json',
|
|
||||||
'i/registry/get-detail': 'application/json',
|
|
||||||
'i/registry/get': 'application/json',
|
|
||||||
'i/registry/keys-with-type': 'application/json',
|
|
||||||
'i/registry/keys': 'application/json',
|
|
||||||
'i/registry/remove': 'application/json',
|
|
||||||
'i/registry/scopes-with-domain': 'application/json',
|
|
||||||
'i/registry/set': 'application/json',
|
|
||||||
'i/revoke-token': 'application/json',
|
|
||||||
'i/signin-history': 'application/json',
|
|
||||||
'i/unpin': 'application/json',
|
|
||||||
'i/update-email': 'application/json',
|
|
||||||
'i/update': 'application/json',
|
|
||||||
'i/move': 'application/json',
|
|
||||||
'i/webhooks/create': 'application/json',
|
|
||||||
'i/webhooks/list': 'application/json',
|
|
||||||
'i/webhooks/show': 'application/json',
|
|
||||||
'i/webhooks/update': 'application/json',
|
|
||||||
'i/webhooks/delete': 'application/json',
|
|
||||||
'invite/create': 'application/json',
|
|
||||||
'invite/delete': 'application/json',
|
|
||||||
'invite/list': 'application/json',
|
|
||||||
'invite/limit': 'application/json',
|
|
||||||
'meta': 'application/json',
|
|
||||||
'emojis': 'application/json',
|
|
||||||
'emoji': 'application/json',
|
|
||||||
'miauth/gen-token': 'application/json',
|
|
||||||
'mute/create': 'application/json',
|
|
||||||
'mute/delete': 'application/json',
|
|
||||||
'mute/list': 'application/json',
|
|
||||||
'renote-mute/create': 'application/json',
|
|
||||||
'renote-mute/delete': 'application/json',
|
|
||||||
'renote-mute/list': 'application/json',
|
|
||||||
'my/apps': 'application/json',
|
|
||||||
'notes': 'application/json',
|
|
||||||
'notes/children': 'application/json',
|
|
||||||
'notes/clips': 'application/json',
|
|
||||||
'notes/conversation': 'application/json',
|
|
||||||
'notes/create': 'application/json',
|
|
||||||
'notes/delete': 'application/json',
|
|
||||||
'notes/favorites/create': 'application/json',
|
|
||||||
'notes/favorites/delete': 'application/json',
|
|
||||||
'notes/featured': 'application/json',
|
|
||||||
'notes/global-timeline': 'application/json',
|
|
||||||
'notes/hybrid-timeline': 'application/json',
|
|
||||||
'notes/local-timeline': 'application/json',
|
|
||||||
'notes/mentions': 'application/json',
|
|
||||||
'notes/polls/recommendation': 'application/json',
|
|
||||||
'notes/polls/vote': 'application/json',
|
|
||||||
'notes/reactions': 'application/json',
|
|
||||||
'notes/reactions/create': 'application/json',
|
|
||||||
'notes/reactions/delete': 'application/json',
|
|
||||||
'notes/renotes': 'application/json',
|
|
||||||
'notes/replies': 'application/json',
|
|
||||||
'notes/search-by-tag': 'application/json',
|
|
||||||
'notes/search': 'application/json',
|
|
||||||
'notes/show': 'application/json',
|
|
||||||
'notes/state': 'application/json',
|
|
||||||
'notes/thread-muting/create': 'application/json',
|
|
||||||
'notes/thread-muting/delete': 'application/json',
|
|
||||||
'notes/timeline': 'application/json',
|
|
||||||
'notes/translate': 'application/json',
|
|
||||||
'notes/unrenote': 'application/json',
|
|
||||||
'notes/user-list-timeline': 'application/json',
|
|
||||||
'notifications/create': 'application/json',
|
|
||||||
'notifications/flush': 'application/json',
|
|
||||||
'notifications/mark-all-as-read': 'application/json',
|
|
||||||
'notifications/test-notification': 'application/json',
|
|
||||||
'page-push': 'application/json',
|
|
||||||
'pages/create': 'application/json',
|
|
||||||
'pages/delete': 'application/json',
|
|
||||||
'pages/featured': 'application/json',
|
|
||||||
'pages/like': 'application/json',
|
|
||||||
'pages/show': 'application/json',
|
|
||||||
'pages/unlike': 'application/json',
|
|
||||||
'pages/update': 'application/json',
|
|
||||||
'flash/create': 'application/json',
|
|
||||||
'flash/delete': 'application/json',
|
|
||||||
'flash/featured': 'application/json',
|
|
||||||
'flash/like': 'application/json',
|
|
||||||
'flash/show': 'application/json',
|
|
||||||
'flash/unlike': 'application/json',
|
|
||||||
'flash/update': 'application/json',
|
|
||||||
'flash/my': 'application/json',
|
|
||||||
'flash/my-likes': 'application/json',
|
|
||||||
'ping': 'application/json',
|
|
||||||
'pinned-users': 'application/json',
|
|
||||||
'promo/read': 'application/json',
|
|
||||||
'roles/list': 'application/json',
|
|
||||||
'roles/show': 'application/json',
|
|
||||||
'roles/users': 'application/json',
|
|
||||||
'roles/notes': 'application/json',
|
|
||||||
'request-reset-password': 'application/json',
|
|
||||||
'reset-db': 'application/json',
|
|
||||||
'reset-password': 'application/json',
|
|
||||||
'server-info': 'application/json',
|
|
||||||
'stats': 'application/json',
|
|
||||||
'sw/show-registration': 'application/json',
|
|
||||||
'sw/update-registration': 'application/json',
|
|
||||||
'sw/register': 'application/json',
|
|
||||||
'sw/unregister': 'application/json',
|
|
||||||
'test': 'application/json',
|
|
||||||
'username/available': 'application/json',
|
|
||||||
'users': 'application/json',
|
|
||||||
'users/clips': 'application/json',
|
|
||||||
'users/followers': 'application/json',
|
|
||||||
'users/following': 'application/json',
|
|
||||||
'users/gallery/posts': 'application/json',
|
|
||||||
'users/get-frequently-replied-users': 'application/json',
|
|
||||||
'users/featured-notes': 'application/json',
|
|
||||||
'users/lists/create': 'application/json',
|
|
||||||
'users/lists/delete': 'application/json',
|
|
||||||
'users/lists/list': 'application/json',
|
|
||||||
'users/lists/pull': 'application/json',
|
|
||||||
'users/lists/push': 'application/json',
|
|
||||||
'users/lists/show': 'application/json',
|
|
||||||
'users/lists/favorite': 'application/json',
|
|
||||||
'users/lists/unfavorite': 'application/json',
|
|
||||||
'users/lists/update': 'application/json',
|
|
||||||
'users/lists/create-from-public': 'application/json',
|
|
||||||
'users/lists/update-membership': 'application/json',
|
|
||||||
'users/lists/get-memberships': 'application/json',
|
|
||||||
'users/notes': 'application/json',
|
|
||||||
'users/pages': 'application/json',
|
|
||||||
'users/flashs': 'application/json',
|
|
||||||
'users/reactions': 'application/json',
|
|
||||||
'users/recommendation': 'application/json',
|
|
||||||
'users/relation': 'application/json',
|
|
||||||
'users/report-abuse': 'application/json',
|
|
||||||
'users/search-by-username-and-host': 'application/json',
|
|
||||||
'users/search': 'application/json',
|
|
||||||
'users/show': 'application/json',
|
|
||||||
'users/achievements': 'application/json',
|
|
||||||
'users/update-memo': 'application/json',
|
|
||||||
'fetch-rss': 'application/json',
|
|
||||||
'fetch-external-resources': 'application/json',
|
|
||||||
'retention': 'application/json',
|
|
||||||
'bubble-game/register': 'application/json',
|
|
||||||
'bubble-game/ranking': 'application/json',
|
|
||||||
'reversi/cancel-match': 'application/json',
|
|
||||||
'reversi/games': 'application/json',
|
|
||||||
'reversi/match': 'application/json',
|
|
||||||
'reversi/invitations': 'application/json',
|
|
||||||
'reversi/show-game': 'application/json',
|
|
||||||
'reversi/surrender': 'application/json',
|
|
||||||
'reversi/verify': 'application/json',
|
|
||||||
};
|
|
||||||
|
|
|
@ -4248,15 +4248,16 @@ export type components = {
|
||||||
/** @enum {string} */
|
/** @enum {string} */
|
||||||
type: 'roleAssigned';
|
type: 'roleAssigned';
|
||||||
role: components['schemas']['Role'];
|
role: components['schemas']['Role'];
|
||||||
} | {
|
} | ({
|
||||||
/** Format: id */
|
/** Format: id */
|
||||||
id: string;
|
id: string;
|
||||||
/** Format: date-time */
|
/** Format: date-time */
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
/** @enum {string} */
|
/** @enum {string} */
|
||||||
type: 'achievementEarned';
|
type: 'achievementEarned';
|
||||||
achievement: string;
|
/** @enum {string} */
|
||||||
} | {
|
achievement: 'notes1' | 'notes10' | 'notes100' | 'notes500' | 'notes1000' | 'notes5000' | 'notes10000' | 'notes20000' | 'notes30000' | 'notes40000' | 'notes50000' | 'notes60000' | 'notes70000' | 'notes80000' | 'notes90000' | 'notes100000' | 'login3' | 'login7' | 'login15' | 'login30' | 'login60' | 'login100' | 'login200' | 'login300' | 'login400' | 'login500' | 'login600' | 'login700' | 'login800' | 'login900' | 'login1000' | 'passedSinceAccountCreated1' | 'passedSinceAccountCreated2' | 'passedSinceAccountCreated3' | 'loggedInOnBirthday' | 'loggedInOnNewYearsDay' | 'noteClipped1' | 'noteFavorited1' | 'myNoteFavorited1' | 'profileFilled' | 'markedAsCat' | 'following1' | 'following10' | 'following50' | 'following100' | 'following300' | 'followers1' | 'followers10' | 'followers50' | 'followers100' | 'followers300' | 'followers500' | 'followers1000' | 'collectAchievements30' | 'viewAchievements3min' | 'iLoveMisskey' | 'foundTreasure' | 'client30min' | 'client60min' | 'noteDeletedWithin1min' | 'postedAtLateNight' | 'postedAt0min0sec' | 'selfQuote' | 'htl20npm' | 'viewInstanceChart' | 'outputHelloWorldOnScratchpad' | 'open3windows' | 'driveFolderCircularReference' | 'reactWithoutRead' | 'clickedClickHere' | 'justPlainLucky' | 'setNameToSyuilo' | 'cookieClicked' | 'brainDiver' | 'smashTestNotificationButton' | 'tutorialCompleted' | 'bubbleGameExplodingHead' | 'bubbleGameDoubleExplodingHead';
|
||||||
|
}) | ({
|
||||||
/** Format: id */
|
/** Format: id */
|
||||||
id: string;
|
id: string;
|
||||||
/** Format: date-time */
|
/** Format: date-time */
|
||||||
|
@ -4264,9 +4265,9 @@ export type components = {
|
||||||
/** @enum {string} */
|
/** @enum {string} */
|
||||||
type: 'app';
|
type: 'app';
|
||||||
body: string;
|
body: string;
|
||||||
header: string;
|
header: string | null;
|
||||||
icon: string;
|
icon: string | null;
|
||||||
} | {
|
}) | {
|
||||||
/** Format: id */
|
/** Format: id */
|
||||||
id: string;
|
id: string;
|
||||||
/** Format: date-time */
|
/** Format: date-time */
|
||||||
|
@ -4950,6 +4951,7 @@ export type components = {
|
||||||
* @enum {string}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
noteSearchableScope: 'local' | 'global';
|
noteSearchableScope: 'local' | 'global';
|
||||||
|
maxFileSize: number;
|
||||||
};
|
};
|
||||||
MetaDetailedOnly: {
|
MetaDetailedOnly: {
|
||||||
features?: {
|
features?: {
|
||||||
|
@ -8219,7 +8221,7 @@ export type operations = {
|
||||||
/** @description OK (with results) */
|
/** @description OK (with results) */
|
||||||
200: {
|
200: {
|
||||||
content: {
|
content: {
|
||||||
'application/json': ((string | number)[])[];
|
'application/json': [string, number][];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
/** @description Client error */
|
/** @description Client error */
|
||||||
|
@ -8265,7 +8267,7 @@ export type operations = {
|
||||||
/** @description OK (with results) */
|
/** @description OK (with results) */
|
||||||
200: {
|
200: {
|
||||||
content: {
|
content: {
|
||||||
'application/json': ((string | number)[])[];
|
'application/json': [string, number][];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
/** @description Client error */
|
/** @description Client error */
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import * as esbuild from 'esbuild';
|
import * as esbuild from 'esbuild';
|
||||||
import locales from '../../locales/index.js';
|
import locales from '../../locales/index.js';
|
||||||
import meta from '../../package.json' with { type: "json" };
|
import meta from '../../package.json' with { type: 'json' };
|
||||||
const watch = process.argv[2]?.includes('watch');
|
const watch = process.argv[2]?.includes('watch');
|
||||||
|
|
||||||
const __dirname = fileURLToPath(new URL('.', import.meta.url))
|
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
||||||
|
|
||||||
console.log('Starting SW building...');
|
console.log('Starting SW building...');
|
||||||
|
|
||||||
|
|
|
@ -41,11 +41,10 @@ export async function createNotification<K extends keyof PushNotificationDataMap
|
||||||
|
|
||||||
async function composeNotification(data: PushNotificationDataMap[keyof PushNotificationDataMap]): Promise<[string, NotificationOptions] | null> {
|
async function composeNotification(data: PushNotificationDataMap[keyof PushNotificationDataMap]): Promise<[string, NotificationOptions] | null> {
|
||||||
const i18n = await (swLang.i18n ?? swLang.fetchLocale());
|
const i18n = await (swLang.i18n ?? swLang.fetchLocale());
|
||||||
const { t } = i18n;
|
|
||||||
switch (data.type) {
|
switch (data.type) {
|
||||||
/*
|
/*
|
||||||
case 'driveFileCreated': // TODO (Server Side)
|
case 'driveFileCreated': // TODO (Server Side)
|
||||||
return [t('_notification.fileUploaded'), {
|
return [i18n.ts._notification.fileUploaded, {
|
||||||
body: body.name,
|
body: body.name,
|
||||||
icon: body.url,
|
icon: body.url,
|
||||||
data
|
data
|
||||||
|
@ -58,52 +57,52 @@ async function composeNotification(data: PushNotificationDataMap[keyof PushNotif
|
||||||
const account = await getAccountFromId(data.userId);
|
const account = await getAccountFromId(data.userId);
|
||||||
if (!account) return null;
|
if (!account) return null;
|
||||||
const userDetail = await cli.request('users/show', { userId: data.body.userId }, account.token);
|
const userDetail = await cli.request('users/show', { userId: data.body.userId }, account.token);
|
||||||
return [t('_notification.youWereFollowed'), {
|
return [i18n.ts._notification.youWereFollowed, {
|
||||||
body: getUserName(data.body.user),
|
body: getUserName(data.body.user),
|
||||||
icon: data.body.user.avatarUrl,
|
icon: data.body.user.avatarUrl ?? undefined,
|
||||||
badge: iconUrl('user-plus'),
|
badge: iconUrl('user-plus'),
|
||||||
data,
|
data,
|
||||||
actions: userDetail.isFollowing ? [] : [
|
actions: userDetail.isFollowing ? [] : [
|
||||||
{
|
{
|
||||||
action: 'follow',
|
action: 'follow',
|
||||||
title: t('_notification._actions.followBack'),
|
title: i18n.ts._notification._actions.followBack,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'mention':
|
case 'mention':
|
||||||
return [t('_notification.youGotMention', { name: getUserName(data.body.user) }), {
|
return [i18n.tsx._notification.youGotMention({ name: getUserName(data.body.user) }), {
|
||||||
body: data.body.note.text ?? '',
|
body: data.body.note.text ?? '',
|
||||||
icon: data.body.user.avatarUrl,
|
icon: data.body.user.avatarUrl ?? undefined,
|
||||||
badge: iconUrl('at'),
|
badge: iconUrl('at'),
|
||||||
data,
|
data,
|
||||||
actions: [
|
actions: [
|
||||||
{
|
{
|
||||||
action: 'reply',
|
action: 'reply',
|
||||||
title: t('_notification._actions.reply'),
|
title: i18n.ts._notification._actions.reply,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}];
|
}];
|
||||||
|
|
||||||
case 'reply':
|
case 'reply':
|
||||||
return [t('_notification.youGotReply', { name: getUserName(data.body.user) }), {
|
return [i18n.tsx._notification.youGotReply({ name: getUserName(data.body.user) }), {
|
||||||
body: data.body.note.text ?? '',
|
body: data.body.note.text ?? '',
|
||||||
icon: data.body.user.avatarUrl,
|
icon: data.body.user.avatarUrl ?? undefined,
|
||||||
badge: iconUrl('arrow-back-up'),
|
badge: iconUrl('arrow-back-up'),
|
||||||
data,
|
data,
|
||||||
actions: [
|
actions: [
|
||||||
{
|
{
|
||||||
action: 'reply',
|
action: 'reply',
|
||||||
title: t('_notification._actions.reply'),
|
title: i18n.ts._notification._actions.reply,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}];
|
}];
|
||||||
|
|
||||||
case 'renote':
|
case 'renote':
|
||||||
return [t('_notification.youRenoted', { name: getUserName(data.body.user) }), {
|
return [i18n.tsx._notification.youRenoted({ name: getUserName(data.body.user) }), {
|
||||||
body: data.body.note.text ?? '',
|
body: data.body.note.text ?? '',
|
||||||
icon: data.body.user.avatarUrl,
|
icon: data.body.user.avatarUrl ?? undefined,
|
||||||
badge: iconUrl('repeat'),
|
badge: iconUrl('repeat'),
|
||||||
data,
|
data,
|
||||||
actions: [
|
actions: [
|
||||||
|
@ -115,29 +114,29 @@ async function composeNotification(data: PushNotificationDataMap[keyof PushNotif
|
||||||
}];
|
}];
|
||||||
|
|
||||||
case 'quote':
|
case 'quote':
|
||||||
return [t('_notification.youGotQuote', { name: getUserName(data.body.user) }), {
|
return [i18n.tsx._notification.youGotQuote({ name: getUserName(data.body.user) }), {
|
||||||
body: data.body.note.text ?? '',
|
body: data.body.note.text ?? '',
|
||||||
icon: data.body.user.avatarUrl,
|
icon: data.body.user.avatarUrl ?? undefined,
|
||||||
badge: iconUrl('quote'),
|
badge: iconUrl('quote'),
|
||||||
data,
|
data,
|
||||||
actions: [
|
actions: [
|
||||||
{
|
{
|
||||||
action: 'reply',
|
action: 'reply',
|
||||||
title: t('_notification._actions.reply'),
|
title: i18n.ts._notification._actions.reply,
|
||||||
},
|
},
|
||||||
...((data.body.note.visibility === 'public' || data.body.note.visibility === 'home') ? [
|
...((data.body.note.visibility === 'public' || data.body.note.visibility === 'home') ? [
|
||||||
{
|
{
|
||||||
action: 'renote',
|
action: 'renote',
|
||||||
title: t('_notification._actions.renote'),
|
title: i18n.ts._notification._actions.renote,
|
||||||
},
|
},
|
||||||
] : []),
|
] : []),
|
||||||
],
|
],
|
||||||
}];
|
}];
|
||||||
|
|
||||||
case 'note':
|
case 'note':
|
||||||
return [t('_notification.newNote') + ': ' + getUserName(data.body.user), {
|
return [i18n.ts._notification.newNote + ': ' + getUserName(data.body.user), {
|
||||||
body: data.body.note.text ?? '',
|
body: data.body.note.text ?? '',
|
||||||
icon: data.body.user.avatarUrl,
|
icon: data.body.user.avatarUrl ?? undefined,
|
||||||
data,
|
data,
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
@ -164,7 +163,7 @@ async function composeNotification(data: PushNotificationDataMap[keyof PushNotif
|
||||||
const tag = `reaction:${data.body.note.id}`;
|
const tag = `reaction:${data.body.note.id}`;
|
||||||
return [`${reaction} ${getUserName(data.body.user)}`, {
|
return [`${reaction} ${getUserName(data.body.user)}`, {
|
||||||
body: data.body.note.text ?? '',
|
body: data.body.note.text ?? '',
|
||||||
icon: data.body.user.avatarUrl,
|
icon: data.body.user.avatarUrl ?? undefined,
|
||||||
tag,
|
tag,
|
||||||
badge,
|
badge,
|
||||||
data,
|
data,
|
||||||
|
@ -178,41 +177,41 @@ async function composeNotification(data: PushNotificationDataMap[keyof PushNotif
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'receiveFollowRequest':
|
case 'receiveFollowRequest':
|
||||||
return [t('_notification.youReceivedFollowRequest'), {
|
return [i18n.ts._notification.youReceivedFollowRequest, {
|
||||||
body: getUserName(data.body.user),
|
body: getUserName(data.body.user),
|
||||||
icon: data.body.user.avatarUrl,
|
icon: data.body.user.avatarUrl ?? undefined,
|
||||||
badge: iconUrl('user-plus'),
|
badge: iconUrl('user-plus'),
|
||||||
data,
|
data,
|
||||||
actions: [
|
actions: [
|
||||||
{
|
{
|
||||||
action: 'accept',
|
action: 'accept',
|
||||||
title: t('accept'),
|
title: i18n.ts.accept,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
action: 'reject',
|
action: 'reject',
|
||||||
title: t('reject'),
|
title: i18n.ts.reject,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}];
|
}];
|
||||||
|
|
||||||
case 'followRequestAccepted':
|
case 'followRequestAccepted':
|
||||||
return [t('_notification.yourFollowRequestAccepted'), {
|
return [i18n.ts._notification.yourFollowRequestAccepted, {
|
||||||
body: getUserName(data.body.user),
|
body: getUserName(data.body.user),
|
||||||
icon: data.body.user.avatarUrl,
|
icon: data.body.user.avatarUrl ?? undefined,
|
||||||
badge: iconUrl('circle-check'),
|
badge: iconUrl('circle-check'),
|
||||||
data,
|
data,
|
||||||
}];
|
}];
|
||||||
|
|
||||||
case 'achievementEarned':
|
case 'achievementEarned':
|
||||||
return [t('_notification.achievementEarned'), {
|
return [i18n.ts._notification.achievementEarned, {
|
||||||
body: t(`_achievements._types._${data.body.achievement}.title`),
|
body: i18n.ts._achievements._types[`_${data.body.achievement}`].title,
|
||||||
badge: iconUrl('medal'),
|
badge: iconUrl('medal'),
|
||||||
data,
|
data,
|
||||||
tag: `achievement:${data.body.achievement}`,
|
tag: `achievement:${data.body.achievement}`,
|
||||||
}];
|
}];
|
||||||
|
|
||||||
case 'pollEnded':
|
case 'pollEnded':
|
||||||
return [t('_notification.pollEnded'), {
|
return [i18n.ts._notification.pollEnded, {
|
||||||
body: data.body.note.text ?? '',
|
body: data.body.note.text ?? '',
|
||||||
badge: iconUrl('chart-arrows'),
|
badge: iconUrl('chart-arrows'),
|
||||||
data,
|
data,
|
||||||
|
@ -226,8 +225,8 @@ async function composeNotification(data: PushNotificationDataMap[keyof PushNotif
|
||||||
}];
|
}];
|
||||||
|
|
||||||
case 'test':
|
case 'test':
|
||||||
return [t('_notification.testNotification'), {
|
return [i18n.ts._notification.testNotification, {
|
||||||
body: t('_notification.notificationWillBeDisplayedLikeThis'),
|
body: i18n.ts._notification.notificationWillBeDisplayedLikeThis,
|
||||||
badge: iconUrl('bell'),
|
badge: iconUrl('bell'),
|
||||||
data,
|
data,
|
||||||
}];
|
}];
|
||||||
|
@ -236,9 +235,9 @@ async function composeNotification(data: PushNotificationDataMap[keyof PushNotif
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
case 'unreadAntennaNote':
|
case 'unreadAntennaNote':
|
||||||
return [t('_notification.unreadAntennaNote', { name: data.body.antenna.name }), {
|
return [i18n.tsx._notification.unreadAntennaNote({ name: data.body.antenna.name }), {
|
||||||
body: `${getUserName(data.body.note.user)}: ${data.body.note.text ?? ''}`,
|
body: `${getUserName(data.body.note.user)}: ${data.body.note.text ?? ''}`,
|
||||||
icon: data.body.note.user.avatarUrl,
|
icon: data.body.note.user.avatarUrl ?? undefined,
|
||||||
badge: iconUrl('antenna'),
|
badge: iconUrl('antenna'),
|
||||||
tag: `antenna:${data.body.antenna.id}`,
|
tag: `antenna:${data.body.antenna.id}`,
|
||||||
data,
|
data,
|
||||||
|
@ -252,7 +251,6 @@ async function composeNotification(data: PushNotificationDataMap[keyof PushNotif
|
||||||
export async function createEmptyNotification(): Promise<void> {
|
export async function createEmptyNotification(): Promise<void> {
|
||||||
return new Promise<void>(async res => {
|
return new Promise<void>(async res => {
|
||||||
const i18n = await (swLang.i18n ?? swLang.fetchLocale());
|
const i18n = await (swLang.i18n ?? swLang.fetchLocale());
|
||||||
const { t } = i18n;
|
|
||||||
|
|
||||||
await globalThis.registration.showNotification(
|
await globalThis.registration.showNotification(
|
||||||
(new URL(origin)).host,
|
(new URL(origin)).host,
|
||||||
|
@ -264,11 +262,11 @@ export async function createEmptyNotification(): Promise<void> {
|
||||||
actions: [
|
actions: [
|
||||||
{
|
{
|
||||||
action: 'markAllAsRead',
|
action: 'markAllAsRead',
|
||||||
title: t('markAllAsRead'),
|
title: i18n.ts.markAllAsRead,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
action: 'settings',
|
action: 'settings',
|
||||||
title: t('notificationSettings'),
|
title: i18n.ts.notificationSettings,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
data: {},
|
data: {},
|
||||||
|
|
|
@ -4,9 +4,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { get } from 'idb-keyval';
|
import { get } from 'idb-keyval';
|
||||||
|
import * as Misskey from 'misskey-js';
|
||||||
|
|
||||||
export async function getAccountFromId(id: string): Promise<{ token: string; id: string } | void> {
|
export async function getAccountFromId(id: string): Promise<Pick<Misskey.entities.SignupResponse, 'id' | 'token'> | undefined> {
|
||||||
const accounts = await get<{ token: string; id: string }[]>('accounts');
|
const accounts = await get<Pick<Misskey.entities.SignupResponse, 'id' | 'token'>[]>('accounts');
|
||||||
if (!accounts) {
|
if (!accounts) {
|
||||||
console.log('Accounts are not recorded');
|
console.log('Accounts are not recorded');
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
export type Locale = { [key: string]: string | Locale };
|
|
||||||
|
|
||||||
export class I18n<T extends Locale = Locale> {
|
|
||||||
public ts: T;
|
|
||||||
|
|
||||||
constructor(locale: T) {
|
|
||||||
this.ts = locale;
|
|
||||||
|
|
||||||
//#region BIND
|
|
||||||
this.t = this.t.bind(this);
|
|
||||||
//#endregion
|
|
||||||
}
|
|
||||||
|
|
||||||
// string にしているのは、ドット区切りでのパス指定を許可するため
|
|
||||||
// なるべくこのメソッド使うよりもlocale直接参照の方がvueのキャッシュ効いてパフォーマンスが良いかも
|
|
||||||
public t(key: string, args?: Record<string, string>): string {
|
|
||||||
try {
|
|
||||||
let str = key.split('.').reduce<Locale | Locale[keyof Locale]>((o, i) => o[i], this.ts);
|
|
||||||
if (typeof str !== 'string') throw new Error();
|
|
||||||
|
|
||||||
if (args) {
|
|
||||||
for (const [k, v] of Object.entries(args)) {
|
|
||||||
str = str.replace(`{${k}}`, v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
} catch (err) {
|
|
||||||
console.warn(`missing localization '${key}'`);
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -7,7 +7,8 @@
|
||||||
* Language manager for SW
|
* Language manager for SW
|
||||||
*/
|
*/
|
||||||
import { get, set } from 'idb-keyval';
|
import { get, set } from 'idb-keyval';
|
||||||
import { I18n, type Locale } from '@/scripts/i18n.js';
|
import { I18n } from '../../../frontend/src/scripts/i18n.js';
|
||||||
|
import type { Locale } from '../../../../locales/index.js';
|
||||||
|
|
||||||
class SwLang {
|
class SwLang {
|
||||||
public cacheName = `mk-cache-${_VERSION_}`;
|
public cacheName = `mk-cache-${_VERSION_}`;
|
||||||
|
@ -23,7 +24,7 @@ class SwLang {
|
||||||
return this.fetchLocale();
|
return this.fetchLocale();
|
||||||
}
|
}
|
||||||
|
|
||||||
public i18n: Promise<I18n> | null = null;
|
public i18n: Promise<I18n<Locale>> | null = null;
|
||||||
|
|
||||||
public fetchLocale(): Promise<I18n<Locale>> {
|
public fetchLocale(): Promise<I18n<Locale>> {
|
||||||
return (this.i18n = this._fetch());
|
return (this.i18n = this._fetch());
|
||||||
|
|
|
@ -14,15 +14,22 @@ import { getUrlWithLoginId } from '@/scripts/login-id.js';
|
||||||
|
|
||||||
export const cli = new Misskey.api.APIClient({ origin, fetch: (...args): Promise<Response> => fetch(...args) });
|
export const cli = new Misskey.api.APIClient({ origin, fetch: (...args): Promise<Response> => fetch(...args) });
|
||||||
|
|
||||||
export async function api<E extends keyof Misskey.Endpoints, O extends Misskey.Endpoints[E]['req']>(endpoint: E, userId?: string, options?: O): Promise<void | ReturnType<typeof cli.request<E, O>>> {
|
export async function api<
|
||||||
let account: { token: string; id: string } | void = undefined;
|
E extends keyof Misskey.Endpoints,
|
||||||
|
P extends Misskey.Endpoints[E]['req']
|
||||||
|
>(endpoint: E, userId?: string, params?: P): Promise<Misskey.api.SwitchCaseResponseType<E, P> | undefined> {
|
||||||
|
let account: Pick<Misskey.entities.SignupResponse, 'id' | 'token'> | undefined;
|
||||||
|
|
||||||
if (userId) {
|
if (userId) {
|
||||||
account = await getAccountFromId(userId);
|
account = await getAccountFromId(userId);
|
||||||
if (!account) return;
|
if (!account) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cli.request(endpoint, options, account?.token);
|
return (cli.request as <E extends keyof Misskey.Endpoints, P extends Misskey.Endpoints[E]['req']>(
|
||||||
|
endpoint: E,
|
||||||
|
params: P,
|
||||||
|
credential?: string | null,
|
||||||
|
) => Promise<Misskey.api.SwitchCaseResponseType<E, P>>)(endpoint, params, account?.token);
|
||||||
}
|
}
|
||||||
|
|
||||||
// mark-all-as-read送出を1秒間隔に制限する
|
// mark-all-as-read送出を1秒間隔に制限する
|
||||||
|
@ -33,7 +40,7 @@ export function sendMarkAllAsRead(userId: string): Promise<null | undefined | vo
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
readBlockingStatus.set(userId, false);
|
readBlockingStatus.set(userId, false);
|
||||||
api('notifications/mark-all-as-read', userId).then(resolve, resolve);
|
(api('notifications/mark-all-as-read', userId) as Promise<void>).then(resolve, resolve);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
import { get } from 'idb-keyval';
|
import { get } from 'idb-keyval';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import type { PushNotificationDataMap } from '@/types.js';
|
import type { PushNotificationDataMap } from '@/types.js';
|
||||||
import type { I18n, Locale } from '@/scripts/i18n.js';
|
import type { I18n } from '../../frontend/src/scripts/i18n.js';
|
||||||
|
import type { Locale } from '../../../locales/index.js';
|
||||||
import { createEmptyNotification, createNotification } from '@/scripts/create-notification.js';
|
import { createEmptyNotification, createNotification } from '@/scripts/create-notification.js';
|
||||||
import { swLang } from '@/scripts/lang.js';
|
import { swLang } from '@/scripts/lang.js';
|
||||||
import * as swos from '@/scripts/operations.js';
|
import * as swos from '@/scripts/operations.js';
|
||||||
|
@ -30,8 +31,8 @@ globalThis.addEventListener('activate', ev => {
|
||||||
async function offlineContentHTML() {
|
async function offlineContentHTML() {
|
||||||
const i18n = await (swLang.i18n ?? swLang.fetchLocale()) as Partial<I18n<Locale>>;
|
const i18n = await (swLang.i18n ?? swLang.fetchLocale()) as Partial<I18n<Locale>>;
|
||||||
const messages = {
|
const messages = {
|
||||||
title: i18n.ts?._offlineScreen?.title ?? 'Offline - Could not connect to server',
|
title: i18n.ts?._offlineScreen.title ?? 'Offline - Could not connect to server',
|
||||||
header: i18n.ts?._offlineScreen?.header ?? 'Could not connect to server',
|
header: i18n.ts?._offlineScreen.header ?? 'Could not connect to server',
|
||||||
reload: i18n.ts?.reload ?? 'Reload',
|
reload: i18n.ts?.reload ?? 'Reload',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -159,8 +160,8 @@ globalThis.addEventListener('notificationclick', (ev: ServiceWorkerGlobalScopeEv
|
||||||
case 'markAllAsRead':
|
case 'markAllAsRead':
|
||||||
await globalThis.registration.getNotifications()
|
await globalThis.registration.getNotifications()
|
||||||
.then(notifications => notifications.forEach(n => n.tag !== 'read_notification' && n.close()));
|
.then(notifications => notifications.forEach(n => n.tag !== 'read_notification' && n.close()));
|
||||||
await get('accounts').then(accounts => {
|
await get<Pick<Misskey.entities.SignupResponse, 'id' | 'token'>[]>('accounts').then(accounts => {
|
||||||
return Promise.all(accounts.map(async account => {
|
return Promise.all((accounts ?? []).map(async account => {
|
||||||
await swos.sendMarkAllAsRead(account.id);
|
await swos.sendMarkAllAsRead(account.id);
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"noEmitOnError": false,
|
"noEmitOnError": false,
|
||||||
|
"noImplicitAny": false,
|
||||||
"noImplicitReturns": true,
|
"noImplicitReturns": true,
|
||||||
"noUnusedParameters": false,
|
"noUnusedParameters": false,
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
|
|
Loading…
Reference in New Issue