chore: format
This commit is contained in:
parent
78c9911788
commit
99c592f4dd
113 changed files with 801 additions and 749 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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>>;
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ export class Note {
|
|||
* specified ... visibleUserIds で指定したユーザーのみ
|
||||
*/
|
||||
@Column("enum", { enum: noteVisibilities })
|
||||
public visibility: typeof noteVisibilities[number];
|
||||
public visibility: (typeof noteVisibilities)[number];
|
||||
|
||||
@Index({ unique: true })
|
||||
@Column("varchar", {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -47,7 +47,7 @@ export class Poll {
|
|||
enum: noteVisibilities,
|
||||
comment: "[Denormalized]",
|
||||
})
|
||||
public noteVisibility: typeof noteVisibilities[number];
|
||||
public noteVisibility: (typeof noteVisibilities)[number];
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
|
|
|
@ -99,7 +99,7 @@ export class UserProfile {
|
|||
enum: ffVisibility,
|
||||
default: "public",
|
||||
})
|
||||
public ffVisibility: typeof ffVisibility[number];
|
||||
public ffVisibility: (typeof ffVisibility)[number];
|
||||
|
||||
@Column("varchar", {
|
||||
length: 128,
|
||||
|
@ -238,7 +238,7 @@ export class UserProfile {
|
|||
array: true,
|
||||
default: [],
|
||||
})
|
||||
public mutingNotificationTypes: typeof notificationTypes[number][];
|
||||
public mutingNotificationTypes: (typeof notificationTypes)[number][];
|
||||
|
||||
//#region Denormalized fields
|
||||
@Index()
|
||||
|
|
|
@ -55,7 +55,7 @@ export class Webhook {
|
|||
array: true,
|
||||
default: "{}",
|
||||
})
|
||||
public on: typeof webhookEventTypes[number][];
|
||||
public on: (typeof webhookEventTypes)[number][];
|
||||
|
||||
@Column("varchar", {
|
||||
length: 1024,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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),
|
||||
)
|
||||
|
|
|
@ -276,26 +276,26 @@ export async function createPerson(
|
|||
followersCount !== undefined
|
||||
? followersCount
|
||||
: person.followers &&
|
||||
typeof person.followers !== "string" &&
|
||||
isCollectionOrOrderedCollection(person.followers)
|
||||
? person.followers.totalItems
|
||||
: undefined,
|
||||
typeof person.followers !== "string" &&
|
||||
isCollectionOrOrderedCollection(person.followers)
|
||||
? person.followers.totalItems
|
||||
: undefined,
|
||||
followingCount:
|
||||
followingCount !== undefined
|
||||
? followingCount
|
||||
: person.following &&
|
||||
typeof person.following !== "string" &&
|
||||
isCollectionOrOrderedCollection(person.following)
|
||||
? person.following.totalItems
|
||||
: undefined,
|
||||
typeof person.following !== "string" &&
|
||||
isCollectionOrOrderedCollection(person.following)
|
||||
? person.following.totalItems
|
||||
: undefined,
|
||||
notesCount:
|
||||
notesCount !== undefined
|
||||
? notesCount
|
||||
: person.outbox &&
|
||||
typeof person.outbox !== "string" &&
|
||||
isCollectionOrOrderedCollection(person.outbox)
|
||||
? person.outbox.totalItems
|
||||
: undefined,
|
||||
typeof person.outbox !== "string" &&
|
||||
isCollectionOrOrderedCollection(person.outbox)
|
||||
? person.outbox.totalItems
|
||||
: undefined,
|
||||
featured: person.featured ? getApId(person.featured) : undefined,
|
||||
uri: person.id,
|
||||
tags,
|
||||
|
@ -315,8 +315,8 @@ export async function createPerson(
|
|||
description: person._misskey_summary
|
||||
? truncate(person._misskey_summary, summaryLength)
|
||||
: person.summary
|
||||
? htmlToMfm(truncate(person.summary, summaryLength), person.tag)
|
||||
: null,
|
||||
? htmlToMfm(truncate(person.summary, summaryLength), person.tag)
|
||||
: null,
|
||||
url: url,
|
||||
fields,
|
||||
birthday: bday ? bday[0] : null,
|
||||
|
@ -527,26 +527,26 @@ export async function updatePerson(
|
|||
followersCount !== undefined
|
||||
? followersCount
|
||||
: person.followers &&
|
||||
typeof person.followers !== "string" &&
|
||||
isCollectionOrOrderedCollection(person.followers)
|
||||
? person.followers.totalItems
|
||||
: undefined,
|
||||
typeof person.followers !== "string" &&
|
||||
isCollectionOrOrderedCollection(person.followers)
|
||||
? person.followers.totalItems
|
||||
: undefined,
|
||||
followingCount:
|
||||
followingCount !== undefined
|
||||
? followingCount
|
||||
: person.following &&
|
||||
typeof person.following !== "string" &&
|
||||
isCollectionOrOrderedCollection(person.following)
|
||||
? person.following.totalItems
|
||||
: undefined,
|
||||
typeof person.following !== "string" &&
|
||||
isCollectionOrOrderedCollection(person.following)
|
||||
? person.following.totalItems
|
||||
: undefined,
|
||||
notesCount:
|
||||
notesCount !== undefined
|
||||
? notesCount
|
||||
: person.outbox &&
|
||||
typeof person.outbox !== "string" &&
|
||||
isCollectionOrOrderedCollection(person.outbox)
|
||||
? person.outbox.totalItems
|
||||
: undefined,
|
||||
typeof person.outbox !== "string" &&
|
||||
isCollectionOrOrderedCollection(person.outbox)
|
||||
? person.outbox.totalItems
|
||||
: undefined,
|
||||
featured: person.featured,
|
||||
emojis: emojiNames,
|
||||
name: truncate(person.name, nameLength),
|
||||
|
@ -593,8 +593,8 @@ export async function updatePerson(
|
|||
description: person._misskey_summary
|
||||
? truncate(person._misskey_summary, summaryLength)
|
||||
: person.summary
|
||||
? htmlToMfm(truncate(person.summary, summaryLength), person.tag)
|
||||
: null,
|
||||
? htmlToMfm(truncate(person.summary, summaryLength), person.tag)
|
||||
: null,
|
||||
birthday: bday ? bday[0] : null,
|
||||
location: person["vcard:Address"] || null,
|
||||
},
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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,
|
||||
);
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -293,14 +293,14 @@ export default define(meta, paramDef, async (ps, me) => {
|
|||
},
|
||||
]
|
||||
: ps.host !== undefined
|
||||
? [
|
||||
{
|
||||
term: {
|
||||
userHost: ps.host,
|
||||
? [
|
||||
{
|
||||
term: {
|
||||
userHost: ps.host,
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
: []
|
||||
]
|
||||
: []
|
||||
: [];
|
||||
|
||||
const result = await es.search({
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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, {
|
||||
|
|
|
@ -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,
|
||||
),
|
||||
);
|
||||
|
||||
|
|
|
@ -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> = {
|
||||
|
@ -186,8 +186,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",
|
||||
|
@ -244,8 +244,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",
|
||||
|
@ -325,7 +325,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) {
|
||||
|
@ -345,8 +345,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({
|
||||
|
@ -375,16 +375,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({
|
||||
|
@ -793,19 +793,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({
|
||||
|
@ -863,8 +863,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),
|
||||
|
|
|
@ -42,10 +42,13 @@ const charts = [
|
|||
];
|
||||
|
||||
// 20分おきにメモリ情報をDBに書き込み
|
||||
setInterval(() => {
|
||||
for (const chart of charts) {
|
||||
chart.save();
|
||||
}
|
||||
}, 1000 * 60 * 20);
|
||||
setInterval(
|
||||
() => {
|
||||
for (const chart of charts) {
|
||||
chart.save();
|
||||
}
|
||||
},
|
||||
1000 * 60 * 20,
|
||||
);
|
||||
|
||||
beforeShutdown(() => Promise.all(charts.map((chart) => chart.save())));
|
||||
|
|
|
@ -497,12 +497,12 @@ export async function addFile({
|
|||
instance.sensitiveMediaDetectionSensitivity === "veryHigh"
|
||||
? 0.1
|
||||
: instance.sensitiveMediaDetectionSensitivity === "high"
|
||||
? 0.3
|
||||
: instance.sensitiveMediaDetectionSensitivity === "low"
|
||||
? 0.7
|
||||
: instance.sensitiveMediaDetectionSensitivity === "veryLow"
|
||||
? 0.9
|
||||
: 0.5,
|
||||
? 0.3
|
||||
: instance.sensitiveMediaDetectionSensitivity === "low"
|
||||
? 0.7
|
||||
: instance.sensitiveMediaDetectionSensitivity === "veryLow"
|
||||
? 0.9
|
||||
: 0.5,
|
||||
sensitiveThresholdForPorn: 0.75,
|
||||
enableSensitiveMediaDetectionForVideos:
|
||||
instance.enableSensitiveMediaDetectionForVideos,
|
||||
|
@ -627,8 +627,8 @@ export async function addFile({
|
|||
? Users.isLocalUser(user) && profile!.alwaysMarkNsfw
|
||||
? true
|
||||
: sensitive != null
|
||||
? sensitive
|
||||
: false
|
||||
? sensitive
|
||||
: false
|
||||
: false;
|
||||
|
||||
if (info.sensitive && profile!.autoSensitive) file.isSensitive = true;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ describe("ユーザー", () => {
|
|||
// エンティティとしてのユーザーを主眼においたテストを記述する
|
||||
// (Userを返すエンドポイントとUserエンティティを書き換えるエンドポイントをテストする)
|
||||
|
||||
const stripUndefined = <T extends { [key: string]: any },>(
|
||||
const stripUndefined = <T extends { [key: string]: any }>(
|
||||
orig: T,
|
||||
): Partial<T> => {
|
||||
return Object.entries({ ...orig })
|
||||
|
@ -224,141 +224,160 @@ describe("ユーザー", () => {
|
|||
let userFollowRequesting: User;
|
||||
let userFollowRequested: User;
|
||||
|
||||
beforeAll(async () => {
|
||||
app = await startServer();
|
||||
}, 1000 * 60 * 2);
|
||||
beforeAll(
|
||||
async () => {
|
||||
app = await startServer();
|
||||
},
|
||||
1000 * 60 * 2,
|
||||
);
|
||||
|
||||
beforeAll(async () => {
|
||||
root = await signup({ username: "root" });
|
||||
alice = await signup({ username: "alice" });
|
||||
aliceNote = (await post(alice, { text: "test" })) as any;
|
||||
alicePage = await page(alice);
|
||||
aliceList = (await api("users/list/create", { name: "aliceList" }, alice))
|
||||
.body;
|
||||
bob = await signup({ username: "bob" });
|
||||
bobNote = (await post(bob, { text: "test" })) as any;
|
||||
carol = await signup({ username: "carol" });
|
||||
dave = await signup({ username: "dave" });
|
||||
ellen = await signup({ username: "ellen" });
|
||||
frank = await signup({ username: "frank" });
|
||||
beforeAll(
|
||||
async () => {
|
||||
root = await signup({ username: "root" });
|
||||
alice = await signup({ username: "alice" });
|
||||
aliceNote = (await post(alice, { text: "test" })) as any;
|
||||
alicePage = await page(alice);
|
||||
aliceList = (await api("users/list/create", { name: "aliceList" }, alice))
|
||||
.body;
|
||||
bob = await signup({ username: "bob" });
|
||||
bobNote = (await post(bob, { text: "test" })) as any;
|
||||
carol = await signup({ username: "carol" });
|
||||
dave = await signup({ username: "dave" });
|
||||
ellen = await signup({ username: "ellen" });
|
||||
frank = await signup({ username: "frank" });
|
||||
|
||||
// @alice -> @replyingへのリプライ。Promise.allで一気に作るとtimeoutしてしまうのでreduceで一つ一つawaitする
|
||||
usersReplying = await [...Array(10)]
|
||||
.map((_, i) => i)
|
||||
.reduce(async (acc, i) => {
|
||||
const u = await signup({ username: `replying${i}` });
|
||||
for (let j = 0; j < 10 - i; j++) {
|
||||
const p = await post(u, { text: `test${j}` });
|
||||
await post(alice, { text: `@${u.username} test${j}`, replyId: p.id });
|
||||
}
|
||||
// @alice -> @replyingへのリプライ。Promise.allで一気に作るとtimeoutしてしまうのでreduceで一つ一つawaitする
|
||||
usersReplying = await [...Array(10)]
|
||||
.map((_, i) => i)
|
||||
.reduce(
|
||||
async (acc, i) => {
|
||||
const u = await signup({ username: `replying${i}` });
|
||||
for (let j = 0; j < 10 - i; j++) {
|
||||
const p = await post(u, { text: `test${j}` });
|
||||
await post(alice, {
|
||||
text: `@${u.username} test${j}`,
|
||||
replyId: p.id,
|
||||
});
|
||||
}
|
||||
|
||||
return (await acc).concat(u);
|
||||
}, Promise.resolve([] as User[]));
|
||||
return (await acc).concat(u);
|
||||
},
|
||||
Promise.resolve([] as User[]),
|
||||
);
|
||||
|
||||
userNoNote = await signup({ username: "userNoNote" });
|
||||
userNotExplorable = await signup({ username: "userNotExplorable" });
|
||||
await post(userNotExplorable, { text: "test" });
|
||||
await api("i/update", { isExplorable: false }, userNotExplorable);
|
||||
userLocking = await signup({ username: "userLocking" });
|
||||
await post(userLocking, { text: "test" });
|
||||
await api("i/update", { isLocked: true }, userLocking);
|
||||
userAdmin = await signup({ username: "userAdmin" });
|
||||
roleAdmin = await role(root, { isAdministrator: true, name: "Admin Role" });
|
||||
await api(
|
||||
"admin/roles/assign",
|
||||
{ userId: userAdmin.id, roleId: roleAdmin.id },
|
||||
root,
|
||||
);
|
||||
userModerator = await signup({ username: "userModerator" });
|
||||
roleModerator = await role(root, {
|
||||
isModerator: true,
|
||||
name: "Moderator Role",
|
||||
});
|
||||
await api(
|
||||
"admin/roles/assign",
|
||||
{ userId: userModerator.id, roleId: roleModerator.id },
|
||||
root,
|
||||
);
|
||||
userRolePublic = await signup({ username: "userRolePublic" });
|
||||
rolePublic = await role(root, { isPublic: true, name: "Public Role" });
|
||||
await api(
|
||||
"admin/roles/assign",
|
||||
{ userId: userRolePublic.id, roleId: rolePublic.id },
|
||||
root,
|
||||
);
|
||||
userRoleBadge = await signup({ username: "userRoleBadge" });
|
||||
roleBadge = await role(root, { asBadge: true, name: "Badge Role" });
|
||||
await api(
|
||||
"admin/roles/assign",
|
||||
{ userId: userRoleBadge.id, roleId: roleBadge.id },
|
||||
root,
|
||||
);
|
||||
userSilenced = await signup({ username: "userSilenced" });
|
||||
await post(userSilenced, { text: "test" });
|
||||
roleSilenced = await role(
|
||||
root,
|
||||
{},
|
||||
{ canPublicNote: { priority: 0, useDefault: false, value: false } },
|
||||
);
|
||||
await api(
|
||||
"admin/roles/assign",
|
||||
{ userId: userSilenced.id, roleId: roleSilenced.id },
|
||||
root,
|
||||
);
|
||||
userSuspended = await signup({ username: "userSuspended" });
|
||||
await post(userSuspended, { text: "test" });
|
||||
await successfulApiCall({
|
||||
endpoint: "i/update",
|
||||
parameters: { description: "#user_testuserSuspended" },
|
||||
user: userSuspended,
|
||||
});
|
||||
await api("admin/suspend-user", { userId: userSuspended.id }, root);
|
||||
userDeletedBySelf = await signup({
|
||||
username: "userDeletedBySelf",
|
||||
password: "userDeletedBySelf",
|
||||
});
|
||||
await post(userDeletedBySelf, { text: "test" });
|
||||
await api(
|
||||
"i/delete-account",
|
||||
{ password: "userDeletedBySelf" },
|
||||
userDeletedBySelf,
|
||||
);
|
||||
userDeletedByAdmin = await signup({ username: "userDeletedByAdmin" });
|
||||
await post(userDeletedByAdmin, { text: "test" });
|
||||
await api("admin/delete-account", { userId: userDeletedByAdmin.id }, root);
|
||||
userFollowingAlice = await signup({ username: "userFollowingAlice" });
|
||||
await post(userFollowingAlice, { text: "test" });
|
||||
await api("following/create", { userId: alice.id }, userFollowingAlice);
|
||||
userFollowedByAlice = await signup({ username: "userFollowedByAlice" });
|
||||
await post(userFollowedByAlice, { text: "test" });
|
||||
await api("following/create", { userId: userFollowedByAlice.id }, alice);
|
||||
userBlockingAlice = await signup({ username: "userBlockingAlice" });
|
||||
await post(userBlockingAlice, { text: "test" });
|
||||
await api("blocking/create", { userId: alice.id }, userBlockingAlice);
|
||||
userBlockedByAlice = await signup({ username: "userBlockedByAlice" });
|
||||
await post(userBlockedByAlice, { text: "test" });
|
||||
await api("blocking/create", { userId: userBlockedByAlice.id }, alice);
|
||||
userMutingAlice = await signup({ username: "userMutingAlice" });
|
||||
await post(userMutingAlice, { text: "test" });
|
||||
await api("mute/create", { userId: alice.id }, userMutingAlice);
|
||||
userMutedByAlice = await signup({ username: "userMutedByAlice" });
|
||||
await post(userMutedByAlice, { text: "test" });
|
||||
await api("mute/create", { userId: userMutedByAlice.id }, alice);
|
||||
userRnMutingAlice = await signup({ username: "userRnMutingAlice" });
|
||||
await post(userRnMutingAlice, { text: "test" });
|
||||
await api("renote-mute/create", { userId: alice.id }, userRnMutingAlice);
|
||||
userRnMutedByAlice = await signup({ username: "userRnMutedByAlice" });
|
||||
await post(userRnMutedByAlice, { text: "test" });
|
||||
await api("renote-mute/create", { userId: userRnMutedByAlice.id }, alice);
|
||||
userFollowRequesting = await signup({ username: "userFollowRequesting" });
|
||||
await post(userFollowRequesting, { text: "test" });
|
||||
userFollowRequested = userLocking;
|
||||
await api(
|
||||
"following/create",
|
||||
{ userId: userFollowRequested.id },
|
||||
userFollowRequesting,
|
||||
);
|
||||
}, 1000 * 60 * 10);
|
||||
userNoNote = await signup({ username: "userNoNote" });
|
||||
userNotExplorable = await signup({ username: "userNotExplorable" });
|
||||
await post(userNotExplorable, { text: "test" });
|
||||
await api("i/update", { isExplorable: false }, userNotExplorable);
|
||||
userLocking = await signup({ username: "userLocking" });
|
||||
await post(userLocking, { text: "test" });
|
||||
await api("i/update", { isLocked: true }, userLocking);
|
||||
userAdmin = await signup({ username: "userAdmin" });
|
||||
roleAdmin = await role(root, {
|
||||
isAdministrator: true,
|
||||
name: "Admin Role",
|
||||
});
|
||||
await api(
|
||||
"admin/roles/assign",
|
||||
{ userId: userAdmin.id, roleId: roleAdmin.id },
|
||||
root,
|
||||
);
|
||||
userModerator = await signup({ username: "userModerator" });
|
||||
roleModerator = await role(root, {
|
||||
isModerator: true,
|
||||
name: "Moderator Role",
|
||||
});
|
||||
await api(
|
||||
"admin/roles/assign",
|
||||
{ userId: userModerator.id, roleId: roleModerator.id },
|
||||
root,
|
||||
);
|
||||
userRolePublic = await signup({ username: "userRolePublic" });
|
||||
rolePublic = await role(root, { isPublic: true, name: "Public Role" });
|
||||
await api(
|
||||
"admin/roles/assign",
|
||||
{ userId: userRolePublic.id, roleId: rolePublic.id },
|
||||
root,
|
||||
);
|
||||
userRoleBadge = await signup({ username: "userRoleBadge" });
|
||||
roleBadge = await role(root, { asBadge: true, name: "Badge Role" });
|
||||
await api(
|
||||
"admin/roles/assign",
|
||||
{ userId: userRoleBadge.id, roleId: roleBadge.id },
|
||||
root,
|
||||
);
|
||||
userSilenced = await signup({ username: "userSilenced" });
|
||||
await post(userSilenced, { text: "test" });
|
||||
roleSilenced = await role(
|
||||
root,
|
||||
{},
|
||||
{ canPublicNote: { priority: 0, useDefault: false, value: false } },
|
||||
);
|
||||
await api(
|
||||
"admin/roles/assign",
|
||||
{ userId: userSilenced.id, roleId: roleSilenced.id },
|
||||
root,
|
||||
);
|
||||
userSuspended = await signup({ username: "userSuspended" });
|
||||
await post(userSuspended, { text: "test" });
|
||||
await successfulApiCall({
|
||||
endpoint: "i/update",
|
||||
parameters: { description: "#user_testuserSuspended" },
|
||||
user: userSuspended,
|
||||
});
|
||||
await api("admin/suspend-user", { userId: userSuspended.id }, root);
|
||||
userDeletedBySelf = await signup({
|
||||
username: "userDeletedBySelf",
|
||||
password: "userDeletedBySelf",
|
||||
});
|
||||
await post(userDeletedBySelf, { text: "test" });
|
||||
await api(
|
||||
"i/delete-account",
|
||||
{ password: "userDeletedBySelf" },
|
||||
userDeletedBySelf,
|
||||
);
|
||||
userDeletedByAdmin = await signup({ username: "userDeletedByAdmin" });
|
||||
await post(userDeletedByAdmin, { text: "test" });
|
||||
await api(
|
||||
"admin/delete-account",
|
||||
{ userId: userDeletedByAdmin.id },
|
||||
root,
|
||||
);
|
||||
userFollowingAlice = await signup({ username: "userFollowingAlice" });
|
||||
await post(userFollowingAlice, { text: "test" });
|
||||
await api("following/create", { userId: alice.id }, userFollowingAlice);
|
||||
userFollowedByAlice = await signup({ username: "userFollowedByAlice" });
|
||||
await post(userFollowedByAlice, { text: "test" });
|
||||
await api("following/create", { userId: userFollowedByAlice.id }, alice);
|
||||
userBlockingAlice = await signup({ username: "userBlockingAlice" });
|
||||
await post(userBlockingAlice, { text: "test" });
|
||||
await api("blocking/create", { userId: alice.id }, userBlockingAlice);
|
||||
userBlockedByAlice = await signup({ username: "userBlockedByAlice" });
|
||||
await post(userBlockedByAlice, { text: "test" });
|
||||
await api("blocking/create", { userId: userBlockedByAlice.id }, alice);
|
||||
userMutingAlice = await signup({ username: "userMutingAlice" });
|
||||
await post(userMutingAlice, { text: "test" });
|
||||
await api("mute/create", { userId: alice.id }, userMutingAlice);
|
||||
userMutedByAlice = await signup({ username: "userMutedByAlice" });
|
||||
await post(userMutedByAlice, { text: "test" });
|
||||
await api("mute/create", { userId: userMutedByAlice.id }, alice);
|
||||
userRnMutingAlice = await signup({ username: "userRnMutingAlice" });
|
||||
await post(userRnMutingAlice, { text: "test" });
|
||||
await api("renote-mute/create", { userId: alice.id }, userRnMutingAlice);
|
||||
userRnMutedByAlice = await signup({ username: "userRnMutedByAlice" });
|
||||
await post(userRnMutedByAlice, { text: "test" });
|
||||
await api("renote-mute/create", { userId: userRnMutedByAlice.id }, alice);
|
||||
userFollowRequesting = await signup({ username: "userFollowRequesting" });
|
||||
await post(userFollowRequesting, { text: "test" });
|
||||
userFollowRequested = userLocking;
|
||||
await api(
|
||||
"following/create",
|
||||
{ userId: userFollowRequested.id },
|
||||
userFollowRequesting,
|
||||
);
|
||||
},
|
||||
1000 * 60 * 10,
|
||||
);
|
||||
|
||||
afterAll(async () => {
|
||||
await app.close();
|
||||
|
|
|
@ -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);
|
||||
|
|
67
packages/client/assets/tagcanvas.min.js
vendored
67
packages/client/assets/tagcanvas.min.js
vendored
|
@ -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) {
|
||||
|
|
|
@ -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 }}
|
||||
|
|
|
@ -330,7 +330,7 @@ const render = () => {
|
|||
max: "original",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
: undefined,
|
||||
// gradient,
|
||||
},
|
||||
|
@ -473,7 +473,7 @@ const fetchNotesChart = async (type: string): Promise<typeof chartData> => {
|
|||
negate(raw.local.dec),
|
||||
raw.remote.inc,
|
||||
negate(raw.remote.dec),
|
||||
)
|
||||
)
|
||||
: sum(raw[type].inc, negate(raw[type].dec)),
|
||||
),
|
||||
color: "#888888",
|
||||
|
@ -516,7 +516,7 @@ const fetchNotesChart = async (type: string): Promise<typeof chartData> => {
|
|||
? sum(
|
||||
raw.local.diffs.withFile,
|
||||
raw.remote.diffs.withFile,
|
||||
)
|
||||
)
|
||||
: raw[type].diffs.withFile,
|
||||
),
|
||||
color: colors.purple,
|
||||
|
@ -569,7 +569,7 @@ const fetchUsersChart = async (total: boolean): Promise<typeof chartData> => {
|
|||
negate(raw.local.dec),
|
||||
raw.remote.inc,
|
||||
negate(raw.remote.dec),
|
||||
),
|
||||
),
|
||||
),
|
||||
},
|
||||
{
|
||||
|
@ -926,7 +926,7 @@ const fetchPerUserNotesChart = async (): Promise<typeof chartData> => {
|
|||
data: format(sum(raw.inc, negate(raw.dec))),
|
||||
color: "#888888",
|
||||
},
|
||||
]),
|
||||
]),
|
||||
{
|
||||
name: "With file",
|
||||
type: "area",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 },
|
||||
);
|
||||
},
|
||||
|
|
|
@ -327,8 +327,8 @@ async function ok() {
|
|||
const result = props.input
|
||||
? inputValue.value
|
||||
: props.select
|
||||
? selectedValue.value
|
||||
: true;
|
||||
? selectedValue.value
|
||||
: true;
|
||||
done(false, result);
|
||||
}
|
||||
|
||||
|
|
|
@ -710,7 +710,7 @@ function getMenu() {
|
|||
action: () => {
|
||||
renameFolder(folder.value);
|
||||
},
|
||||
}
|
||||
}
|
||||
: undefined,
|
||||
folder.value
|
||||
? {
|
||||
|
@ -721,7 +721,7 @@ function getMenu() {
|
|||
folder.value as firefish.entities.DriveFolder,
|
||||
);
|
||||
},
|
||||
}
|
||||
}
|
||||
: undefined,
|
||||
{
|
||||
text: i18n.ts.createFolder,
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
props.skinToneLabels
|
||||
? props.skinToneLabels[
|
||||
props.skinTones.indexOf(skinTone)
|
||||
]
|
||||
]
|
||||
: ''
|
||||
"
|
||||
></i>
|
||||
|
|
|
@ -60,7 +60,7 @@ export default defineComponent({
|
|||
localStorage.getItem(localStoragePrefix + this.persistKey)
|
||||
? localStorage.getItem(
|
||||
localStoragePrefix + this.persistKey,
|
||||
) === "t"
|
||||
) === "t"
|
||||
: this.expanded,
|
||||
animation: defaultStore.state.animation,
|
||||
};
|
||||
|
|
|
@ -88,8 +88,8 @@ const preferedModalType =
|
|||
deviceKind === "desktop" && props.src != null
|
||||
? "popup"
|
||||
: deviceKind === "smartphone"
|
||||
? "drawer"
|
||||
: "dialog";
|
||||
? "drawer"
|
||||
: "dialog";
|
||||
|
||||
const modal = ref<InstanceType<typeof MkModal>>();
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
? `${props.height}px`
|
||||
: null
|
||||
: height
|
||||
? `min(${props.height}px, 100%)`
|
||||
: '100%',
|
||||
? `min(${props.height}px, 100%)`
|
||||
: '100%',
|
||||
}"
|
||||
tabindex="-1"
|
||||
>
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
? notification.reaction.replace(
|
||||
/^:(\w+):$/,
|
||||
':$1@.:',
|
||||
)
|
||||
)
|
||||
: notification.reaction
|
||||
"
|
||||
:custom-emojis="notification.note.emojis"
|
||||
|
|
|
@ -257,14 +257,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) => {
|
||||
|
@ -318,14 +318,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) => {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -171,8 +171,8 @@ function get() {
|
|||
...(expiration.value === "at"
|
||||
? { expiresAt: calcAt() }
|
||||
: expiration.value === "after"
|
||||
? { expiredAfter: calcAfter() }
|
||||
: {}),
|
||||
? { expiredAfter: calcAfter() }
|
||||
: {}),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -87,8 +87,8 @@
|
|||
reply
|
||||
? 'ph-arrow-u-up-left'
|
||||
: renote
|
||||
? 'ph-quotes'
|
||||
: 'ph-paper-plane-tilt',
|
||||
? 'ph-quotes'
|
||||
: 'ph-paper-plane-tilt',
|
||||
)
|
||||
"
|
||||
></i>
|
||||
|
@ -421,10 +421,10 @@ const submitText = computed((): string => {
|
|||
return props.editId
|
||||
? i18n.ts.edit
|
||||
: props.renote
|
||||
? i18n.ts.quote
|
||||
: props.reply
|
||||
? i18n.ts.reply
|
||||
: i18n.ts.note;
|
||||
? i18n.ts.quote
|
||||
: props.reply
|
||||
? i18n.ts.reply
|
||||
: i18n.ts.note;
|
||||
});
|
||||
|
||||
const textLength = computed((): number => {
|
||||
|
@ -493,8 +493,8 @@ if (props.reply && props.reply.text != null) {
|
|||
const mention = x.host
|
||||
? `@${x.username}@${toASCII(x.host)}`
|
||||
: otherHost == null || otherHost === host
|
||||
? `@${x.username}`
|
||||
: `@${x.username}@${toASCII(otherHost)}`;
|
||||
? `@${x.username}`
|
||||
: `@${x.username}@${toASCII(otherHost)}`;
|
||||
|
||||
// exclude me
|
||||
if ($i.username === x.username && (x.host == null || x.host === host))
|
||||
|
@ -987,8 +987,8 @@ async function post() {
|
|||
renoteId: props.renote
|
||||
? props.renote.id
|
||||
: quoteId.value
|
||||
? quoteId.value
|
||||
: undefined,
|
||||
? quoteId.value
|
||||
: undefined,
|
||||
channelId: props.channel ? props.channel.id : undefined,
|
||||
poll: poll.value,
|
||||
cw: useCw.value ? cw.value || "" : undefined,
|
||||
|
@ -1023,8 +1023,9 @@ async function post() {
|
|||
|
||||
if (postAccount.value) {
|
||||
const storedAccounts = await getAccounts();
|
||||
token = storedAccounts.find((x) => x.id === postAccount.value.id)
|
||||
?.token;
|
||||
token = storedAccounts.find(
|
||||
(x) => x.id === postAccount.value.id,
|
||||
)?.token;
|
||||
}
|
||||
|
||||
posting.value = true;
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -45,7 +45,7 @@ export default defineComponent({
|
|||
},
|
||||
[label],
|
||||
),
|
||||
]
|
||||
]
|
||||
: []),
|
||||
h(
|
||||
"div",
|
||||
|
@ -76,7 +76,7 @@ export default defineComponent({
|
|||
},
|
||||
[caption],
|
||||
),
|
||||
]
|
||||
]
|
||||
: []),
|
||||
],
|
||||
);
|
||||
|
|
|
@ -70,7 +70,7 @@ const choseAd = (): Ad | null => {
|
|||
? {
|
||||
...ad,
|
||||
ratio: 0,
|
||||
}
|
||||
}
|
||||
: ad,
|
||||
);
|
||||
|
||||
|
|
|
@ -139,13 +139,13 @@ onMounted(() => {
|
|||
bottom: 32,
|
||||
left: 32,
|
||||
right: 32,
|
||||
}
|
||||
}
|
||||
: {
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
},
|
||||
},
|
||||
imageClickAction: "close",
|
||||
tapAction: "toggle-controls",
|
||||
preloadFirstSlide: false,
|
||||
|
|
|
@ -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(() => {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -45,7 +45,7 @@ export default defineComponent({
|
|||
...(this.block.var
|
||||
? {
|
||||
var: unref(this.hpml.vars)[this.block.var],
|
||||
}
|
||||
}
|
||||
: {}),
|
||||
});
|
||||
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
{},
|
||||
|
|
|
@ -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"];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -193,10 +193,10 @@ function checkForSplash() {
|
|||
window.location.search === "?zen"
|
||||
? defineAsyncComponent(() => import("@/ui/zen.vue"))
|
||||
: !$i
|
||||
? defineAsyncComponent(() => import("@/ui/visitor.vue"))
|
||||
: ui === "deck"
|
||||
? defineAsyncComponent(() => import("@/ui/deck.vue"))
|
||||
: defineAsyncComponent(() => import("@/ui/universal.vue")),
|
||||
? defineAsyncComponent(() => import("@/ui/visitor.vue"))
|
||||
: ui === "deck"
|
||||
? defineAsyncComponent(() => import("@/ui/deck.vue"))
|
||||
: defineAsyncComponent(() => import("@/ui/universal.vue")),
|
||||
);
|
||||
|
||||
if (_DEV_) {
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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 }
|
||||
: {}),
|
||||
})),
|
||||
};
|
||||
|
||||
|
|
|
@ -243,7 +243,7 @@ const headerTabs = computed(() => [
|
|||
key: "ip",
|
||||
title: "IP",
|
||||
icon: `${icon("ph-receipt")}`,
|
||||
}
|
||||
}
|
||||
: null,
|
||||
{
|
||||
key: "raw",
|
||||
|
|
|
@ -150,7 +150,7 @@ const calcBg = () => {
|
|||
rawBg.startsWith("var(")
|
||||
? getComputedStyle(document.documentElement).getPropertyValue(
|
||||
rawBg.slice(4, -1),
|
||||
)
|
||||
)
|
||||
: rawBg,
|
||||
);
|
||||
tinyBg.setAlpha(0.85);
|
||||
|
|
|
@ -105,8 +105,8 @@ async function init() {
|
|||
provider.value = meta.enableHcaptcha
|
||||
? "hcaptcha"
|
||||
: meta.enableRecaptcha
|
||||
? "recaptcha"
|
||||
: null;
|
||||
? "recaptcha"
|
||||
: null;
|
||||
}
|
||||
|
||||
function save() {
|
||||
|
|
|
@ -154,7 +154,7 @@ const menuDef = computed(() => [
|
|||
text: i18n.ts.invite,
|
||||
action: invite,
|
||||
},
|
||||
]
|
||||
]
|
||||
: []),
|
||||
...($i.isAdmin
|
||||
? [
|
||||
|
@ -164,7 +164,7 @@ const menuDef = computed(() => [
|
|||
text: i18n.ts.indexPosts,
|
||||
action: indexPosts,
|
||||
},
|
||||
]
|
||||
]
|
||||
: []),
|
||||
],
|
||||
},
|
||||
|
@ -307,7 +307,7 @@ const menuDef = computed(() => [
|
|||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
]
|
||||
: []),
|
||||
]);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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, {
|
||||
|
|
|
@ -117,8 +117,8 @@ onMounted(() => {
|
|||
props.domain === "inbox"
|
||||
? "admin/queue/inbox-delayed"
|
||||
: props.domain === "deliver"
|
||||
? "admin/queue/deliver-delayed"
|
||||
: null,
|
||||
? "admin/queue/deliver-delayed"
|
||||
: null,
|
||||
{},
|
||||
).then((result) => {
|
||||
jobs.value = result;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -107,7 +107,7 @@
|
|||
user.updatedAt
|
||||
? `Last posted: ${new Date(
|
||||
user.updatedAt,
|
||||
).toLocaleString()}`
|
||||
).toLocaleString()}`
|
||||
: 'Never posted'
|
||||
"
|
||||
class="user"
|
||||
|
|
|
@ -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,
|
||||
),
|
||||
);
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -133,11 +133,11 @@ definePageMetadata(
|
|||
? {
|
||||
title: i18n.ts._channel.edit,
|
||||
icon: `${icon("ph-television")}`,
|
||||
}
|
||||
}
|
||||
: {
|
||||
title: i18n.ts._channel.create,
|
||||
icon: `${icon("ph-television")}`,
|
||||
},
|
||||
},
|
||||
),
|
||||
);
|
||||
</script>
|
||||
|
|
|
@ -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,
|
||||
),
|
||||
);
|
||||
|
|
|
@ -123,7 +123,7 @@ const headerActions = computed(() =>
|
|||
});
|
||||
},
|
||||
},
|
||||
]
|
||||
]
|
||||
: null,
|
||||
);
|
||||
|
||||
|
@ -133,7 +133,7 @@ definePageMetadata(
|
|||
? {
|
||||
title: clip.value.name,
|
||||
icon: `${icon("ph-paperclip")}`,
|
||||
}
|
||||
}
|
||||
: null,
|
||||
),
|
||||
);
|
||||
|
|
|
@ -161,11 +161,11 @@ definePageMetadata(
|
|||
? {
|
||||
title: i18n.ts.edit,
|
||||
icon: `${icon("ph-pencil")}`,
|
||||
}
|
||||
}
|
||||
: {
|
||||
title: i18n.ts.postToGallery,
|
||||
icon: `${icon("ph-pencil")}`,
|
||||
},
|
||||
},
|
||||
),
|
||||
);
|
||||
</script>
|
||||
|
|
|
@ -241,7 +241,7 @@ definePageMetadata(
|
|||
? {
|
||||
title: post.value.title,
|
||||
avatar: post.value.user,
|
||||
}
|
||||
}
|
||||
: null,
|
||||
),
|
||||
);
|
||||
|
|
|
@ -156,7 +156,7 @@ definePageMetadata(
|
|||
? {
|
||||
title: list.value.name,
|
||||
icon: `${icon("ph-list-bullets")}`,
|
||||
}
|
||||
}
|
||||
: null,
|
||||
),
|
||||
);
|
||||
|
|
|
@ -102,7 +102,7 @@ const prevPagination = {
|
|||
? {
|
||||
userId: appearNote.value.userId,
|
||||
untilId: appearNote.value.id,
|
||||
}
|
||||
}
|
||||
: null,
|
||||
),
|
||||
};
|
||||
|
@ -116,7 +116,7 @@ const nextPagination = {
|
|||
? {
|
||||
userId: appearNote.value.userId,
|
||||
sinceId: appearNote.value.id,
|
||||
}
|
||||
}
|
||||
: null,
|
||||
),
|
||||
};
|
||||
|
@ -192,7 +192,7 @@ definePageMetadata(
|
|||
}),
|
||||
text: appearNote.value.text,
|
||||
},
|
||||
}
|
||||
}
|
||||
: null,
|
||||
),
|
||||
);
|
||||
|
|
|
@ -115,7 +115,7 @@ function setFilter(ev) {
|
|||
},
|
||||
null,
|
||||
...typeItems,
|
||||
]
|
||||
]
|
||||
: typeItems;
|
||||
os.popupMenu(items, ev.currentTarget ?? ev.target);
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ const headerActions = computed(() =>
|
|||
icon: `${icon("ph-funnel")}`,
|
||||
highlighted: includeTypes.value != null,
|
||||
handler: setFilter,
|
||||
}
|
||||
}
|
||||
: undefined,
|
||||
tab.value === "all"
|
||||
? {
|
||||
|
@ -137,7 +137,7 @@ const headerActions = computed(() =>
|
|||
handler: () => {
|
||||
os.apiWithDialog("notifications/mark-all-as-read");
|
||||
},
|
||||
}
|
||||
}
|
||||
: undefined,
|
||||
].filter((x) => x !== undefined),
|
||||
);
|
||||
|
|
|
@ -319,7 +319,7 @@ definePageMetadata(
|
|||
title: page.value.title || page.value.name,
|
||||
text: page.value.summary,
|
||||
},
|
||||
}
|
||||
}
|
||||
: null,
|
||||
),
|
||||
);
|
||||
|
|
|
@ -151,7 +151,7 @@ async function install() {
|
|||
},
|
||||
"closed",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
installPlugin({
|
||||
id: uuid(),
|
||||
|
|
|
@ -92,7 +92,7 @@ async function init() {
|
|||
? {
|
||||
username: q.username,
|
||||
host: q.host === null ? undefined : q.host,
|
||||
}
|
||||
}
|
||||
: q,
|
||||
)
|
||||
.map((q) =>
|
||||
|
|
|
@ -90,8 +90,8 @@
|
|||
color: color.forPreview
|
||||
? color.forPreview
|
||||
: theme.base === 'light'
|
||||
? '#5f5f5f'
|
||||
: '#dadada',
|
||||
? '#5f5f5f'
|
||||
: '#dadada',
|
||||
}"
|
||||
>
|
||||
A
|
||||
|
|
|
@ -233,7 +233,7 @@ const headerTabs = computed(() => [
|
|||
icon: `${icon("ph-users")}`,
|
||||
iconOnly: true,
|
||||
},
|
||||
]
|
||||
]
|
||||
: []),
|
||||
...(isLocalTimelineAvailable
|
||||
? [
|
||||
|
@ -243,7 +243,7 @@ const headerTabs = computed(() => [
|
|||
icon: `${icon("ph-handshake")}`,
|
||||
iconOnly: true,
|
||||
},
|
||||
]
|
||||
]
|
||||
: []),
|
||||
...(isRecommendedTimelineAvailable
|
||||
? [
|
||||
|
@ -253,7 +253,7 @@ const headerTabs = computed(() => [
|
|||
icon: `${icon("ph-thumbs-up")}`,
|
||||
iconOnly: true,
|
||||
},
|
||||
]
|
||||
]
|
||||
: []),
|
||||
...(isGlobalTimelineAvailable
|
||||
? [
|
||||
|
@ -263,7 +263,7 @@ const headerTabs = computed(() => [
|
|||
icon: `${icon("ph-planet")}`,
|
||||
iconOnly: true,
|
||||
},
|
||||
]
|
||||
]
|
||||
: []),
|
||||
]);
|
||||
|
||||
|
@ -274,12 +274,12 @@ definePageMetadata(
|
|||
src.value === "local"
|
||||
? "ph-users ph-lg"
|
||||
: src.value === "social"
|
||||
? "ph-handshake ph-lg"
|
||||
: src.value === "recommended"
|
||||
? "ph-thumbs-up ph-lg"
|
||||
: src.value === "global"
|
||||
? "ph-planet ph-lg"
|
||||
: "ph-house ph-lg",
|
||||
? "ph-handshake ph-lg"
|
||||
: src.value === "recommended"
|
||||
? "ph-thumbs-up ph-lg"
|
||||
: src.value === "global"
|
||||
? "ph-planet ph-lg"
|
||||
: "ph-house ph-lg",
|
||||
})),
|
||||
);
|
||||
|
||||
|
|
|
@ -418,7 +418,7 @@ function createFetcher() {
|
|||
isAdmin
|
||||
? os.api("admin/get-user-ips", {
|
||||
userId: props.userId,
|
||||
})
|
||||
})
|
||||
: Promise.resolve(null),
|
||||
]).then(([_user, _info, _ips]) => {
|
||||
user.value = _user;
|
||||
|
@ -644,7 +644,7 @@ const headerTabs = computed(() =>
|
|||
key: "moderation",
|
||||
title: i18n.ts.moderation,
|
||||
icon: `${icon("ph-shield")}`,
|
||||
}
|
||||
}
|
||||
: null,
|
||||
{
|
||||
key: "chart",
|
||||
|
|
|
@ -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,
|
||||
),
|
||||
);
|
||||
|
|
|
@ -66,7 +66,7 @@ definePageMetadata(
|
|||
subtitle: i18n.ts.followers,
|
||||
userName: user.value,
|
||||
avatar: user.value,
|
||||
}
|
||||
}
|
||||
: null,
|
||||
),
|
||||
);
|
||||
|
|
|
@ -66,7 +66,7 @@ definePageMetadata(
|
|||
subtitle: i18n.ts.following,
|
||||
userName: user.value,
|
||||
avatar: user.value,
|
||||
}
|
||||
}
|
||||
: null,
|
||||
),
|
||||
);
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
user.bannerUrl
|
||||
? `url('${getStaticImageUrl(
|
||||
user.bannerUrl,
|
||||
)}')`
|
||||
)}')`
|
||||
: null,
|
||||
}"
|
||||
></div>
|
||||
|
|
|
@ -96,7 +96,7 @@ const headerTabs = computed(() =>
|
|||
title: i18n.ts.reaction,
|
||||
icon: `${icon("ph-smiley")}`,
|
||||
},
|
||||
]
|
||||
]
|
||||
: []),
|
||||
...(user.value.instance == null
|
||||
? [
|
||||
|
@ -115,9 +115,9 @@ const headerTabs = computed(() =>
|
|||
title: i18n.ts.gallery,
|
||||
icon: `${icon("ph-image-square")}`,
|
||||
},
|
||||
]
|
||||
]
|
||||
: []),
|
||||
]
|
||||
]
|
||||
: null,
|
||||
);
|
||||
|
||||
|
@ -136,7 +136,7 @@ definePageMetadata(
|
|||
share: {
|
||||
title: user.value.name,
|
||||
},
|
||||
}
|
||||
}
|
||||
: null,
|
||||
),
|
||||
);
|
||||
|
|
|
@ -188,7 +188,7 @@ function showMenu(ev) {
|
|||
action: () => {
|
||||
window.open(instance.tosUrl, "_blank");
|
||||
},
|
||||
}
|
||||
}
|
||||
: null,
|
||||
],
|
||||
ev.currentTarget ?? ev.target,
|
||||
|
|
|
@ -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";
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue