2023-12-03 04:45:18 +01:00
|
|
|
import { ModerationLogPayloads } from './consts.js';
|
2024-07-10 13:40:04 +02:00
|
|
|
import {
|
|
|
|
Announcement,
|
|
|
|
EmojiDetailed,
|
|
|
|
MeDetailed,
|
2024-08-17 04:28:22 +02:00
|
|
|
Note,
|
2024-07-10 13:40:04 +02:00
|
|
|
Page,
|
|
|
|
Role,
|
|
|
|
RolePolicies,
|
|
|
|
User,
|
2024-07-25 09:40:14 +02:00
|
|
|
UserDetailedNotMe,
|
2024-07-10 13:40:04 +02:00
|
|
|
} from './autogen/models.js';
|
2024-10-03 11:33:56 +02:00
|
|
|
import type { AuthenticationResponseJSON, PublicKeyCredentialRequestOptionsJSON } from '@simplewebauthn/types';
|
2023-12-03 04:45:18 +01:00
|
|
|
|
2024-01-20 05:57:03 +01:00
|
|
|
export * from './autogen/entities.js';
|
|
|
|
export * from './autogen/models.js';
|
2023-09-23 11:28:16 +02:00
|
|
|
|
2023-03-30 02:33:19 +02:00
|
|
|
export type ID = string;
|
|
|
|
export type DateString = string;
|
|
|
|
|
2024-08-17 04:28:22 +02:00
|
|
|
type NonNullableRecord<T> = {
|
|
|
|
[P in keyof T]-?: NonNullable<T[P]>;
|
|
|
|
};
|
|
|
|
type AllNullRecord<T> = {
|
|
|
|
[P in keyof T]: null;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type PureRenote =
|
|
|
|
Omit<Note, 'renote' | 'renoteId' | 'reply' | 'replyId' | 'text' | 'cw' | 'files' | 'fileIds' | 'poll'>
|
|
|
|
& AllNullRecord<Pick<Note, 'reply' | 'replyId' | 'text' | 'cw' | 'poll'>>
|
|
|
|
& { files: []; fileIds: []; }
|
|
|
|
& NonNullableRecord<Pick<Note, 'renote' | 'renoteId'>>;
|
|
|
|
|
2023-03-30 02:33:19 +02:00
|
|
|
export type PageEvent = {
|
|
|
|
pageId: Page['id'];
|
|
|
|
event: string;
|
2024-07-25 09:40:14 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2023-03-30 02:33:19 +02:00
|
|
|
var: any;
|
|
|
|
userId: User['id'];
|
|
|
|
user: User;
|
|
|
|
};
|
|
|
|
|
2023-09-23 11:28:16 +02:00
|
|
|
export type ModerationLog = {
|
|
|
|
id: ID;
|
|
|
|
createdAt: DateString;
|
|
|
|
userId: User['id'];
|
2024-01-31 07:45:35 +01:00
|
|
|
user: UserDetailedNotMe | null;
|
2023-09-23 11:28:16 +02:00
|
|
|
} & ({
|
|
|
|
type: 'updateServerSettings';
|
|
|
|
info: ModerationLogPayloads['updateServerSettings'];
|
|
|
|
} | {
|
|
|
|
type: 'suspend';
|
|
|
|
info: ModerationLogPayloads['suspend'];
|
|
|
|
} | {
|
|
|
|
type: 'unsuspend';
|
|
|
|
info: ModerationLogPayloads['unsuspend'];
|
|
|
|
} | {
|
|
|
|
type: 'updateUserNote';
|
|
|
|
info: ModerationLogPayloads['updateUserNote'];
|
|
|
|
} | {
|
|
|
|
type: 'addCustomEmoji';
|
|
|
|
info: ModerationLogPayloads['addCustomEmoji'];
|
2023-09-24 03:57:24 +02:00
|
|
|
} | {
|
|
|
|
type: 'updateCustomEmoji';
|
|
|
|
info: ModerationLogPayloads['updateCustomEmoji'];
|
|
|
|
} | {
|
|
|
|
type: 'deleteCustomEmoji';
|
|
|
|
info: ModerationLogPayloads['deleteCustomEmoji'];
|
2023-09-23 11:28:16 +02:00
|
|
|
} | {
|
|
|
|
type: 'assignRole';
|
|
|
|
info: ModerationLogPayloads['assignRole'];
|
|
|
|
} | {
|
|
|
|
type: 'unassignRole';
|
|
|
|
info: ModerationLogPayloads['unassignRole'];
|
2023-09-25 03:29:12 +02:00
|
|
|
} | {
|
|
|
|
type: 'createRole';
|
|
|
|
info: ModerationLogPayloads['createRole'];
|
2023-09-23 11:28:16 +02:00
|
|
|
} | {
|
|
|
|
type: 'updateRole';
|
|
|
|
info: ModerationLogPayloads['updateRole'];
|
|
|
|
} | {
|
|
|
|
type: 'deleteRole';
|
|
|
|
info: ModerationLogPayloads['deleteRole'];
|
|
|
|
} | {
|
|
|
|
type: 'clearQueue';
|
|
|
|
info: ModerationLogPayloads['clearQueue'];
|
|
|
|
} | {
|
|
|
|
type: 'promoteQueue';
|
|
|
|
info: ModerationLogPayloads['promoteQueue'];
|
2023-09-24 03:46:09 +02:00
|
|
|
} | {
|
|
|
|
type: 'deleteDriveFile';
|
|
|
|
info: ModerationLogPayloads['deleteDriveFile'];
|
|
|
|
} | {
|
|
|
|
type: 'deleteNote';
|
|
|
|
info: ModerationLogPayloads['deleteNote'];
|
|
|
|
} | {
|
|
|
|
type: 'createGlobalAnnouncement';
|
|
|
|
info: ModerationLogPayloads['createGlobalAnnouncement'];
|
|
|
|
} | {
|
|
|
|
type: 'createUserAnnouncement';
|
|
|
|
info: ModerationLogPayloads['createUserAnnouncement'];
|
|
|
|
} | {
|
|
|
|
type: 'updateGlobalAnnouncement';
|
|
|
|
info: ModerationLogPayloads['updateGlobalAnnouncement'];
|
|
|
|
} | {
|
|
|
|
type: 'updateUserAnnouncement';
|
|
|
|
info: ModerationLogPayloads['updateUserAnnouncement'];
|
|
|
|
} | {
|
|
|
|
type: 'deleteGlobalAnnouncement';
|
|
|
|
info: ModerationLogPayloads['deleteGlobalAnnouncement'];
|
|
|
|
} | {
|
|
|
|
type: 'deleteUserAnnouncement';
|
|
|
|
info: ModerationLogPayloads['deleteUserAnnouncement'];
|
2023-09-23 13:50:02 +02:00
|
|
|
} | {
|
|
|
|
type: 'resetPassword';
|
|
|
|
info: ModerationLogPayloads['resetPassword'];
|
|
|
|
} | {
|
|
|
|
type: 'suspendRemoteInstance';
|
|
|
|
info: ModerationLogPayloads['suspendRemoteInstance'];
|
|
|
|
} | {
|
|
|
|
type: 'unsuspendRemoteInstance';
|
|
|
|
info: ModerationLogPayloads['unsuspendRemoteInstance'];
|
2024-02-22 12:59:52 +01:00
|
|
|
} | {
|
|
|
|
type: 'updateRemoteInstanceNote';
|
|
|
|
info: ModerationLogPayloads['updateRemoteInstanceNote'];
|
2023-09-24 08:40:38 +02:00
|
|
|
} | {
|
|
|
|
type: 'markSensitiveDriveFile';
|
|
|
|
info: ModerationLogPayloads['markSensitiveDriveFile'];
|
|
|
|
} | {
|
|
|
|
type: 'unmarkSensitiveDriveFile';
|
|
|
|
info: ModerationLogPayloads['unmarkSensitiveDriveFile'];
|
2023-09-28 03:02:05 +02:00
|
|
|
} | {
|
|
|
|
type: 'createInvitation';
|
|
|
|
info: ModerationLogPayloads['createInvitation'];
|
2023-09-29 08:01:13 +02:00
|
|
|
} | {
|
|
|
|
type: 'createAd';
|
|
|
|
info: ModerationLogPayloads['createAd'];
|
|
|
|
} | {
|
|
|
|
type: 'updateAd';
|
|
|
|
info: ModerationLogPayloads['updateAd'];
|
|
|
|
} | {
|
|
|
|
type: 'deleteAd';
|
|
|
|
info: ModerationLogPayloads['deleteAd'];
|
2023-10-21 11:38:07 +02:00
|
|
|
} | {
|
|
|
|
type: 'createAvatarDecoration';
|
|
|
|
info: ModerationLogPayloads['createAvatarDecoration'];
|
|
|
|
} | {
|
|
|
|
type: 'updateAvatarDecoration';
|
|
|
|
info: ModerationLogPayloads['updateAvatarDecoration'];
|
|
|
|
} | {
|
|
|
|
type: 'deleteAvatarDecoration';
|
|
|
|
info: ModerationLogPayloads['deleteAvatarDecoration'];
|
|
|
|
} | {
|
|
|
|
type: 'resolveAbuseReport';
|
|
|
|
info: ModerationLogPayloads['resolveAbuseReport'];
|
2024-10-05 09:20:15 +02:00
|
|
|
} | {
|
|
|
|
type: 'forwardAbuseReport';
|
|
|
|
info: ModerationLogPayloads['forwardAbuseReport'];
|
|
|
|
} | {
|
|
|
|
type: 'updateAbuseReportNote';
|
|
|
|
info: ModerationLogPayloads['updateAbuseReportNote'];
|
2023-11-19 02:18:57 +01:00
|
|
|
} | {
|
|
|
|
type: 'unsetUserAvatar';
|
|
|
|
info: ModerationLogPayloads['unsetUserAvatar'];
|
2024-08-17 08:01:08 +02:00
|
|
|
} | {
|
|
|
|
type: 'unsetUserBanner';
|
|
|
|
info: ModerationLogPayloads['unsetUserBanner'];
|
2023-11-19 02:18:57 +01:00
|
|
|
} | {
|
2024-06-08 08:34:19 +02:00
|
|
|
type: 'createSystemWebhook';
|
|
|
|
info: ModerationLogPayloads['createSystemWebhook'];
|
|
|
|
} | {
|
|
|
|
type: 'updateSystemWebhook';
|
|
|
|
info: ModerationLogPayloads['updateSystemWebhook'];
|
|
|
|
} | {
|
|
|
|
type: 'deleteSystemWebhook';
|
|
|
|
info: ModerationLogPayloads['deleteSystemWebhook'];
|
|
|
|
} | {
|
|
|
|
type: 'createAbuseReportNotificationRecipient';
|
|
|
|
info: ModerationLogPayloads['createAbuseReportNotificationRecipient'];
|
|
|
|
} | {
|
|
|
|
type: 'updateAbuseReportNotificationRecipient';
|
|
|
|
info: ModerationLogPayloads['updateAbuseReportNotificationRecipient'];
|
|
|
|
} | {
|
|
|
|
type: 'deleteAbuseReportNotificationRecipient';
|
|
|
|
info: ModerationLogPayloads['deleteAbuseReportNotificationRecipient'];
|
2024-08-17 02:57:28 +02:00
|
|
|
} | {
|
|
|
|
type: 'deleteAccount';
|
|
|
|
info: ModerationLogPayloads['deleteAccount'];
|
2024-08-17 08:01:08 +02:00
|
|
|
} | {
|
|
|
|
type: 'deletePage';
|
|
|
|
info: ModerationLogPayloads['deletePage'];
|
|
|
|
} | {
|
|
|
|
type: 'deleteFlash';
|
|
|
|
info: ModerationLogPayloads['deleteFlash'];
|
|
|
|
} | {
|
|
|
|
type: 'deleteGalleryPost';
|
|
|
|
info: ModerationLogPayloads['deleteGalleryPost'];
|
2023-09-23 11:28:16 +02:00
|
|
|
});
|
2023-12-03 04:45:18 +01:00
|
|
|
|
|
|
|
export type ServerStats = {
|
|
|
|
cpu: number;
|
|
|
|
mem: {
|
|
|
|
used: number;
|
|
|
|
active: number;
|
|
|
|
};
|
|
|
|
net: {
|
|
|
|
rx: number;
|
|
|
|
tx: number;
|
|
|
|
};
|
|
|
|
fs: {
|
|
|
|
r: number;
|
|
|
|
w: number;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2024-01-07 15:56:46 +01:00
|
|
|
export type ServerStatsLog = ServerStats[];
|
2023-12-03 04:45:18 +01:00
|
|
|
|
|
|
|
export type QueueStats = {
|
|
|
|
deliver: {
|
|
|
|
activeSincePrevTick: number;
|
|
|
|
active: number;
|
|
|
|
waiting: number;
|
|
|
|
delayed: number;
|
|
|
|
};
|
|
|
|
inbox: {
|
|
|
|
activeSincePrevTick: number;
|
|
|
|
active: number;
|
|
|
|
waiting: number;
|
|
|
|
delayed: number;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-01-07 15:56:46 +01:00
|
|
|
export type QueueStatsLog = QueueStats[];
|
2023-12-03 04:45:18 +01:00
|
|
|
|
|
|
|
export type EmojiAdded = {
|
|
|
|
emoji: EmojiDetailed
|
|
|
|
};
|
|
|
|
|
|
|
|
export type EmojiUpdated = {
|
|
|
|
emojis: EmojiDetailed[]
|
|
|
|
};
|
|
|
|
|
|
|
|
export type EmojiDeleted = {
|
|
|
|
emojis: EmojiDetailed[]
|
|
|
|
};
|
|
|
|
|
|
|
|
export type AnnouncementCreated = {
|
|
|
|
announcement: Announcement;
|
|
|
|
};
|
2024-01-03 05:41:28 +01:00
|
|
|
|
|
|
|
export type SignupRequest = {
|
|
|
|
username: string;
|
|
|
|
password: string;
|
|
|
|
host?: string;
|
|
|
|
invitationCode?: string;
|
|
|
|
emailAddress?: string;
|
|
|
|
'hcaptcha-response'?: string | null;
|
|
|
|
'g-recaptcha-response'?: string | null;
|
|
|
|
'turnstile-response'?: string | null;
|
2024-10-03 11:33:56 +02:00
|
|
|
'm-captcha-response'?: string | null;
|
2024-01-03 05:41:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export type SignupResponse = MeDetailed & {
|
|
|
|
token: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export type SignupPendingRequest = {
|
|
|
|
code: string;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type SignupPendingResponse = {
|
|
|
|
id: User['id'],
|
|
|
|
i: string,
|
|
|
|
};
|
|
|
|
|
2024-10-05 05:03:47 +02:00
|
|
|
export type SigninFlowRequest = {
|
2024-01-03 05:41:28 +01:00
|
|
|
username: string;
|
2024-10-04 08:23:33 +02:00
|
|
|
password?: string;
|
2024-01-03 05:41:28 +01:00
|
|
|
token?: string;
|
2024-10-03 11:33:56 +02:00
|
|
|
credential?: AuthenticationResponseJSON;
|
|
|
|
'hcaptcha-response'?: string | null;
|
|
|
|
'g-recaptcha-response'?: string | null;
|
|
|
|
'turnstile-response'?: string | null;
|
|
|
|
'm-captcha-response'?: string | null;
|
2024-01-03 05:41:28 +01:00
|
|
|
};
|
|
|
|
|
2024-10-05 05:03:47 +02:00
|
|
|
export type SigninFlowResponse = {
|
|
|
|
finished: true;
|
|
|
|
id: User['id'];
|
|
|
|
i: string;
|
|
|
|
} | {
|
|
|
|
finished: false;
|
|
|
|
next: 'captcha' | 'password' | 'totp';
|
|
|
|
} | {
|
|
|
|
finished: false;
|
|
|
|
next: 'passkey';
|
|
|
|
authRequest: PublicKeyCredentialRequestOptionsJSON;
|
|
|
|
};
|
|
|
|
|
2024-09-26 01:25:33 +02:00
|
|
|
export type SigninWithPasskeyRequest = {
|
2024-10-03 11:33:56 +02:00
|
|
|
credential?: AuthenticationResponseJSON;
|
2024-09-26 01:25:33 +02:00
|
|
|
context?: string;
|
|
|
|
};
|
|
|
|
|
2024-10-03 11:33:56 +02:00
|
|
|
export type SigninWithPasskeyInitResponse = {
|
|
|
|
option: PublicKeyCredentialRequestOptionsJSON;
|
|
|
|
context: string;
|
|
|
|
};
|
|
|
|
|
2024-09-26 01:25:33 +02:00
|
|
|
export type SigninWithPasskeyResponse = {
|
2024-10-10 07:05:20 +02:00
|
|
|
signinResponse: SigninFlowResponse & { finished: true };
|
2024-01-03 05:41:28 +01:00
|
|
|
};
|
2024-07-10 13:40:04 +02:00
|
|
|
|
|
|
|
type Values<T extends Record<PropertyKey, unknown>> = T[keyof T];
|
|
|
|
|
|
|
|
export type PartialRolePolicyOverride = Partial<{[k in keyof RolePolicies]: Omit<Values<Role['policies']>, 'value'> & { value: RolePolicies[k] }}>;
|