diff --git a/packages/backend/src/misc/populate-emojis.ts b/packages/backend/src/misc/populate-emojis.ts index 795a267f91..16bc9e3af7 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 6e03d30d91..cd9692a6b6 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 0ee245aea9..5c570c5a56 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 2b9de38cbe..8f7958e83d 100644 --- a/packages/backend/src/models/entities/note.ts +++ b/packages/backend/src/models/entities/note.ts @@ -125,7 +125,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 da23f7d3ee..425cd55700 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 c117d4e733..f84e5fb8f6 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 a4c2e09754..95e166acf7 100644 --- a/packages/backend/src/models/entities/user-profile.ts +++ b/packages/backend/src/models/entities/user-profile.ts @@ -99,7 +99,7 @@ export class UserProfile { enum: ffVisibility, default: "public", }) - public ffVisibility: typeof ffVisibility[number]; + public ffVisibility: (typeof ffVisibility)[number]; @Column("varchar", { length: 128, @@ -238,7 +238,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 47fd79966d..9573390b36 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 d9241c3629..4d1e9fa4d8 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 be1dbc4531..9b4c6045b9 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 5901b9c484..da83908441 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 ae3532cdae..7a8a469af5 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 0500737a48..e8b938a649 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 201ad67390..fb617953e5 100644 --- a/packages/backend/src/remote/activitypub/models/note.ts +++ b/packages/backend/src/remote/activitypub/models/note.ts @@ -205,8 +205,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 25a84f3f24..88ab7dbaa9 100644 --- a/packages/backend/src/remote/activitypub/models/person.ts +++ b/packages/backend/src/remote/activitypub/models/person.ts @@ -276,26 +276,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, @@ -315,8 +315,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, @@ -527,26 +527,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), @@ -593,8 +593,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 f5855c3e7c..39963fddbf 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 48a33dfc6e..fe761a9b40 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 50eb7e9c6c..ec9209ecd3 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 f691552bce..6e66240b71 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 c3ae9c5206..58411fd668 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/notes/search.ts b/packages/backend/src/server/api/endpoints/notes/search.ts index 4ddcf11abf..9374e0bac7 100644 --- a/packages/backend/src/server/api/endpoints/notes/search.ts +++ b/packages/backend/src/server/api/endpoints/notes/search.ts @@ -293,14 +293,14 @@ export default define(meta, paramDef, async (ps, me) => { }, ] : ps.host !== undefined - ? [ - { - term: { - userHost: ps.host, + ? [ + { + term: { + userHost: ps.host, + }, }, - }, - ] - : [] + ] + : [] : []; const result = await es.search({ diff --git a/packages/backend/src/server/api/endpoints/pages/update.ts b/packages/backend/src/server/api/endpoints/pages/update.ts index 5f434d02e1..091bfb1947 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 14e07b7487..2a1838ba13 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 5af3b2c84b..999e6d4ae1 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 d7a524d488..51bd841c0a 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 = { @@ -186,8 +186,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", @@ -244,8 +244,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", @@ -325,7 +325,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) { @@ -345,8 +345,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({ @@ -375,16 +375,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({ @@ -793,19 +793,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({ @@ -863,8 +863,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/chart/index.ts b/packages/backend/src/services/chart/index.ts index 969cdab6d7..8a4cc2f4be 100644 --- a/packages/backend/src/services/chart/index.ts +++ b/packages/backend/src/services/chart/index.ts @@ -42,10 +42,13 @@ const charts = [ ]; // 20分おきにメモリ情報をDBに書き込み -setInterval(() => { - for (const chart of charts) { - chart.save(); - } -}, 1000 * 60 * 20); +setInterval( + () => { + for (const chart of charts) { + chart.save(); + } + }, + 1000 * 60 * 20, +); beforeShutdown(() => Promise.all(charts.map((chart) => chart.save()))); diff --git a/packages/backend/src/services/drive/add-file.ts b/packages/backend/src/services/drive/add-file.ts index f5dc725577..34cf354f6f 100644 --- a/packages/backend/src/services/drive/add-file.ts +++ b/packages/backend/src/services/drive/add-file.ts @@ -497,12 +497,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, @@ -627,8 +627,8 @@ export async function addFile({ ? Users.isLocalUser(user) && profile!.alwaysMarkNsfw ? true : sensitive != null - ? 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 ddbebdf30b..e8b6d915d0 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 f59674ad6a..aceed7d794 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 2bb5e93e7e..535a389f0c 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/backend/test/e2e/users.ts b/packages/backend/test/e2e/users.ts index 78f5e18928..2f16c66173 100644 --- a/packages/backend/test/e2e/users.ts +++ b/packages/backend/test/e2e/users.ts @@ -224,147 +224,160 @@ describe("ユーザー", () => { let userFollowRequesting: User; let userFollowRequested: User; - beforeAll(async () => { - app = await startServer(); - }, 1000 * 60 * 2); + beforeAll( + async () => { + app = await startServer(); + }, + 1000 * 60 * 2, + ); - beforeAll(async () => { - root = await signup({ username: "root" }); - alice = await signup({ username: "alice" }); - aliceNote = (await post(alice, { text: "test" })) as any; - alicePage = await page(alice); - aliceList = (await api("users/list/create", { name: "aliceList" }, alice)) - .body; - bob = await signup({ username: "bob" }); - bobNote = (await post(bob, { text: "test" })) as any; - carol = await signup({ username: "carol" }); - dave = await signup({ username: "dave" }); - ellen = await signup({ username: "ellen" }); - frank = await signup({ username: "frank" }); + beforeAll( + async () => { + root = await signup({ username: "root" }); + alice = await signup({ username: "alice" }); + aliceNote = (await post(alice, { text: "test" })) as any; + alicePage = await page(alice); + aliceList = (await api("users/list/create", { name: "aliceList" }, alice)) + .body; + bob = await signup({ username: "bob" }); + bobNote = (await post(bob, { text: "test" })) as any; + carol = await signup({ username: "carol" }); + dave = await signup({ username: "dave" }); + ellen = await signup({ username: "ellen" }); + frank = await signup({ username: "frank" }); - // @alice -> @replyingへのリプライ。Promise.allで一気に作るとtimeoutしてしまうのでreduceで一つ一つawaitする - usersReplying = await [...Array(10)] - .map((_, i) => i) - .reduce(async (acc, i) => { - const u = await signup({ username: `replying${i}` }); - for (let j = 0; j < 10 - i; j++) { - const p = await post(u, { text: `test${j}` }); - await post(alice, { - text: `@${u.username} test${j}`, - replyId: p.id, - }); - } + // @alice -> @replyingへのリプライ。Promise.allで一気に作るとtimeoutしてしまうのでreduceで一つ一つawaitする + usersReplying = await [...Array(10)] + .map((_, i) => i) + .reduce( + async (acc, i) => { + const u = await signup({ username: `replying${i}` }); + for (let j = 0; j < 10 - i; j++) { + const p = await post(u, { text: `test${j}` }); + await post(alice, { + text: `@${u.username} test${j}`, + replyId: p.id, + }); + } - return (await acc).concat(u); - }, Promise.resolve([] as User[])); + return (await acc).concat(u); + }, + Promise.resolve([] as User[]), + ); - userNoNote = await signup({ username: "userNoNote" }); - userNotExplorable = await signup({ username: "userNotExplorable" }); - await post(userNotExplorable, { text: "test" }); - await api("i/update", { isExplorable: false }, userNotExplorable); - userLocking = await signup({ username: "userLocking" }); - await post(userLocking, { text: "test" }); - await api("i/update", { isLocked: true }, userLocking); - userAdmin = await signup({ username: "userAdmin" }); - roleAdmin = await role(root, { - isAdministrator: true, - name: "Admin Role", - }); - await api( - "admin/roles/assign", - { userId: userAdmin.id, roleId: roleAdmin.id }, - root, - ); - userModerator = await signup({ username: "userModerator" }); - roleModerator = await role(root, { - isModerator: true, - name: "Moderator Role", - }); - await api( - "admin/roles/assign", - { userId: userModerator.id, roleId: roleModerator.id }, - root, - ); - userRolePublic = await signup({ username: "userRolePublic" }); - rolePublic = await role(root, { isPublic: true, name: "Public Role" }); - await api( - "admin/roles/assign", - { userId: userRolePublic.id, roleId: rolePublic.id }, - root, - ); - userRoleBadge = await signup({ username: "userRoleBadge" }); - roleBadge = await role(root, { asBadge: true, name: "Badge Role" }); - await api( - "admin/roles/assign", - { userId: userRoleBadge.id, roleId: roleBadge.id }, - root, - ); - userSilenced = await signup({ username: "userSilenced" }); - await post(userSilenced, { text: "test" }); - roleSilenced = await role( - root, - {}, - { canPublicNote: { priority: 0, useDefault: false, value: false } }, - ); - await api( - "admin/roles/assign", - { userId: userSilenced.id, roleId: roleSilenced.id }, - root, - ); - userSuspended = await signup({ username: "userSuspended" }); - await post(userSuspended, { text: "test" }); - await successfulApiCall({ - endpoint: "i/update", - parameters: { description: "#user_testuserSuspended" }, - user: userSuspended, - }); - await api("admin/suspend-user", { userId: userSuspended.id }, root); - userDeletedBySelf = await signup({ - username: "userDeletedBySelf", - password: "userDeletedBySelf", - }); - await post(userDeletedBySelf, { text: "test" }); - await api( - "i/delete-account", - { password: "userDeletedBySelf" }, - userDeletedBySelf, - ); - userDeletedByAdmin = await signup({ username: "userDeletedByAdmin" }); - await post(userDeletedByAdmin, { text: "test" }); - await api("admin/delete-account", { userId: userDeletedByAdmin.id }, root); - userFollowingAlice = await signup({ username: "userFollowingAlice" }); - await post(userFollowingAlice, { text: "test" }); - await api("following/create", { userId: alice.id }, userFollowingAlice); - userFollowedByAlice = await signup({ username: "userFollowedByAlice" }); - await post(userFollowedByAlice, { text: "test" }); - await api("following/create", { userId: userFollowedByAlice.id }, alice); - userBlockingAlice = await signup({ username: "userBlockingAlice" }); - await post(userBlockingAlice, { text: "test" }); - await api("blocking/create", { userId: alice.id }, userBlockingAlice); - userBlockedByAlice = await signup({ username: "userBlockedByAlice" }); - await post(userBlockedByAlice, { text: "test" }); - await api("blocking/create", { userId: userBlockedByAlice.id }, alice); - userMutingAlice = await signup({ username: "userMutingAlice" }); - await post(userMutingAlice, { text: "test" }); - await api("mute/create", { userId: alice.id }, userMutingAlice); - userMutedByAlice = await signup({ username: "userMutedByAlice" }); - await post(userMutedByAlice, { text: "test" }); - await api("mute/create", { userId: userMutedByAlice.id }, alice); - userRnMutingAlice = await signup({ username: "userRnMutingAlice" }); - await post(userRnMutingAlice, { text: "test" }); - await api("renote-mute/create", { userId: alice.id }, userRnMutingAlice); - userRnMutedByAlice = await signup({ username: "userRnMutedByAlice" }); - await post(userRnMutedByAlice, { text: "test" }); - await api("renote-mute/create", { userId: userRnMutedByAlice.id }, alice); - userFollowRequesting = await signup({ username: "userFollowRequesting" }); - await post(userFollowRequesting, { text: "test" }); - userFollowRequested = userLocking; - await api( - "following/create", - { userId: userFollowRequested.id }, - userFollowRequesting, - ); - }, 1000 * 60 * 10); + userNoNote = await signup({ username: "userNoNote" }); + userNotExplorable = await signup({ username: "userNotExplorable" }); + await post(userNotExplorable, { text: "test" }); + await api("i/update", { isExplorable: false }, userNotExplorable); + userLocking = await signup({ username: "userLocking" }); + await post(userLocking, { text: "test" }); + await api("i/update", { isLocked: true }, userLocking); + userAdmin = await signup({ username: "userAdmin" }); + roleAdmin = await role(root, { + isAdministrator: true, + name: "Admin Role", + }); + await api( + "admin/roles/assign", + { userId: userAdmin.id, roleId: roleAdmin.id }, + root, + ); + userModerator = await signup({ username: "userModerator" }); + roleModerator = await role(root, { + isModerator: true, + name: "Moderator Role", + }); + await api( + "admin/roles/assign", + { userId: userModerator.id, roleId: roleModerator.id }, + root, + ); + userRolePublic = await signup({ username: "userRolePublic" }); + rolePublic = await role(root, { isPublic: true, name: "Public Role" }); + await api( + "admin/roles/assign", + { userId: userRolePublic.id, roleId: rolePublic.id }, + root, + ); + userRoleBadge = await signup({ username: "userRoleBadge" }); + roleBadge = await role(root, { asBadge: true, name: "Badge Role" }); + await api( + "admin/roles/assign", + { userId: userRoleBadge.id, roleId: roleBadge.id }, + root, + ); + userSilenced = await signup({ username: "userSilenced" }); + await post(userSilenced, { text: "test" }); + roleSilenced = await role( + root, + {}, + { canPublicNote: { priority: 0, useDefault: false, value: false } }, + ); + await api( + "admin/roles/assign", + { userId: userSilenced.id, roleId: roleSilenced.id }, + root, + ); + userSuspended = await signup({ username: "userSuspended" }); + await post(userSuspended, { text: "test" }); + await successfulApiCall({ + endpoint: "i/update", + parameters: { description: "#user_testuserSuspended" }, + user: userSuspended, + }); + await api("admin/suspend-user", { userId: userSuspended.id }, root); + userDeletedBySelf = await signup({ + username: "userDeletedBySelf", + password: "userDeletedBySelf", + }); + await post(userDeletedBySelf, { text: "test" }); + await api( + "i/delete-account", + { password: "userDeletedBySelf" }, + userDeletedBySelf, + ); + userDeletedByAdmin = await signup({ username: "userDeletedByAdmin" }); + await post(userDeletedByAdmin, { text: "test" }); + await api( + "admin/delete-account", + { userId: userDeletedByAdmin.id }, + root, + ); + userFollowingAlice = await signup({ username: "userFollowingAlice" }); + await post(userFollowingAlice, { text: "test" }); + await api("following/create", { userId: alice.id }, userFollowingAlice); + userFollowedByAlice = await signup({ username: "userFollowedByAlice" }); + await post(userFollowedByAlice, { text: "test" }); + await api("following/create", { userId: userFollowedByAlice.id }, alice); + userBlockingAlice = await signup({ username: "userBlockingAlice" }); + await post(userBlockingAlice, { text: "test" }); + await api("blocking/create", { userId: alice.id }, userBlockingAlice); + userBlockedByAlice = await signup({ username: "userBlockedByAlice" }); + await post(userBlockedByAlice, { text: "test" }); + await api("blocking/create", { userId: userBlockedByAlice.id }, alice); + userMutingAlice = await signup({ username: "userMutingAlice" }); + await post(userMutingAlice, { text: "test" }); + await api("mute/create", { userId: alice.id }, userMutingAlice); + userMutedByAlice = await signup({ username: "userMutedByAlice" }); + await post(userMutedByAlice, { text: "test" }); + await api("mute/create", { userId: userMutedByAlice.id }, alice); + userRnMutingAlice = await signup({ username: "userRnMutingAlice" }); + await post(userRnMutingAlice, { text: "test" }); + await api("renote-mute/create", { userId: alice.id }, userRnMutingAlice); + userRnMutedByAlice = await signup({ username: "userRnMutedByAlice" }); + await post(userRnMutedByAlice, { text: "test" }); + await api("renote-mute/create", { userId: userRnMutedByAlice.id }, alice); + userFollowRequesting = await signup({ username: "userFollowRequesting" }); + await post(userFollowRequesting, { text: "test" }); + userFollowRequested = userLocking; + await api( + "following/create", + { userId: userFollowRequested.id }, + userFollowRequesting, + ); + }, + 1000 * 60 * 10, + ); afterAll(async () => { await app.close(); diff --git a/packages/backend/test/utils.ts b/packages/backend/test/utils.ts index 3c8449fb58..5cff65b03f 100644 --- a/packages/backend/test/utils.ts +++ b/packages/backend/test/utils.ts @@ -152,8 +152,8 @@ export const uploadFile = async (user: any, _path?: string): Promise => { _path == null ? `${_dirname}/resources/Lenna.jpg` : path.isAbsolute(_path) - ? _path - : `${_dirname}/resources/${_path}`; + ? _path + : `${_dirname}/resources/${_path}`; const formData = new FormData() as any; formData.append("i", user.token); diff --git a/packages/client/assets/tagcanvas.min.js b/packages/client/assets/tagcanvas.min.js index 562fe02cd8..2a19f5c140 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 17cab18da2..30c3fa3800 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 c11c36e43a..415a486c8a 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, }, @@ -473,7 +473,7 @@ const fetchNotesChart = async (type: string): Promise => { negate(raw.local.dec), raw.remote.inc, negate(raw.remote.dec), - ) + ) : sum(raw[type].inc, negate(raw[type].dec)), ), color: "#888888", @@ -516,7 +516,7 @@ const fetchNotesChart = async (type: string): Promise => { ? sum( raw.local.diffs.withFile, raw.remote.diffs.withFile, - ) + ) : raw[type].diffs.withFile, ), color: colors.purple, @@ -569,7 +569,7 @@ const fetchUsersChart = async (total: boolean): Promise => { negate(raw.local.dec), raw.remote.inc, negate(raw.remote.dec), - ), + ), ), }, { @@ -926,7 +926,7 @@ const fetchPerUserNotesChart = async (): Promise => { data: format(sum(raw.inc, negate(raw.dec))), color: "#888888", }, - ]), + ]), { name: "With file", type: "area", diff --git a/packages/client/src/components/MkChatPreview.vue b/packages/client/src/components/MkChatPreview.vue index b309c8b002..e705fda4bc 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 124de08329..e40d64dd7d 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 2659f139b8..a5e553a5e5 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 988dee9226..c16d4775dc 100644 --- a/packages/client/src/components/MkDrive.vue +++ b/packages/client/src/components/MkDrive.vue @@ -710,7 +710,7 @@ function getMenu() { action: () => { renameFolder(folder.value); }, - } + } : undefined, folder.value ? { @@ -721,7 +721,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 1047acce97..c36008553d 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 279c8f7186..b87df0d8da 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, animation: defaultStore.state.animation, }; diff --git a/packages/client/src/components/MkLaunchPad.vue b/packages/client/src/components/MkLaunchPad.vue index 9e194f8e4b..ddb4dc69d2 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 dad2f9e77d..641600cc9c 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 0d6f098f81..a6a4263350 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 f6b52a626c..8fa9b8f2c9 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 cab0f07a79..fbe22654dc 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 6ad5a916b9..6bb0c07ec5 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 20e67f847a..24e45b1558 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 cf788c9e91..e196129828 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 17d2ef3e7a..ba3f7ed8a7 100644 --- a/packages/client/src/components/MkPagination.vue +++ b/packages/client/src/components/MkPagination.vue @@ -257,14 +257,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) => { @@ -318,14 +318,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 48211f1712..aa1cc2e275 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 622ac7fd98..4184398eb9 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 a36703c9f2..c41e8bfc71 100644 --- a/packages/client/src/components/MkPostForm.vue +++ b/packages/client/src/components/MkPostForm.vue @@ -87,8 +87,8 @@ reply ? 'ph-arrow-u-up-left' : renote - ? 'ph-quotes' - : 'ph-paper-plane-tilt', + ? 'ph-quotes' + : 'ph-paper-plane-tilt', ) " > @@ -421,10 +421,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 => { @@ -493,8 +493,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)) @@ -987,8 +987,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, @@ -1023,8 +1023,9 @@ async function post() { if (postAccount.value) { const storedAccounts = await getAccounts(); - token = storedAccounts.find((x) => x.id === postAccount.value.id) - ?.token; + token = storedAccounts.find( + (x) => x.id === postAccount.value.id, + )?.token; } posting.value = true; diff --git a/packages/client/src/components/MkRenoteButton.vue b/packages/client/src/components/MkRenoteButton.vue index bf16280ec9..66e7f2faa8 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 9340d9af92..189af53f57 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 849ad4c9f0..a46fecf136 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 542070aa8d..1acd9eef51 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/MkAvatar.vue b/packages/client/src/components/global/MkAvatar.vue index d1298b5579..7dde3aecdd 100644 --- a/packages/client/src/components/global/MkAvatar.vue +++ b/packages/client/src/components/global/MkAvatar.vue @@ -139,13 +139,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/global/MkEmoji.vue b/packages/client/src/components/global/MkEmoji.vue index 37fab5c147..92b6e58b6c 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 b9d06c2cdc..4f3ef49604 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,32 +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", { + }) + : ago >= 60 + ? i18n.t("_ago.minutesAgo", { n: (~~(ago / 60)).toString(), - }) - : ago >= 10 - ? i18n.t("_ago.secondsAgo", { + }) + : 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 8de385c40f..a24c8cb476 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 c4efa59f23..3cd60b9f0b 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/tooltip.ts b/packages/client/src/directives/tooltip.ts index 0b29b65560..22894e1181 100644 --- a/packages/client/src/directives/tooltip.ts +++ b/packages/client/src/directives/tooltip.ts @@ -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, }, {}, diff --git a/packages/client/src/i18n.ts b/packages/client/src/i18n.ts index 5b0a7f9ed8..b7aa8c7bef 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 bae6ce7115..d070e2048b 100644 --- a/packages/client/src/init.ts +++ b/packages/client/src/init.ts @@ -193,10 +193,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 d367dc2fc9..2658d7ff86 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, 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 d2d00dce27..06a9db2f50 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 8683bfb729..91a4386e16 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 7b0b627087..2c4e330672 100644 --- a/packages/client/src/pages/admin/_header_.vue +++ b/packages/client/src/pages/admin/_header_.vue @@ -150,7 +150,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 0114aa3993..766fdc0088 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 82cf2e3c0c..a37680d361 100644 --- a/packages/client/src/pages/admin/index.vue +++ b/packages/client/src/pages/admin/index.vue @@ -154,7 +154,7 @@ const menuDef = computed(() => [ text: i18n.ts.invite, action: invite, }, - ] + ] : []), ...($i.isAdmin ? [ @@ -164,7 +164,7 @@ const menuDef = computed(() => [ text: i18n.ts.indexPosts, action: indexPosts, }, - ] + ] : []), ], }, @@ -307,7 +307,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 6482d99db7..1ffcb37713 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 fd3edea98d..b802457b4a 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 cb10e27e7f..62be1b87de 100644 --- a/packages/client/src/pages/admin/queue.chart.vue +++ b/packages/client/src/pages/admin/queue.chart.vue @@ -117,8 +117,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 7522b53d8a..2bf463255f 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 56855a8eaa..d5028993e5 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 1c1b54307e..d9fbbdf84f 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 083db86ce0..a2260dc4a4 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 8406cc0527..60bcfe990e 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 f141cc6fa8..9bba5cf721 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 6f5f3310f6..63ff6315c1 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 330a12f2aa..63b906782b 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 ae7f9e6c30..060b3823a5 100644 --- a/packages/client/src/pages/gallery/post.vue +++ b/packages/client/src/pages/gallery/post.vue @@ -241,7 +241,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 0159bee680..8cc8457f61 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 2feadb40ac..8c8f5317a5 100644 --- a/packages/client/src/pages/note.vue +++ b/packages/client/src/pages/note.vue @@ -102,7 +102,7 @@ const prevPagination = { ? { userId: appearNote.value.userId, untilId: appearNote.value.id, - } + } : null, ), }; @@ -116,7 +116,7 @@ const nextPagination = { ? { userId: appearNote.value.userId, sinceId: appearNote.value.id, - } + } : null, ), }; @@ -192,7 +192,7 @@ definePageMetadata( }), text: appearNote.value.text, }, - } + } : null, ), ); diff --git a/packages/client/src/pages/notifications.vue b/packages/client/src/pages/notifications.vue index 001a3b6b33..0eaeffdf6e 100644 --- a/packages/client/src/pages/notifications.vue +++ b/packages/client/src/pages/notifications.vue @@ -115,7 +115,7 @@ function setFilter(ev) { }, null, ...typeItems, - ] + ] : typeItems; os.popupMenu(items, ev.currentTarget ?? ev.target); } @@ -128,7 +128,7 @@ const headerActions = computed(() => icon: `${icon("ph-funnel")}`, highlighted: includeTypes.value != null, handler: setFilter, - } + } : undefined, tab.value === "all" ? { @@ -137,7 +137,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 db9c069b08..2023595880 100644 --- a/packages/client/src/pages/page.vue +++ b/packages/client/src/pages/page.vue @@ -319,7 +319,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 3b736d39ec..7ad0ac20a1 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 49fb08549f..cd190e2eb7 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 474fe51b08..8c0570641e 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 5bf836051b..fed147e6b6 100644 --- a/packages/client/src/pages/timeline.vue +++ b/packages/client/src/pages/timeline.vue @@ -233,7 +233,7 @@ const headerTabs = computed(() => [ icon: `${icon("ph-users")}`, iconOnly: true, }, - ] + ] : []), ...(isLocalTimelineAvailable ? [ @@ -243,7 +243,7 @@ const headerTabs = computed(() => [ icon: `${icon("ph-handshake")}`, iconOnly: true, }, - ] + ] : []), ...(isRecommendedTimelineAvailable ? [ @@ -253,7 +253,7 @@ const headerTabs = computed(() => [ icon: `${icon("ph-thumbs-up")}`, iconOnly: true, }, - ] + ] : []), ...(isGlobalTimelineAvailable ? [ @@ -263,7 +263,7 @@ const headerTabs = computed(() => [ icon: `${icon("ph-planet")}`, iconOnly: true, }, - ] + ] : []), ]); @@ -274,12 +274,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 a43f113fef..e571730cee 100644 --- a/packages/client/src/pages/user-info.vue +++ b/packages/client/src/pages/user-info.vue @@ -418,7 +418,7 @@ function createFetcher() { isAdmin ? 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: "chart", diff --git a/packages/client/src/pages/user-list-timeline.vue b/packages/client/src/pages/user-list-timeline.vue index 75ad30573c..d48cdcce89 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 dcfca7dd52..b0b7b310b9 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 c72fbf51d6..220ec861bc 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 69657f788f..442ad6dc6c 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 09e4a66209..562715c3b8 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 6537c7dbc8..49f69692fc 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/scripts/device-kind.ts b/packages/client/src/scripts/device-kind.ts index 8c62924025..3c9608c01c 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 09e6e97065..1e9482b6bb 100644 --- a/packages/client/src/scripts/emojilist.ts +++ b/packages/client/src/scripts/emojilist.ts @@ -6,7 +6,7 @@ import { defaultStore } from "@/store"; 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/form.ts b/packages/client/src/scripts/form.ts index dc7393df03..aea6c01e90 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 ca7a6ffeb6..82830e939b 100644 --- a/packages/client/src/scripts/get-user-menu.ts +++ b/packages/client/src/scripts/get-user-menu.ts @@ -98,14 +98,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 ddaa49352f..564ee03606 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 c3406d0b98..eef003ae57 100644 --- a/packages/client/src/store.ts +++ b/packages/client/src/store.ts @@ -429,7 +429,7 @@ export class ColdDeviceStorage { public static get( key: T, - ): typeof ColdDeviceStorage.default[T] { + ): (typeof ColdDeviceStorage.default)[T] { // TODO: indexedDBにする // ただしその際はnullチェックではなくキー存在チェックにしないとダメ // (indexedDBはnullを保存できるため、ユーザーが意図してnullを格納した可能性がある) @@ -443,7 +443,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 805cdb9013..17ff0eb67b 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 ac99d6b8b6..fc7852e95d 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 cbe6f4f933..0b71522ad7 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 2d399b79e9..a8a65f824a 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 6cdd520d98..ab0c41f1e6 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 b6e281d3d9..5bf47a5624 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 a51ff32c9b..289842657e 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) => {