server: Add endpoint to get list of locales

This commit is contained in:
Elian Doran 2024-08-11 07:36:09 +03:00
parent 6871216649
commit 51afb63e25
No known key found for this signature in database
2 changed files with 17 additions and 1 deletions

View File

@ -129,6 +129,20 @@ function getUserThemes() {
return ret;
}
function getSupportedLocales() {
// TODO: Currently hardcoded, needs to read the lits of available languages.
return [
{
"id": "en",
"name": "English"
},
{
"id": "cn",
"name": "Chinese"
}
];
}
function isAllowed(name: string) {
return ALLOWED_OPTIONS.has(name)
|| name.startsWith("keyboardShortcuts")
@ -140,5 +154,6 @@ export default {
getOptions,
updateOption,
updateOptions,
getUserThemes
getUserThemes,
getSupportedLocales
};

View File

@ -217,6 +217,7 @@ function register(app: express.Application) {
apiRoute(PUT, '/api/options/:name/:value*', optionsApiRoute.updateOption);
apiRoute(PUT, '/api/options', optionsApiRoute.updateOptions);
apiRoute(GET, '/api/options/user-themes', optionsApiRoute.getUserThemes);
apiRoute(GET, '/api/options/locales', optionsApiRoute.getSupportedLocales);
apiRoute(PST, '/api/password/change', passwordApiRoute.changePassword);
apiRoute(PST, '/api/password/reset', passwordApiRoute.resetPassword);