misskey-js側で手動定義されていた型を自動生成された型に移行(ただしapi.jsonがvalidでなくなってしまったので後で修正する)
This commit is contained in:
@@ -36,6 +36,9 @@ import { packedGalleryPostSchema } from '@/models/json-schema/gallery-post.js';
|
|||||||
import { packedEmojiDetailedSchema, packedEmojiSimpleSchema } from '@/models/json-schema/emoji.js';
|
import { packedEmojiDetailedSchema, packedEmojiSimpleSchema } from '@/models/json-schema/emoji.js';
|
||||||
import { packedFlashSchema } from '@/models/json-schema/flash.js';
|
import { packedFlashSchema } from '@/models/json-schema/flash.js';
|
||||||
import { packedAnnouncementSchema } from '@/models/json-schema/announcement.js';
|
import { packedAnnouncementSchema } from '@/models/json-schema/announcement.js';
|
||||||
|
import { enumUserOriginSchema } from '@/models/json-schema/enum-user-origin.js';
|
||||||
|
import { enumUserSortingSchema } from '@/models/json-schema/enum-user-sorting.js';
|
||||||
|
import { enumNotificationTypeSchema } from '@/models/json-schema/enum-notification-type.js';
|
||||||
|
|
||||||
export const refs = {
|
export const refs = {
|
||||||
UserLite: packedUserLiteSchema,
|
UserLite: packedUserLiteSchema,
|
||||||
@@ -71,6 +74,11 @@ export const refs = {
|
|||||||
EmojiSimple: packedEmojiSimpleSchema,
|
EmojiSimple: packedEmojiSimpleSchema,
|
||||||
EmojiDetailed: packedEmojiDetailedSchema,
|
EmojiDetailed: packedEmojiDetailedSchema,
|
||||||
Flash: packedFlashSchema,
|
Flash: packedFlashSchema,
|
||||||
|
|
||||||
|
// enum
|
||||||
|
UserOrigin: enumUserOriginSchema,
|
||||||
|
UserSorting: enumUserSortingSchema,
|
||||||
|
NotificationType: enumNotificationTypeSchema,
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Packed<x extends keyof typeof refs> = SchemaType<typeof refs[x]>;
|
export type Packed<x extends keyof typeof refs> = SchemaType<typeof refs[x]>;
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { notificationTypes } from '@/types.js';
|
||||||
|
|
||||||
|
export const enumNotificationTypeSchema = {
|
||||||
|
type: 'string',
|
||||||
|
enum: [...notificationTypes, 'reaction:grouped', 'renote:grouped'],
|
||||||
|
} as const;
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const enumUserOriginSchema = {
|
||||||
|
type: 'string',
|
||||||
|
enum: ['combined', 'local', 'remote'],
|
||||||
|
} as const;
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const enumUserSortingSchema = {
|
||||||
|
type: 'string',
|
||||||
|
enum: [
|
||||||
|
'+follower',
|
||||||
|
'-follower',
|
||||||
|
'+createdAt',
|
||||||
|
'-createdAt',
|
||||||
|
'+updatedAt',
|
||||||
|
'-updatedAt',
|
||||||
|
],
|
||||||
|
} as const;
|
||||||
@@ -21,7 +21,7 @@ export const packedNotificationSchema = {
|
|||||||
type: {
|
type: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
enum: [...notificationTypes, 'reaction:grouped', 'renote:grouped'],
|
ref: 'NotificationType',
|
||||||
},
|
},
|
||||||
user: {
|
user: {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
|
|||||||
@@ -85,8 +85,8 @@ export const paramDef = {
|
|||||||
sinceId: { type: 'string', format: 'misskey:id' },
|
sinceId: { type: 'string', format: 'misskey:id' },
|
||||||
untilId: { type: 'string', format: 'misskey:id' },
|
untilId: { type: 'string', format: 'misskey:id' },
|
||||||
state: { type: 'string', nullable: true, default: null },
|
state: { type: 'string', nullable: true, default: null },
|
||||||
reporterOrigin: { type: 'string', enum: ['combined', 'local', 'remote'], default: 'combined' },
|
reporterOrigin: { type: 'string', ref: 'UserOrigin', default: 'combined' },
|
||||||
targetUserOrigin: { type: 'string', enum: ['combined', 'local', 'remote'], default: 'combined' },
|
targetUserOrigin: { type: 'string', ref: 'UserOrigin', default: 'combined' },
|
||||||
forwarded: { type: 'boolean', default: false },
|
forwarded: { type: 'boolean', default: false },
|
||||||
},
|
},
|
||||||
required: [],
|
required: [],
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export const paramDef = {
|
|||||||
untilId: { type: 'string', format: 'misskey:id' },
|
untilId: { type: 'string', format: 'misskey:id' },
|
||||||
userId: { type: 'string', format: 'misskey:id', nullable: true },
|
userId: { type: 'string', format: 'misskey:id', nullable: true },
|
||||||
type: { type: 'string', nullable: true, pattern: /^[a-zA-Z0-9\/\-*]+$/.toString().slice(1, -1) },
|
type: { type: 'string', nullable: true, pattern: /^[a-zA-Z0-9\/\-*]+$/.toString().slice(1, -1) },
|
||||||
origin: { type: 'string', enum: ['combined', 'local', 'remote'], default: 'local' },
|
origin: { type: 'string', ref: 'UserOrigin', default: 'local' },
|
||||||
hostname: {
|
hostname: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
|||||||
@@ -327,6 +327,82 @@ export const meta = {
|
|||||||
type: 'number',
|
type: 'number',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
},
|
},
|
||||||
|
backgroundImageUrl: {
|
||||||
|
type: 'string',
|
||||||
|
optional: false, nullable: true,
|
||||||
|
},
|
||||||
|
deeplAuthKey: {
|
||||||
|
type: 'string',
|
||||||
|
optional: false, nullable: true,
|
||||||
|
},
|
||||||
|
deeplIsPro: {
|
||||||
|
type: 'boolean',
|
||||||
|
optional: false, nullable: false,
|
||||||
|
},
|
||||||
|
defaultDarkTheme: {
|
||||||
|
type: 'string',
|
||||||
|
optional: false, nullable: true,
|
||||||
|
},
|
||||||
|
defaultLightTheme: {
|
||||||
|
type: 'string',
|
||||||
|
optional: false, nullable: true,
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
type: 'string',
|
||||||
|
optional: false, nullable: true,
|
||||||
|
},
|
||||||
|
disableRegistration: {
|
||||||
|
type: 'boolean',
|
||||||
|
optional: false, nullable: false,
|
||||||
|
},
|
||||||
|
impressumUrl: {
|
||||||
|
type: 'string',
|
||||||
|
optional: false, nullable: true,
|
||||||
|
},
|
||||||
|
maintainerEmail: {
|
||||||
|
type: 'string',
|
||||||
|
optional: false, nullable: true,
|
||||||
|
},
|
||||||
|
maintainerName: {
|
||||||
|
type: 'string',
|
||||||
|
optional: false, nullable: true,
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
type: 'string',
|
||||||
|
optional: false, nullable: true,
|
||||||
|
},
|
||||||
|
objectStorageS3ForcePathStyle: {
|
||||||
|
type: 'boolean',
|
||||||
|
optional: false, nullable: false,
|
||||||
|
},
|
||||||
|
privacyPolicyUrl: {
|
||||||
|
type: 'string',
|
||||||
|
optional: false, nullable: true,
|
||||||
|
},
|
||||||
|
repositoryUrl: {
|
||||||
|
type: 'string',
|
||||||
|
optional: false, nullable: false,
|
||||||
|
},
|
||||||
|
summalyProxy: {
|
||||||
|
type: 'string',
|
||||||
|
optional: false, nullable: true,
|
||||||
|
},
|
||||||
|
themeColor: {
|
||||||
|
type: 'string',
|
||||||
|
optional: false, nullable: true,
|
||||||
|
},
|
||||||
|
tosUrl: {
|
||||||
|
type: 'string',
|
||||||
|
optional: false, nullable: true,
|
||||||
|
},
|
||||||
|
uri: {
|
||||||
|
type: 'string',
|
||||||
|
optional: false, nullable: false,
|
||||||
|
},
|
||||||
|
version: {
|
||||||
|
type: 'string',
|
||||||
|
optional: false, nullable: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export const paramDef = {
|
|||||||
offset: { type: 'integer', default: 0 },
|
offset: { type: 'integer', default: 0 },
|
||||||
sort: { type: 'string', enum: ['+follower', '-follower', '+createdAt', '-createdAt', '+updatedAt', '-updatedAt', '+lastActiveDate', '-lastActiveDate'] },
|
sort: { type: 'string', enum: ['+follower', '-follower', '+createdAt', '-createdAt', '+updatedAt', '-updatedAt', '+lastActiveDate', '-lastActiveDate'] },
|
||||||
state: { type: 'string', enum: ['all', 'alive', 'available', 'admin', 'moderator', 'adminOrModerator', 'suspended'], default: 'all' },
|
state: { type: 'string', enum: ['all', 'alive', 'available', 'admin', 'moderator', 'adminOrModerator', 'suspended'], default: 'all' },
|
||||||
origin: { type: 'string', enum: ['combined', 'local', 'remote'], default: 'combined' },
|
origin: { type: 'string', ref: 'UserOrigin', default: 'combined' },
|
||||||
username: { type: 'string', nullable: true, default: null },
|
username: { type: 'string', nullable: true, default: null },
|
||||||
hostname: {
|
hostname: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
|||||||
@@ -36,13 +36,32 @@ export const paramDef = {
|
|||||||
blocked: { type: 'boolean', nullable: true },
|
blocked: { type: 'boolean', nullable: true },
|
||||||
notResponding: { type: 'boolean', nullable: true },
|
notResponding: { type: 'boolean', nullable: true },
|
||||||
suspended: { type: 'boolean', nullable: true },
|
suspended: { type: 'boolean', nullable: true },
|
||||||
silenced: { type: "boolean", nullable: true },
|
silenced: { type: 'boolean', nullable: true },
|
||||||
federating: { type: 'boolean', nullable: true },
|
federating: { type: 'boolean', nullable: true },
|
||||||
subscribing: { type: 'boolean', nullable: true },
|
subscribing: { type: 'boolean', nullable: true },
|
||||||
publishing: { type: 'boolean', nullable: true },
|
publishing: { type: 'boolean', nullable: true },
|
||||||
limit: { type: 'integer', minimum: 1, maximum: 100, default: 30 },
|
limit: { type: 'integer', minimum: 1, maximum: 100, default: 30 },
|
||||||
offset: { type: 'integer', default: 0 },
|
offset: { type: 'integer', default: 0 },
|
||||||
sort: { type: 'string' },
|
sort: {
|
||||||
|
type: 'string',
|
||||||
|
optional: true, nullable: true,
|
||||||
|
enum: [
|
||||||
|
'+pubSub',
|
||||||
|
'-pubSub',
|
||||||
|
'+notes',
|
||||||
|
'-notes',
|
||||||
|
'+users',
|
||||||
|
'-users',
|
||||||
|
'+following',
|
||||||
|
'-following',
|
||||||
|
'+followers',
|
||||||
|
'-followers',
|
||||||
|
'+firstRetrievedAt',
|
||||||
|
'-firstRetrievedAt',
|
||||||
|
'+latestRequestReceivedAt',
|
||||||
|
'-latestRequestReceivedAt',
|
||||||
|
],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
required: [],
|
required: [],
|
||||||
} as const;
|
} as const;
|
||||||
@@ -103,18 +122,18 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof ps.silenced === "boolean") {
|
if (typeof ps.silenced === 'boolean') {
|
||||||
const meta = await this.metaService.fetch(true);
|
const meta = await this.metaService.fetch(true);
|
||||||
|
|
||||||
if (ps.silenced) {
|
if (ps.silenced) {
|
||||||
if (meta.silencedHosts.length === 0) {
|
if (meta.silencedHosts.length === 0) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
query.andWhere("instance.host IN (:...silences)", {
|
query.andWhere('instance.host IN (:...silences)', {
|
||||||
silences: meta.silencedHosts,
|
silences: meta.silencedHosts,
|
||||||
});
|
});
|
||||||
} else if (meta.silencedHosts.length > 0) {
|
} else if (meta.silencedHosts.length > 0) {
|
||||||
query.andWhere("instance.host NOT IN (:...silences)", {
|
query.andWhere('instance.host NOT IN (:...silences)', {
|
||||||
silences: meta.silencedHosts,
|
silences: meta.silencedHosts,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ export const paramDef = {
|
|||||||
properties: {
|
properties: {
|
||||||
tag: { type: 'string' },
|
tag: { type: 'string' },
|
||||||
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
|
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
|
||||||
sort: { type: 'string', enum: ['+follower', '-follower', '+createdAt', '-createdAt', '+updatedAt', '-updatedAt'] },
|
sort: { type: 'string', ref: 'UserSorting' },
|
||||||
state: { type: 'string', enum: ['all', 'alive'], default: 'all' },
|
state: { type: 'string', enum: ['all', 'alive'], default: 'all' },
|
||||||
origin: { type: 'string', enum: ['combined', 'local', 'remote'], default: 'local' },
|
origin: { type: 'string', ref: 'UserOrigin', default: 'local' },
|
||||||
},
|
},
|
||||||
required: ['tag', 'sort'],
|
required: ['tag', 'sort'],
|
||||||
} as const;
|
} as const;
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ export const meta = {
|
|||||||
items: {
|
items: {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
|
ref: 'InviteCode',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|||||||
@@ -250,6 +250,33 @@ export const meta = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
backgroundImageUrl: {
|
||||||
|
type: 'string',
|
||||||
|
optional: false, nullable: true,
|
||||||
|
},
|
||||||
|
impressumUrl: {
|
||||||
|
type: 'string',
|
||||||
|
optional: false, nullable: true,
|
||||||
|
},
|
||||||
|
logoImageUrl: {
|
||||||
|
type: 'string',
|
||||||
|
optional: false, nullable: true,
|
||||||
|
},
|
||||||
|
privacyPolicyUrl: {
|
||||||
|
type: 'string',
|
||||||
|
optional: false, nullable: true,
|
||||||
|
},
|
||||||
|
serverRules: {
|
||||||
|
type: 'array',
|
||||||
|
optional: false, nullable: false,
|
||||||
|
items: {
|
||||||
|
type: 'string',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
themeColor: {
|
||||||
|
type: 'string',
|
||||||
|
optional: false, nullable: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ export const paramDef = {
|
|||||||
properties: {
|
properties: {
|
||||||
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
|
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
|
||||||
offset: { type: 'integer', default: 0 },
|
offset: { type: 'integer', default: 0 },
|
||||||
sort: { type: 'string', enum: ['+follower', '-follower', '+createdAt', '-createdAt', '+updatedAt', '-updatedAt'] },
|
sort: { type: 'string', ref: 'UserSorting' },
|
||||||
state: { type: 'string', enum: ['all', 'alive'], default: 'all' },
|
state: { type: 'string', enum: ['all', 'alive'], default: 'all' },
|
||||||
origin: { type: 'string', enum: ['combined', 'local', 'remote'], default: 'local' },
|
origin: { type: 'string', ref: 'UserOrigin', default: 'local' },
|
||||||
hostname: {
|
hostname: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export const paramDef = {
|
|||||||
query: { type: 'string' },
|
query: { type: 'string' },
|
||||||
offset: { type: 'integer', default: 0 },
|
offset: { type: 'integer', default: 0 },
|
||||||
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
|
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
|
||||||
origin: { type: 'string', enum: ['local', 'remote', 'combined'], default: 'combined' },
|
origin: { type: 'string', ref: 'UserOrigin', default: 'combined' },
|
||||||
detail: { type: 'boolean', default: true },
|
detail: { type: 'boolean', default: true },
|
||||||
},
|
},
|
||||||
required: ['query'],
|
required: ['query'],
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ const size = computed(() => props.asReactionPicker ? reactionPickerSize.value :
|
|||||||
const width = computed(() => props.asReactionPicker ? reactionPickerWidth.value : 3);
|
const width = computed(() => props.asReactionPicker ? reactionPickerWidth.value : 3);
|
||||||
const height = computed(() => props.asReactionPicker ? reactionPickerHeight.value : 2);
|
const height = computed(() => props.asReactionPicker ? reactionPickerHeight.value : 2);
|
||||||
const q = ref<string>('');
|
const q = ref<string>('');
|
||||||
const searchResultCustom = ref<Misskey.entities.CustomEmoji[]>([]);
|
const searchResultCustom = ref<Misskey.entities.EmojiSimple[]>([]);
|
||||||
const searchResultUnicode = ref<UnicodeEmojiDef[]>([]);
|
const searchResultUnicode = ref<UnicodeEmojiDef[]>([]);
|
||||||
const tab = ref<'index' | 'custom' | 'unicode' | 'tags'>('index');
|
const tab = ref<'index' | 'custom' | 'unicode' | 'tags'>('index');
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ watch(q, () => {
|
|||||||
const searchCustom = () => {
|
const searchCustom = () => {
|
||||||
const max = 100;
|
const max = 100;
|
||||||
const emojis = customEmojis.value;
|
const emojis = customEmojis.value;
|
||||||
const matches = new Set<Misskey.entities.CustomEmoji>();
|
const matches = new Set<Misskey.entities.EmojiSimple>();
|
||||||
|
|
||||||
const exactMatch = emojis.find(emoji => emoji.name === newQ);
|
const exactMatch = emojis.find(emoji => emoji.name === newQ);
|
||||||
if (exactMatch) matches.add(exactMatch);
|
if (exactMatch) matches.add(exactMatch);
|
||||||
@@ -288,7 +288,7 @@ watch(q, () => {
|
|||||||
searchResultUnicode.value = Array.from(searchUnicode());
|
searchResultUnicode.value = Array.from(searchUnicode());
|
||||||
});
|
});
|
||||||
|
|
||||||
function filterAvailable(emoji: Misskey.entities.CustomEmoji): boolean {
|
function filterAvailable(emoji: Misskey.entities.EmojiSimple): boolean {
|
||||||
return (emoji.roleIdsThatCanBeUsedThisEmojiAsReaction == null || emoji.roleIdsThatCanBeUsedThisEmojiAsReaction.length === 0) || ($i && $i.roles.some(r => emoji.roleIdsThatCanBeUsedThisEmojiAsReaction.includes(r.id)));
|
return (emoji.roleIdsThatCanBeUsedThisEmojiAsReaction == null || emoji.roleIdsThatCanBeUsedThisEmojiAsReaction.length === 0) || ($i && $i.roles.some(r => emoji.roleIdsThatCanBeUsedThisEmojiAsReaction.includes(r.id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -305,7 +305,7 @@ function reset() {
|
|||||||
q.value = '';
|
q.value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getKey(emoji: string | Misskey.entities.CustomEmoji | UnicodeEmojiDef): string {
|
function getKey(emoji: string | Misskey.entities.EmojiSimple | UnicodeEmojiDef): string {
|
||||||
return typeof emoji === 'string' ? emoji : 'char' in emoji ? emoji.char : `:${emoji.name}:`;
|
return typeof emoji === 'string' ? emoji : 'char' in emoji ? emoji.char : `:${emoji.name}:`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,15 +21,15 @@ import * as os from '@/os.js';
|
|||||||
import { getProxiedImageUrlNullable } from '@/scripts/media-proxy.js';
|
import { getProxiedImageUrlNullable } from '@/scripts/media-proxy.js';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
instance: Misskey.entities.Instance;
|
instance: Misskey.entities.FederationInstance;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
let chartValues = $ref<number[] | null>(null);
|
let chartValues = $ref<number[] | null>(null);
|
||||||
|
|
||||||
os.apiGet('charts/instance', { host: props.instance.host, limit: 16 + 1, span: 'day' }).then(res => {
|
os.apiGet('charts/instance', { host: props.instance.host, limit: 16 + 1, span: 'day' }).then(res => {
|
||||||
// 今日のぶんの値はまだ途中の値であり、それも含めると大抵の場合前日よりも下降しているようなグラフになってしまうため今日は弾く
|
// 今日のぶんの値はまだ途中の値であり、それも含めると大抵の場合前日よりも下降しているようなグラフになってしまうため今日は弾く
|
||||||
res.requests.received.splice(0, 1);
|
res['requests.received'].splice(0, 1);
|
||||||
chartValues = res.requests.received;
|
chartValues = res['requests.received'];
|
||||||
});
|
});
|
||||||
|
|
||||||
function getInstanceIcon(instance): string {
|
function getInstanceIcon(instance): string {
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ import { i18n } from '@/i18n.js';
|
|||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
invite: Misskey.entities.Invite;
|
invite: Misskey.entities.InviteCode;
|
||||||
moderator?: boolean;
|
moderator?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
|||||||
@@ -67,15 +67,14 @@ import number from '@/filters/number.js';
|
|||||||
import MkNumber from '@/components/MkNumber.vue';
|
import MkNumber from '@/components/MkNumber.vue';
|
||||||
import XActiveUsersChart from '@/components/MkVisitorDashboard.ActiveUsersChart.vue';
|
import XActiveUsersChart from '@/components/MkVisitorDashboard.ActiveUsersChart.vue';
|
||||||
|
|
||||||
let meta = $ref<Misskey.entities.Instance>();
|
let meta = $ref<Misskey.entities.MetaResponse | null>(null);
|
||||||
let stats = $ref(null);
|
let stats = $ref<Misskey.entities.StatsResponse | null>(null);
|
||||||
|
|
||||||
os.api('meta', { detail: true }).then(_meta => {
|
os.api('meta', { detail: true }).then(_meta => {
|
||||||
meta = _meta;
|
meta = _meta;
|
||||||
});
|
});
|
||||||
|
|
||||||
os.api('stats', {
|
os.api('stats', {}).then((res) => {
|
||||||
}).then((res) => {
|
|
||||||
stats = res;
|
stats = res;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { useStream } from '@/stream.js';
|
|||||||
import { get, set } from '@/scripts/idb-proxy.js';
|
import { get, set } from '@/scripts/idb-proxy.js';
|
||||||
|
|
||||||
const storageCache = await get('emojis');
|
const storageCache = await get('emojis');
|
||||||
export const customEmojis = shallowRef<Misskey.entities.CustomEmoji[]>(Array.isArray(storageCache) ? storageCache : []);
|
export const customEmojis = shallowRef<Misskey.entities.EmojiSimple[]>(Array.isArray(storageCache) ? storageCache : []);
|
||||||
export const customEmojiCategories = computed<[ ...string[], null ]>(() => {
|
export const customEmojiCategories = computed<[ ...string[], null ]>(() => {
|
||||||
const categories = new Set<string>();
|
const categories = new Set<string>();
|
||||||
for (const emoji of customEmojis.value) {
|
for (const emoji of customEmojis.value) {
|
||||||
@@ -21,7 +21,7 @@ export const customEmojiCategories = computed<[ ...string[], null ]>(() => {
|
|||||||
return markRaw([...Array.from(categories), null]);
|
return markRaw([...Array.from(categories), null]);
|
||||||
});
|
});
|
||||||
|
|
||||||
export const customEmojisMap = new Map<string, Misskey.entities.CustomEmoji>();
|
export const customEmojisMap = new Map<string, Misskey.entities.EmojiSimple>();
|
||||||
watch(customEmojis, emojis => {
|
watch(customEmojis, emojis => {
|
||||||
customEmojisMap.clear();
|
customEmojisMap.clear();
|
||||||
for (const emoji of emojis) {
|
for (const emoji of emojis) {
|
||||||
@@ -38,7 +38,7 @@ stream.on('emojiAdded', emojiData => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
stream.on('emojiUpdated', emojiData => {
|
stream.on('emojiUpdated', emojiData => {
|
||||||
customEmojis.value = customEmojis.value.map(item => emojiData.emojis.find(search => search.name === item.name) as Misskey.entities.CustomEmoji ?? item);
|
customEmojis.value = customEmojis.value.map(item => emojiData.emojis.find(search => search.name === item.name) as Misskey.entities.EmojiSimple ?? item);
|
||||||
set('emojis', customEmojis.value);
|
set('emojis', customEmojis.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const cached = miLocalStorage.getItem('instance');
|
|||||||
|
|
||||||
// TODO: instanceをリアクティブにするかは再考の余地あり
|
// TODO: instanceをリアクティブにするかは再考の余地あり
|
||||||
|
|
||||||
export const instance: Misskey.entities.InstanceMetadata = reactive(cached ? JSON.parse(cached) : {
|
export const instance: Misskey.entities.MetaResponse = reactive(cached ? JSON.parse(cached) : {
|
||||||
// TODO: set default values
|
// TODO: set default values
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ import { $i } from '@/account.js';
|
|||||||
|
|
||||||
const customEmojiTags = getCustomEmojiTags();
|
const customEmojiTags = getCustomEmojiTags();
|
||||||
let q = $ref('');
|
let q = $ref('');
|
||||||
let searchEmojis = $ref<Misskey.entities.CustomEmoji[]>(null);
|
let searchEmojis = $ref<Misskey.entities.EmojiSimple[]>(null);
|
||||||
let selectedTags = $ref(new Set());
|
let selectedTags = $ref(new Set());
|
||||||
|
|
||||||
function search() {
|
function search() {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import * as os from '@/os.js';
|
|||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
session: Misskey.entities.AuthSession;
|
session: Misskey.entities.AuthSessionShowResponse;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ const props = defineProps<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
let state = $ref<'waiting' | 'accepted' | 'fetch-session-error' | 'denied' | null>(null);
|
let state = $ref<'waiting' | 'accepted' | 'fetch-session-error' | 'denied' | null>(null);
|
||||||
let session = $ref<Misskey.entities.AuthSession | null>(null);
|
let session = $ref<Misskey.entities.AuthSessionShowResponse | null>(null);
|
||||||
|
|
||||||
function accepted() {
|
function accepted() {
|
||||||
state = 'accepted';
|
state = 'accepted';
|
||||||
|
|||||||
@@ -144,8 +144,8 @@ const props = defineProps<{
|
|||||||
|
|
||||||
let tab = $ref('overview');
|
let tab = $ref('overview');
|
||||||
let chartSrc = $ref('instance-requests');
|
let chartSrc = $ref('instance-requests');
|
||||||
let meta = $ref<Misskey.entities.AdminInstanceMetadata | null>(null);
|
let meta = $ref<Misskey.entities.AdminMetaResponse | null>(null);
|
||||||
let instance = $ref<Misskey.entities.Instance | null>(null);
|
let instance = $ref<Misskey.entities.FederationInstance | null>(null);
|
||||||
let suspended = $ref(false);
|
let suspended = $ref(false);
|
||||||
let isBlocked = $ref(false);
|
let isBlocked = $ref(false);
|
||||||
let isSilenced = $ref(false);
|
let isSilenced = $ref(false);
|
||||||
@@ -169,10 +169,10 @@ async function fetch(): Promise<void> {
|
|||||||
instance = await os.api('federation/show-instance', {
|
instance = await os.api('federation/show-instance', {
|
||||||
host: props.host,
|
host: props.host,
|
||||||
});
|
});
|
||||||
suspended = instance.isSuspended;
|
suspended = instance?.isSuspended ?? false;
|
||||||
isBlocked = instance.isBlocked;
|
isBlocked = instance?.isBlocked ?? false;
|
||||||
isSilenced = instance.isSilenced;
|
isSilenced = instance?.isSilenced ?? false;
|
||||||
faviconUrl = getProxiedImageUrlNullable(instance.faviconUrl, 'preview') ?? getProxiedImageUrlNullable(instance.iconUrl, 'preview');
|
faviconUrl = getProxiedImageUrlNullable(instance?.faviconUrl, 'preview') ?? getProxiedImageUrlNullable(instance?.iconUrl, 'preview');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function toggleBlock(): Promise<void> {
|
async function toggleBlock(): Promise<void> {
|
||||||
@@ -188,8 +188,9 @@ async function toggleSilenced(): Promise<void> {
|
|||||||
if (!meta) throw new Error('No meta?');
|
if (!meta) throw new Error('No meta?');
|
||||||
if (!instance) throw new Error('No instance?');
|
if (!instance) throw new Error('No instance?');
|
||||||
const { host } = instance;
|
const { host } = instance;
|
||||||
|
const silencedHosts = meta.silencedHosts ?? [];
|
||||||
await os.api('admin/update-meta', {
|
await os.api('admin/update-meta', {
|
||||||
silencedHosts: isSilenced ? meta.silencedHosts.concat([host]) : meta.silencedHosts.filter(x => x !== host),
|
silencedHosts: isSilenced ? silencedHosts.concat([host]) : silencedHosts.filter(x => x !== host),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
<MkPagination ref="pagingComponent" :pagination="pagination">
|
<MkPagination ref="pagingComponent" :pagination="pagination">
|
||||||
<template #default="{ items }">
|
<template #default="{ items }">
|
||||||
<div class="_gaps_s">
|
<div class="_gaps_s">
|
||||||
<MkInviteCode v-for="item in (items as Misskey.entities.Invite[])" :key="item.id" :invite="item" :onDeleted="deleted"/>
|
<MkInviteCode v-for="item in (items as Misskey.entities.InviteCode[])" :key="item.id" :invite="item" :onDeleted="deleted"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</MkPagination>
|
</MkPagination>
|
||||||
|
|||||||
@@ -48,11 +48,15 @@ import MkNumber from '@/components/MkNumber.vue';
|
|||||||
import MkVisitorDashboard from '@/components/MkVisitorDashboard.vue';
|
import MkVisitorDashboard from '@/components/MkVisitorDashboard.vue';
|
||||||
import { getProxiedImageUrl } from '@/scripts/media-proxy.js';
|
import { getProxiedImageUrl } from '@/scripts/media-proxy.js';
|
||||||
|
|
||||||
let meta = $ref<Misskey.entities.Instance>();
|
let meta = $ref<Misskey.entities.MetaResponse>();
|
||||||
let instances = $ref<any[]>();
|
let instances = $ref<Misskey.entities.FederationInstance[]>();
|
||||||
|
|
||||||
function getInstanceIcon(instance): string {
|
function getInstanceIcon(instance: Misskey.entities.FederationInstance): string {
|
||||||
return getProxiedImageUrl(instance.iconUrl, 'preview');
|
if (!instance.iconUrl) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return getProxiedImageUrl(instance.iconUrl, 'preview');
|
||||||
}
|
}
|
||||||
|
|
||||||
os.api('meta', { detail: true }).then(_meta => {
|
os.api('meta', { detail: true }).then(_meta => {
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ const props = defineProps<{
|
|||||||
refreshIntervalSec?: number;
|
refreshIntervalSec?: number;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const instances = ref<Misskey.entities.Instance[]>([]);
|
const instances = ref<Misskey.entities.FederationInstance[]>([]);
|
||||||
const fetching = ref(true);
|
const fetching = ref(true);
|
||||||
let key = $ref(0);
|
let key = $ref(0);
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user