chore: format

Co-authored-by: deathg.rip <josh@deathg.rip>
This commit is contained in:
Nyan Helsing 2024-03-28 05:25:33 +00:00 committed by naskya
parent bd5e95a1f0
commit a98a26e901
87 changed files with 599 additions and 599 deletions

View file

@ -213,7 +213,7 @@ export const db = new DataSource({
db: config.redis.db || 0,
tls: config.redis.tls,
},
}
}
: false,
logging: log,
logger: log ? new MyCustomLogger() : undefined,

View file

@ -126,7 +126,7 @@ export const httpAgent = config.proxy
scheduling: "lifo",
proxy: config.proxy,
localAddress: config.outgoingAddress,
})
})
: _http;
/**
@ -141,7 +141,7 @@ export const httpsAgent = config.proxy
scheduling: "lifo",
proxy: config.proxy,
localAddress: config.outgoingAddress,
})
})
: _https;
/**

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);
@ -87,7 +87,7 @@ export async function populateEmoji(
? emojiUrl
: `${config.url}/proxy/${encodeURIComponent(
new URL(emojiUrl).pathname,
)}?${query({ url: emojiUrl })}`;
)}?${query({ url: emojiUrl })}`;
return {
name: emojiName,
@ -168,7 +168,7 @@ export async function prefetchEmojis(
? await Emojis.find({
where: emojisQuery,
select: ["name", "host", "originalUrl", "publicUrl"],
})
})
: [];
const trans = redisClient.multi();
for (const emoji of _emojis) {

View file

@ -85,18 +85,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 = {
@ -134,14 +134,14 @@ type RequiredPropertyNames<s extends Obj> = {
s[K]["optional"] extends false
? K
: // K has default value
s[K]["default"] extends
s[K]["default"] extends
| null
| string
| number
| boolean
| Record<string, unknown>
? K
: never;
? K
: never;
}[keyof s];
export type Obj = Record<string, Schema>;
@ -186,47 +186,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[]
? 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
? 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"]> &
? 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["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<
? ArrayUnion<
UnionSchemaType<NonNullable<p["items"]["oneOf"]>>
>
: p["items"]["allOf"] extends ReadonlyArray<Schema>
? UnionToIntersection<
>
: p["items"]["allOf"] extends ReadonlyArray<Schema>
? UnionToIntersection<
UnionSchemaType<NonNullable<p["items"]["allOf"]>>
>[]
: never
>[]
: never
: p["items"] extends NonNullable<Schema>
? SchemaTypeDef<p["items"]>[]
: any[]
: p["oneOf"] extends ReadonlyArray<Schema>
? UnionSchemaType<p["oneOf"]>
: any;
? 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

@ -27,7 +27,7 @@ export const AbuseUserReportRepository = db
assignee: report.assigneeId
? Users.pack(report.assignee || report.assigneeId, null, {
detail: true,
})
})
: null,
forwarded: report.forwarded,
});

View file

@ -38,7 +38,7 @@ export const AppRepository = db.getRepository(App).extend({
appId: app.id,
userId: me.id,
}).then((count) => count > 0),
}
}
: {}),
};
},

View file

@ -21,14 +21,14 @@ export const ChannelRepository = db.getRepository(Channel).extend({
? (await NoteUnreads.findOneBy({
noteChannelId: channel.id,
userId: meId,
})) != null
})) != null
: undefined;
const following = meId
? await ChannelFollowings.findOneBy({
followerId: meId,
followeeId: channel.id,
})
})
: null;
return {
@ -48,7 +48,7 @@ export const ChannelRepository = db.getRepository(Channel).extend({
? {
isFollowing: following != null,
hasUnreadNote,
}
}
: {}),
};
},

View file

@ -162,7 +162,7 @@ export const DriveFileRepository = db.getRepository(DriveFile).extend({
opts.detail && file.folderId
? DriveFolders.pack(file.folderId, {
detail: true,
})
})
: null,
userId: opts.withUser ? file.userId : null,
user: opts.withUser && file.userId ? Users.pack(file.userId) : null,
@ -203,7 +203,7 @@ export const DriveFileRepository = db.getRepository(DriveFile).extend({
opts.detail && file.folderId
? DriveFolders.pack(file.folderId, {
detail: true,
})
})
: null,
userId: opts.withUser ? file.userId : null,
user: opts.withUser && file.userId ? Users.pack(file.userId) : null,

View file

@ -41,9 +41,9 @@ export const DriveFolderRepository = db.getRepository(DriveFolder).extend({
parent: this.pack(folder.parentId, {
detail: true,
}),
}
}
: {}),
}
}
: {}),
});
},

View file

@ -67,12 +67,12 @@ export const FollowingRepository = db.getRepository(Following).extend({
followee: opts.populateFollowee
? Users.pack(following.followee || following.followeeId, me, {
detail: true,
})
})
: undefined,
follower: opts.populateFollower
? Users.pack(following.follower || following.followerId, me, {
detail: true,
})
})
: undefined,
});
},

View file

@ -30,7 +30,7 @@ export const GalleryPostRepository = db.getRepository(GalleryPost).extend({
isLiked: meId
? await GalleryLikes.findOneBy({ postId: post.id, userId: meId }).then(
(x) => x != null,
)
)
: undefined,
});
},

View file

@ -32,7 +32,7 @@ export const NoteReactionRepository = db.getRepository(NoteReaction).extend({
? {
// may throw error
note: await Notes.pack(reaction.note ?? reaction.noteId, me),
}
}
: {}),
};
},

View file

@ -227,7 +227,7 @@ export const NoteRepository = db.getRepository(Note).extend({
? {
id: channel.id,
name: channel.name,
}
}
: undefined,
mentions: note.mentions.length > 0 ? note.mentions : undefined,
uri: note.uri || undefined,
@ -237,7 +237,7 @@ export const NoteRepository = db.getRepository(Note).extend({
...(meId
? {
myReaction: populateMyReaction(note, meId, options?._hint_),
}
}
: {}),
...(opts.detail
@ -246,16 +246,16 @@ export const NoteRepository = db.getRepository(Note).extend({
? this.pack(note.reply || note.replyId, me, {
detail: false,
_hint_: options?._hint_,
})
})
: undefined,
renote: note.renoteId
? this.pack(note.renote || note.renoteId, me, {
detail: true,
_hint_: options?._hint_,
})
})
: undefined,
}
}
: {}),
lang: note.lang,
});

View file

@ -29,7 +29,7 @@ export const NotificationRepository = db.getRepository(Notification).extend({
const token = notification.appAccessTokenId
? await AccessTokens.findOneByOrFail({
id: notification.appAccessTokenId,
})
})
: null;
return await awaitAll({
@ -51,7 +51,7 @@ export const NotificationRepository = db.getRepository(Notification).extend({
_hint_: options._hintForEachNotes_,
},
),
}
}
: {}),
...(notification.type === "reply"
? {
@ -63,7 +63,7 @@ export const NotificationRepository = db.getRepository(Notification).extend({
_hint_: options._hintForEachNotes_,
},
),
}
}
: {}),
...(notification.type === "renote"
? {
@ -75,7 +75,7 @@ export const NotificationRepository = db.getRepository(Notification).extend({
_hint_: options._hintForEachNotes_,
},
),
}
}
: {}),
...(notification.type === "quote"
? {
@ -87,7 +87,7 @@ export const NotificationRepository = db.getRepository(Notification).extend({
_hint_: options._hintForEachNotes_,
},
),
}
}
: {}),
...(notification.type === "reaction"
? {
@ -100,7 +100,7 @@ export const NotificationRepository = db.getRepository(Notification).extend({
},
),
reaction: notification.reaction,
}
}
: {}),
...(notification.type === "pollVote"
? {
@ -113,7 +113,7 @@ export const NotificationRepository = db.getRepository(Notification).extend({
},
),
choice: notification.choice,
}
}
: {}),
...(notification.type === "pollEnded"
? {
@ -125,21 +125,21 @@ export const NotificationRepository = db.getRepository(Notification).extend({
_hint_: options._hintForEachNotes_,
},
),
}
}
: {}),
...(notification.type === "groupInvited"
? {
invitation: UserGroupInvitations.pack(
notification.userGroupInvitationId!,
),
}
}
: {}),
...(notification.type === "app"
? {
body: notification.customBody,
header: notification.customHeader || token?.name,
icon: notification.customIcon || token?.iconUrl,
}
}
: {}),
});
},

View file

@ -88,7 +88,7 @@ export const PageRepository = db.getRepository(Page).extend({
isLiked: meId
? await PageLikes.findOneBy({ pageId: page.id, userId: meId }).then(
(x) => x != null,
)
)
: undefined,
});
},

View file

@ -53,8 +53,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();
@ -235,7 +235,7 @@ export const UserRepository = db.getRepository(User).extend({
reads.length > 0
? {
id: Not(In(reads.map((read) => read.announcementId))),
}
}
: {},
);
@ -292,7 +292,7 @@ export const UserRepository = db.getRepository(User).extend({
? await NoteUnreads.findOneBy({
userId: userId,
noteChannelId: In(channels.map((x) => x.followeeId)),
})
})
: null;
return unread != null;
@ -335,8 +335,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> {
@ -429,23 +429,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;
@ -481,7 +481,7 @@ export const UserRepository = db.getRepository(User).extend({
iconUrl: instance.iconUrl,
faviconUrl: instance.faviconUrl,
themeColor: instance.themeColor,
}
}
: undefined,
)
: undefined,
@ -538,7 +538,7 @@ export const UserRepository = db.getRepository(User).extend({
securityKeys: UserSecurityKeys.countBy({
userId: user.id,
}).then((result) => result >= 1),
}
}
: {}),
...(opts.detail && isMe
@ -577,7 +577,7 @@ export const UserRepository = db.getRepository(User).extend({
mutedInstances: profile?.mutedInstances,
mutingNotificationTypes: profile?.mutingNotificationTypes,
emailNotificationTypes: profile?.emailNotificationTypes,
}
}
: {}),
...(opts.includeSecrets
@ -594,7 +594,7 @@ export const UserRepository = db.getRepository(User).extend({
lastUsed: true,
},
}),
}
}
: {}),
...(relation
@ -609,7 +609,7 @@ export const UserRepository = db.getRepository(User).extend({
isMuted: relation.isMuted,
isRenoteMuted: relation.isRenoteMuted,
isReplyMuted: relation.isReplyMuted,
}
}
: {}),
} as Promiseable<Packed<"User">> as Promiseable<
IsMeAndIsUserDetailed<ExpectsMe, D>

View file

@ -9,15 +9,15 @@ 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(
? 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],
@ -25,8 +25,8 @@ export function dateUTC(time: number[]): Date {
time[4],
time[5],
time[6],
)
: null;
)
: 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

@ -18,7 +18,7 @@ export function initialize<T>(name: string, limitPerSec = -1) {
? {
max: limitPerSec,
duration: 1000,
}
}
: undefined,
settings: {
stalledInterval: 60,

View file

@ -38,7 +38,7 @@ export async function exportFollowing(
const mutings = job.data.excludeMuting
? await Mutings.findBy({
muterId: user.id,
})
})
: [];
while (true) {

View file

@ -48,11 +48,11 @@ export async function importBlocking(
? await Users.findOneBy({
host: IsNull(),
usernameLower: username.toLowerCase(),
})
})
: await Users.findOneBy({
host: toPuny(host!),
usernameLower: username.toLowerCase(),
});
});
if (host == null && target == null) continue;

View file

@ -46,11 +46,11 @@ export async function importFollowing(
? await Users.findOneBy({
host: IsNull(),
usernameLower: username.toLowerCase(),
})
})
: await Users.findOneBy({
host: toPuny(host!),
usernameLower: username.toLowerCase(),
});
});
if (host == null && target == null) continue;
@ -84,11 +84,11 @@ export async function importFollowing(
? await Users.findOneBy({
host: IsNull(),
usernameLower: username.toLowerCase(),
})
})
: await Users.findOneBy({
host: toPuny(host!),
usernameLower: username.toLowerCase(),
});
});
if (host == null && target == null) continue;

View file

@ -49,11 +49,11 @@ export async function importMuting(
? await Users.findOneBy({
host: IsNull(),
usernameLower: username.toLowerCase(),
})
})
: await Users.findOneBy({
host: toPuny(host!),
usernameLower: username.toLowerCase(),
});
});
if (host == null && target == null) continue;

View file

@ -68,11 +68,11 @@ export async function importUserLists(
? await Users.findOneBy({
host: IsNull(),
usernameLower: username.toLowerCase(),
})
})
: await Users.findOneBy({
host: toPuny(host!),
usernameLower: username.toLowerCase(),
});
});
if (target == null) {
target = await resolveUser(username, host);

View file

@ -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),
)
@ -216,7 +216,7 @@ export async function createNote(
(x) => limit(() => resolveImage(actor, x)) as Promise<DriveFile>,
),
)
).filter((image) => image != null)
).filter((image) => image != null)
: [];
// Reply

View file

@ -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,
@ -526,26 +526,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),
@ -592,8 +592,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

@ -85,7 +85,7 @@ export default async function renderNote(
note.mentions.length > 0
? await Users.findBy({
id: In(note.mentions),
})
})
: [];
const hashtagTags = (note.tags || []).map((tag) => renderHashtag(tag));
@ -117,7 +117,7 @@ export default async function renderNote(
const contentMap = note.lang
? {
[note.lang]: content,
}
}
: null;
const emojis = await getEmojis(note.emojis);
@ -143,13 +143,13 @@ export default async function renderNote(
totalItems: poll!.votes[i],
},
})),
}
}
: {};
const asTalk = isTalk
? {
_misskey_talk: true,
}
}
: {};
return {

View file

@ -41,9 +41,9 @@ export async function renderPerson(user: ILocalUser) {
value: field.value?.match(/^https?:/)
? `<a href="${
new URL(field.value).href
}" rel="me nofollow noopener" target="_blank">${
}" rel="me nofollow noopener" target="_blank">${
new URL(field.value).href
}</a>`
}</a>`
: field.value,
});
}

View file

@ -121,7 +121,7 @@ export default class Resolver {
(Array.isArray(object["@context"])
? !(object["@context"] as unknown[]).includes(
"https://www.w3.org/ns/activitystreams",
)
)
: object["@context"] !== "https://www.w3.org/ns/activitystreams")
) {
throw new Error("invalid response");

View file

@ -94,7 +94,7 @@ export default async (ctx: Router.RouterContext) => {
? `${partOf}?${url.query({
page: "true",
cursor: followings[followings.length - 1].id,
})}`
})}`
: undefined,
);

View file

@ -94,7 +94,7 @@ export default async (ctx: Router.RouterContext) => {
? `${partOf}?${url.query({
page: "true",
cursor: followings[followings.length - 1].id,
})}`
})}`
: undefined,
);

View file

@ -93,13 +93,13 @@ export default async (ctx: Router.RouterContext) => {
? `${partOf}?${url.query({
page: "true",
since_id: notes[0].id,
})}`
})}`
: undefined,
notes.length
? `${partOf}?${url.query({
page: "true",
until_id: notes[notes.length - 1].id,
})}`
})}`
: undefined,
);

View file

@ -22,8 +22,8 @@ export default (endpoint: IEndpoint, ctx: Koa.Context) =>
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) {
@ -76,8 +76,8 @@ export default (endpoint: IEndpoint, ctx: Koa.Context) =>
e.httpStatusCode
? e.httpStatusCode
: e.kind === "client"
? 400
: 500,
? 400
: 500,
e,
);
});

View file

@ -11,7 +11,7 @@ export async function injectPromo(timeline: Note[], user?: User | null) {
const reads = user
? await PromoReads.findBy({
userId: user.id,
})
})
: [];
let promos = await PromoNotes.find();

View file

@ -210,7 +210,7 @@ export default define(meta, paramDef, async (ps, me) => {
webpublicUrl: ps.url,
},
],
});
});
if (file == null) {
throw new ApiError(meta.errors.noSuchFile);

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

@ -44,7 +44,7 @@ export default define(meta, paramDef, async (ps, user) => {
const groups = ps.group
? await UserGroupJoinings.findBy({
userId: user.id,
}).then((xs) => xs.map((x) => x.userGroupId))
}).then((xs) => xs.map((x) => x.userGroupId))
: [];
if (ps.group && groups.length === 0) {

View file

@ -477,7 +477,7 @@ export default define(meta, paramDef, async (ps, me) => {
place: ad.place,
ratio: ad.ratio,
imageUrl: ad.imageUrl,
})),
})),
enableEmail: instance.enableEmail,
enableServiceWorker: instance.enableServiceWorker,
@ -501,7 +501,7 @@ export default define(meta, paramDef, async (ps, me) => {
host: IsNull(),
isAdmin: true,
})) === 0,
}
}
: {}),
};

View file

@ -297,7 +297,7 @@ export default define(meta, paramDef, async (ps, user) => {
choices: ps.poll.choices,
multiple: ps.poll.multiple,
expiresAt: ps.poll.expiresAt ? new Date(ps.poll.expiresAt) : null,
}
}
: undefined,
text: ps.text || undefined,
lang: ps.lang,

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

@ -81,7 +81,7 @@ export default define(meta, paramDef, async (ps, me) => {
: {
usernameLower: ps.username!.toLowerCase(),
host: toPunyNullable(ps.host) ?? IsNull(),
},
},
);
if (user == null) {

View file

@ -80,7 +80,7 @@ export default define(meta, paramDef, async (ps, me) => {
: {
usernameLower: ps.username!.toLowerCase(),
host: toPunyNullable(ps.host) ?? IsNull(),
},
},
);
if (user == null) {

View file

@ -40,7 +40,7 @@ export default define(meta, paramDef, async (ps, me) => {
...(ownedGroups.length > 0
? {
userGroupId: Not(In(ownedGroups.map((x) => x.id))),
}
}
: {}),
});

View file

@ -67,10 +67,10 @@ export function apiTimelineMastodon(router: Router): void {
query.local === "true"
? await client.getLocalTimeline(
convertTimelinesArgsId(argsToBools(limitToInt(query))),
)
)
: await client.getPublicTimeline(
convertTimelinesArgsId(argsToBools(limitToInt(query))),
);
);
ctx.body = data.data.map((status) => convertStatus(status));
} catch (e: any) {
apiLogger.error(inspect(e));

View file

@ -129,12 +129,12 @@ export function genOpenapiSpec() {
},
},
},
}
}
: {
"204": {
description: "OK (without any results)",
},
}),
}),
"400": {
description: "Client error",
content: {
@ -192,7 +192,7 @@ export function genOpenapiSpec() {
},
},
},
}
}
: {}),
"500": {
description: "Internal server error",

View file

@ -68,7 +68,7 @@ export const initializeStreamingServer = (server: http.Server) => {
});
},
1000 * 60 * 5,
)
)
: null;
if (user) {
Users.update(user.id, {

View file

@ -195,7 +195,7 @@ export default async function (ctx: Koa.Context) {
BigInt(file.size),
ranges,
contentType,
);
);
readable.on("error", commonReadableHandlerGenerator(ctx));
ctx.body = readable;

View file

@ -107,15 +107,15 @@ export default async function (
let outstr = author
? `${author.name}(@${author.username}@${
author.host ? author.host : config.host
}) ${
}) ${
note.renoteId ? "renotes" : note.replyId ? "replies" : "says"
}: <br>`
}: <br>`
: "";
const files =
note.fileIds.length > 0
? await DriveFiles.findBy({
id: In(note.fileIds),
})
})
: [];
let fileEle = "";
for (const file of files) {

View file

@ -95,7 +95,7 @@ app.use(
`${_dirname}/../../../../../built/_client_dist_/manifest.json`,
"utf-8",
),
)["src/init.ts"],
)["src/init.ts"],
config,
},
}),

View file

@ -37,11 +37,11 @@ export const urlPreviewHandler = async (ctx: Koa.Context) => {
url: url,
lang: lang ?? "en-US",
})}`,
)
)
: await summaly.default(url, {
followRedirects: false,
lang: lang ?? "en-US",
});
});
logger.succ(`Got preview of ${url}: ${summary.title}`);
@ -83,7 +83,7 @@ function wrap(url?: string): string | null {
? `${config.url}/proxy/preview.webp?${query({
url,
preview: "1",
})}`
})}`
: url
: null;
}

View file

@ -114,10 +114,10 @@ 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,
),
);
);
const fromAcct = (acct: Acct.Acct): FindOptionsWhere<User> | number =>
!acct.host || acct.host === config.host.toLowerCase()
@ -125,7 +125,7 @@ router.get(webFingerPath, async (ctx) => {
usernameLower: acct.username,
host: IsNull(),
isSuspended: false,
}
}
: 422;
if (typeof ctx.query.resource !== "string") {

View file

@ -97,10 +97,10 @@ type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) extends (
type UnflattenSingleton<K extends string, V> = K extends `${infer A}.${infer B}`
? {
[_ in A]: UnflattenSingleton<B, V>;
}
}
: {
[_ in K]: V;
};
};
type Unflatten<T extends Record<string, any>> = UnionToIntersection<
{
@ -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",
@ -251,7 +251,7 @@ export default abstract class Chart<T extends Schema> {
type: "varchar",
length: 128,
},
}
}
: {}),
...Chart.convertSchemaToColumnDefinitions(schema),
},
@ -335,15 +335,15 @@ 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({
where: group
? {
group: group,
}
}
: {},
order: {
date: -1,
@ -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({
@ -729,21 +729,21 @@ export default abstract class Chart<T extends Schema> {
cursor ? dateUTC([y2, m2, d2, 0]) : dateUTC([y, m, d, 0]),
amount - 1,
"day",
)
)
: span === "hour"
? subtractTime(
? subtractTime(
cursor ? dateUTC([y2, m2, d2, h2]) : dateUTC([y, m, d, h]),
amount - 1,
"hour",
)
: (new Error("not happen") as never);
)
: (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({
@ -764,7 +764,7 @@ export default abstract class Chart<T extends Schema> {
where: group
? {
group: group,
}
}
: {},
order: {
date: -1,
@ -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

@ -586,8 +586,8 @@ export async function addFile({
(instance!.markLocalFilesNsfwByDefault || profile!.alwaysMarkNsfw)
? true
: sensitive != null
? sensitive
: false
? sensitive
: false
: false;
if (url != null) {

View file

@ -9,7 +9,7 @@ export function getS3(meta: Meta) {
meta.objectStorageEndpoint != null
? `${meta.objectStorageUseSsl ? "https://" : "http://"}${
meta.objectStorageEndpoint
}`
}`
: `${meta.objectStorageUseSsl ? "https://" : "http://"}example.net`;
try {

View file

@ -85,16 +85,16 @@ export default class Logger {
? chalk.bgRed.white("ERR ")
: chalk.red("ERR ")
: level === "warning"
? chalk.yellow("WARN")
: level === "success"
? important
? chalk.yellow("WARN")
: level === "success"
? important
? chalk.bgGreen.white("DONE")
: chalk.green("DONE")
: level === "debug"
? chalk.gray("VERB")
: level === "info"
? chalk.blue("INFO")
: null;
: level === "debug"
? chalk.gray("VERB")
: level === "info"
? chalk.blue("INFO")
: null;
const domains = [this.domain]
.concat(subDomains)
.map((d) =>
@ -106,14 +106,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}`;
@ -130,14 +130,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

@ -679,7 +679,7 @@ async function renderNoteOrRenoteActivity(data: Option, note: Note) {
? data.renote.uri
: `${config.url}/notes/${data.renote.id}`,
note,
)
)
: renderCreate(await renderNote(note, false), note);
return renderActivity(content);

View file

@ -99,11 +99,11 @@ export default async function (
note,
),
user,
)
)
: renderDelete(
renderTombstone(`${config.url}/notes/${note.id}`),
user,
),
),
);
deliverToConcerned(user, note, content);

View file

@ -110,7 +110,7 @@ export default async (
? `${emoji.name}@${emoji.host}`
: `${emoji.name}@.`,
url: emoji.publicUrl || emoji.originalUrl, // || emoji.originalUrl してるのは後方互換性のため
}
}
: null,
userId: user.id,
});

View file

@ -34,7 +34,7 @@ export default async function (
select: ["followeeId"],
})
).map((x) => x.followeeId),
);
);
const followingChannels = info?.followingChannels
? info.followingChannels
: new Set<string>(
@ -46,7 +46,7 @@ export default async function (
select: ["followeeId"],
})
).map((x) => x.followeeId),
);
);
// const myAntennas = (await getAntennas()).filter((a) => a.userId === userId);
const readMentions: (Note | Packed<"Note">)[] = [];

View file

@ -29,7 +29,7 @@ export async function sendEmail(
? {
user: meta.smtpUser,
pass: meta.smtpPass,
}
}
: undefined,
} as any);

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

@ -21,7 +21,7 @@ export async function validateEmailForAccount(emailAddress: string): Promise<{
validateTypo: false, // TLDを見ているみたいだけどclubとか弾かれるので
validateDisposable: true, // 捨てアドかどうかチェック
validateSMTP: false, // 日本だと25ポートが殆どのプロバイダーで塞がれていてタイムアウトになるので
})
})
: { valid: true };
const available = exist === 0 && validated.valid;
@ -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

@ -171,7 +171,7 @@ describe("ユーザー", () => {
email: user.email,
emailVerified: user.emailVerified,
securityKeysList: user.securityKeysList,
}
}
: {}),
});
};

View file

@ -37,7 +37,7 @@ export const api = async (endpoint: string, params: any, me?: any) => {
const auth = me
? {
i: me.token,
}
}
: {};
const res = await got<string>(`http://localhost:${port}/api/${endpoint}`, {
@ -77,7 +77,7 @@ export const request = async (
const auth = me
? {
i: me.token,
}
}
: {};
const res = await fetch(`http://localhost:${port}/api${endpoint}`, {
@ -152,8 +152,8 @@ export const uploadFile = async (user: any, _path?: string): Promise<any> => {
_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);

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();
@ -226,7 +226,7 @@
this[a][1] * c[1][b] +
this[a][2] * c[2][b] +
this[a][3] * c[3][b],
)
)
: d.push(this[a][b] * c);
return new m(d);
}),
@ -330,14 +330,14 @@
D[a.substr(1, 2)] +
D[a.substr(3, 2)] +
D[a.substr(5, 2)])),
(b = I[a] + f))
(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
);
}
@ -414,13 +414,13 @@
function y(d, a, b, f, e, c, g) {
c
? (d.beginPath(),
d.moveTo(a, b + e - c),
d.arcTo(a, b, a + c, b, c),
d.arcTo(a + f, b, a + f, b + c, c),
d.arcTo(a + f, b + e, a + f - c, b + e, c),
d.arcTo(a, b + e, a, b + e - c, c),
d.closePath(),
d[g ? "stroke" : "fill"]())
d.moveTo(a, b + e - c),
d.arcTo(a, b, a + c, b, c),
d.arcTo(a + f, b, a + f, b + c, c),
d.arcTo(a + f, b + e, a + f - c, b + e, c),
d.arcTo(a, b + e, a, b + e - c, c),
d.closePath(),
d[g ? "stroke" : "fill"]())
: d[g ? "strokeRect" : "fillRect"](a, b, f, e);
}
function O(a, b, c, d, e, f, g, h, i) {
@ -489,33 +489,33 @@
? (c < this.width
? (w += this.Align(c, this.width, this.ialign))
: (v += this.Align(this.width, c, this.align)),
this.ipos == "top"
this.ipos == "top"
? (r += d + this.ipad)
: (n += this.height + this.ipad),
(e = g(e, c + l)),
(f += d + this.ipad))
(e = g(e, c + l)),
(f += d + this.ipad))
: (d < this.height
? (n += this.Align(d, this.height, this.ivalign))
: (r += this.Align(this.height, d, this.valign)),
this.ipos == "right"
this.ipos == "right"
? (w += this.width + this.ipad)
: (v += c + this.ipad),
(e += c + this.ipad),
(f = g(f, d + i)))),
(e += c + this.ipad),
(f = g(f, d + i)))),
(o = k(e, f)),
!o
? null
: ((l = i = b / 2),
(s = e - b),
(u = f - b),
(x = h(E, s / 2, u / 2)),
(a = o.getContext("2d")),
D && ((a.fillStyle = D), y(a, l, i, s, u, x)),
b &&
(s = e - b),
(u = f - b),
(x = h(E, s / 2, u / 2)),
(a = o.getContext("2d")),
D && ((a.fillStyle = D), y(a, l, i, s, u, x)),
b &&
((a.strokeStyle = F), (a.lineWidth = b), y(a, l, i, s, u, x, !0)),
(m || B || C) &&
(m || B || C) &&
((t = k(e, f)), t && ((z = a), (a = t.getContext("2d")))),
Y(
Y(
a,
this.font,
G,
@ -528,16 +528,16 @@
this.maxWidth,
this.stringWidths,
this.align,
),
this.image && a.drawImage(this.image, w, n, c, d),
z &&
),
this.image && a.drawImage(this.image, w, n, c, d),
z &&
((a = z),
A && (a.shadowColor = A),
m && (a.shadowBlur = m),
(a.shadowOffsetX = q[0]),
(a.shadowOffsetY = q[1]),
a.drawImage(t, 0, 0)),
o)
o)
);
});
function H(a, c, d) {
@ -545,8 +545,8 @@
e;
return b
? ((e = b.getContext("2d")),
e.drawImage(a, (c - a.width) / 2, (d - a.height) / 2),
b)
e.drawImage(a, (c - a.width) / 2, (d - a.height) / 2),
b)
: null;
}
function S(e, b, c) {
@ -568,28 +568,28 @@
p;
return l
? ((c *= e),
(r *= e),
(i = q = c / 2),
(m = g - c),
(j = f - c),
(d = d * e + i),
(b = l.getContext("2d")),
(p = h(r, m / 2, j / 2)),
s && ((b.fillStyle = s), y(b, i, q, m, j, p)),
c && ((b.strokeStyle = v), (b.lineWidth = c), y(b, i, q, m, j, p, !0)),
w
(r *= e),
(i = q = c / 2),
(m = g - c),
(j = f - c),
(d = d * e + i),
(b = l.getContext("2d")),
(p = h(r, m / 2, j / 2)),
s && ((b.fillStyle = s), y(b, i, q, m, j, p)),
c && ((b.strokeStyle = v), (b.lineWidth = c), y(b, i, q, m, j, p, !0)),
w
? ((o = k(g, f)),
(a = o.getContext("2d")),
a.drawImage(n, d, d, u, t),
(a.globalCompositeOperation = "source-in"),
(a.fillStyle = v),
a.fillRect(0, 0, g, f),
(a.globalCompositeOperation = "destination-over"),
a.drawImage(l, 0, 0),
(a.globalCompositeOperation = "source-over"),
b.drawImage(o, 0, 0))
(a = o.getContext("2d")),
a.drawImage(n, d, d, u, t),
(a.globalCompositeOperation = "source-in"),
(a.fillStyle = v),
a.fillRect(0, 0, g, f),
(a.globalCompositeOperation = "destination-over"),
a.drawImage(l, 0, 0),
(a.globalCompositeOperation = "source-over"),
b.drawImage(o, 0, 0))
: b.drawImage(n, d, d, n.width, n.height),
{ image: l, width: g / e, height: f / e })
{ image: l, width: g / e, height: f / e })
: null;
}
function at(l, f, c, d, j) {
@ -602,20 +602,20 @@
!e
? null
: (f.indexOf("%") > 0 ? (b = (i * b) / 100) : (b = b * j),
(a = e.getContext("2d")),
(a.globalCompositeOperation = "source-over"),
(a.fillStyle = "#fff"),
b >= i / 2
(a = e.getContext("2d")),
(a.globalCompositeOperation = "source-over"),
(a.fillStyle = "#fff"),
b >= i / 2
? ((b = h(c, d) / 2),
a.beginPath(),
a.moveTo(c / 2, d / 2),
a.arc(c / 2, d / 2, b, 0, 2 * Math.PI, !1),
a.fill(),
a.closePath())
a.beginPath(),
a.moveTo(c / 2, d / 2),
a.arc(c / 2, d / 2, b, 0, 2 * Math.PI, !1),
a.fill(),
a.closePath())
: ((b = h(c / 2, d / 2, b)), y(a, 0, 0, c, d, b, !0), a.fill()),
(a.globalCompositeOperation = "source-in"),
a.drawImage(l, 0, 0, c, d),
e)
(a.globalCompositeOperation = "source-in"),
a.drawImage(l, 0, 0, c, d),
e)
);
}
function ao(q, m, i, b, h, a, c) {
@ -632,11 +632,11 @@
!e
? null
: ((d = e.getContext("2d")),
h && (d.shadowColor = h),
a && (d.shadowBlur = a * b),
c && ((d.shadowOffsetX = c[0] * b), (d.shadowOffsetY = c[1] * b)),
d.drawImage(q, n, o, m, i),
{ image: e, width: j / b, height: l / b })
h && (d.shadowColor = h),
a && (d.shadowBlur = a * b),
c && ((d.shadowOffsetX = c[0] * b), (d.shadowOffsetY = c[1] * b)),
d.drawImage(q, n, o, m, i),
{ image: e, width: j / b, height: l / b })
);
}
function ae(m, o, l) {
@ -779,16 +779,16 @@
b.outlineMethod == "size" &&
(b.outlineIncrease > 0
? ((a.iw += 2 * b.outlineIncrease),
(a.ih += 2 * b.outlineIncrease),
(f = h * a.iw),
(d = h * a.ih),
(c = S(a.fimage, f, d)),
(a.oimage = c),
(a.fimage = H(a.fimage, a.oimage.width, a.oimage.height)))
(a.ih += 2 * b.outlineIncrease),
(f = h * a.iw),
(d = h * a.ih),
(c = S(a.fimage, f, d)),
(a.oimage = c),
(a.fimage = H(a.fimage, a.oimage.width, a.oimage.height)))
: ((f = h * (a.iw + 2 * b.outlineIncrease)),
(d = h * (a.ih + 2 * b.outlineIncrease)),
(c = S(a.fimage, f, d)),
(a.oimage = H(c, a.fimage.width, a.fimage.height)))))),
(d = h * (a.ih + 2 * b.outlineIncrease)),
(c = S(a.fimage, f, d)),
(a.oimage = H(c, a.fimage.width, a.fimage.height)))))),
(a.alt = j),
a.Init();
}
@ -811,7 +811,7 @@
d
? (b = 1 * (c.getAttribute(d) || e))
: (a = i(c, "font-size")) &&
(b =
(b =
(a.indexOf("px") > -1 && a.replace("px", "") * 1) ||
(a.indexOf("pt") > -1 && a.replace("pt", "") * 1.25) ||
a * 3.3),
@ -832,8 +832,8 @@
n(a.offsetX)
? (b = { x: a.offsetX, y: a.offsetY })
: ((d = X(c.id)),
n(a.changedTouches) && (a = a.changedTouches[0]),
a.pageX && (b = { x: a.pageX - d.x, y: a.pageY - d.y })),
n(a.changedTouches) && (a = a.changedTouches[0]),
a.pageX && (b = { x: a.pageX - d.x, y: a.pageY - d.y })),
b && e && f && ((b.x /= e), (b.y /= f)),
b
);
@ -881,11 +881,11 @@
c.changedTouches &&
(c.touches.length == 1 && b.touchState == 0
? ((b.touchState = 1),
b.BeginDrag(c),
(d = K(c, b.canvas)) && ((b.mx = d.x), (b.my = d.y), (b.drawn = 0)))
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.br
? ((this.line = [b[a].nodeValue]), (this.br = 0))
: this.line.push(b[a].nodeValue)
: this.Lines(b[a]);
: this.Lines(b[a]);
return e || this.br || this.text.push(this.line.join(" ")), this.text;
}),
(F.SplitWidth = function (h, e, f, g) {
@ -1056,7 +1056,7 @@
a == "none"
? (this.Draw = function () {
return 1;
})
})
: (this.drawFunc = this[c[1]]),
(this[c[0]] = this.Draw),
d && ((this.RealPreDraw = this.PreDraw), (this.PreDraw = this.DrawAlt));
@ -1089,7 +1089,7 @@
(a = ~~d % j)),
a
? (b >= a ? ((h = b - a), (g = a)) : ((f = j - a), (i = c - f)),
(e = [h, f, g, i]))
(e = [h, f, g, i]))
: (e = [b, c]),
k.setLineDash(e);
}),
@ -1109,10 +1109,10 @@
? (d =
(a.image.height + this.tc.outlineIncrease) / a.image.height)
: (d = a.oscale),
(b = a.fimage || a.image),
(c = 1 + (d - 1) * (1 - this.pulse)),
(a.h *= c),
(a.w *= c))
(b = a.fimage || a.image),
(c = 1 + (d - 1) * (1 - this.pulse)),
(a.h *= c),
(a.w *= c))
: (b = a.oimage),
(a.alpha = 1),
a.Draw(i, h, g, b),
@ -1125,11 +1125,11 @@
return a.oimage
? (this.pulse < 1
? ((a.alpha = 1 - w(this.pulse, 2)),
a.Draw(d, b, c, a.fimage),
(a.alpha = this.pulse))
a.Draw(d, b, c, a.fimage),
(a.alpha = this.pulse))
: (a.alpha = 1),
a.Draw(d, b, c, a.oimage),
1)
a.Draw(d, b, c, a.oimage),
1)
: this[a.image ? "DrawColourImage" : "DrawColourText"](
d,
h,
@ -1140,7 +1140,7 @@
a,
b,
c,
);
);
}),
(f.DrawColourText = function (f, h, i, j, g, e, a, b, c) {
var d = a.colour;
@ -1158,24 +1158,24 @@
!v
? this.SetMethod("outline")
: ((j = v.getContext("2d")),
j.drawImage(f, e, d, c, b, 0, 0, c, b),
a.clearRect(e, d, c, b),
this.pulsate ? (i.alpha = 1 - w(this.pulse, 2)) : (i.alpha = 1),
i.Draw(a, r, l),
a.setTransform(1, 0, 0, 1, 0, 0),
a.save(),
a.beginPath(),
a.rect(e, d, c, b),
a.clip(),
(a.globalCompositeOperation = "source-in"),
(a.fillStyle = m),
a.fillRect(e, d, c, b),
a.restore(),
(a.globalAlpha = 1),
(a.globalCompositeOperation = "destination-over"),
a.drawImage(v, 0, 0, c, b, e, d, c, b),
(a.globalCompositeOperation = "source-over"),
1)
j.drawImage(f, e, d, c, b, 0, 0, c, b),
a.clearRect(e, d, c, b),
this.pulsate ? (i.alpha = 1 - w(this.pulse, 2)) : (i.alpha = 1),
i.Draw(a, r, l),
a.setTransform(1, 0, 0, 1, 0, 0),
a.save(),
a.beginPath(),
a.rect(e, d, c, b),
a.clip(),
(a.globalCompositeOperation = "source-in"),
(a.fillStyle = m),
a.fillRect(e, d, c, b),
a.restore(),
(a.globalAlpha = 1),
(a.globalCompositeOperation = "destination-over"),
a.drawImage(v, 0, 0, c, b, e, d, c, b),
(a.globalCompositeOperation = "source-over"),
1)
);
}),
(f.DrawAlt = function (b, a, c, d, 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;
@ -1354,21 +1354,21 @@
i,
b * this.padding,
b * this.bgRadius,
))
))
: a.outlineMethod == "size" &&
((f = ae(
((f = ae(
this.text,
this.textFont,
this.textHeight + a.outlineIncrease,
)),
(k = f.max.y + f.min.y),
(h =
)),
(k = f.max.y + f.min.y),
(h =
b * (this.textHeight + a.outlineIncrease) +
"px " +
this.textFont),
(e.font = h),
(g = this.MeasureText(e)),
(d = new O(
(e.font = h),
(g = this.MeasureText(e)),
(d = new O(
this.text,
h,
g + b,
@ -1378,8 +1378,8 @@
a.textAlign,
a.textVAlign,
b,
)),
this.image &&
)),
this.image &&
d.SetImage(
this.image,
this.iw + a.outlineIncrease,
@ -1390,7 +1390,7 @@
a.imageVAlign,
a.imageScale,
),
(this.oimage = d.Create(
(this.oimage = d.Create(
this.colour,
this.bgColour,
this.bgOutline,
@ -1400,9 +1400,9 @@
i,
b * this.padding,
b * this.bgRadius,
)),
(this.oscale = this.oimage.width / c.width),
a.outlineIncrease > 0
)),
(this.oscale = this.oimage.width / c.width),
a.outlineIncrease > 0
? (c = H(c, this.oimage.width, this.oimage.height))
: (this.oimage = H(this.oimage, c.width, c.height))),
c &&
@ -1440,8 +1440,8 @@
b.min_weight[a],
b.max_weight[a],
a,
),
this.Weight(
),
this.Weight(
c[a],
b.ctxt,
b,
@ -1449,7 +1449,7 @@
b.min_weight[a],
b.max_weight[a],
a,
))
))
: this.Weight(
c[a],
b.ctxt,
@ -1458,7 +1458,7 @@
b.min_weight[a],
b.max_weight[a],
a,
);
);
this.Measure(b.ctxt, b);
}),
(d.Weight = function (b, i, a, d, f, h, e) {
@ -1467,13 +1467,13 @@
"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.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 +
@ -1504,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);
@ -1712,8 +1712,8 @@
: a.Smooth),
this.shadowBlur || this.shadowOffset[0] || this.shadowOffset[1]
? ((this.ctxt.shadowColor = this.shadow),
(this.shadow = this.ctxt.shadowColor),
(this.shadowAlpha = aD()))
(this.shadow = this.ctxt.shadowColor),
(this.shadowAlpha = aD()))
: delete this.shadow,
this.activeAudio === !1
? (e = "off")
@ -1730,17 +1730,17 @@
b.HideTags();
},
window,
);
);
})(this),
(this.yaw = this.initial ? this.initial[0] * this.maxSpeed : 0),
(this.pitch = this.initial ? this.initial[1] * this.maxSpeed : 0),
this.tooltip
? ((this.ctitle = b.title),
(b.title = ""),
this.tooltip == "native"
(b.title = ""),
this.tooltip == "native"
? (this.Tooltip = this.TooltipNative)
: ((this.Tooltip = this.TooltipDiv),
this.ttdiv ||
this.ttdiv ||
((this.ttdiv = c.createElement("div")),
(this.ttdiv.className = this.tooltipClass),
(this.ttdiv.style.position = "absolute"),
@ -1874,18 +1874,18 @@
d.Empty()
? (d = null)
: ((g = this.textFont || Q(i(b, "font-family"))),
this.splitWidth &&
this.splitWidth &&
(f = d.SplitWidth(
this.splitWidth,
this.ctxt,
g,
this.textHeight,
)),
(h =
(h =
this.bgColour == "tag"
? i(b, "background-color")
: this.bgColour),
(j = this.bgOutline == "tag" ? i(b, "color") : this.bgOutline))),
(j = this.bgOutline == "tag" ? i(b, "color") : this.bgOutline))),
d || c)
)
return (
@ -1973,11 +1973,11 @@
this.shapeArgs
? (this.shapeArgs[0] = b.length)
: ((l = this.shape.toString().split(/[(),]/)),
(d = l.shift()),
typeof window[d] == "function"
(d = l.shift()),
typeof window[d] == "function"
? (this.shape = window[d])
: (this.shape = m[d] || m.sphere),
(this.shapeArgs = [b.length, h, i, j].concat(l))),
(this.shapeArgs = [b.length, h, i, j].concat(l))),
(f = this.shape.apply(this, this.shapeArgs)),
(this.listLength = b.length);
for (a = 0; a < b.length; ++a)
@ -2189,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) {
@ -2222,8 +2222,8 @@
(this.transform = a.transform),
b >= a.t
? ((this.fixedCallbackTag = a.tag),
(this.fixedCallback = a.cb),
(this.fixedAnim = this.yaw = this.pitch = 0))
(this.fixedCallback = a.cb),
(this.fixedAnim = this.yaw = this.pitch = 0))
: (c *= e),
(d = m.Rotation(c, a.axis)),
(this.transform = this.transform.mul(d)),
@ -2238,12 +2238,12 @@
c;
!a.frozen && d >= 0 && e >= 0 && d < g && e < h
? ((b = a.maxSpeed),
(c = a.reverse ? -1 : 1),
a.lx || (a.yaw = ((d * 2 * b) / g - b) * c * f),
a.ly || (a.pitch = ((e * 2 * b) / h - b) * -c * f),
(a.initial = null))
(c = a.reverse ? -1 : 1),
a.lx || (a.yaw = ((d * 2 * b) / g - b) * c * f),
a.ly || (a.pitch = ((e * 2 * b) / h - b) * -c * f),
(a.initial = null))
: a.initial ||
(a.frozen && !a.freezeDecel ? (a.yaw = a.pitch = 0) : a.Decel(a)),
(a.frozen && !a.freezeDecel ? (a.yaw = a.pitch = 0) : a.Decel(a)),
this.Transform(a, a.pitch, a.yaw);
}),
(b.AnimateDrag = function (d, e, c) {
@ -2251,9 +2251,9 @@
b = (100 * c * a.maxSpeed) / a.max_radius / a.zoom;
a.dx || a.dy
? (a.lx || (a.yaw = (a.dx * b) / a.stretchX),
a.ly || (a.pitch = (a.dy * -b) / a.stretchY),
(a.dx = a.dy = 0),
(a.initial = null))
a.ly || (a.pitch = (a.dy * -b) / a.stretchY),
(a.dx = a.dy = 0),
(a.initial = null))
: a.initial || a.Decel(a),
this.Transform(a, a.pitch, a.yaw);
}),
@ -2297,7 +2297,7 @@
a.tag.Clicked(b);
},
!0,
));
));
} catch (a) {}
}),
(b.Wheel = function (a) {
@ -2382,7 +2382,7 @@
cb: f,
tag: a,
active: g,
});
});
}),
(b.TagToFront = function (a, b, c, d) {
this.RotateTag(a, 0, 0, b, c, d);

View file

@ -251,7 +251,7 @@ export async function openAccountMenu(
},
],
},
]
]
: [
{
type: "link",
@ -260,7 +260,7 @@ export async function openAccountMenu(
avatar: me,
},
null,
]),
]),
...(opts.includeCurrentAccount ? [createItem(me)] : []),
...accountItemPromises,
...(isMobile ?? false
@ -272,7 +272,7 @@ export async function openAccountMenu(
to: `/@${me.username}`,
avatar: me,
},
]
]
: [
{
type: "parent",
@ -293,7 +293,7 @@ export async function openAccountMenu(
},
],
},
]),
]),
],
],
ev.currentTarget ?? ev.target,

View file

@ -149,13 +149,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";
@ -204,8 +204,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;
}
@ -240,16 +240,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;
}
@ -266,8 +266,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

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

View file

@ -190,10 +190,10 @@ function checkForSplash() {
window.location.search === "?zen"
? defineAsyncComponent(() => import("@/ui/zen.vue"))
: !me
? 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

@ -12,7 +12,7 @@ export const instance: entities.DetailedInstanceMetadata = reactive(
? JSON.parse(instanceData)
: {
// TODO: set default values
},
},
);
export async function fetchInstance() {

View file

@ -221,7 +221,7 @@ export async function popup(
? {
...events,
[disposeEvent]: dispose,
}
}
: events,
id,
};
@ -500,7 +500,7 @@ export function inputDate(props: {
? {
result: new Date(result.result),
canceled: false,
}
}
: { canceled: true },
);
},
@ -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,
activeTextarea: HTMLTextAreaElement | HTMLInputElement | null = null;
export async function openEmojiPicker(

View file

@ -46,13 +46,13 @@ export class Storage<T extends StateDef> {
const deviceAccountState = isSignedIn
? JSON.parse(
localStorage.getItem(`${this.keyForLocalStorage}::${me.id}`) || "{}",
)
)
: {};
const registryCache = isSignedIn
? JSON.parse(
localStorage.getItem(`${this.keyForLocalStorage}::cache::${me.id}`) ||
"{}",
)
)
: {};
const state = {};

View file

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

View file

@ -54,18 +54,18 @@ export type Form = Record<string, FormItem>;
type GetItemType<Item extends FormItem> = 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<string, unknown>
: 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<string, unknown>
: never;
export type GetFormResultType<F extends Form> = {
[P in keyof F]: GetItemType<F[P]>;

View file

@ -300,7 +300,7 @@ export function getNoteMenu(props: {
action: unclip,
},
null,
]
]
: []),
statePromise.then((state) =>
state?.isFavorited
@ -308,12 +308,12 @@ export function getNoteMenu(props: {
icon: `${icon("ph-bookmark-simple")}`,
text: i18n.ts.unfavorite,
action: () => toggleFavorite(false),
}
}
: {
icon: `${icon("ph-bookmark-simple")}`,
text: i18n.ts.favorite,
action: () => toggleFavorite(true),
},
},
),
{
icon: `${icon("ph-paperclip")}`,
@ -327,13 +327,13 @@ export function getNoteMenu(props: {
icon: `${icon("ph-eye-slash")}`,
text: i18n.ts.unwatch,
action: () => toggleWatch(false),
}
}
: {
icon: `${icon("ph-eye")}`,
text: i18n.ts.watch,
action: () => toggleWatch(true),
},
)
},
)
: undefined,
statePromise.then((state) =>
state.isMutedThread
@ -341,12 +341,12 @@ export function getNoteMenu(props: {
icon: `${icon("ph-speaker-x")}`,
text: i18n.ts.unmuteThread,
action: () => toggleThreadMute(false),
}
}
: {
icon: `${icon("ph-speaker-x")}`,
text: i18n.ts.muteThread,
action: () => toggleThreadMute(true),
},
},
),
isAppearAuthor
? (me.pinnedNoteIds || []).includes(appearNote.id)
@ -354,19 +354,19 @@ export function getNoteMenu(props: {
icon: `${icon("ph-push-pin")}`,
text: i18n.ts.unpin,
action: () => togglePin(false),
}
}
: {
icon: `${icon("ph-push-pin")}`,
text: i18n.ts.pin,
action: () => togglePin(true),
}
}
: undefined,
instance.translatorAvailable
? {
icon: `${icon("ph-translate")}`,
text: i18n.ts.translate,
action: translate,
}
}
: undefined,
appearNote.url || appearNote.uri
? {
@ -375,7 +375,7 @@ export function getNoteMenu(props: {
action: () => {
window.open(appearNote.url || appearNote.uri, "_blank");
},
}
}
: undefined,
{
type: "parent",
@ -397,14 +397,14 @@ export function getNoteMenu(props: {
icon: `${icon("ph-link-simple")}`,
text: `${i18n.ts.copyLink} (${i18n.ts.origin})`,
action: copyOriginal,
}
}
: undefined,
shareAvailable()
? {
icon: `${icon("ph-share-network")}`,
text: i18n.ts.share,
action: share,
}
}
: undefined,
],
},
@ -440,7 +440,7 @@ export function getNoteMenu(props: {
"closed",
);
},
}
}
: undefined,
isAppearAuthor
? {
@ -448,7 +448,7 @@ export function getNoteMenu(props: {
text: i18n.ts.toEdit,
accent: true,
action: edit,
}
}
: undefined,
isAppearAuthor &&
!(
@ -460,7 +460,7 @@ export function getNoteMenu(props: {
text: i18n.ts.makePrivate,
danger: true,
action: makePrivate,
}
}
: undefined,
isAppearAuthor
? {
@ -468,7 +468,7 @@ export function getNoteMenu(props: {
text: i18n.ts.deleteAndEdit,
danger: true,
action: delEdit,
}
}
: undefined,
isAppearAuthor || isModerator
? {
@ -476,7 +476,7 @@ export function getNoteMenu(props: {
text: i18n.ts.delete,
danger: true,
action: del,
}
}
: undefined,
!isAppearAuthor ? null : undefined,
!isAppearAuthor
@ -485,7 +485,7 @@ export function getNoteMenu(props: {
icon: `${icon("ph-user")}`,
text: i18n.ts.user,
children: getUserMenu(appearNote.user),
}
}
: undefined,
].filter((x) => x !== undefined);
} else {
@ -497,7 +497,7 @@ export function getNoteMenu(props: {
action: () => {
window.open(appearNote.url || appearNote.uri, "_blank");
},
}
}
: undefined,
{
icon: `${icon("ph-clipboard-text")}`,
@ -514,14 +514,14 @@ export function getNoteMenu(props: {
icon: `${icon("ph-link-simple")}`,
text: `${i18n.ts.copyLink} (${i18n.ts.origin})`,
action: copyOriginal,
}
}
: undefined,
shareAvailable()
? {
icon: `${icon("ph-share-network")}`,
text: i18n.ts.share,
action: share,
}
}
: undefined,
].filter((x) => x !== undefined);
}

View file

@ -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,
@ -296,7 +296,7 @@ export function getUserMenu(user, router: Router = mainRouter) {
icon: `${icon("ph-chats-teardrop")}`,
text: i18n.ts.startMessaging,
to: `/my/messaging/${acct.toString(user)}`,
}
}
: undefined,
user.host != null && user.url
? {
@ -305,7 +305,7 @@ export function getUserMenu(user, router: Router = mainRouter) {
text: i18n.ts.showOnRemote,
href: user.url,
target: "_blank",
}
}
: undefined,
null,
{
@ -318,7 +318,7 @@ export function getUserMenu(user, router: Router = mainRouter) {
icon: `${icon("ph-users-three")}`,
text: i18n.ts.inviteToGroup,
action: inviteGroup,
}
}
: undefined,
null,
{

View file

@ -93,7 +93,7 @@ function select(
? {
text: label,
type: "label",
}
}
: undefined,
{
type: "switch",

View file

@ -9,15 +9,15 @@ 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(
? 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],
@ -25,8 +25,8 @@ export function dateUTC(time: number[]): Date {
time[4],
time[5],
time[6],
)
: null;
)
: null;
if (!d) throw "wrong number of arguments";

View file

@ -69,7 +69,7 @@ export function uploadFile(
file.type !== imgConfig.mimeType
? `${ctx.name}.${
mimeTypeMap[compressTypeMap[file.type].mimeType]
}`
}`
: ctx.name;
} catch (err) {
console.error("Failed to resize image", err);

View file

@ -65,7 +65,7 @@ export function useNoteCapture(props: {
...(isSignedIn && body.userId === me.id
? {
isVoted: true,
}
}
: {}),
};
note.value.poll.choices = choices;

View file

@ -16,7 +16,7 @@ export function useStream() {
me
? {
token: me.token,
}
}
: null,
),
);

View file

@ -316,7 +316,7 @@ export function updateColumnWidget(
? {
...w,
data: widgetData,
}
}
: w,
);
columns[columnIndex] = column;

View file

@ -75,24 +75,24 @@ export class APIClient {
? IsCaseMatched<E, P, 0> extends true
? GetCaseResult<E, P, 0>
: IsCaseMatched<E, P, 1> extends true
? GetCaseResult<E, P, 1>
: IsCaseMatched<E, P, 2> extends true
? GetCaseResult<E, P, 2>
: IsCaseMatched<E, P, 3> extends true
? GetCaseResult<E, P, 3>
: IsCaseMatched<E, P, 4> extends true
? GetCaseResult<E, P, 4>
: IsCaseMatched<E, P, 5> extends true
? GetCaseResult<E, P, 5>
: IsCaseMatched<E, P, 6> extends true
? GetCaseResult<E, P, 6>
: IsCaseMatched<E, P, 7> extends true
? GetCaseResult<E, P, 7>
: IsCaseMatched<E, P, 8> extends true
? GetCaseResult<E, P, 8>
: IsCaseMatched<E, P, 9> extends true
? GetCaseResult<E, P, 9>
: Endpoints[E]["res"]["$switch"]["$default"]
? GetCaseResult<E, P, 1>
: IsCaseMatched<E, P, 2> extends true
? GetCaseResult<E, P, 2>
: IsCaseMatched<E, P, 3> extends true
? GetCaseResult<E, P, 3>
: IsCaseMatched<E, P, 4> extends true
? GetCaseResult<E, P, 4>
: IsCaseMatched<E, P, 5> extends true
? GetCaseResult<E, P, 5>
: IsCaseMatched<E, P, 6> extends true
? GetCaseResult<E, P, 6>
: IsCaseMatched<E, P, 7> extends true
? GetCaseResult<E, P, 7>
: IsCaseMatched<E, P, 8> extends true
? GetCaseResult<E, P, 8>
: IsCaseMatched<E, P, 9> extends true
? GetCaseResult<E, P, 9>
: Endpoints[E]["res"]["$switch"]["$default"]
: Endpoints[E]["res"]
> {
const promise = new Promise((resolve, reject) => {

View file

@ -220,7 +220,7 @@ export default class Stream extends EventEmitter<StreamEvents> {
: {
type: typeOrPayload,
body: payload,
};
};
this.stream.send(JSON.stringify(data));
}

View file

@ -380,7 +380,7 @@ namespace MisskeyAPI {
return Object.values(r).length > 0
? Object.values(r).reduce(
(previousValue, currentValue) => previousValue + currentValue,
)
)
: 0;
};

View file

@ -79,7 +79,7 @@ async function composeNotification(
action: "follow",
title: t("_notification._actions.followBack"),
},
],
],
},
];
}
@ -163,7 +163,7 @@ async function composeNotification(
action: "renote",
title: t("_notification._actions.renote"),
},
]
]
: []),
],
},