chore: format

This commit is contained in:
naskya 2023-12-29 05:53:16 +09:00
parent 9af4d5024f
commit 209fee7a6d
Signed by: naskya
GPG key ID: 712D413B3A9FED5C
121 changed files with 670 additions and 636 deletions

View file

@ -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);

View file

@ -67,7 +67,7 @@ export const refs = {
Emoji: packedEmojiSchema,
};
export type Packed<x extends keyof typeof refs> = SchemaType<typeof refs[x]>;
export type Packed<x extends keyof typeof refs> = SchemaType<(typeof refs)[x]>;
type TypeStringef =
| "null"
@ -81,18 +81,18 @@ type TypeStringef =
type StringDefToType<T extends TypeStringef> = 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<any>
: T extends "object"
? Record<string, any>
: any;
? boolean
: T extends "integer"
? number
: T extends "number"
? number
: T extends "string"
? string | Date
: T extends "array"
? ReadonlyArray<any>
: T extends "object"
? Record<string, any>
: any;
// https://swagger.io/specification/?sbsearch=optional#schema-object
type OfSchema = {
@ -130,14 +130,14 @@ type RequiredPropertyNames<s extends Obj> = {
s[K]["optional"] extends false
? K
: // K has default value
s[K]["default"] extends
| null
| string
| number
| boolean
| Record<string, unknown>
? K
: never;
s[K]["default"] extends
| null
| string
| number
| boolean
| Record<string, unknown>
? K
: never;
}[keyof s];
export type Obj = Record<string, Schema>;
@ -182,43 +182,47 @@ type ArrayUnion<T> = T extends any ? Array<T> : never;
export type SchemaTypeDef<p extends Schema> = 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["ref"]>
: p["properties"] extends NonNullable<Obj>
? ObjType<p["properties"], NonNullable<p["required"]>[number]>
: p["anyOf"] extends ReadonlyArray<Schema>
? UnionSchemaType<p["anyOf"]> &
Partial<UnionToIntersection<UnionSchemaType<p["anyOf"]>>>
: p["allOf"] extends ReadonlyArray<Schema>
? UnionToIntersection<UnionSchemaType<p["allOf"]>>
: any
: p["type"] extends "array"
? p["items"] extends OfSchema
? p["items"]["anyOf"] extends ReadonlyArray<Schema>
? UnionSchemaType<NonNullable<p["items"]["anyOf"]>>[]
: p["items"]["oneOf"] extends ReadonlyArray<Schema>
? ArrayUnion<UnionSchemaType<NonNullable<p["items"]["oneOf"]>>>
: p["items"]["allOf"] extends ReadonlyArray<Schema>
? UnionToIntersection<UnionSchemaType<NonNullable<p["items"]["allOf"]>>>[]
: never
: p["items"] extends NonNullable<Schema>
? SchemaTypeDef<p["items"]>[]
: any[]
: p["oneOf"] extends ReadonlyArray<Schema>
? UnionSchemaType<p["oneOf"]>
: 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["ref"]>
: p["properties"] extends NonNullable<Obj>
? ObjType<p["properties"], NonNullable<p["required"]>[number]>
: p["anyOf"] extends ReadonlyArray<Schema>
? UnionSchemaType<p["anyOf"]> &
Partial<UnionToIntersection<UnionSchemaType<p["anyOf"]>>>
: p["allOf"] extends ReadonlyArray<Schema>
? UnionToIntersection<UnionSchemaType<p["allOf"]>>
: any
: p["type"] extends "array"
? p["items"] extends OfSchema
? p["items"]["anyOf"] extends ReadonlyArray<Schema>
? UnionSchemaType<NonNullable<p["items"]["anyOf"]>>[]
: p["items"]["oneOf"] extends ReadonlyArray<Schema>
? ArrayUnion<
UnionSchemaType<NonNullable<p["items"]["oneOf"]>>
>
: p["items"]["allOf"] extends ReadonlyArray<Schema>
? UnionToIntersection<
UnionSchemaType<NonNullable<p["items"]["allOf"]>>
>[]
: never
: p["items"] extends NonNullable<Schema>
? SchemaTypeDef<p["items"]>[]
: any[]
: p["oneOf"] extends ReadonlyArray<Schema>
? UnionSchemaType<p["oneOf"]>
: any;
export type SchemaType<p extends Schema> = NullOrUndefined<p, SchemaTypeDef<p>>;

View file

@ -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];
}

View file

@ -126,7 +126,7 @@ export class Note {
* specified ... visibleUserIds
*/
@Column("enum", { enum: noteVisibilities })
public visibility: typeof noteVisibilities[number];
public visibility: (typeof noteVisibilities)[number];
@Index({ unique: true })
@Column("varchar", {

View file

@ -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.

View file

@ -47,7 +47,7 @@ export class Poll {
enum: noteVisibilities,
comment: "[Denormalized]",
})
public noteVisibility: typeof noteVisibilities[number];
public noteVisibility: (typeof noteVisibilities)[number];
@Index()
@Column({

View file

@ -100,7 +100,7 @@ export class UserProfile {
enum: ffVisibility,
default: "public",
})
public ffVisibility: typeof ffVisibility[number];
public ffVisibility: (typeof ffVisibility)[number];
@Column("varchar", {
length: 128,
@ -239,7 +239,7 @@ export class UserProfile {
array: true,
default: [],
})
public mutingNotificationTypes: typeof notificationTypes[number][];
public mutingNotificationTypes: (typeof notificationTypes)[number][];
//#region Denormalized fields
@Index()

View file

@ -55,7 +55,7 @@ export class Webhook {
array: true,
default: "{}",
})
public on: typeof webhookEventTypes[number][];
public on: (typeof webhookEventTypes)[number][];
@Column("varchar", {
length: 1024,

View file

@ -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

View file

@ -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<string> {
@ -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;

View file

@ -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");

View file

@ -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);

View file

@ -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 = {

View file

@ -197,8 +197,8 @@ export async function createNote(
note.attachment = Array.isArray(note.attachment)
? note.attachment
: note.attachment
? [note.attachment]
: [];
? [note.attachment]
: [];
const files = note.attachment.map(
(attach) => (attach.sensitive = note.sensitive),
)

View file

@ -275,26 +275,26 @@ export async function createPerson(
followersCount !== undefined
? followersCount
: person.followers &&
typeof person.followers !== "string" &&
isCollectionOrOrderedCollection(person.followers)
? person.followers.totalItems
: undefined,
typeof person.followers !== "string" &&
isCollectionOrOrderedCollection(person.followers)
? person.followers.totalItems
: undefined,
followingCount:
followingCount !== undefined
? followingCount
: person.following &&
typeof person.following !== "string" &&
isCollectionOrOrderedCollection(person.following)
? person.following.totalItems
: undefined,
typeof person.following !== "string" &&
isCollectionOrOrderedCollection(person.following)
? person.following.totalItems
: undefined,
notesCount:
notesCount !== undefined
? notesCount
: person.outbox &&
typeof person.outbox !== "string" &&
isCollectionOrOrderedCollection(person.outbox)
? person.outbox.totalItems
: undefined,
typeof person.outbox !== "string" &&
isCollectionOrOrderedCollection(person.outbox)
? person.outbox.totalItems
: undefined,
featured: person.featured ? getApId(person.featured) : undefined,
uri: person.id,
tags,
@ -314,8 +314,8 @@ export async function createPerson(
description: person._misskey_summary
? truncate(person._misskey_summary, summaryLength)
: person.summary
? htmlToMfm(truncate(person.summary, summaryLength), person.tag)
: null,
? htmlToMfm(truncate(person.summary, summaryLength), person.tag)
: null,
url: url,
fields,
birthday: bday ? bday[0] : null,
@ -523,26 +523,26 @@ export async function updatePerson(
followersCount !== undefined
? followersCount
: person.followers &&
typeof person.followers !== "string" &&
isCollectionOrOrderedCollection(person.followers)
? person.followers.totalItems
: undefined,
typeof person.followers !== "string" &&
isCollectionOrOrderedCollection(person.followers)
? person.followers.totalItems
: undefined,
followingCount:
followingCount !== undefined
? followingCount
: person.following &&
typeof person.following !== "string" &&
isCollectionOrOrderedCollection(person.following)
? person.following.totalItems
: undefined,
typeof person.following !== "string" &&
isCollectionOrOrderedCollection(person.following)
? person.following.totalItems
: undefined,
notesCount:
notesCount !== undefined
? notesCount
: person.outbox &&
typeof person.outbox !== "string" &&
isCollectionOrOrderedCollection(person.outbox)
? person.outbox.totalItems
: undefined,
typeof person.outbox !== "string" &&
isCollectionOrOrderedCollection(person.outbox)
? person.outbox.totalItems
: undefined,
featured: person.featured,
emojis: emojiNames,
name: truncate(person.name, nameLength),
@ -589,8 +589,8 @@ export async function updatePerson(
description: person._misskey_summary
? truncate(person._misskey_summary, summaryLength)
: person.summary
? htmlToMfm(truncate(person.summary, summaryLength), person.tag)
: null,
? htmlToMfm(truncate(person.summary, summaryLength), person.tag)
: null,
birthday: bday ? bday[0] : null,
location: person["vcard:Address"] || null,
},

View file

@ -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");

View file

@ -10,17 +10,20 @@ import { ApiError } from "./error.js";
const userIpHistories = new Map<User["id"], Set<string>>();
setInterval(() => {
userIpHistories.clear();
}, 1000 * 60 * 60);
setInterval(
() => {
userIpHistories.clear();
},
1000 * 60 * 60,
);
export default (endpoint: IEndpoint, ctx: Koa.Context) =>
new Promise<void>((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,
);
});

View file

@ -99,7 +99,7 @@ export default define(meta, paramDef, async (ps, me) => {
async function fetchAny(
uri: string,
me: CacheableLocalUser | null | undefined,
): Promise<SchemaType<typeof meta["res"]> | null> {
): Promise<SchemaType<(typeof meta)["res"]> | null> {
// Wait if blocked.
if (await shouldBlockInstance(extractDbHost(uri))) return null;

View file

@ -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;

View file

@ -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;

View file

@ -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,
});
});

View file

@ -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, {

View file

@ -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,
),
);

View file

@ -44,15 +44,15 @@ type KeyToColumnName<T extends string> = T extends `${infer R1}.${infer R2}`
: T;
type Columns<S extends Schema> = {
[K in
keyof S as `${typeof columnPrefix}${KeyToColumnName<string & K>}`]: number;
[K in keyof S as `${typeof columnPrefix}${KeyToColumnName<
string & K
>}`]: number;
};
type TempColumnsForUnique<S extends Schema> = {
[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<S extends Schema> = {
@ -176,8 +176,8 @@ export default abstract class Chart<T extends Schema> {
v.range === "big"
? "bigint"
: v.range === "small"
? "smallint"
: "integer";
? "smallint"
: "integer";
if (v.uniqueIncrement) {
columns[uniqueTempColumnPrefix + name] = {
type: "varchar",
@ -234,8 +234,8 @@ export default abstract class Chart<T extends Schema> {
span === "hour"
? `__chart__${camelToSnake(name)}`
: span === "day"
? `__chart_day__${camelToSnake(name)}`
: (new Error("not happen") as never),
? `__chart_day__${camelToSnake(name)}`
: (new Error("not happen") as never),
columns: {
id: {
type: "integer",
@ -315,7 +315,7 @@ export default abstract class Chart<T extends Schema> {
private getNewLog(latest: KVs<T> | null): KVs<T> {
const log = {} as Record<keyof T, number>;
for (const [k, v] of Object.entries(this.schema) as [
keyof typeof this["schema"],
keyof (typeof this)["schema"],
this["schema"][string],
][]) {
if (v.accumulate && latest) {
@ -335,8 +335,8 @@ export default abstract class Chart<T extends Schema> {
span === "hour"
? this.repositoryForHour
: span === "day"
? this.repositoryForDay
: (new Error("not happen") as never);
? this.repositoryForDay
: (new Error("not happen") as never);
return repository
.findOne({
@ -365,16 +365,16 @@ export default abstract class Chart<T extends Schema> {
span === "hour"
? [y, m, d, h]
: span === "day"
? [y, m, d]
: (new Error("not happen") as never),
? [y, m, d]
: (new Error("not happen") as never),
);
const repository =
span === "hour"
? this.repositoryForHour
: span === "day"
? this.repositoryForDay
: (new Error("not happen") as never);
? this.repositoryForDay
: (new Error("not happen") as never);
// 現在(=今のHour or Day)のログ
const currentLog = (await repository.findOneBy({
@ -731,19 +731,19 @@ export default abstract class Chart<T extends Schema> {
"day",
)
: span === "hour"
? subtractTime(
cursor ? dateUTC([y2, m2, d2, h2]) : dateUTC([y, m, d, h]),
amount - 1,
"hour",
)
: (new Error("not happen") as never);
? subtractTime(
cursor ? dateUTC([y2, m2, d2, h2]) : dateUTC([y, m, d, h]),
amount - 1,
"hour",
)
: (new Error("not happen") as never);
const repository =
span === "hour"
? this.repositoryForHour
: span === "day"
? this.repositoryForDay
: (new Error("not happen") as never);
? this.repositoryForDay
: (new Error("not happen") as never);
// ログ取得
let logs = (await repository.find({
@ -801,8 +801,8 @@ export default abstract class Chart<T extends Schema> {
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),

View file

@ -492,12 +492,12 @@ export async function addFile({
instance.sensitiveMediaDetectionSensitivity === "veryHigh"
? 0.1
: instance.sensitiveMediaDetectionSensitivity === "high"
? 0.3
: instance.sensitiveMediaDetectionSensitivity === "low"
? 0.7
: instance.sensitiveMediaDetectionSensitivity === "veryLow"
? 0.9
: 0.5,
? 0.3
: instance.sensitiveMediaDetectionSensitivity === "low"
? 0.7
: instance.sensitiveMediaDetectionSensitivity === "veryLow"
? 0.9
: 0.5,
sensitiveThresholdForPorn: 0.75,
enableSensitiveMediaDetectionForVideos:
instance.enableSensitiveMediaDetectionForVideos,
@ -622,8 +622,8 @@ export async function addFile({
? Users.isLocalUser(user) && profile?.alwaysMarkNsfw
? true
: sensitive !== null && sensitive !== undefined
? sensitive
: false
? sensitive
: false
: false;
if (info.sensitive && profile?.autoSensitive) file.isSensitive = true;

View file

@ -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)

View file

@ -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,

View file

@ -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,
};
}

View file

@ -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) {

View file

@ -20,7 +20,7 @@
1 -
angleDiff(hAngle, angle) / Math.PI -
numbersOpacityFactor,
)
)
"
/>
</template>
@ -49,7 +49,7 @@
1 -
angleDiff(hAngle, angle) / Math.PI -
numbersOpacityFactor,
)
)
"
>
{{ i === 0 ? (props.twentyfour ? "24" : "12") : i }}

View file

@ -330,7 +330,7 @@ const render = () => {
max: "original",
},
},
}
}
: undefined,
// gradient,
},

View file

@ -12,7 +12,7 @@
? `/my/messaging/group/${message.groupId}`
: `/my/messaging/${getAcct(
isMe(message) ? message.recipient : message.user,
)}`
)}`
"
>
<div class="message _block">
@ -22,8 +22,8 @@
message.groupId
? message.user
: isMe(message)
? message.recipient
: message.user
? message.recipient
: message.user
"
:show-indicator="true"
disable-link

View file

@ -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 },
);
},

View file

@ -327,8 +327,8 @@ async function ok() {
const result = props.input
? inputValue.value
: props.select
? selectedValue.value
: true;
? selectedValue.value
: true;
done(false, result);
}

View file

@ -712,7 +712,7 @@ function getMenu() {
action: () => {
renameFolder(folder.value);
},
}
}
: undefined,
folder.value
? {
@ -723,7 +723,7 @@ function getMenu() {
folder.value as firefish.entities.DriveFolder,
);
},
}
}
: undefined,
{
text: i18n.ts.createFolder,

View file

@ -17,8 +17,8 @@
? i18n.ts.selectFiles
: i18n.ts.selectFolders
: type === "file"
? i18n.ts.selectFile
: i18n.ts.selectFolder
? i18n.ts.selectFile
: i18n.ts.selectFolder
}}
<span
v-if="selected.length > 0"

View file

@ -25,7 +25,7 @@
props.skinToneLabels
? props.skinToneLabels[
props.skinTones.indexOf(skinTone)
]
]
: ''
"
></i>

View file

@ -60,7 +60,7 @@ export default defineComponent({
localStorage.getItem(localStoragePrefix + this.persistKey)
? localStorage.getItem(
localStoragePrefix + this.persistKey,
) === "t"
) === "t"
: this.expanded,
icon,
animation: defaultStore.state.animation,

View file

@ -88,8 +88,8 @@ const preferedModalType =
deviceKind === "desktop" && props.src != null
? "popup"
: deviceKind === "smartphone"
? "drawer"
: "dialog";
? "drawer"
: "dialog";
const modal = ref<InstanceType<typeof MkModal>>();

View file

@ -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,

View file

@ -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,

View file

@ -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;

View file

@ -17,8 +17,8 @@
? `${props.height}px`
: null
: height
? `min(${props.height}px, 100%)`
: '100%',
? `min(${props.height}px, 100%)`
: '100%',
}"
tabindex="-1"
>

View file

@ -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,

View file

@ -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,

View file

@ -74,7 +74,7 @@
? notification.reaction.replace(
/^:(\w+):$/,
':$1@.:',
)
)
: notification.reaction
"
:custom-emojis="notification.note.emojis"

View file

@ -258,14 +258,14 @@ const fetchMore = async (): Promise<void> => {
...(props.pagination.offsetMode
? {
offset: offset.value,
}
}
: props.pagination.reversed
? {
? {
sinceId: items.value[0].id,
}
: {
}
: {
untilId: items.value[items.value.length - 1].id,
}),
}),
})
.then(
(res) => {
@ -319,14 +319,14 @@ const fetchMoreAhead = async (): Promise<void> => {
...(props.pagination.offsetMode
? {
offset: offset.value,
}
}
: props.pagination.reversed
? {
? {
untilId: items.value[0].id,
}
: {
}
: {
sinceId: items.value[items.value.length - 1].id,
}),
}),
})
.then(
(res) => {

View file

@ -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,

View file

@ -171,8 +171,8 @@ function get() {
...(expiration.value === "at"
? { expiresAt: calcAt() }
: expiration.value === "after"
? { expiredAfter: calcAfter() }
: {}),
? { expiredAfter: calcAfter() }
: {}),
};
}

View file

@ -91,8 +91,8 @@
reply
? 'ph-arrow-u-up-left'
: renote
? 'ph-quotes'
: 'ph-paper-plane-tilt',
? 'ph-quotes'
: 'ph-paper-plane-tilt',
)
"
></i>
@ -249,8 +249,8 @@
reply
? 'ph-arrow-u-up-left'
: renote
? 'ph-quotes'
: 'ph-paper-plane-tilt',
? 'ph-quotes'
: 'ph-paper-plane-tilt',
)
"
></i>
@ -441,10 +441,10 @@ const submitText = computed((): string => {
return props.editId
? i18n.ts.edit
: props.renote
? i18n.ts.quote
: props.reply
? i18n.ts.reply
: i18n.ts.note;
? i18n.ts.quote
: props.reply
? i18n.ts.reply
: i18n.ts.note;
});
const textLength = computed((): number => {
@ -513,8 +513,8 @@ if (props.reply && props.reply.text != null) {
const mention = x.host
? `@${x.username}@${toASCII(x.host)}`
: otherHost == null || otherHost === host
? `@${x.username}`
: `@${x.username}@${toASCII(otherHost)}`;
? `@${x.username}`
: `@${x.username}@${toASCII(otherHost)}`;
// exclude me
if ($i.username === x.username && (x.host == null || x.host === host))
@ -1009,8 +1009,8 @@ async function post() {
renoteId: props.renote
? props.renote.id
: quoteId.value
? quoteId.value
: undefined,
? quoteId.value
: undefined,
channelId: props.channel ? props.channel.id : undefined,
poll: poll.value,
cw: useCw.value ? cw.value || "" : undefined,
@ -1022,8 +1022,8 @@ async function post() {
visibility.value === "private"
? []
: visibility.value === "specified"
? visibleUsers.value.map((u) => u.id)
: undefined,
? visibleUsers.value.map((u) => u.id)
: undefined,
};
if (withHashtags.value && hashtags.value && hashtags.value.trim() !== "") {

View file

@ -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 =

View file

@ -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";

View file

@ -45,7 +45,7 @@ export default defineComponent({
},
[label],
),
]
]
: []),
h(
"div",
@ -76,7 +76,7 @@ export default defineComponent({
},
[caption],
),
]
]
: []),
],
);

View file

@ -70,7 +70,7 @@ const choseAd = (): Ad | null => {
? {
...ad,
ratio: 0,
}
}
: ad,
);

View file

@ -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(() => {

View file

@ -29,11 +29,11 @@ const _time =
props.time == null
? NaN
: typeof props.time === "number"
? props.time
: (props.time instanceof Date
? props.time
: (props.time instanceof Date
? props.time
: new Date(props.time)
).getTime();
).getTime();
const invalid = Number.isNaN(_time);
const absolute = !invalid ? dateTimeFormat.format(_time) : i18n.ts._ago.invalid;
@ -46,30 +46,32 @@ const relative = computed<string>(() => {
return ago >= 31536000
? i18n.t("_ago.yearsAgo", { n: Math.floor(ago / 31536000).toString() })
: ago >= 2592000
? i18n.t("_ago.monthsAgo", {
? i18n.t("_ago.monthsAgo", {
n: Math.floor(ago / 2592000).toString(),
})
: ago >= 604800
? i18n.t("_ago.weeksAgo", {
})
: ago >= 604800
? i18n.t("_ago.weeksAgo", {
n: Math.floor(ago / 604800).toString(),
})
: ago >= 86400
? i18n.t("_ago.daysAgo", {
})
: ago >= 86400
? i18n.t("_ago.daysAgo", {
n: Math.floor(ago / 86400).toString(),
})
: ago >= 3600
? i18n.t("_ago.hoursAgo", {
})
: ago >= 3600
? i18n.t("_ago.hoursAgo", {
n: Math.floor(ago / 3600).toString(),
})
: ago >= 60
? i18n.t("_ago.minutesAgo", { n: (~~(ago / 60)).toString() })
: ago >= 10
? i18n.t("_ago.secondsAgo", {
})
: ago >= 60
? i18n.t("_ago.minutesAgo", {
n: (~~(ago / 60)).toString(),
})
: ago >= 10
? i18n.t("_ago.secondsAgo", {
n: (~~(ago % 60)).toString(),
})
: ago >= -1
? i18n.ts._ago.justNow
: i18n.ts._ago.future;
})
: ago >= -1
? i18n.ts._ago.justNow
: i18n.ts._ago.future;
});
let tickId: number;

View file

@ -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;

View file

@ -45,7 +45,7 @@ export default defineComponent({
...(this.block.var
? {
var: unref(this.hpml.vars)[this.block.var],
}
}
: {}),
});

View file

@ -1,6 +1,6 @@
import type { Directive } from "vue";
export default {
export default ({
mounted(src, binding, vn) {
const getBgColor = (el: HTMLElement) => {
const style = window.getComputedStyle(el);
@ -26,4 +26,4 @@ export default {
src.style.borderColor = myBg;
}
},
} as Directive;
} as Directive);

View file

@ -1,6 +1,6 @@
import type { Directive } from "vue";
export default {
export default ({
beforeMount(src, binding, vn) {
src.style.opacity = "0";
src.style.transform = "scale(0.9)";
@ -15,4 +15,4 @@ export default {
src.style.transform = "none";
}, 1);
},
} as Directive;
} as Directive);

View file

@ -1,6 +1,6 @@
import type { Directive } from "vue";
export default {
export default ({
mounted(src, binding, vn) {
const fn = binding.value;
if (fn == null) return;
@ -19,4 +19,4 @@ export default {
unmounted(src, binding, vn) {
if (src._observer_) src._observer_.disconnect();
},
} as Directive;
} as Directive);

View file

@ -1,7 +1,7 @@
import type { Directive } from "vue";
// import { defaultStore } from "@/store";
export default {
export default ({
mounted(el, binding, vn) {
/*
if (!defaultStore.state.animation) return;
@ -28,4 +28,4 @@ export default {
});
*/
},
} as Directive;
} as Directive);

View file

@ -1,7 +1,7 @@
import { getScrollContainer, getScrollPosition } from "@/scripts/scroll";
import type { Directive } from "vue";
export default {
export default ({
mounted(src, binding, vn) {
if (binding.value === false) return;
@ -36,4 +36,4 @@ export default {
unmounted(src, binding, vn) {
if (src._ro_) src._ro_.unobserve(src);
},
} as Directive;
} as Directive);

View file

@ -35,7 +35,7 @@ function calc(src: Element) {
info.fn(width, height);
}
export default {
export default ({
mounted(src, binding, vn) {
const resize = new ResizeObserver((entries, observer) => {
calc(src);
@ -54,4 +54,4 @@ export default {
if (info.intersection) info.intersection.disconnect();
mountings.delete(src);
},
} as Directive<Element, (w: number, h: number) => void>;
} as Directive<Element, (w: number, h: number) => void>);

View file

@ -1,7 +1,7 @@
import { makeHotkey } from "@/scripts/hotkey";
import type { Directive } from "vue";
export default {
export default ({
mounted(el, binding) {
el._hotkey_global = binding.modifiers.global === true;
@ -21,4 +21,4 @@ export default {
el.removeEventListener("keydown", el._keyHandler);
}
},
} as Directive;
} as Directive);

View file

@ -1,6 +1,6 @@
import type { Directive } from "vue";
export default {
export default ({
mounted(src, binding, vn) {
const getBgColor = (el: HTMLElement) => {
const style = window.getComputedStyle(el);
@ -28,4 +28,4 @@ export default {
src.style.backgroundColor = "var(--panel)";
}
},
} as Directive;
} as Directive);

View file

@ -88,7 +88,7 @@ function calc(el: Element) {
}
}
export default {
export default ({
mounted(src, binding, vn) {
const resize = new ResizeObserver((entries, observer) => {
calc(src);
@ -119,4 +119,4 @@ export default {
if (info.intersection) info.intersection.disconnect();
mountings.delete(src);
},
} as Directive<Element, Value>;
} as Directive<Element, Value>);

View file

@ -10,7 +10,7 @@ import { defineAsyncComponent, ref } from "vue";
const start = isTouchUsing ? "touchstart" : "mouseover";
const end = isTouchUsing ? "touchend" : "mouseleave";
export default {
export default ({
mounted(el: HTMLElement, binding, vn) {
const delay = binding.modifiers.noDelay ? 0 : 100;
@ -63,12 +63,12 @@ export default {
direction: binding.modifiers.left
? "left"
: binding.modifiers.right
? "right"
: binding.modifiers.top
? "top"
: binding.modifiers.bottom
? "bottom"
: "top",
? "right"
: binding.modifiers.top
? "top"
: binding.modifiers.bottom
? "bottom"
: "top",
targetElement: el,
},
{},
@ -119,4 +119,4 @@ export default {
window.clearInterval(self.checkTimer);
self.close();
},
} as Directive;
} as Directive);

View file

@ -104,7 +104,7 @@ export class UserPreview {
}
}
export default {
export default ({
mounted(el: HTMLElement, binding, vn) {
if (binding.value == null) return;
@ -121,4 +121,4 @@ export default {
const self = el._userPreviewDirective_;
self.preview.detach();
},
} as Directive;
} as Directive);

View file

@ -1,11 +1,11 @@
import { vibrate } from "@/scripts/vibrate";
import type { Directive } from "vue";
export default {
export default ({
mounted(el, binding) {
const pattern = (binding.value as VibratePattern) ?? 20;
el.addEventListener("mousedown", () => {
vibrate(pattern);
});
},
} as Directive;
} as Directive);

View file

@ -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"];
}
}

View file

@ -195,10 +195,10 @@ function checkForSplash() {
window.location.search === "?zen"
? defineAsyncComponent(() => import("@/ui/zen.vue"))
: !$i
? defineAsyncComponent(() => import("@/ui/visitor.vue"))
: ui === "deck"
? defineAsyncComponent(() => import("@/ui/deck.vue"))
: defineAsyncComponent(() => import("@/ui/universal.vue")),
? defineAsyncComponent(() => import("@/ui/visitor.vue"))
: ui === "deck"
? defineAsyncComponent(() => import("@/ui/deck.vue"))
: defineAsyncComponent(() => import("@/ui/universal.vue")),
);
if (_DEV_) {

View file

@ -774,8 +774,8 @@ export async function cropImage(
type AwaitType<T> = T extends Promise<infer U>
? U
: T extends (...args: any[]) => Promise<infer V>
? V
: T;
? V
: T;
let openingEmojiPicker: AwaitType<ReturnType<typeof popup>> | null = null;
let activeTextarea: HTMLTextAreaElement | HTMLInputElement | null = null;
export async function openEmojiPicker(

View file

@ -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 }
: {}),
})),
};

View file

@ -243,7 +243,7 @@ const headerTabs = computed(() => [
key: "ip",
title: "IP",
icon: `${icon("ph-receipt")}`,
}
}
: null,
{
key: "raw",

View file

@ -153,7 +153,7 @@ const calcBg = () => {
rawBg.startsWith("var(")
? getComputedStyle(document.documentElement).getPropertyValue(
rawBg.slice(4, -1),
)
)
: rawBg,
);
tinyBg.setAlpha(0.85);

View file

@ -105,8 +105,8 @@ async function init() {
provider.value = meta.enableHcaptcha
? "hcaptcha"
: meta.enableRecaptcha
? "recaptcha"
: null;
? "recaptcha"
: null;
}
function save() {

View file

@ -150,7 +150,7 @@ const menuDef = computed(() => [
text: i18n.ts.invite,
action: invite,
},
]
]
: []),
],
},
@ -293,7 +293,7 @@ const menuDef = computed(() => [
},
],
},
]
]
: []),
]);

View file

@ -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

View file

@ -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, {

View file

@ -118,8 +118,8 @@ onMounted(() => {
props.domain === "inbox"
? "admin/queue/inbox-delayed"
: props.domain === "deliver"
? "admin/queue/deliver-delayed"
: null,
? "admin/queue/deliver-delayed"
: null,
{},
).then((result) => {
jobs.value = result;

View file

@ -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,

View file

@ -107,7 +107,7 @@
user.updatedAt
? `Last posted: ${new Date(
user.updatedAt,
).toLocaleString()}`
).toLocaleString()}`
: 'Never posted'
"
class="user"

View file

@ -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,
),
);

View file

@ -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);
});

View file

@ -133,11 +133,11 @@ definePageMetadata(
? {
title: i18n.ts._channel.edit,
icon: `${icon("ph-television")}`,
}
}
: {
title: i18n.ts._channel.create,
icon: `${icon("ph-television")}`,
},
},
),
);
</script>

View file

@ -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,
),
);

View file

@ -123,7 +123,7 @@ const headerActions = computed(() =>
});
},
},
]
]
: null,
);
@ -133,7 +133,7 @@ definePageMetadata(
? {
title: clip.value.name,
icon: `${icon("ph-paperclip")}`,
}
}
: null,
),
);

View file

@ -161,11 +161,11 @@ definePageMetadata(
? {
title: i18n.ts.edit,
icon: `${icon("ph-pencil")}`,
}
}
: {
title: i18n.ts.postToGallery,
icon: `${icon("ph-pencil")}`,
},
},
),
);
</script>

View file

@ -238,7 +238,7 @@ definePageMetadata(
? {
title: post.value.title,
avatar: post.value.user,
}
}
: null,
),
);

View file

@ -156,7 +156,7 @@ definePageMetadata(
? {
title: list.value.name,
icon: `${icon("ph-list-bullets")}`,
}
}
: null,
),
);

View file

@ -103,7 +103,7 @@ const prevPagination = {
? {
userId: appearNote.value.userId,
untilId: appearNote.value.id,
}
}
: null,
),
};
@ -117,7 +117,7 @@ const nextPagination = {
? {
userId: appearNote.value.userId,
sinceId: appearNote.value.id,
}
}
: null,
),
};
@ -183,7 +183,7 @@ definePageMetadata(
user:
appearNote.value.user.name ||
appearNote.value.user.username,
}),
}),
subtitle: new Date(
appearNote.value.createdAt,
).toLocaleString(),
@ -197,7 +197,7 @@ definePageMetadata(
}),
text: appearNote.value.text,
},
}
}
: null,
),
);

View file

@ -116,7 +116,7 @@ function setFilter(ev) {
},
null,
...typeItems,
]
]
: typeItems;
os.popupMenu(items, ev.currentTarget ?? ev.target);
}
@ -129,7 +129,7 @@ const headerActions = computed(() =>
icon: `${icon("ph-funnel")}`,
highlighted: includeTypes.value != null,
handler: setFilter,
}
}
: undefined,
tab.value === "all"
? {
@ -138,7 +138,7 @@ const headerActions = computed(() =>
handler: () => {
os.apiWithDialog("notifications/mark-all-as-read");
},
}
}
: undefined,
].filter((x) => x !== undefined),
);

View file

@ -316,7 +316,7 @@ definePageMetadata(
title: page.value.title || page.value.name,
text: page.value.summary,
},
}
}
: null,
),
);

View file

@ -151,7 +151,7 @@ async function install() {
},
"closed",
);
});
});
installPlugin({
id: uuid(),

View file

@ -92,7 +92,7 @@ async function init() {
? {
username: q.username,
host: q.host === null ? undefined : q.host,
}
}
: q,
)
.map((q) =>

View file

@ -90,8 +90,8 @@
color: color.forPreview
? color.forPreview
: theme.base === 'light'
? '#5f5f5f'
: '#dadada',
? '#5f5f5f'
: '#dadada',
}"
>
A

View file

@ -230,7 +230,7 @@ const headerTabs = computed(() => [
icon: `${icon("ph-handshake")}`,
iconOnly: true,
},
]
]
: []),
...(isRecommendedTimelineAvailable
? [
@ -240,7 +240,7 @@ const headerTabs = computed(() => [
icon: `${icon("ph-thumbs-up")}`,
iconOnly: true,
},
]
]
: []),
...(isLocalTimelineAvailable
? [
@ -250,7 +250,7 @@ const headerTabs = computed(() => [
icon: `${icon("ph-users")}`,
iconOnly: true,
},
]
]
: []),
...(isGlobalTimelineAvailable
? [
@ -260,7 +260,7 @@ const headerTabs = computed(() => [
icon: `${icon("ph-planet")}`,
iconOnly: true,
},
]
]
: []),
]);
@ -271,12 +271,12 @@ definePageMetadata(
src.value === "local"
? "ph-users ph-lg"
: src.value === "social"
? "ph-handshake ph-lg"
: src.value === "recommended"
? "ph-thumbs-up ph-lg"
: src.value === "global"
? "ph-planet ph-lg"
: "ph-house ph-lg",
? "ph-handshake ph-lg"
: src.value === "recommended"
? "ph-thumbs-up ph-lg"
: src.value === "global"
? "ph-planet ph-lg"
: "ph-house ph-lg",
})),
);

View file

@ -409,7 +409,7 @@ function createFetcher() {
iAmAdmin
? os.api("admin/get-user-ips", {
userId: props.userId,
})
})
: Promise.resolve(null),
]).then(([_user, _info, _ips]) => {
user.value = _user;
@ -644,7 +644,7 @@ const headerTabs = computed(() =>
key: "moderation",
title: i18n.ts.moderation,
icon: `${icon("ph-shield")}`,
}
}
: null,
{
key: "raw",

View file

@ -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,
),
);

Some files were not shown because too many files have changed in this diff Show more