monkeeShark/packages/misskey-js/src/consts.ts
Chocolate Pie 82822e29d9
Merge pull request from GHSA-7pxq-6xx9-xpgm
* fix: fix improper authorization when accessing with third-party application

* refactor: refactor type definitions

* fix: get rid of unnecessary access limitation

* enhance: サードパーティアプリケーションがWebsocket APIを使えるように

* fix: add missing parentheses

* Revert "fix(backend): add missing kind definition for admin endpoints to improve security"

This reverts commit 5150053275.

* frontend: 翻訳の抜けを訂正, read:adminとwrite:adminはアクセス発行トークンのデフォルトでは非表示にする

* enhance(test): misskey-ghsa-7pxq-6xx9-xpgmに関するテストを追加

* enhance(test): Websocket APIに対するテストも追加

* enhance(refactor): `@/misc/api-permissions.ts`を`misskey-js/permissions`に統合

* fix(frontend): アクセストークン発行UIで全ての権限を有効にした際、管理者用APIへのアクセスも許可してしまう問題を修正

* enhance(backend): Websocketの接続に最低限必要な権限を変更

* fix(backend): `/api/admin/meta`をサードパーティアプリケーションからはアクセスできないように

* fix(backend): エンドポイントにアクセスするために必要な権限を変更

* fix(frontend/locale): Add missing type declaration

* chore: update `misskey-js/src/autogen`

---------

Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-12-28 09:45:54 +01:00

328 lines
6.7 KiB
TypeScript

export const notificationTypes = ['note', 'follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'pollEnded', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app', 'roleAssigned', 'achievementEarned'] as const;
export const noteVisibilities = ['public', 'home', 'followers', 'specified'] as const;
export const mutedNoteReasons = ['word', 'manual', 'spam', 'other'] as const;
export const followingVisibilities = ['public', 'followers', 'private'] as const;
export const followersVisibilities = ['public', 'followers', 'private'] as const;
export const permissions = [
'read:account',
'write:account',
'read:blocks',
'write:blocks',
'read:drive',
'write:drive',
'read:favorites',
'write:favorites',
'read:following',
'write:following',
'read:messaging',
'write:messaging',
'read:mutes',
'write:mutes',
'write:notes',
'read:notifications',
'write:notifications',
'read:reactions',
'write:reactions',
'write:votes',
'read:pages',
'write:pages',
'write:page-likes',
'read:page-likes',
'read:user-groups',
'write:user-groups',
'read:channels',
'write:channels',
'read:gallery',
'write:gallery',
'read:gallery-likes',
'write:gallery-likes',
'read:flash',
'write:flash',
'read:flash-likes',
'write:flash-likes',
'read:admin:abuse-user-reports',
'write:admin:delete-account',
'write:admin:delete-all-files-of-a-user',
'read:admin:index-stats',
'read:admin:table-stats',
'read:admin:user-ips',
'read:admin:meta',
'write:admin:reset-password',
'write:admin:resolve-abuse-user-report',
'write:admin:send-email',
'read:admin:server-info',
'read:admin:show-moderation-log',
'read:admin:show-user',
'read:admin:show-users',
'write:admin:suspend-user',
'write:admin:unset-user-avatar',
'write:admin:unset-user-banner',
'write:admin:unsuspend-user',
'write:admin:meta',
'write:admin:user-note',
'write:admin:roles',
'read:admin:roles',
'write:admin:relays',
'read:admin:relays',
'write:admin:invite-codes',
'read:admin:invite-codes',
'write:admin:announcements',
'read:admin:announcements',
'write:admin:avatar-decorations',
'read:admin:avatar-decorations',
'write:admin:federation',
'write:admin:account',
'read:admin:account',
'write:admin:emoji',
'read:admin:emoji',
'write:admin:queue',
'read:admin:queue',
'write:admin:promo',
'write:admin:drive',
'read:admin:drive',
'write:admin:ad',
'read:admin:ad',
'write:invite-codes',
'read:invite-codes',
'write:clip-favorite',
'read:clip-favorite',
'read:federation',
'write:report-abuse',
] as const;
export const moderationLogTypes = [
'updateServerSettings',
'suspend',
'approve',
'unsuspend',
'updateUserNote',
'addCustomEmoji',
'updateCustomEmoji',
'deleteCustomEmoji',
'assignRole',
'unassignRole',
'createRole',
'updateRole',
'deleteRole',
'clearQueue',
'promoteQueue',
'deleteDriveFile',
'deleteNote',
'createGlobalAnnouncement',
'createUserAnnouncement',
'updateGlobalAnnouncement',
'updateUserAnnouncement',
'deleteGlobalAnnouncement',
'deleteUserAnnouncement',
'resetPassword',
'suspendRemoteInstance',
'unsuspendRemoteInstance',
'markSensitiveDriveFile',
'unmarkSensitiveDriveFile',
'resolveAbuseReport',
'createInvitation',
'createAd',
'updateAd',
'deleteAd',
'createAvatarDecoration',
'updateAvatarDecoration',
'deleteAvatarDecoration',
'unsetUserAvatar',
'unsetUserBanner',
] as const;
export type ModerationLogPayloads = {
updateServerSettings: {
before: any | null;
after: any | null;
};
suspend: {
userId: string;
userUsername: string;
userHost: string | null;
};
approve: {
userId: string;
userUsername: string;
userHost: string | null;
};
unsuspend: {
userId: string;
userUsername: string;
userHost: string | null;
};
updateUserNote: {
userId: string;
userUsername: string;
userHost: string | null;
before: string | null;
after: string | null;
};
addCustomEmoji: {
emojiId: string;
emoji: any;
};
updateCustomEmoji: {
emojiId: string;
before: any;
after: any;
};
deleteCustomEmoji: {
emojiId: string;
emoji: any;
};
assignRole: {
userId: string;
userUsername: string;
userHost: string | null;
roleId: string;
roleName: string;
expiresAt: string | null;
};
unassignRole: {
userId: string;
userUsername: string;
userHost: string | null;
roleId: string;
roleName: string;
};
createRole: {
roleId: string;
role: any;
};
updateRole: {
roleId: string;
before: any;
after: any;
};
deleteRole: {
roleId: string;
role: any;
};
clearQueue: Record<string, never>;
promoteQueue: Record<string, never>;
deleteDriveFile: {
fileId: string;
fileUserId: string | null;
fileUserUsername: string | null;
fileUserHost: string | null;
};
deleteNote: {
noteId: string;
noteUserId: string;
noteUserUsername: string;
noteUserHost: string | null;
note: any;
};
createGlobalAnnouncement: {
announcementId: string;
announcement: any;
};
createUserAnnouncement: {
announcementId: string;
announcement: any;
userId: string;
userUsername: string;
userHost: string | null;
};
updateGlobalAnnouncement: {
announcementId: string;
before: any;
after: any;
};
updateUserAnnouncement: {
announcementId: string;
before: any;
after: any;
userId: string;
userUsername: string;
userHost: string | null;
};
deleteGlobalAnnouncement: {
announcementId: string;
announcement: any;
};
deleteUserAnnouncement: {
announcementId: string;
announcement: any;
userId: string;
userUsername: string;
userHost: string | null;
};
resetPassword: {
userId: string;
userUsername: string;
userHost: string | null;
};
suspendRemoteInstance: {
id: string;
host: string;
};
unsuspendRemoteInstance: {
id: string;
host: string;
};
markSensitiveDriveFile: {
fileId: string;
fileUserId: string | null;
fileUserUsername: string | null;
fileUserHost: string | null;
};
unmarkSensitiveDriveFile: {
fileId: string;
fileUserId: string | null;
fileUserUsername: string | null;
fileUserHost: string | null;
};
resolveAbuseReport: {
reportId: string;
report: any;
forwarded: boolean;
};
createInvitation: {
invitations: any[];
};
createAd: {
adId: string;
ad: any;
};
updateAd: {
adId: string;
before: any;
after: any;
};
deleteAd: {
adId: string;
ad: any;
};
createAvatarDecoration: {
avatarDecorationId: string;
avatarDecoration: any;
};
updateAvatarDecoration: {
avatarDecorationId: string;
before: any;
after: any;
};
deleteAvatarDecoration: {
avatarDecorationId: string;
avatarDecoration: any;
};
unsetUserAvatar: {
userId: string;
userUsername: string;
userHost: string | null;
fileId: string;
};
unsetUserBanner: {
userId: string;
userUsername: string;
userHost: string | null;
fileId: string;
};
};