clean up w/ rome

This commit is contained in:
ThatOneCalculator 2023-01-16 11:19:20 -08:00
parent cc52292985
commit abf47e54f3
No known key found for this signature in database
GPG Key ID: 8703CACD01000000
359 changed files with 88 additions and 406 deletions

View File

@ -69,7 +69,7 @@ export function fromHtml(html: string, hashtagNames?: string[]): string {
) { ) {
text += txt; text += txt;
// メンション // メンション
} else if (txt.startsWith("@") && !(rel?.value.match(/^me /))) { } else if (txt.startsWith("@") && !rel?.value.match(/^me /)) {
const part = txt.split("@"); const part = txt.split("@");
if (part.length === 2 && href) { if (part.length === 2 && href) {

View File

@ -1,5 +1,3 @@
export function isDuplicateKeyValueError(e: unknown | Error): boolean { export function isDuplicateKeyValueError(e: unknown | Error): boolean {
return ( return (e as Error).message?.startsWith("duplicate key value");
(e as Error).message?.startsWith("duplicate key value")
);
} }

View File

@ -1,7 +1,6 @@
export function isUserRelated(note: any, ids: Set<string>): boolean { export function isUserRelated(note: any, ids: Set<string>): boolean {
if (ids.has(note.userId)) return true; // note author is muted if (ids.has(note.userId)) return true; // note author is muted
if (note.mentions?.some((user: string) => ids.has(user))) if (note.mentions?.some((user: string) => ids.has(user))) return true; // any of mentioned users are muted
return true; // any of mentioned users are muted
if (note.reply && isUserRelated(note.reply, ids)) return true; // also check reply target if (note.reply && isUserRelated(note.reply, ids)) return true; // also check reply target
if (note.renote && isUserRelated(note.renote, ids)) return true; // also check renote target if (note.renote && isUserRelated(note.renote, ids)) return true; // also check renote target
return false; return false;

View File

@ -9,7 +9,7 @@ export async function awaitAll<T>(obj: Promiseable<T>): Promise<T> {
const resolvedValues = await Promise.all( const resolvedValues = await Promise.all(
values.map((value) => values.map((value) =>
!(value?.constructor ) || value.constructor.name !== "Object" !value?.constructor || value.constructor.name !== "Object"
? value ? value
: awaitAll(value), : awaitAll(value),
), ),

View File

@ -85,8 +85,10 @@ export async function exportBlocking(
stream.end(); stream.end();
logger.succ(`Exported to: ${path}`); logger.succ(`Exported to: ${path}`);
const fileName = const fileName = `blocking-${dateFormat(
`blocking-${dateFormat(new Date(), "yyyy-MM-dd-HH-mm-ss")}.csv`; new Date(),
"yyyy-MM-dd-HH-mm-ss",
)}.csv`;
const driveFile = await addFile({ const driveFile = await addFile({
user, user,
path, path,

View File

@ -108,8 +108,10 @@ export async function exportCustomEmojis(
archiveStream.on("close", async () => { archiveStream.on("close", async () => {
logger.succ(`Exported to: ${archivePath}`); logger.succ(`Exported to: ${archivePath}`);
const fileName = const fileName = `custom-emojis-${dateFormat(
`custom-emojis-${dateFormat(new Date(), "yyyy-MM-dd-HH-mm-ss")}.zip`; new Date(),
"yyyy-MM-dd-HH-mm-ss",
)}.zip`;
const driveFile = await addFile({ const driveFile = await addFile({
user, user,
path: archivePath, path: archivePath,

View File

@ -93,8 +93,10 @@ export async function exportFollowing(
stream.end(); stream.end();
logger.succ(`Exported to: ${path}`); logger.succ(`Exported to: ${path}`);
const fileName = const fileName = `following-${dateFormat(
`following-${dateFormat(new Date(), "yyyy-MM-dd-HH-mm-ss")}.csv`; new Date(),
"yyyy-MM-dd-HH-mm-ss",
)}.csv`;
const driveFile = await addFile({ const driveFile = await addFile({
user, user,
path, path,

View File

@ -86,8 +86,10 @@ export async function exportMute(
stream.end(); stream.end();
logger.succ(`Exported to: ${path}`); logger.succ(`Exported to: ${path}`);
const fileName = const fileName = `mute-${dateFormat(
`mute-${dateFormat(new Date(), "yyyy-MM-dd-HH-mm-ss")}.csv`; new Date(),
"yyyy-MM-dd-HH-mm-ss",
)}.csv`;
const driveFile = await addFile({ const driveFile = await addFile({
user, user,
path, path,

View File

@ -93,8 +93,10 @@ export async function exportNotes(
stream.end(); stream.end();
logger.succ(`Exported to: ${path}`); logger.succ(`Exported to: ${path}`);
const fileName = const fileName = `notes-${dateFormat(
`notes-${dateFormat(new Date(), "yyyy-MM-dd-HH-mm-ss")}.json`; new Date(),
"yyyy-MM-dd-HH-mm-ss",
)}.json`;
const driveFile = await addFile({ const driveFile = await addFile({
user, user,
path, path,

View File

@ -61,8 +61,10 @@ export async function exportUserLists(
stream.end(); stream.end();
logger.succ(`Exported to: ${path}`); logger.succ(`Exported to: ${path}`);
const fileName = const fileName = `user-lists-${dateFormat(
`user-lists-${dateFormat(new Date(), "yyyy-MM-dd-HH-mm-ss")}.csv`; new Date(),
"yyyy-MM-dd-HH-mm-ss",
)}.csv`;
const driveFile = await addFile({ const driveFile = await addFile({
user, user,
path, path,

View File

@ -34,7 +34,7 @@ export async function extractPollFromQuestion(
); );
const votes = question[multiple ? "anyOf" : "oneOf"]!.map( const votes = question[multiple ? "anyOf" : "oneOf"]!.map(
(x, i) => (x.replies?.totalItems) || x._misskey_votes || 0, (x, i) => x.replies?.totalItems || x._misskey_votes || 0,
); );
return { return {

View File

@ -38,8 +38,7 @@ export async function renderPerson(user: ILocalUser) {
attachment.push({ attachment.push({
type: "PropertyValue", type: "PropertyValue",
name: field.name, name: field.name,
value: value: field.value?.match(/^https?:/)
field.value?.match(/^https?:/)
? `<a href="${ ? `<a href="${
new URL(field.value).href new URL(field.value).href
}" rel="me nofollow noopener" target="_blank">${ }" rel="me nofollow noopener" target="_blank">${

View File

@ -24,17 +24,17 @@ export default async function (query: string): Promise<IWebFinger> {
function genUrl(query: string) { function genUrl(query: string) {
if (query.match(/^https?:\/\//)) { if (query.match(/^https?:\/\//)) {
const u = new URL(query); const u = new URL(query);
return ( return `${u.protocol}//${u.hostname}/.well-known/webfinger?${urlQuery({
`${u.protocol}//${u.hostname}/.well-known/webfinger?${urlQuery({ resource: query })}` resource: query,
); })}`;
} }
const m = query.match(/^([^@]+)@(.*)/); const m = query.match(/^([^@]+)@(.*)/);
if (m) { if (m) {
const hostname = m[2]; const hostname = m[2];
return ( return `https://${hostname}/.well-known/webfinger?${urlQuery({
`https://${hostname}/.well-known/webfinger?${urlQuery({ resource: `acct:${query}` })}` resource: `acct:${query}`,
); })}`;
} }
throw new Error(`Invalid query (${query})`); throw new Error(`Invalid query (${query})`);

View File

@ -92,9 +92,9 @@ function PEMString(pemBuffer: Buffer, type = "CERTIFICATE") {
start += 64; start += 64;
} }
return ( return `-----BEGIN ${type}-----\n${keyParts.join(
`-----BEGIN ${type}-----\n${keyParts.join("\n")}\n-----END ${type}-----\n` "\n",
); )}\n-----END ${type}-----\n`;
} }
export function hash(data: Buffer) { export function hash(data: Buffer) {

View File

@ -104,7 +104,6 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async (ps) => { export default define(meta, paramDef, async (ps) => {
const query = makePaginationQuery( const query = makePaginationQuery(
AbuseUserReports.createQueryBuilder("report"), AbuseUserReports.createQueryBuilder("report"),

View File

@ -30,7 +30,6 @@ export const paramDef = {
required: ["username", "password"], required: ["username", "password"],
} as const; } as const;
export default define(meta, paramDef, async (ps, _me) => { export default define(meta, paramDef, async (ps, _me) => {
const me = _me ? await Users.findOneByOrFail({ id: _me.id }) : null; const me = _me ? await Users.findOneByOrFail({ id: _me.id }) : null;
const noUsers = const noUsers =

View File

@ -19,7 +19,6 @@ export const paramDef = {
required: ["userId"], required: ["userId"],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const user = await Users.findOneBy({ id: ps.userId }); const user = await Users.findOneBy({ id: ps.userId });

View File

@ -17,7 +17,6 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const hostedConfig = config.isManagedHosting; const hostedConfig = config.isManagedHosting;
const hosted = hostedConfig != null && hostedConfig === true; const hosted = hostedConfig != null && hostedConfig === true;

View File

@ -31,7 +31,6 @@ export const paramDef = {
], ],
} as const; } as const;
export default define(meta, paramDef, async (ps) => { export default define(meta, paramDef, async (ps) => {
await Ads.insert({ await Ads.insert({
id: genId(), id: genId(),

View File

@ -25,7 +25,6 @@ export const paramDef = {
required: ["id"], required: ["id"],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const ad = await Ads.findOneBy({ id: ps.id }); const ad = await Ads.findOneBy({ id: ps.id });

View File

@ -19,7 +19,6 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async (ps) => { export default define(meta, paramDef, async (ps) => {
const query = makePaginationQuery( const query = makePaginationQuery(
Ads.createQueryBuilder("ad"), Ads.createQueryBuilder("ad"),

View File

@ -41,7 +41,6 @@ export const paramDef = {
], ],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const ad = await Ads.findOneBy({ id: ps.id }); const ad = await Ads.findOneBy({ id: ps.id });

View File

@ -61,7 +61,6 @@ export const paramDef = {
required: ["title", "text", "imageUrl"], required: ["title", "text", "imageUrl"],
} as const; } as const;
export default define(meta, paramDef, async (ps) => { export default define(meta, paramDef, async (ps) => {
const announcement = await Announcements.insert({ const announcement = await Announcements.insert({
id: genId(), id: genId(),

View File

@ -25,7 +25,6 @@ export const paramDef = {
required: ["id"], required: ["id"],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const announcement = await Announcements.findOneBy({ id: ps.id }); const announcement = await Announcements.findOneBy({ id: ps.id });

View File

@ -72,7 +72,6 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async (ps) => { export default define(meta, paramDef, async (ps) => {
const query = makePaginationQuery( const query = makePaginationQuery(
Announcements.createQueryBuilder("announcement"), Announcements.createQueryBuilder("announcement"),

View File

@ -28,7 +28,6 @@ export const paramDef = {
required: ["id", "title", "text", "imageUrl"], required: ["id", "title", "text", "imageUrl"],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const announcement = await Announcements.findOneBy({ id: ps.id }); const announcement = await Announcements.findOneBy({ id: ps.id });

View File

@ -19,7 +19,6 @@ export const paramDef = {
required: ["userId"], required: ["userId"],
} as const; } as const;
export default define(meta, paramDef, async (ps) => { export default define(meta, paramDef, async (ps) => {
const user = await Users.findOneByOrFail({ id: ps.userId }); const user = await Users.findOneByOrFail({ id: ps.userId });
if (user.isDeleted) { if (user.isDeleted) {

View File

@ -17,7 +17,6 @@ export const paramDef = {
required: ["userId"], required: ["userId"],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const files = await DriveFiles.findBy({ const files = await DriveFiles.findBy({
userId: ps.userId, userId: ps.userId,

View File

@ -18,7 +18,6 @@ export const paramDef = {
required: ["userId", "overrideMb"], required: ["userId", "overrideMb"],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const user = await Users.findOneBy({ id: ps.userId }); const user = await Users.findOneBy({ id: ps.userId });

View File

@ -14,7 +14,6 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
createCleanRemoteFilesJob(); createCleanRemoteFilesJob();
}); });

View File

@ -16,7 +16,6 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const files = await DriveFiles.findBy({ const files = await DriveFiles.findBy({
userId: IsNull(), userId: IsNull(),

View File

@ -48,7 +48,6 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const query = makePaginationQuery( const query = makePaginationQuery(
DriveFiles.createQueryBuilder("file"), DriveFiles.createQueryBuilder("file"),

View File

@ -195,7 +195,6 @@ export const paramDef = {
], ],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const file = ps.fileId const file = ps.fileId
? await DriveFiles.findOneBy({ id: ps.fileId }) ? await DriveFiles.findOneBy({ id: ps.fileId })

View File

@ -31,7 +31,6 @@ export const paramDef = {
required: ["ids", "aliases"], required: ["ids", "aliases"],
} as const; } as const;
export default define(meta, paramDef, async (ps) => { export default define(meta, paramDef, async (ps) => {
const emojis = await Emojis.findBy({ const emojis = await Emojis.findBy({
id: In(ps.ids), id: In(ps.ids),

View File

@ -30,7 +30,6 @@ export const paramDef = {
required: ["fileId"], required: ["fileId"],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const file = await DriveFiles.findOneBy({ id: ps.fileId }); const file = await DriveFiles.findOneBy({ id: ps.fileId });

View File

@ -44,7 +44,6 @@ export const paramDef = {
required: ["emojiId"], required: ["emojiId"],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const emoji = await Emojis.findOneBy({ id: ps.emojiId }); const emoji = await Emojis.findOneBy({ id: ps.emojiId });

View File

@ -26,7 +26,6 @@ export const paramDef = {
required: ["ids"], required: ["ids"],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const emojis = await Emojis.findBy({ const emojis = await Emojis.findBy({
id: In(ps.ids), id: In(ps.ids),

View File

@ -27,7 +27,6 @@ export const paramDef = {
required: ["id"], required: ["id"],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const emoji = await Emojis.findOneBy({ id: ps.id }); const emoji = await Emojis.findOneBy({ id: ps.id });

View File

@ -16,7 +16,6 @@ export const paramDef = {
required: ["fileId"], required: ["fileId"],
} as const; } as const;
export default define(meta, paramDef, async (ps, user) => { export default define(meta, paramDef, async (ps, user) => {
createImportCustomEmojisJob(user, ps.fileId); createImportCustomEmojisJob(user, ps.fileId);
}); });

View File

@ -77,7 +77,6 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async (ps) => { export default define(meta, paramDef, async (ps) => {
const q = makePaginationQuery( const q = makePaginationQuery(
Emojis.createQueryBuilder("emoji"), Emojis.createQueryBuilder("emoji"),

View File

@ -71,7 +71,6 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async (ps) => { export default define(meta, paramDef, async (ps) => {
const q = makePaginationQuery( const q = makePaginationQuery(
Emojis.createQueryBuilder("emoji"), Emojis.createQueryBuilder("emoji"),

View File

@ -31,7 +31,6 @@ export const paramDef = {
required: ["ids", "aliases"], required: ["ids", "aliases"],
} as const; } as const;
export default define(meta, paramDef, async (ps) => { export default define(meta, paramDef, async (ps) => {
const emojis = await Emojis.findBy({ const emojis = await Emojis.findBy({
id: In(ps.ids), id: In(ps.ids),

View File

@ -31,7 +31,6 @@ export const paramDef = {
required: ["ids", "aliases"], required: ["ids", "aliases"],
} as const; } as const;
export default define(meta, paramDef, async (ps) => { export default define(meta, paramDef, async (ps) => {
await Emojis.update( await Emojis.update(
{ {

View File

@ -30,7 +30,6 @@ export const paramDef = {
required: ["ids"], required: ["ids"],
} as const; } as const;
export default define(meta, paramDef, async (ps) => { export default define(meta, paramDef, async (ps) => {
await Emojis.update( await Emojis.update(
{ {

View File

@ -38,7 +38,6 @@ export const paramDef = {
required: ["id", "name", "aliases"], required: ["id", "name", "aliases"],
} as const; } as const;
export default define(meta, paramDef, async (ps) => { export default define(meta, paramDef, async (ps) => {
const emoji = await Emojis.findOneBy({ id: ps.id }); const emoji = await Emojis.findOneBy({ id: ps.id });

View File

@ -17,7 +17,6 @@ export const paramDef = {
required: ["host"], required: ["host"],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const files = await DriveFiles.findBy({ const files = await DriveFiles.findBy({
userHost: ps.host, userHost: ps.host,

View File

@ -18,7 +18,6 @@ export const paramDef = {
required: ["host"], required: ["host"],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const instance = await Instances.findOneBy({ host: toPuny(ps.host) }); const instance = await Instances.findOneBy({ host: toPuny(ps.host) });

View File

@ -17,7 +17,6 @@ export const paramDef = {
required: ["host"], required: ["host"],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const followings = await Followings.findBy({ const followings = await Followings.findBy({
followerHost: ps.host, followerHost: ps.host,

View File

@ -18,7 +18,6 @@ export const paramDef = {
required: ["host", "isSuspended"], required: ["host", "isSuspended"],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const instance = await Instances.findOneBy({ host: toPuny(ps.host) }); const instance = await Instances.findOneBy({ host: toPuny(ps.host) });

View File

@ -14,7 +14,6 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async () => { export default define(meta, paramDef, async () => {
const stats = await db.query("SELECT * FROM pg_indexes;").then((recs) => { const stats = await db.query("SELECT * FROM pg_indexes;").then((recs) => {
const res = [] as { tablename: string; indexname: string }[]; const res = [] as { tablename: string; indexname: string }[];

View File

@ -26,7 +26,6 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async () => { export default define(meta, paramDef, async () => {
const sizes = await db const sizes = await db
.query(` .query(`

View File

@ -16,7 +16,6 @@ export const paramDef = {
required: ["userId"], required: ["userId"],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const ips = await UserIps.find({ const ips = await UserIps.find({
where: { userId: ps.userId }, where: { userId: ps.userId },

View File

@ -32,7 +32,6 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async () => { export default define(meta, paramDef, async () => {
const code = rndstr({ const code = rndstr({
length: 8, length: 8,

View File

@ -465,7 +465,6 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const instance = await fetchMeta(true); const instance = await fetchMeta(true);

View File

@ -17,7 +17,6 @@ export const paramDef = {
required: ["userId"], required: ["userId"],
} as const; } as const;
export default define(meta, paramDef, async (ps) => { export default define(meta, paramDef, async (ps) => {
const user = await Users.findOneBy({ id: ps.userId }); const user = await Users.findOneBy({ id: ps.userId });

View File

@ -17,7 +17,6 @@ export const paramDef = {
required: ["userId"], required: ["userId"],
} as const; } as const;
export default define(meta, paramDef, async (ps) => { export default define(meta, paramDef, async (ps) => {
const user = await Users.findOneBy({ id: ps.userId }); const user = await Users.findOneBy({ id: ps.userId });

View File

@ -33,7 +33,6 @@ export const paramDef = {
required: ["noteId", "expiresAt"], required: ["noteId", "expiresAt"],
} as const; } as const;
export default define(meta, paramDef, async (ps, user) => { export default define(meta, paramDef, async (ps, user) => {
const note = await getNote(ps.noteId, user).catch((err) => { const note = await getNote(ps.noteId, user).catch((err) => {
if (err.id === "9725d0ce-ba28-4dde-95a7-2cbb2c15de24") if (err.id === "9725d0ce-ba28-4dde-95a7-2cbb2c15de24")

View File

@ -15,7 +15,6 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
destroy(); destroy();

View File

@ -37,7 +37,6 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async (ps) => { export default define(meta, paramDef, async (ps) => {
const jobs = await deliverQueue.getJobs(["delayed"]); const jobs = await deliverQueue.getJobs(["delayed"]);

View File

@ -37,7 +37,6 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async (ps) => { export default define(meta, paramDef, async (ps) => {
const jobs = await inboxQueue.getJobs(["delayed"]); const jobs = await inboxQueue.getJobs(["delayed"]);

View File

@ -47,7 +47,6 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async (ps) => { export default define(meta, paramDef, async (ps) => {
const deliverJobCounts = await deliverQueue.getJobCounts(); const deliverJobCounts = await deliverQueue.getJobCounts();
const inboxJobCounts = await inboxQueue.getJobCounts(); const inboxJobCounts = await inboxQueue.getJobCounts();

View File

@ -54,7 +54,6 @@ export const paramDef = {
required: ["inbox"], required: ["inbox"],
} as const; } as const;
export default define(meta, paramDef, async (ps, user) => { export default define(meta, paramDef, async (ps, user) => {
try { try {
if (new URL(ps.inbox).protocol !== "https:") throw new Error("https only"); if (new URL(ps.inbox).protocol !== "https:") throw new Error("https only");

View File

@ -46,7 +46,6 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async (ps, user) => { export default define(meta, paramDef, async (ps, user) => {
return await listRelay(); return await listRelay();
}); });

View File

@ -16,7 +16,6 @@ export const paramDef = {
required: ["inbox"], required: ["inbox"],
} as const; } as const;
export default define(meta, paramDef, async (ps, user) => { export default define(meta, paramDef, async (ps, user) => {
return await removeRelay(ps.inbox); return await removeRelay(ps.inbox);
}); });

View File

@ -33,7 +33,6 @@ export const paramDef = {
required: ["userId"], required: ["userId"],
} as const; } as const;
export default define(meta, paramDef, async (ps) => { export default define(meta, paramDef, async (ps) => {
const user = await Users.findOneBy({ id: ps.userId }); const user = await Users.findOneBy({ id: ps.userId });

View File

@ -21,7 +21,6 @@ export const paramDef = {
required: ["reportId"], required: ["reportId"],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const report = await AbuseUserReports.findOneByOrFail({ id: ps.reportId }); const report = await AbuseUserReports.findOneByOrFail({ id: ps.reportId });

View File

@ -18,7 +18,6 @@ export const paramDef = {
required: ["to", "subject", "text"], required: ["to", "subject", "text"],
} as const; } as const;
export default define(meta, paramDef, async (ps) => { export default define(meta, paramDef, async (ps) => {
await sendEmail(ps.to, ps.subject, ps.text, ps.text); await sendEmail(ps.to, ps.subject, ps.text, ps.text);
}); });

View File

@ -108,7 +108,6 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async () => { export default define(meta, paramDef, async () => {
const memStats = await si.mem(); const memStats = await si.mem();
const fsStats = await si.fsSize(); const fsStats = await si.fsSize();

View File

@ -66,7 +66,6 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async (ps) => { export default define(meta, paramDef, async (ps) => {
const query = makePaginationQuery( const query = makePaginationQuery(
ModerationLogs.createQueryBuilder("report"), ModerationLogs.createQueryBuilder("report"),

View File

@ -22,7 +22,6 @@ export const paramDef = {
required: ["userId"], required: ["userId"],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const [user, profile] = await Promise.all([ const [user, profile] = await Promise.all([
Users.findOneBy({ id: ps.userId }), Users.findOneBy({ id: ps.userId }),

View File

@ -66,7 +66,6 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const query = Users.createQueryBuilder("user"); const query = Users.createQueryBuilder("user");

View File

@ -18,7 +18,6 @@ export const paramDef = {
required: ["userId"], required: ["userId"],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const user = await Users.findOneBy({ id: ps.userId }); const user = await Users.findOneBy({ id: ps.userId });

View File

@ -21,7 +21,6 @@ export const paramDef = {
required: ["userId"], required: ["userId"],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const user = await Users.findOneBy({ id: ps.userId }); const user = await Users.findOneBy({ id: ps.userId });

View File

@ -18,7 +18,6 @@ export const paramDef = {
required: ["userId"], required: ["userId"],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const user = await Users.findOneBy({ id: ps.userId }); const user = await Users.findOneBy({ id: ps.userId });

View File

@ -18,7 +18,6 @@ export const paramDef = {
required: ["userId"], required: ["userId"],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const user = await Users.findOneBy({ id: ps.userId }); const user = await Users.findOneBy({ id: ps.userId });

View File

@ -165,7 +165,6 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const set = {} as Partial<Meta>; const set = {} as Partial<Meta>;

View File

@ -17,7 +17,6 @@ export const paramDef = {
required: ["userId", "text"], required: ["userId", "text"],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const user = await Users.findOneBy({ id: ps.userId }); const user = await Users.findOneBy({ id: ps.userId });

View File

@ -18,7 +18,6 @@ export const paramDef = {
required: ["full", "analyze"], required: ["full", "analyze"],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const params: string[] = []; const params: string[] = [];

View File

@ -72,7 +72,6 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async (ps, user) => { export default define(meta, paramDef, async (ps, user) => {
const query = makePaginationQuery( const query = makePaginationQuery(
Announcements.createQueryBuilder("announcement"), Announcements.createQueryBuilder("announcement"),

View File

@ -82,7 +82,6 @@ export const paramDef = {
], ],
} as const; } as const;
export default define(meta, paramDef, async (ps, user) => { export default define(meta, paramDef, async (ps, user) => {
if (user.movedToUri != null) throw new ApiError(meta.errors.noSuchUserGroup); if (user.movedToUri != null) throw new ApiError(meta.errors.noSuchUserGroup);
let userList; let userList;

View File

@ -27,7 +27,6 @@ export const paramDef = {
required: ["antennaId"], required: ["antennaId"],
} as const; } as const;
export default define(meta, paramDef, async (ps, user) => { export default define(meta, paramDef, async (ps, user) => {
const antenna = await Antennas.findOneBy({ const antenna = await Antennas.findOneBy({
id: ps.antennaId, id: ps.antennaId,

View File

@ -27,7 +27,6 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const antennas = await Antennas.findBy({ const antennas = await Antennas.findBy({
userId: me.id, userId: me.id,

View File

@ -19,7 +19,6 @@ export const paramDef = {
required: ["antennaId"], required: ["antennaId"],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const antenna = await Antennas.findOneBy({ const antenna = await Antennas.findOneBy({
userId: me.id, userId: me.id,

View File

@ -48,7 +48,6 @@ export const paramDef = {
required: ["antennaId"], required: ["antennaId"],
} as const; } as const;
export default define(meta, paramDef, async (ps, user) => { export default define(meta, paramDef, async (ps, user) => {
const antenna = await Antennas.findOneBy({ const antenna = await Antennas.findOneBy({
id: ps.antennaId, id: ps.antennaId,

View File

@ -33,7 +33,6 @@ export const paramDef = {
required: ["antennaId"], required: ["antennaId"],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
// Fetch the antenna // Fetch the antenna
const antenna = await Antennas.findOneBy({ const antenna = await Antennas.findOneBy({

View File

@ -89,7 +89,6 @@ export const paramDef = {
], ],
} as const; } as const;
export default define(meta, paramDef, async (ps, user) => { export default define(meta, paramDef, async (ps, user) => {
// Fetch the antenna // Fetch the antenna
const antenna = await Antennas.findOneBy({ const antenna = await Antennas.findOneBy({

View File

@ -29,7 +29,6 @@ export const paramDef = {
required: ["uri"], required: ["uri"],
} as const; } as const;
export default define(meta, paramDef, async (ps) => { export default define(meta, paramDef, async (ps) => {
const resolver = new Resolver(); const resolver = new Resolver();
const object = await resolver.resolve(ps.uri); const object = await resolver.resolve(ps.uri);

View File

@ -83,7 +83,6 @@ export const paramDef = {
required: ["uri"], required: ["uri"],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const object = await fetchAny(ps.uri, me); const object = await fetchAny(ps.uri, me);
if (object) { if (object) {

View File

@ -34,7 +34,6 @@ export const paramDef = {
required: ["name", "description", "permission"], required: ["name", "description", "permission"],
} as const; } as const;
export default define(meta, paramDef, async (ps, user) => { export default define(meta, paramDef, async (ps, user) => {
if (user?.movedToUri != null) if (user?.movedToUri != null)
return await Apps.pack("", null, { return await Apps.pack("", null, {

View File

@ -29,7 +29,6 @@ export const paramDef = {
required: ["appId"], required: ["appId"],
} as const; } as const;
export default define(meta, paramDef, async (ps, user, token) => { export default define(meta, paramDef, async (ps, user, token) => {
const isSecure = user != null && token == null; const isSecure = user != null && token == null;

View File

@ -29,7 +29,6 @@ export const paramDef = {
required: ["token"], required: ["token"],
} as const; } as const;
export default define(meta, paramDef, async (ps, user) => { export default define(meta, paramDef, async (ps, user) => {
// Fetch token // Fetch token
const session = await AuthSessions.findOneBy({ token: ps.token }); const session = await AuthSessions.findOneBy({ token: ps.token });

View File

@ -46,7 +46,6 @@ export const paramDef = {
required: ["appSecret"], required: ["appSecret"],
} as const; } as const;
export default define(meta, paramDef, async (ps) => { export default define(meta, paramDef, async (ps) => {
// Lookup app // Lookup app
const app = await Apps.findOneBy({ const app = await Apps.findOneBy({

View File

@ -49,7 +49,6 @@ export const paramDef = {
required: ["token"], required: ["token"],
} as const; } as const;
export default define(meta, paramDef, async (ps, user) => { export default define(meta, paramDef, async (ps, user) => {
// Lookup session // Lookup session
const session = await AuthSessions.findOneBy({ const session = await AuthSessions.findOneBy({

View File

@ -57,7 +57,6 @@ export const paramDef = {
required: ["appSecret", "token"], required: ["appSecret", "token"],
} as const; } as const;
export default define(meta, paramDef, async (ps) => { export default define(meta, paramDef, async (ps) => {
// Lookup app // Lookup app
const app = await Apps.findOneBy({ const app = await Apps.findOneBy({

View File

@ -53,7 +53,6 @@ export const paramDef = {
required: ["userId"], required: ["userId"],
} as const; } as const;
export default define(meta, paramDef, async (ps, user) => { export default define(meta, paramDef, async (ps, user) => {
const blocker = await Users.findOneByOrFail({ id: user.id }); const blocker = await Users.findOneByOrFail({ id: user.id });

View File

@ -53,7 +53,6 @@ export const paramDef = {
required: ["userId"], required: ["userId"],
} as const; } as const;
export default define(meta, paramDef, async (ps, user) => { export default define(meta, paramDef, async (ps, user) => {
const blocker = await Users.findOneByOrFail({ id: user.id }); const blocker = await Users.findOneByOrFail({ id: user.id });

View File

@ -32,7 +32,6 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const query = makePaginationQuery( const query = makePaginationQuery(
Blockings.createQueryBuilder("blocking"), Blockings.createQueryBuilder("blocking"),

View File

@ -42,7 +42,6 @@ export const paramDef = {
required: ["name"], required: ["name"],
} as const; } as const;
export default define(meta, paramDef, async (ps, user) => { export default define(meta, paramDef, async (ps, user) => {
let banner = null; let banner = null;
if (ps.bannerId != null) { if (ps.bannerId != null) {

View File

@ -26,7 +26,6 @@ export const paramDef = {
required: [], required: [],
} as const; } as const;
export default define(meta, paramDef, async (ps, me) => { export default define(meta, paramDef, async (ps, me) => {
const query = Channels.createQueryBuilder("channel") const query = Channels.createQueryBuilder("channel")
.where("channel.lastNotedAt IS NOT NULL") .where("channel.lastNotedAt IS NOT NULL")

View File

@ -28,7 +28,6 @@ export const paramDef = {
required: ["channelId"], required: ["channelId"],
} as const; } as const;
export default define(meta, paramDef, async (ps, user) => { export default define(meta, paramDef, async (ps, user) => {
const channel = await Channels.findOneBy({ const channel = await Channels.findOneBy({
id: ps.channelId, id: ps.channelId,

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