forked from FoundKeyGang/FoundKey
docs: read scope descriptions from locale strings
This commit is contained in:
parent
c5568cfdf3
commit
2f2e6a58a4
3 changed files with 73 additions and 71 deletions
|
@ -1082,38 +1082,37 @@ _2fa:
|
||||||
\ authentication via hardware security keys that support FIDO2 to further secure\
|
\ authentication via hardware security keys that support FIDO2 to further secure\
|
||||||
\ your account."
|
\ your account."
|
||||||
_permissions:
|
_permissions:
|
||||||
"read:account": "View your account information"
|
"read:account": "Read account information"
|
||||||
"write:account": "Edit your account information"
|
"write:account": "Edit account information"
|
||||||
"read:blocks": "View your list of blocked users"
|
"read:blocks": "Read which users are blocked"
|
||||||
"write:blocks": "Edit your list of blocked users"
|
"write:blocks": "Block and unblock users"
|
||||||
"read:drive": "Access your Drive files and folders"
|
"read:drive": "List files and folders in the drive"
|
||||||
"write:drive": "Edit or delete your Drive files and folders"
|
"write:drive": "Create, change and delete files in the drive"
|
||||||
"read:favorites": "View your list of favorites"
|
"read:favorites": "List favourited notes"
|
||||||
"write:favorites": "Edit your list of favorites"
|
"write:favorites": "Favorite and unfavorite notes"
|
||||||
"read:following": "View information on who you follow"
|
"read:following": "List followed and following users"
|
||||||
"write:following": "Follow or unfollow other accounts"
|
"write:following": "Follow and unfollow other users"
|
||||||
"read:messaging": "View your chats"
|
"read:messaging": "View chat messages and history"
|
||||||
"write:messaging": "Compose or delete chat messages"
|
"write:messaging": "Create and delete chat messages"
|
||||||
"read:mutes": "View your list of muted users"
|
"read:mutes": "List users which are muted or whose renotes are muted"
|
||||||
"write:mutes": "Edit your list of muted users"
|
"write:mutes": "Mute and unmute users or their renotes"
|
||||||
"write:notes": "Compose or delete notes"
|
"write:notes": "Create and delete notes"
|
||||||
"read:notifications": "View your notifications"
|
"read:notifications": "Read notifications"
|
||||||
"write:notifications": "Manage your notifications"
|
"write:notifications": "Mark notifications as read and create custom notifications"
|
||||||
"read:reactions": "View your reactions"
|
"write:reactions": "Create and delete reactions"
|
||||||
"write:reactions": "Edit your reactions"
|
"write:votes": "Vote in polls"
|
||||||
"write:votes": "Vote on a poll"
|
"read:pages": "List and read pages"
|
||||||
"read:pages": "View your pages"
|
"write:pages": "Create, change and delete pages"
|
||||||
"write:pages": "Edit or delete your pages"
|
"read:page-likes": "List and read page likes"
|
||||||
"read:page-likes": "View your likes on pages"
|
"write:page-likes": "Like and unlike pages"
|
||||||
"write:page-likes": "Edit your likes on pages"
|
"read:user-groups": "List and view joined, owned and invited to groups"
|
||||||
"read:user-groups": "View your user groups"
|
"write:user-groups": "Create, modify, delete, transfer, join and leave groups. Invite and ban others from groups. Accept and reject group invitations."
|
||||||
"write:user-groups": "Edit or delete your user groups"
|
"read:channels": "List and read followed and joined channels"
|
||||||
"read:channels": "View your channels"
|
"write:channels": "Create, modify, follow and unfollow channels"
|
||||||
"write:channels": "Edit your channels"
|
"read:gallery": "List and read gallery posts"
|
||||||
"read:gallery": "View your gallery"
|
"write:gallery": "Create, modify and delete gallery posts"
|
||||||
"write:gallery": "Edit your gallery"
|
"read:gallery-likes": "List and read gallery post likes"
|
||||||
"read:gallery-likes": "View your list of liked gallery posts"
|
"write:gallery-likes": "Like and unlike gallery posts"
|
||||||
"write:gallery-likes": "Edit your list of liked gallery posts"
|
|
||||||
_auth:
|
_auth:
|
||||||
shareAccess: "Would you like to authorize \"{name}\" to access this account?"
|
shareAccess: "Would you like to authorize \"{name}\" to access this account?"
|
||||||
shareAccessAsk: "Are you sure you want to authorize this application to access your\
|
shareAccessAsk: "Are you sure you want to authorize this application to access your\
|
||||||
|
|
|
@ -1,38 +1,35 @@
|
||||||
|
export const kinds = [
|
||||||
|
'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',
|
||||||
|
];
|
||||||
// IF YOU ADD KINDS(PERMISSIONS), YOU MUST ADD TRANSLATIONS (under _permissions).
|
// IF YOU ADD KINDS(PERMISSIONS), YOU MUST ADD TRANSLATIONS (under _permissions).
|
||||||
|
|
||||||
// short English descriptions used for the documentation
|
|
||||||
export const descriptions = {
|
|
||||||
'read:account': 'Read the accounts data.',
|
|
||||||
'write:account': 'Write the accounts data.',
|
|
||||||
'read:blocks': 'Read which users are blocked.',
|
|
||||||
'write:blocks': 'Create, change and delete blocks.',
|
|
||||||
'read:drive': 'List files and folders in the drive.',
|
|
||||||
'write:drive': 'Create, change and delete files from the drive.',
|
|
||||||
'read:favourites': 'List favourited notes.',
|
|
||||||
'write:favourites': 'Favourite or unfavourite notes.',
|
|
||||||
'read:following': 'Read who the user is following.',
|
|
||||||
'write:following': 'Follow or unfollow other users.',
|
|
||||||
'read:messaging': 'Read chat messages and history.',
|
|
||||||
'write:messaging': 'Create and delete chat messages.',
|
|
||||||
'read:mutes': 'List users which are muted or whose renotes are muted.',
|
|
||||||
'write:mutes': 'Create or delete (renote) mutes.',
|
|
||||||
'write:notes': 'Create or delete notes.',
|
|
||||||
'read:notifications': 'Read notifications.',
|
|
||||||
'write:notifications': 'Mark notifications as read or create notifications.',
|
|
||||||
'write:reactions': 'Create or delete reactions.',
|
|
||||||
'write:votes': 'Vote in polls.',
|
|
||||||
'read:pages': 'List and read pages.',
|
|
||||||
'write:pages': 'Create, modify and delete pages.',
|
|
||||||
'read:page-likes': 'List page likes.',
|
|
||||||
'write:page-likes': 'Like or unlike pages.',
|
|
||||||
'read:user-groups': 'List joined, owned and invited to groups.',
|
|
||||||
'write:user-groups': 'Create, modify, delete, transfer, join, or leave groups. Invite or ban others from groups. Accept or reject group invitations.',
|
|
||||||
'read:channels': 'List followed and owned channels.',
|
|
||||||
'write:channels': 'Create, modify, follow or unfollow channels.',
|
|
||||||
'read:gallery': 'Read gallery posts.',
|
|
||||||
'write:gallery': 'Create, modify or delete gallery posts.',
|
|
||||||
'read:gallery-likes': 'List which gallery posts are liked.',
|
|
||||||
'write:gallery-likes': 'Like or unlike gallery posts.',
|
|
||||||
};
|
|
||||||
|
|
||||||
export const kinds = Object.keys(descriptions);
|
|
||||||
|
|
|
@ -3,7 +3,10 @@ import { errors as errorDefinitions } from '../error.js';
|
||||||
import endpoints from '../endpoints.js';
|
import endpoints from '../endpoints.js';
|
||||||
import { schemas, convertSchemaToOpenApiSchema } from './schemas.js';
|
import { schemas, convertSchemaToOpenApiSchema } from './schemas.js';
|
||||||
import { httpCodes } from './http-codes.js';
|
import { httpCodes } from './http-codes.js';
|
||||||
import { descriptions as scopes } from '@/misc/api-permissions.js';
|
import { kinds } from '@/misc/api-permissions.js';
|
||||||
|
import { I18n } from '@/misc/i18n.js';
|
||||||
|
|
||||||
|
const i18n = new I18n('en-US');
|
||||||
|
|
||||||
export function genOpenapiSpec() {
|
export function genOpenapiSpec() {
|
||||||
const spec = {
|
const spec = {
|
||||||
|
@ -41,7 +44,10 @@ export function genOpenapiSpec() {
|
||||||
authorizationCode: {
|
authorizationCode: {
|
||||||
authorizationUrl: `${config.url}/auth`,
|
authorizationUrl: `${config.url}/auth`,
|
||||||
tokenUrl: `${config.apiUrl}/auth/session/oauth`,
|
tokenUrl: `${config.apiUrl}/auth/session/oauth`,
|
||||||
scopes,
|
scopes: kinds.reduce((acc, kind) => {
|
||||||
|
acc[kind] = i18n.ts['_permissions'][kind];
|
||||||
|
return acc;
|
||||||
|
}, {}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue