Skip to content

Build your personal knowledge base with Trilium Notes

refactor(server): remove unnecessary route

Elian Doran19bb7f5ddbc5
diff --git a/apps/server/src/routes/api/options.ts b/apps/server/src/routes/api/options.ts
index ce5d7b9dc6..9e21dcb7b7 100644
--- a/apps/server/src/routes/api/options.ts
+++ b/apps/server/src/routes/api/options.ts
@@ -5,7 +5,7 @@ import type { Request } from "express";
import ValidationError from "../../errors/validation_error.js";
import config from "../../services/config.js";
-import { changeLanguage, getLocales } from "../../services/i18n.js";
+import { changeLanguage } from "../../services/i18n.js";
import log from "../../services/log.js";
import optionService from "../../services/options.js";
import searchService from "../../services/search/services/search.js";
@@ -192,10 +192,6 @@ function getUserThemes() {
return ret;
}
-function getSupportedLocales() {
- return getLocales();
-}
-
function isAllowed(name: string) {
return (ALLOWED_OPTIONS as Set<string>).has(name)
|| name.startsWith("keyboardShortcuts")
@@ -207,6 +203,5 @@ export default {
getOptions,
updateOption,
updateOptions,
- getUserThemes,
- getSupportedLocales
+ getUserThemes
};
diff --git a/apps/server/src/routes/routes.ts b/apps/server/src/routes/routes.ts
index 775a36e833..198fa5c22e 100644
--- a/apps/server/src/routes/routes.ts
+++ b/apps/server/src/routes/routes.ts
@@ -215,7 +215,6 @@ 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);
diff --git a/apps/server/src/services/i18n.ts b/apps/server/src/services/i18n.ts
index f77ec93ef6..51cec3e2ed 100644
--- a/apps/server/src/services/i18n.ts
+++ b/apps/server/src/services/i18n.ts
@@ -4,7 +4,7 @@ import sql_init from "./sql_init.js";
import { join } from "path";
import { getResourceDir } from "./utils.js";
import hidden_subtree from "./hidden_subtree.js";
-import { dayjs, LOCALES, setDayjsLocale, type Dayjs, type Locale, type LOCALE_IDS } from "@triliumnext/commons";
+import { dayjs, LOCALES, setDayjsLocale, type Dayjs, type LOCALE_IDS } from "@triliumnext/commons";
export async function initializeTranslations() {
const resourceDir = getResourceDir();
@@ -30,10 +30,6 @@ export function ordinal(date: Dayjs) {
.format("Do");
}
-export function getLocales(): Locale[] {
- return LOCALES;
-}
-
function getCurrentLanguage(): LOCALE_IDS {
let language: string | null = null;
if (sql_init.isDbInitialized()) {