From 209fee7a6df249a32a65e19d87510ae672a2f58b Mon Sep 17 00:00:00 2001 From: naskya Date: Fri, 29 Dec 2023 05:53:16 +0900 Subject: [PATCH] chore: format --- packages/backend/src/misc/populate-emojis.ts | 8 +- packages/backend/src/misc/schema.ts | 122 +++++++++--------- .../backend/src/models/entities/muted-note.ts | 2 +- packages/backend/src/models/entities/note.ts | 2 +- .../src/models/entities/notification.ts | 2 +- packages/backend/src/models/entities/poll.ts | 2 +- .../src/models/entities/user-profile.ts | 4 +- .../backend/src/models/entities/webhook.ts | 2 +- .../backend/src/models/repositories/page.ts | 6 +- .../backend/src/models/repositories/user.ts | 32 ++--- packages/backend/src/prelude/time.ts | 28 ++-- packages/backend/src/queue/get-job-info.ts | 4 +- packages/backend/src/queue/index.ts | 2 +- .../src/remote/activitypub/models/note.ts | 4 +- .../src/remote/activitypub/models/person.ts | 56 ++++---- .../src/remote/activitypub/models/question.ts | 4 +- .../backend/src/server/api/api-handler.ts | 17 ++- .../src/server/api/endpoints/ap/show.ts | 2 +- .../endpoints/i/registry/keys-with-type.ts | 20 +-- .../src/server/api/endpoints/i/update.ts | 2 +- .../src/server/api/endpoints/pages/update.ts | 4 +- packages/backend/src/server/api/streaming.ts | 13 +- packages/backend/src/server/well-known.ts | 4 +- packages/backend/src/services/chart/core.ts | 54 ++++---- .../backend/src/services/drive/add-file.ts | 16 +-- packages/backend/src/services/logger.ts | 52 ++++---- packages/backend/src/services/stream.ts | 4 +- .../services/validate-email-for-account.ts | 20 +-- packages/client/assets/tagcanvas.min.js | 67 +++++----- .../client/src/components/MkAnalogClock.vue | 4 +- packages/client/src/components/MkChart.vue | 2 +- .../client/src/components/MkChatPreview.vue | 6 +- .../src/components/MkDateSeparatedList.vue | 4 +- packages/client/src/components/MkDialog.vue | 4 +- packages/client/src/components/MkDrive.vue | 4 +- .../src/components/MkDriveSelectDialog.vue | 4 +- .../src/components/MkEmojiPicker.section.vue | 2 +- packages/client/src/components/MkFolder.vue | 2 +- .../client/src/components/MkLaunchPad.vue | 4 +- packages/client/src/components/MkMedia.vue | 8 +- .../client/src/components/MkMediaList.vue | 4 +- packages/client/src/components/MkModal.vue | 20 +-- .../client/src/components/MkModalWindow.vue | 4 +- packages/client/src/components/MkNote.vue | 4 +- packages/client/src/components/MkNoteSub.vue | 4 +- .../client/src/components/MkNotification.vue | 2 +- .../client/src/components/MkPagination.vue | 20 +-- packages/client/src/components/MkPoll.vue | 8 +- .../client/src/components/MkPollEditor.vue | 4 +- packages/client/src/components/MkPostForm.vue | 28 ++-- .../client/src/components/MkRenoteButton.vue | 4 +- packages/client/src/components/MkSignup.vue | 28 ++-- .../client/src/components/form/radios.vue | 4 +- .../client/src/components/global/MkAd.vue | 2 +- .../client/src/components/global/MkEmoji.vue | 2 +- .../client/src/components/global/MkTime.vue | 46 +++---- packages/client/src/components/mfm.ts | 36 +++--- .../src/components/page/page.button.vue | 2 +- .../client/src/directives/adaptive-border.ts | 4 +- packages/client/src/directives/anim.ts | 4 +- packages/client/src/directives/appear.ts | 4 +- packages/client/src/directives/click-anime.ts | 4 +- .../client/src/directives/follow-append.ts | 4 +- packages/client/src/directives/get-size.ts | 4 +- packages/client/src/directives/hotkey.ts | 4 +- packages/client/src/directives/panel.ts | 4 +- packages/client/src/directives/size.ts | 4 +- packages/client/src/directives/tooltip.ts | 16 +-- .../client/src/directives/user-preview.ts | 4 +- packages/client/src/directives/vibrate.ts | 4 +- packages/client/src/i18n.ts | 4 +- packages/client/src/init.ts | 8 +- packages/client/src/os.ts | 4 +- .../client/src/pages/about.federation.vue | 24 ++-- packages/client/src/pages/admin-file.vue | 2 +- packages/client/src/pages/admin/_header_.vue | 2 +- .../client/src/pages/admin/bot-protection.vue | 4 +- packages/client/src/pages/admin/index.vue | 4 +- .../src/pages/admin/overview.queue.chart.vue | 24 ++-- .../src/pages/admin/queue.chart.chart.vue | 24 ++-- .../client/src/pages/admin/queue.chart.vue | 4 +- packages/client/src/pages/admin/security.vue | 32 ++--- packages/client/src/pages/admin/users.vue | 2 +- .../client/src/pages/antenna-timeline.vue | 4 +- packages/client/src/pages/api-console.vue | 16 +-- packages/client/src/pages/channel-editor.vue | 4 +- packages/client/src/pages/channel.vue | 4 +- packages/client/src/pages/clip.vue | 4 +- packages/client/src/pages/gallery/edit.vue | 4 +- packages/client/src/pages/gallery/post.vue | 2 +- packages/client/src/pages/my-lists/list.vue | 2 +- packages/client/src/pages/note.vue | 8 +- packages/client/src/pages/notifications.vue | 6 +- packages/client/src/pages/page.vue | 2 +- .../src/pages/settings/plugin.install.vue | 2 +- packages/client/src/pages/share.vue | 2 +- packages/client/src/pages/theme-editor.vue | 4 +- packages/client/src/pages/timeline.vue | 20 +-- packages/client/src/pages/user-info.vue | 4 +- .../client/src/pages/user-list-timeline.vue | 4 +- packages/client/src/pages/user/followers.vue | 2 +- packages/client/src/pages/user/following.vue | 2 +- packages/client/src/pages/user/home.vue | 2 +- packages/client/src/pages/user/index.vue | 8 +- .../client/src/pages/welcome.entrance.a.vue | 2 +- packages/client/src/plugin.ts | 16 ++- packages/client/src/scripts/device-kind.ts | 8 +- packages/client/src/scripts/emojilist.ts | 2 +- .../src/scripts/extract-url-from-mfm.ts | 15 ++- packages/client/src/scripts/form.ts | 24 ++-- packages/client/src/scripts/get-user-menu.ts | 16 +-- packages/client/src/scripts/time.ts | 28 ++-- packages/client/src/store.ts | 4 +- packages/client/src/ui/deck.vue | 4 +- packages/client/src/ui/deck/column.vue | 6 +- packages/client/src/ui/deck/deck-store.ts | 2 +- packages/client/src/ui/universal.widgets.vue | 2 +- packages/client/src/widgets/clock.vue | 4 +- packages/client/src/widgets/digital-clock.vue | 4 +- packages/client/src/widgets/timeline.vue | 8 +- packages/firefish-js/src/api.ts | 36 +++--- 121 files changed, 670 insertions(+), 636 deletions(-) diff --git a/packages/backend/src/misc/populate-emojis.ts b/packages/backend/src/misc/populate-emojis.ts index 15d051c2..5bd74f19 100644 --- a/packages/backend/src/misc/populate-emojis.ts +++ b/packages/backend/src/misc/populate-emojis.ts @@ -30,10 +30,10 @@ function normalizeHost( src === "." ? null // .はローカルホスト (ここがマッチするのはリアクションのみ) : src === undefined - ? noteUserHost // ノートなどでホスト省略表記の場合はローカルホスト (ここがリアクションにマッチすることはない) - : isSelfHost(src) - ? null // 自ホスト指定 - : src || noteUserHost; // 指定されたホスト || ノートなどの所有者のホスト (こっちがリアクションにマッチすることはない) + ? noteUserHost // ノートなどでホスト省略表記の場合はローカルホスト (ここがリアクションにマッチすることはない) + : isSelfHost(src) + ? null // 自ホスト指定 + : src || noteUserHost; // 指定されたホスト || ノートなどの所有者のホスト (こっちがリアクションにマッチすることはない) host = toPunyNullable(host); diff --git a/packages/backend/src/misc/schema.ts b/packages/backend/src/misc/schema.ts index 6e03d30d..cd9692a6 100644 --- a/packages/backend/src/misc/schema.ts +++ b/packages/backend/src/misc/schema.ts @@ -67,7 +67,7 @@ export const refs = { Emoji: packedEmojiSchema, }; -export type Packed = SchemaType; +export type Packed = SchemaType<(typeof refs)[x]>; type TypeStringef = | "null" @@ -81,18 +81,18 @@ type TypeStringef = type StringDefToType = T extends "null" ? null : T extends "boolean" - ? boolean - : T extends "integer" - ? number - : T extends "number" - ? number - : T extends "string" - ? string | Date - : T extends "array" - ? ReadonlyArray - : T extends "object" - ? Record - : any; + ? boolean + : T extends "integer" + ? number + : T extends "number" + ? number + : T extends "string" + ? string | Date + : T extends "array" + ? ReadonlyArray + : T extends "object" + ? Record + : any; // https://swagger.io/specification/?sbsearch=optional#schema-object type OfSchema = { @@ -130,14 +130,14 @@ type RequiredPropertyNames = { s[K]["optional"] extends false ? K : // K has default value - s[K]["default"] extends - | null - | string - | number - | boolean - | Record - ? K - : never; + s[K]["default"] extends + | null + | string + | number + | boolean + | Record + ? K + : never; }[keyof s]; export type Obj = Record; @@ -182,43 +182,47 @@ type ArrayUnion = T extends any ? Array : never; export type SchemaTypeDef

= p["type"] extends "null" ? null : p["type"] extends "integer" - ? number - : p["type"] extends "number" - ? number - : p["type"] extends "string" - ? p["enum"] extends readonly string[] - ? p["enum"][number] - : p["format"] extends "date-time" - ? string - : // Dateにする?? - string - : p["type"] extends "boolean" - ? boolean - : p["type"] extends "object" - ? p["ref"] extends keyof typeof refs - ? Packed - : p["properties"] extends NonNullable - ? ObjType[number]> - : p["anyOf"] extends ReadonlyArray - ? UnionSchemaType & - Partial>> - : p["allOf"] extends ReadonlyArray - ? UnionToIntersection> - : any - : p["type"] extends "array" - ? p["items"] extends OfSchema - ? p["items"]["anyOf"] extends ReadonlyArray - ? UnionSchemaType>[] - : p["items"]["oneOf"] extends ReadonlyArray - ? ArrayUnion>> - : p["items"]["allOf"] extends ReadonlyArray - ? UnionToIntersection>>[] - : never - : p["items"] extends NonNullable - ? SchemaTypeDef[] - : any[] - : p["oneOf"] extends ReadonlyArray - ? UnionSchemaType - : any; + ? number + : p["type"] extends "number" + ? number + : p["type"] extends "string" + ? p["enum"] extends readonly string[] + ? p["enum"][number] + : p["format"] extends "date-time" + ? string + : // Dateにする?? + string + : p["type"] extends "boolean" + ? boolean + : p["type"] extends "object" + ? p["ref"] extends keyof typeof refs + ? Packed + : p["properties"] extends NonNullable + ? ObjType[number]> + : p["anyOf"] extends ReadonlyArray + ? UnionSchemaType & + Partial>> + : p["allOf"] extends ReadonlyArray + ? UnionToIntersection> + : any + : p["type"] extends "array" + ? p["items"] extends OfSchema + ? p["items"]["anyOf"] extends ReadonlyArray + ? UnionSchemaType>[] + : p["items"]["oneOf"] extends ReadonlyArray + ? ArrayUnion< + UnionSchemaType> + > + : p["items"]["allOf"] extends ReadonlyArray + ? UnionToIntersection< + UnionSchemaType> + >[] + : never + : p["items"] extends NonNullable + ? SchemaTypeDef[] + : any[] + : p["oneOf"] extends ReadonlyArray + ? UnionSchemaType + : any; export type SchemaType

= NullOrUndefined>; diff --git a/packages/backend/src/models/entities/muted-note.ts b/packages/backend/src/models/entities/muted-note.ts index 0ee245ae..5c570c5a 100644 --- a/packages/backend/src/models/entities/muted-note.ts +++ b/packages/backend/src/models/entities/muted-note.ts @@ -51,5 +51,5 @@ export class MutedNote { enum: mutedNoteReasons, comment: "The reason of the MutedNote.", }) - public reason: typeof mutedNoteReasons[number]; + public reason: (typeof mutedNoteReasons)[number]; } diff --git a/packages/backend/src/models/entities/note.ts b/packages/backend/src/models/entities/note.ts index e4e57e8e..e08cb6b5 100644 --- a/packages/backend/src/models/entities/note.ts +++ b/packages/backend/src/models/entities/note.ts @@ -126,7 +126,7 @@ export class Note { * specified ... visibleUserIds で指定したユーザーのみ */ @Column("enum", { enum: noteVisibilities }) - public visibility: typeof noteVisibilities[number]; + public visibility: (typeof noteVisibilities)[number]; @Index({ unique: true }) @Column("varchar", { diff --git a/packages/backend/src/models/entities/notification.ts b/packages/backend/src/models/entities/notification.ts index da23f7d3..425cd557 100644 --- a/packages/backend/src/models/entities/notification.ts +++ b/packages/backend/src/models/entities/notification.ts @@ -78,7 +78,7 @@ export class Notification { enum: notificationTypes, comment: "The type of the Notification.", }) - public type: typeof notificationTypes[number]; + public type: (typeof notificationTypes)[number]; /** * Whether the notification was read. diff --git a/packages/backend/src/models/entities/poll.ts b/packages/backend/src/models/entities/poll.ts index c117d4e7..f84e5fb8 100644 --- a/packages/backend/src/models/entities/poll.ts +++ b/packages/backend/src/models/entities/poll.ts @@ -47,7 +47,7 @@ export class Poll { enum: noteVisibilities, comment: "[Denormalized]", }) - public noteVisibility: typeof noteVisibilities[number]; + public noteVisibility: (typeof noteVisibilities)[number]; @Index() @Column({ diff --git a/packages/backend/src/models/entities/user-profile.ts b/packages/backend/src/models/entities/user-profile.ts index cb9161ce..71a42621 100644 --- a/packages/backend/src/models/entities/user-profile.ts +++ b/packages/backend/src/models/entities/user-profile.ts @@ -100,7 +100,7 @@ export class UserProfile { enum: ffVisibility, default: "public", }) - public ffVisibility: typeof ffVisibility[number]; + public ffVisibility: (typeof ffVisibility)[number]; @Column("varchar", { length: 128, @@ -239,7 +239,7 @@ export class UserProfile { array: true, default: [], }) - public mutingNotificationTypes: typeof notificationTypes[number][]; + public mutingNotificationTypes: (typeof notificationTypes)[number][]; //#region Denormalized fields @Index() diff --git a/packages/backend/src/models/entities/webhook.ts b/packages/backend/src/models/entities/webhook.ts index 47fd7996..9573390b 100644 --- a/packages/backend/src/models/entities/webhook.ts +++ b/packages/backend/src/models/entities/webhook.ts @@ -55,7 +55,7 @@ export class Webhook { array: true, default: "{}", }) - public on: typeof webhookEventTypes[number][]; + public on: (typeof webhookEventTypes)[number][]; @Column("varchar", { length: 1024, diff --git a/packages/backend/src/models/repositories/page.ts b/packages/backend/src/models/repositories/page.ts index d9241c36..4d1e9fa4 100644 --- a/packages/backend/src/models/repositories/page.ts +++ b/packages/backend/src/models/repositories/page.ts @@ -80,9 +80,9 @@ export const PageRepository = db.getRepository(Page).extend({ ? await DriveFiles.pack(page.eyeCatchingImageId) : null, attachedFiles: DriveFiles.packMany( - ( - await Promise.all(attachedFiles) - ).filter((x): x is DriveFile => x != null), + (await Promise.all(attachedFiles)).filter( + (x): x is DriveFile => x != null, + ), ), likedCount: page.likedCount, isLiked: meId diff --git a/packages/backend/src/models/repositories/user.ts b/packages/backend/src/models/repositories/user.ts index fb00f992..41299613 100644 --- a/packages/backend/src/models/repositories/user.ts +++ b/packages/backend/src/models/repositories/user.ts @@ -52,8 +52,8 @@ type IsMeAndIsUserDetailed< ? ExpectsMe extends true ? Packed<"MeDetailed"> : ExpectsMe extends false - ? Packed<"UserDetailedNotMe"> - : Packed<"UserDetailed"> + ? Packed<"UserDetailedNotMe"> + : Packed<"UserDetailed"> : Packed<"UserLite">; const ajv = new Ajv(); @@ -327,8 +327,8 @@ export const UserRepository = db.getRepository(User).extend({ return elapsed < USER_ONLINE_THRESHOLD ? "online" : elapsed < USER_ACTIVE_THRESHOLD - ? "active" - : "offline"; + ? "active" + : "offline"; }, async getAvatarUrl(user: User): Promise { @@ -421,23 +421,23 @@ export const UserRepository = db.getRepository(User).extend({ profile == null ? null : profile.ffVisibility === "public" || isMe - ? user.followingCount - : profile.ffVisibility === "followers" && - relation && - relation.isFollowing - ? user.followingCount - : null; + ? user.followingCount + : profile.ffVisibility === "followers" && + relation && + relation.isFollowing + ? user.followingCount + : null; const followersCount = profile == null ? null : profile.ffVisibility === "public" || isMe - ? user.followersCount - : profile.ffVisibility === "followers" && - relation && - relation.isFollowing - ? user.followersCount - : null; + ? user.followersCount + : profile.ffVisibility === "followers" && + relation && + relation.isFollowing + ? user.followersCount + : null; const falsy = opts.detail ? false : undefined; diff --git a/packages/backend/src/prelude/time.ts b/packages/backend/src/prelude/time.ts index 5901b9c4..da839084 100644 --- a/packages/backend/src/prelude/time.ts +++ b/packages/backend/src/prelude/time.ts @@ -9,16 +9,24 @@ export function dateUTC(time: number[]): Date { time.length === 2 ? Date.UTC(time[0], time[1]) : time.length === 3 - ? Date.UTC(time[0], time[1], time[2]) - : time.length === 4 - ? Date.UTC(time[0], time[1], time[2], time[3]) - : time.length === 5 - ? Date.UTC(time[0], time[1], time[2], time[3], time[4]) - : time.length === 6 - ? Date.UTC(time[0], time[1], time[2], time[3], time[4], time[5]) - : time.length === 7 - ? Date.UTC(time[0], time[1], time[2], time[3], time[4], time[5], time[6]) - : null; + ? Date.UTC(time[0], time[1], time[2]) + : time.length === 4 + ? Date.UTC(time[0], time[1], time[2], time[3]) + : time.length === 5 + ? Date.UTC(time[0], time[1], time[2], time[3], time[4]) + : time.length === 6 + ? Date.UTC(time[0], time[1], time[2], time[3], time[4], time[5]) + : time.length === 7 + ? Date.UTC( + time[0], + time[1], + time[2], + time[3], + time[4], + time[5], + time[6], + ) + : null; if (!d) throw new Error("wrong number of arguments"); diff --git a/packages/backend/src/queue/get-job-info.ts b/packages/backend/src/queue/get-job-info.ts index ae3532cd..7a8a469a 100644 --- a/packages/backend/src/queue/get-job-info.ts +++ b/packages/backend/src/queue/get-job-info.ts @@ -7,8 +7,8 @@ export function getJobInfo(job: Bull.Job, increment = false) { age > 60000 ? `${Math.floor(age / 1000 / 60)}m` : age > 10000 - ? `${Math.floor(age / 1000)}s` - : `${age}ms`; + ? `${Math.floor(age / 1000)}s` + : `${age}ms`; // onActiveとかonCompletedのattemptsMadeがなぜか0始まりなのでインクリメントする const currentAttempts = job.attemptsMade + (increment ? 1 : 0); diff --git a/packages/backend/src/queue/index.ts b/packages/backend/src/queue/index.ts index f9ca155f..ced08fee 100644 --- a/packages/backend/src/queue/index.ts +++ b/packages/backend/src/queue/index.ts @@ -492,7 +492,7 @@ export function createIndexAllNotesJob(data = {}) { export function webhookDeliver( webhook: Webhook, - type: typeof webhookEventTypes[number], + type: (typeof webhookEventTypes)[number], content: unknown, ) { const data = { diff --git a/packages/backend/src/remote/activitypub/models/note.ts b/packages/backend/src/remote/activitypub/models/note.ts index 4b05ef7f..a5c16c88 100644 --- a/packages/backend/src/remote/activitypub/models/note.ts +++ b/packages/backend/src/remote/activitypub/models/note.ts @@ -197,8 +197,8 @@ export async function createNote( note.attachment = Array.isArray(note.attachment) ? note.attachment : note.attachment - ? [note.attachment] - : []; + ? [note.attachment] + : []; const files = note.attachment.map( (attach) => (attach.sensitive = note.sensitive), ) diff --git a/packages/backend/src/remote/activitypub/models/person.ts b/packages/backend/src/remote/activitypub/models/person.ts index f6ec3d16..e0eb7207 100644 --- a/packages/backend/src/remote/activitypub/models/person.ts +++ b/packages/backend/src/remote/activitypub/models/person.ts @@ -275,26 +275,26 @@ export async function createPerson( followersCount !== undefined ? followersCount : person.followers && - typeof person.followers !== "string" && - isCollectionOrOrderedCollection(person.followers) - ? person.followers.totalItems - : undefined, + typeof person.followers !== "string" && + isCollectionOrOrderedCollection(person.followers) + ? person.followers.totalItems + : undefined, followingCount: followingCount !== undefined ? followingCount : person.following && - typeof person.following !== "string" && - isCollectionOrOrderedCollection(person.following) - ? person.following.totalItems - : undefined, + typeof person.following !== "string" && + isCollectionOrOrderedCollection(person.following) + ? person.following.totalItems + : undefined, notesCount: notesCount !== undefined ? notesCount : person.outbox && - typeof person.outbox !== "string" && - isCollectionOrOrderedCollection(person.outbox) - ? person.outbox.totalItems - : undefined, + typeof person.outbox !== "string" && + isCollectionOrOrderedCollection(person.outbox) + ? person.outbox.totalItems + : undefined, featured: person.featured ? getApId(person.featured) : undefined, uri: person.id, tags, @@ -314,8 +314,8 @@ export async function createPerson( description: person._misskey_summary ? truncate(person._misskey_summary, summaryLength) : person.summary - ? htmlToMfm(truncate(person.summary, summaryLength), person.tag) - : null, + ? htmlToMfm(truncate(person.summary, summaryLength), person.tag) + : null, url: url, fields, birthday: bday ? bday[0] : null, @@ -523,26 +523,26 @@ export async function updatePerson( followersCount !== undefined ? followersCount : person.followers && - typeof person.followers !== "string" && - isCollectionOrOrderedCollection(person.followers) - ? person.followers.totalItems - : undefined, + typeof person.followers !== "string" && + isCollectionOrOrderedCollection(person.followers) + ? person.followers.totalItems + : undefined, followingCount: followingCount !== undefined ? followingCount : person.following && - typeof person.following !== "string" && - isCollectionOrOrderedCollection(person.following) - ? person.following.totalItems - : undefined, + typeof person.following !== "string" && + isCollectionOrOrderedCollection(person.following) + ? person.following.totalItems + : undefined, notesCount: notesCount !== undefined ? notesCount : person.outbox && - typeof person.outbox !== "string" && - isCollectionOrOrderedCollection(person.outbox) - ? person.outbox.totalItems - : undefined, + typeof person.outbox !== "string" && + isCollectionOrOrderedCollection(person.outbox) + ? person.outbox.totalItems + : undefined, featured: person.featured, emojis: emojiNames, name: truncate(person.name, nameLength), @@ -589,8 +589,8 @@ export async function updatePerson( description: person._misskey_summary ? truncate(person._misskey_summary, summaryLength) : person.summary - ? htmlToMfm(truncate(person.summary, summaryLength), person.tag) - : null, + ? htmlToMfm(truncate(person.summary, summaryLength), person.tag) + : null, birthday: bday ? bday[0] : null, location: person["vcard:Address"] || null, }, diff --git a/packages/backend/src/remote/activitypub/models/question.ts b/packages/backend/src/remote/activitypub/models/question.ts index 3652cb64..83664f0e 100644 --- a/packages/backend/src/remote/activitypub/models/question.ts +++ b/packages/backend/src/remote/activitypub/models/question.ts @@ -22,8 +22,8 @@ export async function extractPollFromQuestion( const expiresAt = question.endTime ? new Date(question.endTime) : question.closed - ? new Date(question.closed) - : null; + ? new Date(question.closed) + : null; if (multiple && !question.anyOf) { throw new Error("invalid question"); diff --git a/packages/backend/src/server/api/api-handler.ts b/packages/backend/src/server/api/api-handler.ts index 5fc01f59..b9e6a3e0 100644 --- a/packages/backend/src/server/api/api-handler.ts +++ b/packages/backend/src/server/api/api-handler.ts @@ -10,17 +10,20 @@ import { ApiError } from "./error.js"; const userIpHistories = new Map>(); -setInterval(() => { - userIpHistories.clear(); -}, 1000 * 60 * 60); +setInterval( + () => { + userIpHistories.clear(); + }, + 1000 * 60 * 60, +); export default (endpoint: IEndpoint, ctx: Koa.Context) => new Promise((res) => { const body = ctx.is("multipart/form-data") ? (ctx.request as any).body : ctx.method === "GET" - ? ctx.query - : ctx.request.body; + ? ctx.query + : ctx.request.body; const reply = (x?: any, y?: ApiError) => { if (x == null) { @@ -73,8 +76,8 @@ export default (endpoint: IEndpoint, ctx: Koa.Context) => e.httpStatusCode ? e.httpStatusCode : e.kind === "client" - ? 400 - : 500, + ? 400 + : 500, e, ); }); diff --git a/packages/backend/src/server/api/endpoints/ap/show.ts b/packages/backend/src/server/api/endpoints/ap/show.ts index 50eb7e9c..ec9209ec 100644 --- a/packages/backend/src/server/api/endpoints/ap/show.ts +++ b/packages/backend/src/server/api/endpoints/ap/show.ts @@ -99,7 +99,7 @@ export default define(meta, paramDef, async (ps, me) => { async function fetchAny( uri: string, me: CacheableLocalUser | null | undefined, -): Promise | null> { +): Promise | null> { // Wait if blocked. if (await shouldBlockInstance(extractDbHost(uri))) return null; diff --git a/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts b/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts index f691552b..6e66240b 100644 --- a/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts +++ b/packages/backend/src/server/api/endpoints/i/registry/keys-with-type.ts @@ -38,16 +38,16 @@ export default define(meta, paramDef, async (ps, user) => { item.value === null ? "null" : Array.isArray(item.value) - ? "array" - : type === "number" - ? "number" - : type === "string" - ? "string" - : type === "boolean" - ? "boolean" - : type === "object" - ? "object" - : (null as never); + ? "array" + : type === "number" + ? "number" + : type === "string" + ? "string" + : type === "boolean" + ? "boolean" + : type === "object" + ? "object" + : (null as never); } return res; diff --git a/packages/backend/src/server/api/endpoints/i/update.ts b/packages/backend/src/server/api/endpoints/i/update.ts index c3ae9c52..58411fd6 100644 --- a/packages/backend/src/server/api/endpoints/i/update.ts +++ b/packages/backend/src/server/api/endpoints/i/update.ts @@ -189,7 +189,7 @@ export default define(meta, paramDef, async (ps, _user, token) => { profileUpdates.mutedInstances = ps.mutedInstances; if (ps.mutingNotificationTypes !== undefined) profileUpdates.mutingNotificationTypes = - ps.mutingNotificationTypes as typeof notificationTypes[number][]; + ps.mutingNotificationTypes as (typeof notificationTypes)[number][]; if (typeof ps.isLocked === "boolean") updates.isLocked = ps.isLocked; if (typeof ps.isExplorable === "boolean") updates.isExplorable = ps.isExplorable; diff --git a/packages/backend/src/server/api/endpoints/pages/update.ts b/packages/backend/src/server/api/endpoints/pages/update.ts index 939cd214..130ba65e 100644 --- a/packages/backend/src/server/api/endpoints/pages/update.ts +++ b/packages/backend/src/server/api/endpoints/pages/update.ts @@ -128,7 +128,7 @@ export default define(meta, paramDef, async (ps, user) => { ps.eyeCatchingImageId === null ? null : ps.eyeCatchingImageId === undefined - ? page.eyeCatchingImageId - : eyeCatchingImage?.id, + ? page.eyeCatchingImageId + : eyeCatchingImage?.id, }); }); diff --git a/packages/backend/src/server/api/streaming.ts b/packages/backend/src/server/api/streaming.ts index 14e07b74..2a1838ba 100644 --- a/packages/backend/src/server/api/streaming.ts +++ b/packages/backend/src/server/api/streaming.ts @@ -61,11 +61,14 @@ export const initializeStreamingServer = (server: http.Server) => { ); const intervalId = user - ? setInterval(() => { - Users.update(user.id, { - lastActiveDate: new Date(), - }); - }, 1000 * 60 * 5) + ? setInterval( + () => { + Users.update(user.id, { + lastActiveDate: new Date(), + }); + }, + 1000 * 60 * 5, + ) : null; if (user) { Users.update(user.id, { diff --git a/packages/backend/src/server/well-known.ts b/packages/backend/src/server/well-known.ts index 5af3b2c8..999e6d4a 100644 --- a/packages/backend/src/server/well-known.ts +++ b/packages/backend/src/server/well-known.ts @@ -114,8 +114,8 @@ router.get(webFingerPath, async (ctx) => { resource.startsWith(`${config.url.toLowerCase()}/@`) ? resource.split("/").pop()! : resource.startsWith("acct:") - ? resource.slice("acct:".length) - : resource, + ? resource.slice("acct:".length) + : resource, ), ); diff --git a/packages/backend/src/services/chart/core.ts b/packages/backend/src/services/chart/core.ts index 9bd331a5..75177e70 100644 --- a/packages/backend/src/services/chart/core.ts +++ b/packages/backend/src/services/chart/core.ts @@ -44,15 +44,15 @@ type KeyToColumnName = T extends `${infer R1}.${infer R2}` : T; type Columns = { - [K in - keyof S as `${typeof columnPrefix}${KeyToColumnName}`]: number; + [K in keyof S as `${typeof columnPrefix}${KeyToColumnName< + string & K + >}`]: number; }; type TempColumnsForUnique = { - [K in - keyof S as `${typeof uniqueTempColumnPrefix}${KeyToColumnName< - string & K - >}`]: S[K]["uniqueIncrement"] extends true ? string[] : never; + [K in keyof S as `${typeof uniqueTempColumnPrefix}${KeyToColumnName< + string & K + >}`]: S[K]["uniqueIncrement"] extends true ? string[] : never; }; type RawRecord = { @@ -176,8 +176,8 @@ export default abstract class Chart { v.range === "big" ? "bigint" : v.range === "small" - ? "smallint" - : "integer"; + ? "smallint" + : "integer"; if (v.uniqueIncrement) { columns[uniqueTempColumnPrefix + name] = { type: "varchar", @@ -234,8 +234,8 @@ export default abstract class Chart { span === "hour" ? `__chart__${camelToSnake(name)}` : span === "day" - ? `__chart_day__${camelToSnake(name)}` - : (new Error("not happen") as never), + ? `__chart_day__${camelToSnake(name)}` + : (new Error("not happen") as never), columns: { id: { type: "integer", @@ -315,7 +315,7 @@ export default abstract class Chart { private getNewLog(latest: KVs | null): KVs { const log = {} as Record; for (const [k, v] of Object.entries(this.schema) as [ - keyof typeof this["schema"], + keyof (typeof this)["schema"], this["schema"][string], ][]) { if (v.accumulate && latest) { @@ -335,8 +335,8 @@ export default abstract class Chart { span === "hour" ? this.repositoryForHour : span === "day" - ? this.repositoryForDay - : (new Error("not happen") as never); + ? this.repositoryForDay + : (new Error("not happen") as never); return repository .findOne({ @@ -365,16 +365,16 @@ export default abstract class Chart { span === "hour" ? [y, m, d, h] : span === "day" - ? [y, m, d] - : (new Error("not happen") as never), + ? [y, m, d] + : (new Error("not happen") as never), ); const repository = span === "hour" ? this.repositoryForHour : span === "day" - ? this.repositoryForDay - : (new Error("not happen") as never); + ? this.repositoryForDay + : (new Error("not happen") as never); // 現在(=今のHour or Day)のログ const currentLog = (await repository.findOneBy({ @@ -731,19 +731,19 @@ export default abstract class Chart { "day", ) : span === "hour" - ? subtractTime( - cursor ? dateUTC([y2, m2, d2, h2]) : dateUTC([y, m, d, h]), - amount - 1, - "hour", - ) - : (new Error("not happen") as never); + ? subtractTime( + cursor ? dateUTC([y2, m2, d2, h2]) : dateUTC([y, m, d, h]), + amount - 1, + "hour", + ) + : (new Error("not happen") as never); const repository = span === "hour" ? this.repositoryForHour : span === "day" - ? this.repositoryForDay - : (new Error("not happen") as never); + ? this.repositoryForDay + : (new Error("not happen") as never); // ログ取得 let logs = (await repository.find({ @@ -801,8 +801,8 @@ export default abstract class Chart { span === "hour" ? subtractTime(dateUTC([y, m, d, h]), i, "hour") : span === "day" - ? subtractTime(dateUTC([y, m, d]), i, "day") - : (new Error("not happen") as never); + ? subtractTime(dateUTC([y, m, d]), i, "day") + : (new Error("not happen") as never); const log = logs.find((l) => isTimeSame(new Date(l.date * 1000), current), diff --git a/packages/backend/src/services/drive/add-file.ts b/packages/backend/src/services/drive/add-file.ts index 00393137..6badc49d 100644 --- a/packages/backend/src/services/drive/add-file.ts +++ b/packages/backend/src/services/drive/add-file.ts @@ -492,12 +492,12 @@ export async function addFile({ instance.sensitiveMediaDetectionSensitivity === "veryHigh" ? 0.1 : instance.sensitiveMediaDetectionSensitivity === "high" - ? 0.3 - : instance.sensitiveMediaDetectionSensitivity === "low" - ? 0.7 - : instance.sensitiveMediaDetectionSensitivity === "veryLow" - ? 0.9 - : 0.5, + ? 0.3 + : instance.sensitiveMediaDetectionSensitivity === "low" + ? 0.7 + : instance.sensitiveMediaDetectionSensitivity === "veryLow" + ? 0.9 + : 0.5, sensitiveThresholdForPorn: 0.75, enableSensitiveMediaDetectionForVideos: instance.enableSensitiveMediaDetectionForVideos, @@ -622,8 +622,8 @@ export async function addFile({ ? Users.isLocalUser(user) && profile?.alwaysMarkNsfw ? true : sensitive !== null && sensitive !== undefined - ? sensitive - : false + ? sensitive + : false : false; if (info.sensitive && profile?.autoSensitive) file.isSensitive = true; diff --git a/packages/backend/src/services/logger.ts b/packages/backend/src/services/logger.ts index df4c2e35..5a429ae3 100644 --- a/packages/backend/src/services/logger.ts +++ b/packages/backend/src/services/logger.ts @@ -80,16 +80,16 @@ export default class Logger { ? chalk.bgRed.white("ERR ") : chalk.red("ERR ") : level === "warning" - ? chalk.yellow("WARN") - : level === "success" - ? important - ? chalk.bgGreen.white("DONE") - : chalk.green("DONE") - : level === "debug" - ? chalk.gray("VERB") - : level === "info" - ? chalk.blue("INFO") - : null; + ? chalk.yellow("WARN") + : level === "success" + ? important + ? chalk.bgGreen.white("DONE") + : chalk.green("DONE") + : level === "debug" + ? chalk.gray("VERB") + : level === "info" + ? chalk.blue("INFO") + : null; const domains = [this.domain] .concat(subDomains) .map((d) => @@ -101,14 +101,14 @@ export default class Logger { level === "error" ? chalk.red(message) : level === "warning" - ? chalk.yellow(message) - : level === "success" - ? chalk.green(message) - : level === "debug" - ? chalk.gray(message) - : level === "info" - ? message - : null; + ? chalk.yellow(message) + : level === "success" + ? chalk.green(message) + : level === "debug" + ? chalk.gray(message) + : level === "info" + ? message + : null; let log = `${l} ${worker}\t[${domains.join(" ")}]\t${m}`; if (envOption.withLogTime) log = `${chalk.gray(time)} ${log}`; @@ -125,14 +125,14 @@ export default class Logger { level === "error" ? this.syslogClient.error : level === "warning" - ? this.syslogClient.warning - : level === "success" - ? this.syslogClient.info - : level === "debug" - ? this.syslogClient.info - : level === "info" - ? this.syslogClient.info - : (null as never); + ? this.syslogClient.warning + : level === "success" + ? this.syslogClient.info + : level === "debug" + ? this.syslogClient.info + : level === "info" + ? this.syslogClient.info + : (null as never); send .bind(this.syslogClient)(message) diff --git a/packages/backend/src/services/stream.ts b/packages/backend/src/services/stream.ts index f59674ad..aceed7d7 100644 --- a/packages/backend/src/services/stream.ts +++ b/packages/backend/src/services/stream.ts @@ -33,8 +33,8 @@ class Publisher { type == null ? value : value == null - ? { type: type, body: null } - : { type: type, body: value }; + ? { type: type, body: null } + : { type: type, body: value }; redisClient.publish( config.host, diff --git a/packages/backend/src/services/validate-email-for-account.ts b/packages/backend/src/services/validate-email-for-account.ts index 2bb5e93e..535a389f 100644 --- a/packages/backend/src/services/validate-email-for-account.ts +++ b/packages/backend/src/services/validate-email-for-account.ts @@ -31,15 +31,15 @@ export async function validateEmailForAccount(emailAddress: string): Promise<{ reason: available ? null : exist !== 0 - ? "used" - : validated.reason === "regex" - ? "format" - : validated.reason === "disposable" - ? "disposable" - : validated.reason === "mx" - ? "mx" - : validated.reason === "smtp" - ? "smtp" - : null, + ? "used" + : validated.reason === "regex" + ? "format" + : validated.reason === "disposable" + ? "disposable" + : validated.reason === "mx" + ? "mx" + : validated.reason === "smtp" + ? "smtp" + : null, }; } diff --git a/packages/client/assets/tagcanvas.min.js b/packages/client/assets/tagcanvas.min.js index 562fe02c..2a19f5c1 100644 --- a/packages/client/assets/tagcanvas.min.js +++ b/packages/client/assets/tagcanvas.min.js @@ -173,10 +173,10 @@ return c == 0 ? Math.PI / 2 : ((a = c / (this.length() * b.length())), a >= 1) - ? 0 - : a <= -1 - ? Math.PI - : Math.acos(a); + ? 0 + : a <= -1 + ? Math.PI + : Math.acos(a); }), (z.unit = function () { var a = this.length(); @@ -332,12 +332,12 @@ D[a.substr(5, 2)])), (b = I[a] + f)) : a.substr(0, 4) === "rgb(" || a.substr(0, 4) === "hsl(" - ? (b = a.replace("(", "a(").replace(")", "," + f)) - : (a.substr(0, 5) === "rgba(" || a.substr(0, 5) === "hsla(") && - ((d = a.lastIndexOf(",") + 1), - (e = a.indexOf(")")), - (c *= parseFloat(a.substring(d, e))), - (b = a.substr(0, d) + c.toPrecision(3) + ")")), + ? (b = a.replace("(", "a(").replace(")", "," + f)) + : (a.substr(0, 5) === "rgba(" || a.substr(0, 5) === "hsla(") && + ((d = a.lastIndexOf(",") + 1), + (e = a.indexOf(")")), + (c *= parseFloat(a.substring(d, e))), + (b = a.substr(0, d) + c.toPrecision(3) + ")")), b ); } @@ -884,8 +884,8 @@ b.BeginDrag(c), (d = K(c, b.canvas)) && ((b.mx = d.x), (b.my = d.y), (b.drawn = 0))) : c.targetTouches.length == 2 && b.pinchZoom - ? ((b.touchState = 3), b.EndDrag(), b.BeginPinch(c)) - : (b.EndDrag(), b.EndPinch(), (b.touchState = 0))); + ? ((b.touchState = 3), b.EndDrag(), b.BeginPinch(c)) + : (b.EndDrag(), b.EndPinch(), (b.touchState = 0))); } function ac(c) { var d = u(c), @@ -1001,10 +1001,10 @@ b[a].nodeName == "BR" ? (this.text.push(this.line.join(" ")), (this.br = 1)) : b[a].nodeType == 3 - ? this.br - ? ((this.line = [b[a].nodeValue]), (this.br = 0)) - : this.line.push(b[a].nodeValue) - : this.Lines(b[a]); + ? this.br + ? ((this.line = [b[a].nodeValue]), (this.br = 0)) + : this.line.push(b[a].nodeValue) + : this.Lines(b[a]); return e || this.br || this.text.push(this.line.join(" ")), this.text; }), (F.SplitWidth = function (h, e, f, g) { @@ -1262,8 +1262,8 @@ return this.a.href != a.href ? 0 : b.length - ? this.image.src == b[0].src - : (a.innerText || a.textContent) == this.text_original; + ? this.image.src == b[0].src + : (a.innerText || a.textContent) == this.text_original; }), (d.SetImage = function (a) { this.image = this.fimage = a; @@ -1467,17 +1467,18 @@ "colour" == d ? (this.colour = L(a, c, e)) : "bgcolour" == d - ? (this.bgColour = L(a, c, e)) - : "bgoutline" == d - ? (this.bgOutline = L(a, c, e)) - : "outline" == d - ? (this.outline.colour = L(a, c, e)) - : "size" == d && - (a.weightSizeMin > 0 && a.weightSizeMax > a.weightSizeMin - ? (this.textHeight = - a.weightSize * - (a.weightSizeMin + (a.weightSizeMax - a.weightSizeMin) * c)) - : (this.textHeight = g(1, b * a.weightSize))); + ? (this.bgColour = L(a, c, e)) + : "bgoutline" == d + ? (this.bgOutline = L(a, c, e)) + : "outline" == d + ? (this.outline.colour = L(a, c, e)) + : "size" == d && + (a.weightSizeMin > 0 && a.weightSizeMax > a.weightSizeMin + ? (this.textHeight = + a.weightSize * + (a.weightSizeMin + + (a.weightSizeMax - a.weightSizeMin) * c)) + : (this.textHeight = g(1, b * a.weightSize))); }), (d.SetShadowColourFixed = function (a, b, c) { a.shadowColor = b; @@ -1503,8 +1504,8 @@ "right" == e.textAlign ? (d += this.w / 2 - this.line_widths[b]) : "centre" == e.textAlign - ? (d -= this.line_widths[b] / 2) - : (d -= this.w / 2), + ? (d -= this.line_widths[b] / 2) + : (d -= this.w / 2), a.setTransform(c, 0, 0, c, c * d, c * f), a.fillText(this.text[b], 0, 0), (f += this.textHeight); @@ -2188,8 +2189,8 @@ b && a && a.title ? this.SetTTDiv(a.title, a) : !b && this.mx != -1 && this.my != -1 && this.ctitle.length - ? this.SetTTDiv(this.ctitle) - : (this.ttdiv.style.display = "none"); + ? this.SetTTDiv(this.ctitle) + : (this.ttdiv.style.display = "none"); }), (b.Transform = function (c, a, b) { if (a || b) { diff --git a/packages/client/src/components/MkAnalogClock.vue b/packages/client/src/components/MkAnalogClock.vue index 17cab18d..30c3fa38 100644 --- a/packages/client/src/components/MkAnalogClock.vue +++ b/packages/client/src/components/MkAnalogClock.vue @@ -20,7 +20,7 @@ 1 - angleDiff(hAngle, angle) / Math.PI - numbersOpacityFactor, - ) + ) " /> @@ -49,7 +49,7 @@ 1 - angleDiff(hAngle, angle) / Math.PI - numbersOpacityFactor, - ) + ) " > {{ i === 0 ? (props.twentyfour ? "24" : "12") : i }} diff --git a/packages/client/src/components/MkChart.vue b/packages/client/src/components/MkChart.vue index 30aef8f7..69782b66 100644 --- a/packages/client/src/components/MkChart.vue +++ b/packages/client/src/components/MkChart.vue @@ -330,7 +330,7 @@ const render = () => { max: "original", }, }, - } + } : undefined, // gradient, }, diff --git a/packages/client/src/components/MkChatPreview.vue b/packages/client/src/components/MkChatPreview.vue index b309c8b0..e705fda4 100644 --- a/packages/client/src/components/MkChatPreview.vue +++ b/packages/client/src/components/MkChatPreview.vue @@ -12,7 +12,7 @@ ? `/my/messaging/group/${message.groupId}` : `/my/messaging/${getAcct( isMe(message) ? message.recipient : message.user, - )}` + )}` " >

@@ -22,8 +22,8 @@ message.groupId ? message.user : isMe(message) - ? message.recipient - : message.user + ? message.recipient + : message.user " :show-indicator="true" disable-link diff --git a/packages/client/src/components/MkDateSeparatedList.vue b/packages/client/src/components/MkDateSeparatedList.vue index 1628724f..6699f031 100644 --- a/packages/client/src/components/MkDateSeparatedList.vue +++ b/packages/client/src/components/MkDateSeparatedList.vue @@ -117,10 +117,10 @@ export default defineComponent({ tag: "div", "data-direction": props.direction, "data-reversed": props.reversed ? "true" : "false", - } + } : { class: "sqadhkmv" + (props.noGap ? " noGap" : ""), - }, + }, { default: renderChildren }, ); }, diff --git a/packages/client/src/components/MkDialog.vue b/packages/client/src/components/MkDialog.vue index 2659f139..a5e553a5 100644 --- a/packages/client/src/components/MkDialog.vue +++ b/packages/client/src/components/MkDialog.vue @@ -327,8 +327,8 @@ async function ok() { const result = props.input ? inputValue.value : props.select - ? selectedValue.value - : true; + ? selectedValue.value + : true; done(false, result); } diff --git a/packages/client/src/components/MkDrive.vue b/packages/client/src/components/MkDrive.vue index 29803965..1ca9b2ff 100644 --- a/packages/client/src/components/MkDrive.vue +++ b/packages/client/src/components/MkDrive.vue @@ -712,7 +712,7 @@ function getMenu() { action: () => { renameFolder(folder.value); }, - } + } : undefined, folder.value ? { @@ -723,7 +723,7 @@ function getMenu() { folder.value as firefish.entities.DriveFolder, ); }, - } + } : undefined, { text: i18n.ts.createFolder, diff --git a/packages/client/src/components/MkDriveSelectDialog.vue b/packages/client/src/components/MkDriveSelectDialog.vue index 5ec929a8..548c7d4b 100644 --- a/packages/client/src/components/MkDriveSelectDialog.vue +++ b/packages/client/src/components/MkDriveSelectDialog.vue @@ -17,8 +17,8 @@ ? i18n.ts.selectFiles : i18n.ts.selectFolders : type === "file" - ? i18n.ts.selectFile - : i18n.ts.selectFolder + ? i18n.ts.selectFile + : i18n.ts.selectFolder }} diff --git a/packages/client/src/components/MkFolder.vue b/packages/client/src/components/MkFolder.vue index 1c22d0e4..88bef2ea 100644 --- a/packages/client/src/components/MkFolder.vue +++ b/packages/client/src/components/MkFolder.vue @@ -60,7 +60,7 @@ export default defineComponent({ localStorage.getItem(localStoragePrefix + this.persistKey) ? localStorage.getItem( localStoragePrefix + this.persistKey, - ) === "t" + ) === "t" : this.expanded, icon, animation: defaultStore.state.animation, diff --git a/packages/client/src/components/MkLaunchPad.vue b/packages/client/src/components/MkLaunchPad.vue index 7893e169..bae84ba1 100644 --- a/packages/client/src/components/MkLaunchPad.vue +++ b/packages/client/src/components/MkLaunchPad.vue @@ -88,8 +88,8 @@ const preferedModalType = deviceKind === "desktop" && props.src != null ? "popup" : deviceKind === "smartphone" - ? "drawer" - : "dialog"; + ? "drawer" + : "dialog"; const modal = ref>(); diff --git a/packages/client/src/components/MkMedia.vue b/packages/client/src/components/MkMedia.vue index bd816230..e188f007 100644 --- a/packages/client/src/components/MkMedia.vue +++ b/packages/client/src/components/MkMedia.vue @@ -113,9 +113,9 @@ const url = props.raw || defaultStore.state.loadRawImages ? props.media.url : defaultStore.state.disableShowingAnimatedImages && - props.media.type.startsWith("image") - ? getStaticImageUrl(props.media.thumbnailUrl) - : props.media.thumbnailUrl; + props.media.type.startsWith("image") + ? getStaticImageUrl(props.media.thumbnailUrl) + : props.media.thumbnailUrl; const mediaType = computed(() => { return props.media.type === "video/quicktime" @@ -151,7 +151,7 @@ watch( defaultStore.state.nsfw === "force" ? true : props.media.isSensitive && - defaultStore.state.nsfw !== "ignore"; + defaultStore.state.nsfw !== "ignore"; }, { deep: true, diff --git a/packages/client/src/components/MkMediaList.vue b/packages/client/src/components/MkMediaList.vue index 8b0077bd..0a12c00c 100644 --- a/packages/client/src/components/MkMediaList.vue +++ b/packages/client/src/components/MkMediaList.vue @@ -100,13 +100,13 @@ onMounted(() => { bottom: 32, left: 32, right: 32, - } + } : { top: 0, bottom: 0, left: 0, right: 0, - }, + }, imageClickAction: "close", tapAction: "toggle-controls", preloadFirstSlide: false, diff --git a/packages/client/src/components/MkModal.vue b/packages/client/src/components/MkModal.vue index 0f42db59..f3476b7f 100644 --- a/packages/client/src/components/MkModal.vue +++ b/packages/client/src/components/MkModal.vue @@ -169,22 +169,22 @@ const transitionName = computed(() => ? useSendAnime.value ? "send" : type.value === "drawer" - ? "modal-drawer" - : type.value === "popup" - ? "modal-popup" - : "modal" + ? "modal-drawer" + : type.value === "popup" + ? "modal-popup" + : "modal" : "", ); const transitionDuration = computed(() => transitionName.value === "send" ? 400 : transitionName.value === "modal-popup" - ? 100 - : transitionName.value === "modal" - ? 200 - : transitionName.value === "modal-drawer" - ? 200 - : 0, + ? 100 + : transitionName.value === "modal" + ? 200 + : transitionName.value === "modal-drawer" + ? 200 + : 0, ); let contentClicking = false; diff --git a/packages/client/src/components/MkModalWindow.vue b/packages/client/src/components/MkModalWindow.vue index a7bc4765..83de6f06 100644 --- a/packages/client/src/components/MkModalWindow.vue +++ b/packages/client/src/components/MkModalWindow.vue @@ -17,8 +17,8 @@ ? `${props.height}px` : null : height - ? `min(${props.height}px, 100%)` - : '100%', + ? `min(${props.height}px, 100%)` + : '100%', }" tabindex="-1" > diff --git a/packages/client/src/components/MkNote.vue b/packages/client/src/components/MkNote.vue index 95a99c82..11edeb5a 100644 --- a/packages/client/src/components/MkNote.vue +++ b/packages/client/src/components/MkNote.vue @@ -510,7 +510,7 @@ function onContextmenu(ev: MouseEvent): void { "forcePage", ); }, - } + } : undefined, null, { @@ -537,7 +537,7 @@ function onContextmenu(ev: MouseEvent): void { appearNote.value.uri ?? "", target: "_blank", - } + } : undefined, ], ev, diff --git a/packages/client/src/components/MkNoteSub.vue b/packages/client/src/components/MkNoteSub.vue index b03e3fc0..d98ad1a1 100644 --- a/packages/client/src/components/MkNoteSub.vue +++ b/packages/client/src/components/MkNoteSub.vue @@ -428,7 +428,7 @@ function onContextmenu(ev: MouseEvent): void { "forcePage", ); }, - } + } : undefined, null, { @@ -452,7 +452,7 @@ function onContextmenu(ev: MouseEvent): void { text: i18n.ts.showOnRemote, href: note.value.url ?? note.value.uri ?? "", target: "_blank", - } + } : undefined, ], ev, diff --git a/packages/client/src/components/MkNotification.vue b/packages/client/src/components/MkNotification.vue index 71173eda..25156eac 100644 --- a/packages/client/src/components/MkNotification.vue +++ b/packages/client/src/components/MkNotification.vue @@ -74,7 +74,7 @@ ? notification.reaction.replace( /^:(\w+):$/, ':$1@.:', - ) + ) : notification.reaction " :custom-emojis="notification.note.emojis" diff --git a/packages/client/src/components/MkPagination.vue b/packages/client/src/components/MkPagination.vue index f12e7ed1..a03a77dc 100644 --- a/packages/client/src/components/MkPagination.vue +++ b/packages/client/src/components/MkPagination.vue @@ -258,14 +258,14 @@ const fetchMore = async (): Promise => { ...(props.pagination.offsetMode ? { offset: offset.value, - } + } : props.pagination.reversed - ? { + ? { sinceId: items.value[0].id, - } - : { + } + : { untilId: items.value[items.value.length - 1].id, - }), + }), }) .then( (res) => { @@ -319,14 +319,14 @@ const fetchMoreAhead = async (): Promise => { ...(props.pagination.offsetMode ? { offset: offset.value, - } + } : props.pagination.reversed - ? { + ? { untilId: items.value[0].id, - } - : { + } + : { sinceId: items.value[items.value.length - 1].id, - }), + }), }) .then( (res) => { diff --git a/packages/client/src/components/MkPoll.vue b/packages/client/src/components/MkPoll.vue index 8b66ed23..2765ce4c 100644 --- a/packages/client/src/components/MkPoll.vue +++ b/packages/client/src/components/MkPoll.vue @@ -81,10 +81,10 @@ const timer = computed(() => remaining.value >= 86400 ? "_poll.remainingDays" : remaining.value >= 3600 - ? "_poll.remainingHours" - : remaining.value >= 60 - ? "_poll.remainingMinutes" - : "_poll.remainingSeconds", + ? "_poll.remainingHours" + : remaining.value >= 60 + ? "_poll.remainingMinutes" + : "_poll.remainingSeconds", { s: Math.floor(remaining.value % 60), m: Math.floor(remaining.value / 60) % 60, diff --git a/packages/client/src/components/MkPollEditor.vue b/packages/client/src/components/MkPollEditor.vue index abacb413..fa5b4a11 100644 --- a/packages/client/src/components/MkPollEditor.vue +++ b/packages/client/src/components/MkPollEditor.vue @@ -171,8 +171,8 @@ function get() { ...(expiration.value === "at" ? { expiresAt: calcAt() } : expiration.value === "after" - ? { expiredAfter: calcAfter() } - : {}), + ? { expiredAfter: calcAfter() } + : {}), }; } diff --git a/packages/client/src/components/MkPostForm.vue b/packages/client/src/components/MkPostForm.vue index 1b364bf1..a881b670 100644 --- a/packages/client/src/components/MkPostForm.vue +++ b/packages/client/src/components/MkPostForm.vue @@ -91,8 +91,8 @@ reply ? 'ph-arrow-u-up-left' : renote - ? 'ph-quotes' - : 'ph-paper-plane-tilt', + ? 'ph-quotes' + : 'ph-paper-plane-tilt', ) " > @@ -249,8 +249,8 @@ reply ? 'ph-arrow-u-up-left' : renote - ? 'ph-quotes' - : 'ph-paper-plane-tilt', + ? 'ph-quotes' + : 'ph-paper-plane-tilt', ) " > @@ -441,10 +441,10 @@ const submitText = computed((): string => { return props.editId ? i18n.ts.edit : props.renote - ? i18n.ts.quote - : props.reply - ? i18n.ts.reply - : i18n.ts.note; + ? i18n.ts.quote + : props.reply + ? i18n.ts.reply + : i18n.ts.note; }); const textLength = computed((): number => { @@ -513,8 +513,8 @@ if (props.reply && props.reply.text != null) { const mention = x.host ? `@${x.username}@${toASCII(x.host)}` : otherHost == null || otherHost === host - ? `@${x.username}` - : `@${x.username}@${toASCII(otherHost)}`; + ? `@${x.username}` + : `@${x.username}@${toASCII(otherHost)}`; // exclude me if ($i.username === x.username && (x.host == null || x.host === host)) @@ -1009,8 +1009,8 @@ async function post() { renoteId: props.renote ? props.renote.id : quoteId.value - ? quoteId.value - : undefined, + ? quoteId.value + : undefined, channelId: props.channel ? props.channel.id : undefined, poll: poll.value, cw: useCw.value ? cw.value || "" : undefined, @@ -1022,8 +1022,8 @@ async function post() { visibility.value === "private" ? [] : visibility.value === "specified" - ? visibleUsers.value.map((u) => u.id) - : undefined, + ? visibleUsers.value.map((u) => u.id) + : undefined, }; if (withHashtags.value && hashtags.value && hashtags.value.trim() !== "") { diff --git a/packages/client/src/components/MkRenoteButton.vue b/packages/client/src/components/MkRenoteButton.vue index f9262ac5..d86e1560 100644 --- a/packages/client/src/components/MkRenoteButton.vue +++ b/packages/client/src/components/MkRenoteButton.vue @@ -211,12 +211,12 @@ const renote = (viaKeyboard = false, ev?: MouseEvent) => { visibility: props.note.visibility, visibleUserIds: props.note.visibleUserIds, localOnly: true, - } + } : { renoteId: props.note.id, visibility: props.note.visibility, localOnly: true, - }, + }, ); hasRenotedBefore.value = true; const el = diff --git a/packages/client/src/components/MkSignup.vue b/packages/client/src/components/MkSignup.vue index 9340d9af..189af53f 100644 --- a/packages/client/src/components/MkSignup.vue +++ b/packages/client/src/components/MkSignup.vue @@ -371,10 +371,10 @@ function onChangeUsername(): void { const err = !username.value.match(/^[a-zA-Z0-9_]+$/) ? "invalid-format" : username.value.length < 1 - ? "min-range" - : username.value.length > 20 - ? "max-range" - : null; + ? "min-range" + : username.value.length > 20 + ? "max-range" + : null; if (err) { usernameState.value = err; @@ -410,16 +410,16 @@ function onChangeEmail(): void { emailState.value = result.available ? "ok" : result.reason === "used" - ? "unavailable:used" - : result.reason === "format" - ? "unavailable:format" - : result.reason === "disposable" - ? "unavailable:disposable" - : result.reason === "mx" - ? "unavailable:mx" - : result.reason === "smtp" - ? "unavailable:smtp" - : "unavailable"; + ? "unavailable:used" + : result.reason === "format" + ? "unavailable:format" + : result.reason === "disposable" + ? "unavailable:disposable" + : result.reason === "mx" + ? "unavailable:mx" + : result.reason === "smtp" + ? "unavailable:smtp" + : "unavailable"; }) .catch(() => { emailState.value = "error"; diff --git a/packages/client/src/components/form/radios.vue b/packages/client/src/components/form/radios.vue index 849ad4c9..a46fecf1 100644 --- a/packages/client/src/components/form/radios.vue +++ b/packages/client/src/components/form/radios.vue @@ -45,7 +45,7 @@ export default defineComponent({ }, [label], ), - ] + ] : []), h( "div", @@ -76,7 +76,7 @@ export default defineComponent({ }, [caption], ), - ] + ] : []), ], ); diff --git a/packages/client/src/components/global/MkAd.vue b/packages/client/src/components/global/MkAd.vue index 619b4226..f3945859 100644 --- a/packages/client/src/components/global/MkAd.vue +++ b/packages/client/src/components/global/MkAd.vue @@ -70,7 +70,7 @@ const choseAd = (): Ad | null => { ? { ...ad, ratio: 0, - } + } : ad, ); diff --git a/packages/client/src/components/global/MkEmoji.vue b/packages/client/src/components/global/MkEmoji.vue index 37fab5c1..92b6e58b 100644 --- a/packages/client/src/components/global/MkEmoji.vue +++ b/packages/client/src/components/global/MkEmoji.vue @@ -46,7 +46,7 @@ const customEmoji = computed(() => isCustom.value ? ce.value.find( (x) => x.name === props.emoji.substr(1, props.emoji.length - 2), - ) + ) : null, ); const url = computed(() => { diff --git a/packages/client/src/components/global/MkTime.vue b/packages/client/src/components/global/MkTime.vue index e2356845..4f3ef496 100644 --- a/packages/client/src/components/global/MkTime.vue +++ b/packages/client/src/components/global/MkTime.vue @@ -29,11 +29,11 @@ const _time = props.time == null ? NaN : typeof props.time === "number" - ? props.time - : (props.time instanceof Date + ? props.time + : (props.time instanceof Date ? props.time : new Date(props.time) - ).getTime(); + ).getTime(); const invalid = Number.isNaN(_time); const absolute = !invalid ? dateTimeFormat.format(_time) : i18n.ts._ago.invalid; @@ -46,30 +46,32 @@ const relative = computed(() => { return ago >= 31536000 ? i18n.t("_ago.yearsAgo", { n: Math.floor(ago / 31536000).toString() }) : ago >= 2592000 - ? i18n.t("_ago.monthsAgo", { + ? i18n.t("_ago.monthsAgo", { n: Math.floor(ago / 2592000).toString(), - }) - : ago >= 604800 - ? i18n.t("_ago.weeksAgo", { + }) + : ago >= 604800 + ? i18n.t("_ago.weeksAgo", { n: Math.floor(ago / 604800).toString(), - }) - : ago >= 86400 - ? i18n.t("_ago.daysAgo", { + }) + : ago >= 86400 + ? i18n.t("_ago.daysAgo", { n: Math.floor(ago / 86400).toString(), - }) - : ago >= 3600 - ? i18n.t("_ago.hoursAgo", { + }) + : ago >= 3600 + ? i18n.t("_ago.hoursAgo", { n: Math.floor(ago / 3600).toString(), - }) - : ago >= 60 - ? i18n.t("_ago.minutesAgo", { n: (~~(ago / 60)).toString() }) - : ago >= 10 - ? i18n.t("_ago.secondsAgo", { + }) + : ago >= 60 + ? i18n.t("_ago.minutesAgo", { + n: (~~(ago / 60)).toString(), + }) + : ago >= 10 + ? i18n.t("_ago.secondsAgo", { n: (~~(ago % 60)).toString(), - }) - : ago >= -1 - ? i18n.ts._ago.justNow - : i18n.ts._ago.future; + }) + : ago >= -1 + ? i18n.ts._ago.justNow + : i18n.ts._ago.future; }); let tickId: number; diff --git a/packages/client/src/components/mfm.ts b/packages/client/src/components/mfm.ts index fa70e36b..4f4ecd2b 100644 --- a/packages/client/src/components/mfm.ts +++ b/packages/client/src/components/mfm.ts @@ -145,13 +145,13 @@ export default defineComponent({ const direction = token.props.args.left ? "reverse" : token.props.args.alternate - ? "alternate" - : "normal"; + ? "alternate" + : "normal"; const anime = token.props.args.x ? "mfm-spinX" : token.props.args.y - ? "mfm-spinY" - : "mfm-spin"; + ? "mfm-spinY" + : "mfm-spin"; const speed = validTime(token.props.args.speed) || "1.5s"; const delay = validTime(token.props.args.delay) || "0s"; const loop = validNumber(token.props.args.loop) || "infinite"; @@ -200,8 +200,8 @@ export default defineComponent({ token.props.args.h && token.props.args.v ? "scale(-1, -1)" : token.props.args.v - ? "scaleY(-1)" - : "scaleX(-1)"; + ? "scaleY(-1)" + : "scaleX(-1)"; style = `transform: ${transform};`; break; } @@ -236,16 +236,16 @@ export default defineComponent({ const family = token.props.args.serif ? "serif" : token.props.args.monospace - ? "monospace" - : token.props.args.cursive - ? "cursive" - : token.props.args.fantasy - ? "fantasy" - : token.props.args.emoji - ? "emoji" - : token.props.args.math - ? "math" - : null; + ? "monospace" + : token.props.args.cursive + ? "cursive" + : token.props.args.fantasy + ? "fantasy" + : token.props.args.emoji + ? "emoji" + : token.props.args.math + ? "math" + : null; if (family) style = `font-family: ${family};`; break; } @@ -262,8 +262,8 @@ export default defineComponent({ const rotate = token.props.args.x ? "perspective(128px) rotateX" : token.props.args.y - ? "perspective(128px) rotateY" - : "rotate"; + ? "perspective(128px) rotateY" + : "rotate"; const degrees = parseFloat(token.props.args.deg ?? "90"); style = `transform: ${rotate}(${degrees}deg); transform-origin: center center;`; break; diff --git a/packages/client/src/components/page/page.button.vue b/packages/client/src/components/page/page.button.vue index c4efa59f..3cd60b9f 100644 --- a/packages/client/src/components/page/page.button.vue +++ b/packages/client/src/components/page/page.button.vue @@ -45,7 +45,7 @@ export default defineComponent({ ...(this.block.var ? { var: unref(this.hpml.vars)[this.block.var], - } + } : {}), }); diff --git a/packages/client/src/directives/adaptive-border.ts b/packages/client/src/directives/adaptive-border.ts index a5a7ddbd..888fd2ad 100644 --- a/packages/client/src/directives/adaptive-border.ts +++ b/packages/client/src/directives/adaptive-border.ts @@ -1,6 +1,6 @@ import type { Directive } from "vue"; -export default { +export default ({ mounted(src, binding, vn) { const getBgColor = (el: HTMLElement) => { const style = window.getComputedStyle(el); @@ -26,4 +26,4 @@ export default { src.style.borderColor = myBg; } }, -} as Directive; +} as Directive); diff --git a/packages/client/src/directives/anim.ts b/packages/client/src/directives/anim.ts index b738f6c4..12936399 100644 --- a/packages/client/src/directives/anim.ts +++ b/packages/client/src/directives/anim.ts @@ -1,6 +1,6 @@ import type { Directive } from "vue"; -export default { +export default ({ beforeMount(src, binding, vn) { src.style.opacity = "0"; src.style.transform = "scale(0.9)"; @@ -15,4 +15,4 @@ export default { src.style.transform = "none"; }, 1); }, -} as Directive; +} as Directive); diff --git a/packages/client/src/directives/appear.ts b/packages/client/src/directives/appear.ts index 8e93ebd2..30074337 100644 --- a/packages/client/src/directives/appear.ts +++ b/packages/client/src/directives/appear.ts @@ -1,6 +1,6 @@ import type { Directive } from "vue"; -export default { +export default ({ mounted(src, binding, vn) { const fn = binding.value; if (fn == null) return; @@ -19,4 +19,4 @@ export default { unmounted(src, binding, vn) { if (src._observer_) src._observer_.disconnect(); }, -} as Directive; +} as Directive); diff --git a/packages/client/src/directives/click-anime.ts b/packages/client/src/directives/click-anime.ts index cca10c82..4ae4c88e 100644 --- a/packages/client/src/directives/click-anime.ts +++ b/packages/client/src/directives/click-anime.ts @@ -1,7 +1,7 @@ import type { Directive } from "vue"; // import { defaultStore } from "@/store"; -export default { +export default ({ mounted(el, binding, vn) { /* if (!defaultStore.state.animation) return; @@ -28,4 +28,4 @@ export default { }); */ }, -} as Directive; +} as Directive); diff --git a/packages/client/src/directives/follow-append.ts b/packages/client/src/directives/follow-append.ts index bf7223b8..444f4ac6 100644 --- a/packages/client/src/directives/follow-append.ts +++ b/packages/client/src/directives/follow-append.ts @@ -1,7 +1,7 @@ import { getScrollContainer, getScrollPosition } from "@/scripts/scroll"; import type { Directive } from "vue"; -export default { +export default ({ mounted(src, binding, vn) { if (binding.value === false) return; @@ -36,4 +36,4 @@ export default { unmounted(src, binding, vn) { if (src._ro_) src._ro_.unobserve(src); }, -} as Directive; +} as Directive); diff --git a/packages/client/src/directives/get-size.ts b/packages/client/src/directives/get-size.ts index e30eac75..13de3d55 100644 --- a/packages/client/src/directives/get-size.ts +++ b/packages/client/src/directives/get-size.ts @@ -35,7 +35,7 @@ function calc(src: Element) { info.fn(width, height); } -export default { +export default ({ mounted(src, binding, vn) { const resize = new ResizeObserver((entries, observer) => { calc(src); @@ -54,4 +54,4 @@ export default { if (info.intersection) info.intersection.disconnect(); mountings.delete(src); }, -} as Directive void>; +} as Directive void>); diff --git a/packages/client/src/directives/hotkey.ts b/packages/client/src/directives/hotkey.ts index 9bdfe476..975b4e26 100644 --- a/packages/client/src/directives/hotkey.ts +++ b/packages/client/src/directives/hotkey.ts @@ -1,7 +1,7 @@ import { makeHotkey } from "@/scripts/hotkey"; import type { Directive } from "vue"; -export default { +export default ({ mounted(el, binding) { el._hotkey_global = binding.modifiers.global === true; @@ -21,4 +21,4 @@ export default { el.removeEventListener("keydown", el._keyHandler); } }, -} as Directive; +} as Directive); diff --git a/packages/client/src/directives/panel.ts b/packages/client/src/directives/panel.ts index f1328fa3..b7be721a 100644 --- a/packages/client/src/directives/panel.ts +++ b/packages/client/src/directives/panel.ts @@ -1,6 +1,6 @@ import type { Directive } from "vue"; -export default { +export default ({ mounted(src, binding, vn) { const getBgColor = (el: HTMLElement) => { const style = window.getComputedStyle(el); @@ -28,4 +28,4 @@ export default { src.style.backgroundColor = "var(--panel)"; } }, -} as Directive; +} as Directive); diff --git a/packages/client/src/directives/size.ts b/packages/client/src/directives/size.ts index 700b560a..57302710 100644 --- a/packages/client/src/directives/size.ts +++ b/packages/client/src/directives/size.ts @@ -88,7 +88,7 @@ function calc(el: Element) { } } -export default { +export default ({ mounted(src, binding, vn) { const resize = new ResizeObserver((entries, observer) => { calc(src); @@ -119,4 +119,4 @@ export default { if (info.intersection) info.intersection.disconnect(); mountings.delete(src); }, -} as Directive; +} as Directive); diff --git a/packages/client/src/directives/tooltip.ts b/packages/client/src/directives/tooltip.ts index 23172a02..8d123f14 100644 --- a/packages/client/src/directives/tooltip.ts +++ b/packages/client/src/directives/tooltip.ts @@ -10,7 +10,7 @@ import { defineAsyncComponent, ref } from "vue"; const start = isTouchUsing ? "touchstart" : "mouseover"; const end = isTouchUsing ? "touchend" : "mouseleave"; -export default { +export default ({ mounted(el: HTMLElement, binding, vn) { const delay = binding.modifiers.noDelay ? 0 : 100; @@ -63,12 +63,12 @@ export default { direction: binding.modifiers.left ? "left" : binding.modifiers.right - ? "right" - : binding.modifiers.top - ? "top" - : binding.modifiers.bottom - ? "bottom" - : "top", + ? "right" + : binding.modifiers.top + ? "top" + : binding.modifiers.bottom + ? "bottom" + : "top", targetElement: el, }, {}, @@ -119,4 +119,4 @@ export default { window.clearInterval(self.checkTimer); self.close(); }, -} as Directive; +} as Directive); diff --git a/packages/client/src/directives/user-preview.ts b/packages/client/src/directives/user-preview.ts index 6cbe97d9..d5898db1 100644 --- a/packages/client/src/directives/user-preview.ts +++ b/packages/client/src/directives/user-preview.ts @@ -104,7 +104,7 @@ export class UserPreview { } } -export default { +export default ({ mounted(el: HTMLElement, binding, vn) { if (binding.value == null) return; @@ -121,4 +121,4 @@ export default { const self = el._userPreviewDirective_; self.preview.detach(); }, -} as Directive; +} as Directive); diff --git a/packages/client/src/directives/vibrate.ts b/packages/client/src/directives/vibrate.ts index f62e2a74..24ed8322 100644 --- a/packages/client/src/directives/vibrate.ts +++ b/packages/client/src/directives/vibrate.ts @@ -1,11 +1,11 @@ import { vibrate } from "@/scripts/vibrate"; import type { Directive } from "vue"; -export default { +export default ({ mounted(el, binding) { const pattern = (binding.value as VibratePattern) ?? 20; el.addEventListener("mousedown", () => { vibrate(pattern); }); }, -} as Directive; +} as Directive); diff --git a/packages/client/src/i18n.ts b/packages/client/src/i18n.ts index 5b0a7f9e..b7aa8c7b 100644 --- a/packages/client/src/i18n.ts +++ b/packages/client/src/i18n.ts @@ -7,7 +7,7 @@ export const i18n = markRaw(new I18n(locale)); // このファイルに書きたくないけどここに書かないと何故かVeturが認識しない declare module "@vue/runtime-core" { interface ComponentCustomProperties { - $t: typeof i18n["t"]; - $ts: typeof i18n["locale"]; + $t: (typeof i18n)["t"]; + $ts: (typeof i18n)["locale"]; } } diff --git a/packages/client/src/init.ts b/packages/client/src/init.ts index b7f1a483..1ced8df7 100644 --- a/packages/client/src/init.ts +++ b/packages/client/src/init.ts @@ -195,10 +195,10 @@ function checkForSplash() { window.location.search === "?zen" ? defineAsyncComponent(() => import("@/ui/zen.vue")) : !$i - ? defineAsyncComponent(() => import("@/ui/visitor.vue")) - : ui === "deck" - ? defineAsyncComponent(() => import("@/ui/deck.vue")) - : defineAsyncComponent(() => import("@/ui/universal.vue")), + ? defineAsyncComponent(() => import("@/ui/visitor.vue")) + : ui === "deck" + ? defineAsyncComponent(() => import("@/ui/deck.vue")) + : defineAsyncComponent(() => import("@/ui/universal.vue")), ); if (_DEV_) { diff --git a/packages/client/src/os.ts b/packages/client/src/os.ts index aeedbdb1..f0cb0c90 100644 --- a/packages/client/src/os.ts +++ b/packages/client/src/os.ts @@ -774,8 +774,8 @@ export async function cropImage( type AwaitType = T extends Promise ? U : T extends (...args: any[]) => Promise - ? V - : T; + ? V + : T; let openingEmojiPicker: AwaitType> | null = null; let activeTextarea: HTMLTextAreaElement | HTMLInputElement | null = null; export async function openEmojiPicker( diff --git a/packages/client/src/pages/about.federation.vue b/packages/client/src/pages/about.federation.vue index d2d00dce..06a9db2f 100644 --- a/packages/client/src/pages/about.federation.vue +++ b/packages/client/src/pages/about.federation.vue @@ -127,18 +127,18 @@ const pagination = { ...(state.value === "federating" ? { federating: true } : state.value === "subscribing" - ? { subscribing: true } - : state.value === "publishing" - ? { publishing: true } - : state.value === "suspended" - ? { suspended: true } - : state.value === "blocked" - ? { blocked: true } - : state.value === "silenced" - ? { silenced: true } - : state.value === "notResponding" - ? { notResponding: true } - : {}), + ? { subscribing: true } + : state.value === "publishing" + ? { publishing: true } + : state.value === "suspended" + ? { suspended: true } + : state.value === "blocked" + ? { blocked: true } + : state.value === "silenced" + ? { silenced: true } + : state.value === "notResponding" + ? { notResponding: true } + : {}), })), }; diff --git a/packages/client/src/pages/admin-file.vue b/packages/client/src/pages/admin-file.vue index a8c8e9ce..da6fc068 100644 --- a/packages/client/src/pages/admin-file.vue +++ b/packages/client/src/pages/admin-file.vue @@ -243,7 +243,7 @@ const headerTabs = computed(() => [ key: "ip", title: "IP", icon: `${icon("ph-receipt")}`, - } + } : null, { key: "raw", diff --git a/packages/client/src/pages/admin/_header_.vue b/packages/client/src/pages/admin/_header_.vue index 873d209e..bdd1ae8c 100644 --- a/packages/client/src/pages/admin/_header_.vue +++ b/packages/client/src/pages/admin/_header_.vue @@ -153,7 +153,7 @@ const calcBg = () => { rawBg.startsWith("var(") ? getComputedStyle(document.documentElement).getPropertyValue( rawBg.slice(4, -1), - ) + ) : rawBg, ); tinyBg.setAlpha(0.85); diff --git a/packages/client/src/pages/admin/bot-protection.vue b/packages/client/src/pages/admin/bot-protection.vue index 0114aa39..766fdc00 100644 --- a/packages/client/src/pages/admin/bot-protection.vue +++ b/packages/client/src/pages/admin/bot-protection.vue @@ -105,8 +105,8 @@ async function init() { provider.value = meta.enableHcaptcha ? "hcaptcha" : meta.enableRecaptcha - ? "recaptcha" - : null; + ? "recaptcha" + : null; } function save() { diff --git a/packages/client/src/pages/admin/index.vue b/packages/client/src/pages/admin/index.vue index 155837ca..281b9915 100644 --- a/packages/client/src/pages/admin/index.vue +++ b/packages/client/src/pages/admin/index.vue @@ -150,7 +150,7 @@ const menuDef = computed(() => [ text: i18n.ts.invite, action: invite, }, - ] + ] : []), ], }, @@ -293,7 +293,7 @@ const menuDef = computed(() => [ }, ], }, - ] + ] : []), ]); diff --git a/packages/client/src/pages/admin/overview.queue.chart.vue b/packages/client/src/pages/admin/overview.queue.chart.vue index 6482d99d..1ffcb377 100644 --- a/packages/client/src/pages/admin/overview.queue.chart.vue +++ b/packages/client/src/pages/admin/overview.queue.chart.vue @@ -51,23 +51,23 @@ const label = props.type === "process" ? "Process" : props.type === "active" - ? "Active" - : props.type === "delayed" - ? "Delayed" - : props.type === "waiting" - ? "Waiting" - : ("?" as never); + ? "Active" + : props.type === "delayed" + ? "Delayed" + : props.type === "waiting" + ? "Waiting" + : ("?" as never); const color = props.type === "process" ? "#c4a7e7" : props.type === "active" - ? "#31748f" - : props.type === "delayed" - ? "#eb6f92" - : props.type === "waiting" - ? "#f6c177" - : ("?" as never); + ? "#31748f" + : props.type === "delayed" + ? "#eb6f92" + : props.type === "waiting" + ? "#f6c177" + : ("?" as never); onMounted(() => { const vLineColor = defaultStore.state.darkMode diff --git a/packages/client/src/pages/admin/queue.chart.chart.vue b/packages/client/src/pages/admin/queue.chart.chart.vue index fd3edea9..b802457b 100644 --- a/packages/client/src/pages/admin/queue.chart.chart.vue +++ b/packages/client/src/pages/admin/queue.chart.chart.vue @@ -96,23 +96,23 @@ const label = props.type === "process" ? "Process" : props.type === "active" - ? "Active" - : props.type === "delayed" - ? "Delayed" - : props.type === "waiting" - ? "Waiting" - : ("?" as never); + ? "Active" + : props.type === "delayed" + ? "Delayed" + : props.type === "waiting" + ? "Waiting" + : ("?" as never); const color = props.type === "process" ? "#9ccfd8" : props.type === "active" - ? "#31748f" - : props.type === "delayed" - ? "#eb6f92" - : props.type === "waiting" - ? "#f6c177" - : ("?" as never); + ? "#31748f" + : props.type === "delayed" + ? "#eb6f92" + : props.type === "waiting" + ? "#f6c177" + : ("?" as never); onMounted(() => { chartInstance = new Chart(chartEl.value, { diff --git a/packages/client/src/pages/admin/queue.chart.vue b/packages/client/src/pages/admin/queue.chart.vue index 6cf25265..69d59241 100644 --- a/packages/client/src/pages/admin/queue.chart.vue +++ b/packages/client/src/pages/admin/queue.chart.vue @@ -118,8 +118,8 @@ onMounted(() => { props.domain === "inbox" ? "admin/queue/inbox-delayed" : props.domain === "deliver" - ? "admin/queue/deliver-delayed" - : null, + ? "admin/queue/deliver-delayed" + : null, {}, ).then((result) => { jobs.value = result; diff --git a/packages/client/src/pages/admin/security.vue b/packages/client/src/pages/admin/security.vue index 7522b53d..2bf46325 100644 --- a/packages/client/src/pages/admin/security.vue +++ b/packages/client/src/pages/admin/security.vue @@ -290,14 +290,14 @@ async function init() { meta.sensitiveMediaDetectionSensitivity === "veryLow" ? 0 : meta.sensitiveMediaDetectionSensitivity === "low" - ? 1 - : meta.sensitiveMediaDetectionSensitivity === "medium" - ? 2 - : meta.sensitiveMediaDetectionSensitivity === "high" - ? 3 - : meta.sensitiveMediaDetectionSensitivity === "veryHigh" - ? 4 - : 0; + ? 1 + : meta.sensitiveMediaDetectionSensitivity === "medium" + ? 2 + : meta.sensitiveMediaDetectionSensitivity === "high" + ? 3 + : meta.sensitiveMediaDetectionSensitivity === "veryHigh" + ? 4 + : 0; setSensitiveFlagAutomatically.value = meta.setSensitiveFlagAutomatically; enableSensitiveMediaDetectionForVideos.value = meta.enableSensitiveMediaDetectionForVideos; @@ -317,14 +317,14 @@ function save() { sensitiveMediaDetectionSensitivity.value === 0 ? "veryLow" : sensitiveMediaDetectionSensitivity.value === 1 - ? "low" - : sensitiveMediaDetectionSensitivity.value === 2 - ? "medium" - : sensitiveMediaDetectionSensitivity.value === 3 - ? "high" - : sensitiveMediaDetectionSensitivity.value === 4 - ? "veryHigh" - : 0, + ? "low" + : sensitiveMediaDetectionSensitivity.value === 2 + ? "medium" + : sensitiveMediaDetectionSensitivity.value === 3 + ? "high" + : sensitiveMediaDetectionSensitivity.value === 4 + ? "veryHigh" + : 0, setSensitiveFlagAutomatically: setSensitiveFlagAutomatically.value, enableSensitiveMediaDetectionForVideos: enableSensitiveMediaDetectionForVideos.value, diff --git a/packages/client/src/pages/admin/users.vue b/packages/client/src/pages/admin/users.vue index c69fbd4b..1161c382 100644 --- a/packages/client/src/pages/admin/users.vue +++ b/packages/client/src/pages/admin/users.vue @@ -107,7 +107,7 @@ user.updatedAt ? `Last posted: ${new Date( user.updatedAt, - ).toLocaleString()}` + ).toLocaleString()}` : 'Never posted' " class="user" diff --git a/packages/client/src/pages/antenna-timeline.vue b/packages/client/src/pages/antenna-timeline.vue index 1c1b5430..d9fbbdf8 100644 --- a/packages/client/src/pages/antenna-timeline.vue +++ b/packages/client/src/pages/antenna-timeline.vue @@ -83,7 +83,7 @@ const headerActions = computed(() => text: i18n.ts.settings, handler: settings, }, - ] + ] : [], ); @@ -95,7 +95,7 @@ definePageMetadata( ? { title: antenna.value.name, icon: `${icon("ph-flying-saucer")}`, - } + } : null, ), ); diff --git a/packages/client/src/pages/api-console.vue b/packages/client/src/pages/api-console.vue index 083db86c..a2260dc4 100644 --- a/packages/client/src/pages/api-console.vue +++ b/packages/client/src/pages/api-console.vue @@ -98,14 +98,14 @@ function onEndpointChange() { p.type === "String" ? "" : p.type === "Number" - ? 0 - : p.type === "Boolean" - ? false - : p.type === "Array" - ? [] - : p.type === "Object" - ? {} - : null; + ? 0 + : p.type === "Boolean" + ? false + : p.type === "Array" + ? [] + : p.type === "Object" + ? {} + : null; } body.value = JSON5.stringify(endpointBody, null, 2); }); diff --git a/packages/client/src/pages/channel-editor.vue b/packages/client/src/pages/channel-editor.vue index 8406cc05..60bcfe99 100644 --- a/packages/client/src/pages/channel-editor.vue +++ b/packages/client/src/pages/channel-editor.vue @@ -133,11 +133,11 @@ definePageMetadata( ? { title: i18n.ts._channel.edit, icon: `${icon("ph-television")}`, - } + } : { title: i18n.ts._channel.create, icon: `${icon("ph-television")}`, - }, + }, ), ); diff --git a/packages/client/src/pages/channel.vue b/packages/client/src/pages/channel.vue index 1730d0cd..9cfb5306 100644 --- a/packages/client/src/pages/channel.vue +++ b/packages/client/src/pages/channel.vue @@ -139,7 +139,7 @@ const headerActions = computed(() => [ text: i18n.ts.edit, handler: edit, }, - ] + ] : []), ]); @@ -151,7 +151,7 @@ definePageMetadata( ? { title: channel.value.name, icon: `${icon("ph-television")}`, - } + } : null, ), ); diff --git a/packages/client/src/pages/clip.vue b/packages/client/src/pages/clip.vue index 033864e1..4a47aee3 100644 --- a/packages/client/src/pages/clip.vue +++ b/packages/client/src/pages/clip.vue @@ -123,7 +123,7 @@ const headerActions = computed(() => }); }, }, - ] + ] : null, ); @@ -133,7 +133,7 @@ definePageMetadata( ? { title: clip.value.name, icon: `${icon("ph-paperclip")}`, - } + } : null, ), ); diff --git a/packages/client/src/pages/gallery/edit.vue b/packages/client/src/pages/gallery/edit.vue index 7f79c7f3..cef48a44 100644 --- a/packages/client/src/pages/gallery/edit.vue +++ b/packages/client/src/pages/gallery/edit.vue @@ -161,11 +161,11 @@ definePageMetadata( ? { title: i18n.ts.edit, icon: `${icon("ph-pencil")}`, - } + } : { title: i18n.ts.postToGallery, icon: `${icon("ph-pencil")}`, - }, + }, ), ); diff --git a/packages/client/src/pages/gallery/post.vue b/packages/client/src/pages/gallery/post.vue index 25b414db..490bedb0 100644 --- a/packages/client/src/pages/gallery/post.vue +++ b/packages/client/src/pages/gallery/post.vue @@ -238,7 +238,7 @@ definePageMetadata( ? { title: post.value.title, avatar: post.value.user, - } + } : null, ), ); diff --git a/packages/client/src/pages/my-lists/list.vue b/packages/client/src/pages/my-lists/list.vue index 0159bee6..8cc8457f 100644 --- a/packages/client/src/pages/my-lists/list.vue +++ b/packages/client/src/pages/my-lists/list.vue @@ -156,7 +156,7 @@ definePageMetadata( ? { title: list.value.name, icon: `${icon("ph-list-bullets")}`, - } + } : null, ), ); diff --git a/packages/client/src/pages/note.vue b/packages/client/src/pages/note.vue index 86e2890b..ca120fca 100644 --- a/packages/client/src/pages/note.vue +++ b/packages/client/src/pages/note.vue @@ -103,7 +103,7 @@ const prevPagination = { ? { userId: appearNote.value.userId, untilId: appearNote.value.id, - } + } : null, ), }; @@ -117,7 +117,7 @@ const nextPagination = { ? { userId: appearNote.value.userId, sinceId: appearNote.value.id, - } + } : null, ), }; @@ -183,7 +183,7 @@ definePageMetadata( user: appearNote.value.user.name || appearNote.value.user.username, - }), + }), subtitle: new Date( appearNote.value.createdAt, ).toLocaleString(), @@ -197,7 +197,7 @@ definePageMetadata( }), text: appearNote.value.text, }, - } + } : null, ), ); diff --git a/packages/client/src/pages/notifications.vue b/packages/client/src/pages/notifications.vue index b3f562a5..7cff33be 100644 --- a/packages/client/src/pages/notifications.vue +++ b/packages/client/src/pages/notifications.vue @@ -116,7 +116,7 @@ function setFilter(ev) { }, null, ...typeItems, - ] + ] : typeItems; os.popupMenu(items, ev.currentTarget ?? ev.target); } @@ -129,7 +129,7 @@ const headerActions = computed(() => icon: `${icon("ph-funnel")}`, highlighted: includeTypes.value != null, handler: setFilter, - } + } : undefined, tab.value === "all" ? { @@ -138,7 +138,7 @@ const headerActions = computed(() => handler: () => { os.apiWithDialog("notifications/mark-all-as-read"); }, - } + } : undefined, ].filter((x) => x !== undefined), ); diff --git a/packages/client/src/pages/page.vue b/packages/client/src/pages/page.vue index 7e39269a..ebca658e 100644 --- a/packages/client/src/pages/page.vue +++ b/packages/client/src/pages/page.vue @@ -316,7 +316,7 @@ definePageMetadata( title: page.value.title || page.value.name, text: page.value.summary, }, - } + } : null, ), ); diff --git a/packages/client/src/pages/settings/plugin.install.vue b/packages/client/src/pages/settings/plugin.install.vue index 3b736d39..7ad0ac20 100644 --- a/packages/client/src/pages/settings/plugin.install.vue +++ b/packages/client/src/pages/settings/plugin.install.vue @@ -151,7 +151,7 @@ async function install() { }, "closed", ); - }); + }); installPlugin({ id: uuid(), diff --git a/packages/client/src/pages/share.vue b/packages/client/src/pages/share.vue index 49fb0854..cd190e2e 100644 --- a/packages/client/src/pages/share.vue +++ b/packages/client/src/pages/share.vue @@ -92,7 +92,7 @@ async function init() { ? { username: q.username, host: q.host === null ? undefined : q.host, - } + } : q, ) .map((q) => diff --git a/packages/client/src/pages/theme-editor.vue b/packages/client/src/pages/theme-editor.vue index 15cd92e4..713c9f69 100644 --- a/packages/client/src/pages/theme-editor.vue +++ b/packages/client/src/pages/theme-editor.vue @@ -90,8 +90,8 @@ color: color.forPreview ? color.forPreview : theme.base === 'light' - ? '#5f5f5f' - : '#dadada', + ? '#5f5f5f' + : '#dadada', }" > A diff --git a/packages/client/src/pages/timeline.vue b/packages/client/src/pages/timeline.vue index 47c2955e..fb9e7479 100644 --- a/packages/client/src/pages/timeline.vue +++ b/packages/client/src/pages/timeline.vue @@ -230,7 +230,7 @@ const headerTabs = computed(() => [ icon: `${icon("ph-handshake")}`, iconOnly: true, }, - ] + ] : []), ...(isRecommendedTimelineAvailable ? [ @@ -240,7 +240,7 @@ const headerTabs = computed(() => [ icon: `${icon("ph-thumbs-up")}`, iconOnly: true, }, - ] + ] : []), ...(isLocalTimelineAvailable ? [ @@ -250,7 +250,7 @@ const headerTabs = computed(() => [ icon: `${icon("ph-users")}`, iconOnly: true, }, - ] + ] : []), ...(isGlobalTimelineAvailable ? [ @@ -260,7 +260,7 @@ const headerTabs = computed(() => [ icon: `${icon("ph-planet")}`, iconOnly: true, }, - ] + ] : []), ]); @@ -271,12 +271,12 @@ definePageMetadata( src.value === "local" ? "ph-users ph-lg" : src.value === "social" - ? "ph-handshake ph-lg" - : src.value === "recommended" - ? "ph-thumbs-up ph-lg" - : src.value === "global" - ? "ph-planet ph-lg" - : "ph-house ph-lg", + ? "ph-handshake ph-lg" + : src.value === "recommended" + ? "ph-thumbs-up ph-lg" + : src.value === "global" + ? "ph-planet ph-lg" + : "ph-house ph-lg", })), ); diff --git a/packages/client/src/pages/user-info.vue b/packages/client/src/pages/user-info.vue index 49dadea9..8b0926cf 100644 --- a/packages/client/src/pages/user-info.vue +++ b/packages/client/src/pages/user-info.vue @@ -409,7 +409,7 @@ function createFetcher() { iAmAdmin ? os.api("admin/get-user-ips", { userId: props.userId, - }) + }) : Promise.resolve(null), ]).then(([_user, _info, _ips]) => { user.value = _user; @@ -644,7 +644,7 @@ const headerTabs = computed(() => key: "moderation", title: i18n.ts.moderation, icon: `${icon("ph-shield")}`, - } + } : null, { key: "raw", diff --git a/packages/client/src/pages/user-list-timeline.vue b/packages/client/src/pages/user-list-timeline.vue index 75ad3057..d48cdcce 100644 --- a/packages/client/src/pages/user-list-timeline.vue +++ b/packages/client/src/pages/user-list-timeline.vue @@ -73,7 +73,7 @@ const headerActions = computed(() => text: i18n.ts.settings, handler: settings, }, - ] + ] : [], ); @@ -85,7 +85,7 @@ definePageMetadata( ? { title: list.value.name, icon: `${icon("ph-list-bullets")}`, - } + } : null, ), ); diff --git a/packages/client/src/pages/user/followers.vue b/packages/client/src/pages/user/followers.vue index dcfca7dd..b0b7b310 100644 --- a/packages/client/src/pages/user/followers.vue +++ b/packages/client/src/pages/user/followers.vue @@ -66,7 +66,7 @@ definePageMetadata( subtitle: i18n.ts.followers, userName: user.value, avatar: user.value, - } + } : null, ), ); diff --git a/packages/client/src/pages/user/following.vue b/packages/client/src/pages/user/following.vue index c72fbf51..220ec861 100644 --- a/packages/client/src/pages/user/following.vue +++ b/packages/client/src/pages/user/following.vue @@ -66,7 +66,7 @@ definePageMetadata( subtitle: i18n.ts.following, userName: user.value, avatar: user.value, - } + } : null, ), ); diff --git a/packages/client/src/pages/user/home.vue b/packages/client/src/pages/user/home.vue index e293f54a..943f2e2a 100644 --- a/packages/client/src/pages/user/home.vue +++ b/packages/client/src/pages/user/home.vue @@ -31,7 +31,7 @@ user.bannerUrl ? `url('${getStaticImageUrl( user.bannerUrl, - )}')` + )}')` : null, }" >
diff --git a/packages/client/src/pages/user/index.vue b/packages/client/src/pages/user/index.vue index 9fe9678e..2997653c 100644 --- a/packages/client/src/pages/user/index.vue +++ b/packages/client/src/pages/user/index.vue @@ -96,7 +96,7 @@ const headerTabs = computed(() => title: i18n.ts.reaction, icon: `${icon("ph-smiley")}`, }, - ] + ] : []), ...(user.value.instance == null ? [ @@ -115,9 +115,9 @@ const headerTabs = computed(() => title: i18n.ts.gallery, icon: `${icon("ph-image-square")}`, }, - ] + ] : []), - ] + ] : null, ); @@ -136,7 +136,7 @@ definePageMetadata( share: { title: user.value.name, }, - } + } : null, ), ); diff --git a/packages/client/src/pages/welcome.entrance.a.vue b/packages/client/src/pages/welcome.entrance.a.vue index 4cdc1094..cd6e6485 100644 --- a/packages/client/src/pages/welcome.entrance.a.vue +++ b/packages/client/src/pages/welcome.entrance.a.vue @@ -188,7 +188,7 @@ function showMenu(ev) { action: () => { window.open(instance.tosUrl, "_blank"); }, - } + } : null, ], ev.currentTarget ?? ev.target, diff --git a/packages/client/src/plugin.ts b/packages/client/src/plugin.ts index c38aaa36..2fceb20d 100644 --- a/packages/client/src/plugin.ts +++ b/packages/client/src/plugin.ts @@ -80,13 +80,15 @@ function createPluginEnv(opts) { }); }), // #endregion - "Plugin:register_post_form_action": values.FN_NATIVE(([title, handler]) => { - registerPostFormAction({ - pluginId: opts.plugin.id, - title: title.value, - handler, - }); - }), + "Plugin:register_post_form_action": values.FN_NATIVE( + ([title, handler]) => { + registerPostFormAction({ + pluginId: opts.plugin.id, + title: title.value, + handler, + }); + }, + ), "Plugin:register_user_action": values.FN_NATIVE(([title, handler]) => { registerUserAction({ pluginId: opts.plugin.id, diff --git a/packages/client/src/scripts/device-kind.ts b/packages/client/src/scripts/device-kind.ts index 8c629240..3c9608c0 100644 --- a/packages/client/src/scripts/device-kind.ts +++ b/packages/client/src/scripts/device-kind.ts @@ -9,7 +9,7 @@ const isSmartphone = !isTablet && /mobile|iphone|android/.test(ua); export const deviceKind = defaultStore.state.overridedDeviceKind ? defaultStore.state.overridedDeviceKind : isSmartphone - ? "smartphone" - : isTablet - ? "tablet" - : "desktop"; + ? "smartphone" + : isTablet + ? "tablet" + : "desktop"; diff --git a/packages/client/src/scripts/emojilist.ts b/packages/client/src/scripts/emojilist.ts index 64219da9..39d000b3 100644 --- a/packages/client/src/scripts/emojilist.ts +++ b/packages/client/src/scripts/emojilist.ts @@ -6,7 +6,7 @@ import emojiComponents from "unicode-emoji-json/data-emoji-components.json"; export interface UnicodeEmojiDef { emoji: string; - category: typeof unicodeEmojiCategories[number]; + category: (typeof unicodeEmojiCategories)[number]; skin_tone_support: boolean; slug: string; keywords?: string[]; diff --git a/packages/client/src/scripts/extract-url-from-mfm.ts b/packages/client/src/scripts/extract-url-from-mfm.ts index 0c32e81b..1845f3a6 100644 --- a/packages/client/src/scripts/extract-url-from-mfm.ts +++ b/packages/client/src/scripts/extract-url-from-mfm.ts @@ -17,10 +17,13 @@ export function extractUrlFromMfm( }); const urls: string[] = unique(urlNodes.map((x) => x.props.url)); - return urls.reduce((array, url) => { - const urlWithoutHash = removeHash(url); - if (!array.map((x) => removeHash(x)).includes(urlWithoutHash)) - array.push(url); - return array; - }, [] as string[]); + return urls.reduce( + (array, url) => { + const urlWithoutHash = removeHash(url); + if (!array.map((x) => removeHash(x)).includes(urlWithoutHash)) + array.push(url); + return array; + }, + [] as string[], + ); } diff --git a/packages/client/src/scripts/form.ts b/packages/client/src/scripts/form.ts index dc7393df..aea6c01e 100644 --- a/packages/client/src/scripts/form.ts +++ b/packages/client/src/scripts/form.ts @@ -54,18 +54,18 @@ export type Form = Record; type GetItemType = Item["type"] extends "string" ? string : Item["type"] extends "number" - ? number - : Item["type"] extends "boolean" - ? boolean - : Item["type"] extends "radio" - ? unknown - : Item["type"] extends "enum" - ? string - : Item["type"] extends "array" - ? unknown[] - : Item["type"] extends "object" - ? Record - : never; + ? number + : Item["type"] extends "boolean" + ? boolean + : Item["type"] extends "radio" + ? unknown + : Item["type"] extends "enum" + ? string + : Item["type"] extends "array" + ? unknown[] + : Item["type"] extends "object" + ? Record + : never; export type GetFormResultType = { [P in keyof F]: GetItemType; diff --git a/packages/client/src/scripts/get-user-menu.ts b/packages/client/src/scripts/get-user-menu.ts index 75ba2c53..1ee1dd07 100644 --- a/packages/client/src/scripts/get-user-menu.ts +++ b/packages/client/src/scripts/get-user-menu.ts @@ -101,14 +101,14 @@ export function getUserMenu(user, router: Router = mainRouter) { period === "indefinitely" ? null : period === "tenMinutes" - ? Date.now() + 1000 * 60 * 10 - : period === "oneHour" - ? Date.now() + 1000 * 60 * 60 - : period === "oneDay" - ? Date.now() + 1000 * 60 * 60 * 24 - : period === "oneWeek" - ? Date.now() + 1000 * 60 * 60 * 24 * 7 - : null; + ? Date.now() + 1000 * 60 * 10 + : period === "oneHour" + ? Date.now() + 1000 * 60 * 60 + : period === "oneDay" + ? Date.now() + 1000 * 60 * 60 * 24 + : period === "oneWeek" + ? Date.now() + 1000 * 60 * 60 * 24 * 7 + : null; os.apiWithDialog("mute/create", { userId: user.id, diff --git a/packages/client/src/scripts/time.ts b/packages/client/src/scripts/time.ts index ddaa4935..564ee036 100644 --- a/packages/client/src/scripts/time.ts +++ b/packages/client/src/scripts/time.ts @@ -9,16 +9,24 @@ export function dateUTC(time: number[]): Date { time.length === 2 ? Date.UTC(time[0], time[1]) : time.length === 3 - ? Date.UTC(time[0], time[1], time[2]) - : time.length === 4 - ? Date.UTC(time[0], time[1], time[2], time[3]) - : time.length === 5 - ? Date.UTC(time[0], time[1], time[2], time[3], time[4]) - : time.length === 6 - ? Date.UTC(time[0], time[1], time[2], time[3], time[4], time[5]) - : time.length === 7 - ? Date.UTC(time[0], time[1], time[2], time[3], time[4], time[5], time[6]) - : null; + ? Date.UTC(time[0], time[1], time[2]) + : time.length === 4 + ? Date.UTC(time[0], time[1], time[2], time[3]) + : time.length === 5 + ? Date.UTC(time[0], time[1], time[2], time[3], time[4]) + : time.length === 6 + ? Date.UTC(time[0], time[1], time[2], time[3], time[4], time[5]) + : time.length === 7 + ? Date.UTC( + time[0], + time[1], + time[2], + time[3], + time[4], + time[5], + time[6], + ) + : null; if (!d) throw "wrong number of arguments"; diff --git a/packages/client/src/store.ts b/packages/client/src/store.ts index 69951774..0c57e358 100644 --- a/packages/client/src/store.ts +++ b/packages/client/src/store.ts @@ -478,7 +478,7 @@ export class ColdDeviceStorage { public static get( key: T, - ): typeof ColdDeviceStorage.default[T] { + ): (typeof ColdDeviceStorage.default)[T] { // TODO: indexedDBにする // ただしその際はnullチェックではなくキー存在チェックにしないとダメ // (indexedDBはnullを保存できるため、ユーザーが意図してnullを格納した可能性がある) @@ -492,7 +492,7 @@ export class ColdDeviceStorage { public static set( key: T, - value: typeof ColdDeviceStorage.default[T], + value: (typeof ColdDeviceStorage.default)[T], ): void { // 呼び出し側のバグ等で undefined が来ることがある // undefined を文字列として localStorage に入れると参照する際の JSON.parse でコケて不具合の元になるため無視 diff --git a/packages/client/src/ui/deck.vue b/packages/client/src/ui/deck.vue index 9d54d682..4a91958c 100644 --- a/packages/client/src/ui/deck.vue +++ b/packages/client/src/ui/deck.vue @@ -30,7 +30,7 @@ ) .map((c) => c.width), ) + 'px', - } + } " @wheel.self="onWheel" > @@ -58,7 +58,7 @@ columns.find( (c) => c.id === ids[0], )!.width + 'px', - } + } " @parent-focus="moveFocus(ids[0], $event)" @headerWheel="onWheel" diff --git a/packages/client/src/ui/deck/column.vue b/packages/client/src/ui/deck/column.vue index e2a2d8d9..41795b71 100644 --- a/packages/client/src/ui/deck/column.vue +++ b/packages/client/src/ui/deck/column.vue @@ -198,7 +198,7 @@ function getMenu() { action: () => { swapUpColumn(props.column.id); }, - } + } : undefined, props.isStacked ? { @@ -207,7 +207,7 @@ function getMenu() { action: () => { swapDownColumn(props.column.id); }, - } + } : undefined, ], }, @@ -225,7 +225,7 @@ function getMenu() { action: () => { popRightColumn(props.column.id); }, - } + } : undefined, null, { diff --git a/packages/client/src/ui/deck/deck-store.ts b/packages/client/src/ui/deck/deck-store.ts index 3cf753ba..0faacc0b 100644 --- a/packages/client/src/ui/deck/deck-store.ts +++ b/packages/client/src/ui/deck/deck-store.ts @@ -31,7 +31,7 @@ export interface Column { antennaId?: string; channelId?: string; listId?: string; - includingTypes?: typeof notificationTypes[number][]; + includingTypes?: (typeof notificationTypes)[number][]; tl?: "home" | "local" | "social" | "recommended" | "global"; } diff --git a/packages/client/src/ui/universal.widgets.vue b/packages/client/src/ui/universal.widgets.vue index 2d399b79..a8a65f82 100644 --- a/packages/client/src/ui/universal.widgets.vue +++ b/packages/client/src/ui/universal.widgets.vue @@ -74,7 +74,7 @@ function updateWidget({ id, data }) { ? { ...w, data, - } + } : w, ), ); diff --git a/packages/client/src/widgets/clock.vue b/packages/client/src/widgets/clock.vue index 8a5e7b8f..31e96311 100644 --- a/packages/client/src/widgets/clock.vue +++ b/packages/client/src/widgets/clock.vue @@ -206,10 +206,10 @@ const tzAbbrev = computed( Intl.DateTimeFormat() .resolvedOptions() .timeZone.toLowerCase(), - )?.abbrev + )?.abbrev : timezones.find( (tz) => tz.name.toLowerCase() === widgetProps.timezone, - )?.abbrev) ?? "?", + )?.abbrev) ?? "?", ); const tzOffset = computed(() => diff --git a/packages/client/src/widgets/digital-clock.vue b/packages/client/src/widgets/digital-clock.vue index b6e281d3..5bf47a56 100644 --- a/packages/client/src/widgets/digital-clock.vue +++ b/packages/client/src/widgets/digital-clock.vue @@ -86,10 +86,10 @@ const tzAbbrev = computed( Intl.DateTimeFormat() .resolvedOptions() .timeZone.toLowerCase(), - )?.abbrev + )?.abbrev : timezones.find( (tz) => tz.name.toLowerCase() === widgetProps.timezone, - )?.abbrev) ?? "?", + )?.abbrev) ?? "?", ); const tzOffset = computed(() => diff --git a/packages/client/src/widgets/timeline.vue b/packages/client/src/widgets/timeline.vue index c429a460..fc3afab2 100644 --- a/packages/client/src/widgets/timeline.vue +++ b/packages/client/src/widgets/timeline.vue @@ -35,8 +35,8 @@ widgetProps.src === "list" ? widgetProps.list.name : widgetProps.src === "antenna" - ? widgetProps.antenna.name - : i18n.t("_timelines." + widgetProps.src) + ? widgetProps.antenna.name + : i18n.t("_timelines." + widgetProps.src) }} extends true ? GetCaseResult : IsCaseMatched extends true - ? GetCaseResult - : IsCaseMatched extends true - ? GetCaseResult - : IsCaseMatched extends true - ? GetCaseResult - : IsCaseMatched extends true - ? GetCaseResult - : IsCaseMatched extends true - ? GetCaseResult - : IsCaseMatched extends true - ? GetCaseResult - : IsCaseMatched extends true - ? GetCaseResult - : IsCaseMatched extends true - ? GetCaseResult - : IsCaseMatched extends true - ? GetCaseResult - : Endpoints[E]["res"]["$switch"]["$default"] + ? GetCaseResult + : IsCaseMatched extends true + ? GetCaseResult + : IsCaseMatched extends true + ? GetCaseResult + : IsCaseMatched extends true + ? GetCaseResult + : IsCaseMatched extends true + ? GetCaseResult + : IsCaseMatched extends true + ? GetCaseResult + : IsCaseMatched extends true + ? GetCaseResult + : IsCaseMatched extends true + ? GetCaseResult + : IsCaseMatched extends true + ? GetCaseResult + : Endpoints[E]["res"]["$switch"]["$default"] : Endpoints[E]["res"] > { const promise = new Promise((resolve, reject) => {