Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/custom themes #1409

Merged
merged 85 commits into from
Feb 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
148e577
feat: add theme page
Hachi-R Jan 23, 2025
44aed56
Merge branch 'feature/custom-themes' of https://github.com/hydralaunc…
Hachi-R Jan 23, 2025
6bf049d
Merge branch 'feat/migration-to-leveldb' into feature/custom-themes
Hachi-R Jan 23, 2025
58f63ca
feat: implement custom theme management
Hachi-R Jan 24, 2025
3e2d7a7
feat: use leveldb instead of localStorage
Hachi-R Jan 24, 2025
c8044f6
chore: update upload-build script
zamitto Jan 28, 2025
ab44348
Merge branch 'main' into feature/custom-themes
zamitto Jan 28, 2025
5a19e9f
feat: add theme editor with Monaco and custom CSS injection
Hachi-R Jan 29, 2025
b56fc4d
refactor: lint
Hachi-R Jan 29, 2025
1fe6abb
refactor: convert theme author span to button
Hachi-R Jan 29, 2025
a42975a
refactor: move hex color validation to theme types
Hachi-R Jan 29, 2025
613d8ca
Merge branch 'feature/custom-themes' of https://github.com/hydralaunc…
Hachi-R Jan 29, 2025
56e686f
fix: close dev tools when editor window closes
Hachi-R Jan 29, 2025
5510036
lint
Hachi-R Jan 29, 2025
f542b2d
fix: handle null user preferences in get-user-preferences
Hachi-R Jan 29, 2025
e49a321
feat: fix editor theme load
Hachi-R Jan 30, 2025
61d4910
feat: prevent multiple editor windows for the same theme
Hachi-R Jan 30, 2025
13eeb2c
feat: add active theme handling in theme deletion modals
Hachi-R Jan 30, 2025
afcd99a
refactor: sonar issues
Hachi-R Jan 30, 2025
d91d8dd
refactor: remove unused ThemesManager export
Hachi-R Jan 30, 2025
964e9bb
feat: close theme editor if the theme was deleted
Hachi-R Jan 30, 2025
6a6e3ca
feat: add F12 shortcut to toggle dev tools
Hachi-R Jan 30, 2025
4758b8c
fix: open dev tools on main window when editor window is ready
Hachi-R Jan 30, 2025
4535ebc
fix: prevent error when injecting empty theme CSS
Hachi-R Jan 30, 2025
15746a5
feat: disable delete all themes button when no themes exist
Hachi-R Feb 1, 2025
e4631bb
refactor: reset default theme colors to empty strings
Hachi-R Feb 1, 2025
f6e4852
refactor: remove vanilla-extract
Hachi-R Feb 1, 2025
f288870
Merge branch 'main' into feature/custom-themes
Hachi-R Feb 1, 2025
b9e04de
chore: remove vanilla-extract plugin from Electron Vite config
Hachi-R Feb 1, 2025
47e6d88
refactor: replace inline styles with CSS classes
Hachi-R Feb 1, 2025
0f0e27e
feat: removing crypto from level
thegrannychaseroperation Feb 15, 2025
0a37ce4
feat: removing crypto from level
thegrannychaseroperation Feb 15, 2025
ec638d1
refactor: simplify theme structure and remove color-related code
Hachi-R Feb 15, 2025
1fe7e23
feat: i18n
zamitto Feb 16, 2025
c0c78b5
feat: i18n
zamitto Feb 16, 2025
418ad71
chore: bump version
zamitto Feb 16, 2025
740d3ff
feat: add deep link theme installation support
Hachi-R Feb 16, 2025
ce95dbb
lint
Hachi-R Feb 16, 2025
821149b
Merge branch 'feature/custom-themes' of https://github.com/hydralaunc…
Hachi-R Feb 16, 2025
9314b17
feat: updating translations
thegrannychaseroperation Feb 16, 2025
730184d
feat: updating translations
thegrannychaseroperation Feb 16, 2025
ae159a4
feat: redirecting to web store
thegrannychaseroperation Feb 16, 2025
543528b
feat: i18n
zamitto Feb 16, 2025
b202daf
Merge branch 'main' into feature/custom-themes
zamitto Feb 16, 2025
0511cc0
fix: editor window use correct dev tools
zamitto Feb 16, 2025
3271de0
fix: dev tools
zamitto Feb 16, 2025
39ceb8e
fix: editor window hash path
zamitto Feb 16, 2025
ba6eb2e
fix: fixing download cancel
thegrannychaseroperation Feb 16, 2025
6158108
fix: fixing download cancel
thegrannychaseroperation Feb 16, 2025
22e5674
fix: showing form errors when creating theme
thegrannychaseroperation Feb 16, 2025
d7d88ec
feat: add deep link theme import functionality
Hachi-R Feb 16, 2025
bf3905f
lint
Hachi-R Feb 16, 2025
3f6315f
Merge branch 'feature/custom-themes' of https://github.com/hydralaunc…
Hachi-R Feb 16, 2025
c36aff8
fix: updating themes when installing
thegrannychaseroperation Feb 16, 2025
9449d7c
Merge branch 'feature/custom-themes' of github.com:hydralauncher/hydr…
thegrannychaseroperation Feb 16, 2025
484fa86
fix: fixing stale state
thegrannychaseroperation Feb 16, 2025
d1dc27a
fix: fixing stale state
thegrannychaseroperation Feb 16, 2025
ca75ad6
feat: improve theme import with dynamic author information
Hachi-R Feb 16, 2025
ef28337
feat: enhance theme import flow with redirect and modal
Hachi-R Feb 16, 2025
569c80c
refactor: simplify theme import handling and remove redundant code
Hachi-R Feb 16, 2025
4cfecf8
lint
Hachi-R Feb 16, 2025
e3a4f12
feat: adding deeplink for profile
thegrannychaseroperation Feb 16, 2025
74c7668
Merge branch 'feature/custom-themes' of github.com:hydralauncher/hydr…
thegrannychaseroperation Feb 16, 2025
a13e991
feat: add theme import translations and modal improvements
Hachi-R Feb 16, 2025
cd48acc
feat: adding hydra shop constant
thegrannychaseroperation Feb 16, 2025
f428c52
feat: adding hydra shop constant
thegrannychaseroperation Feb 16, 2025
6e35600
feat: adding hydra shop constant
thegrannychaseroperation Feb 16, 2025
21684ef
fix: fixing submit on new theme
thegrannychaseroperation Feb 16, 2025
b74e093
fix: ensure objectId exists before removing game from favorites
Hachi-R Feb 16, 2025
002f814
feat: adding lower case to theme
thegrannychaseroperation Feb 16, 2025
a372afc
fix: prevent adding game to favorites without objectId
Hachi-R Feb 16, 2025
043062e
remove whitespace
Hachi-R Feb 16, 2025
5d48ce8
Merge branch 'feature/custom-themes' of https://github.com/hydralaunc…
Hachi-R Feb 16, 2025
401e61a
fix: fixing toast bottom
thegrannychaseroperation Feb 16, 2025
b999da3
fix: fixing update of inactive theme
thegrannychaseroperation Feb 16, 2025
4f725d0
Merge branch 'feature/custom-themes' of github.com:hydralauncher/hydr…
thegrannychaseroperation Feb 16, 2025
7064da8
feat: update theme installation with author details
Hachi-R Feb 16, 2025
d1a77dc
lint
Hachi-R Feb 16, 2025
cc14562
fix: add space in Torbox tab label
Hachi-R Feb 16, 2025
f7acb44
refactor: improve Torbox tab label rendering
Hachi-R Feb 16, 2025
5a6f66a
feat: add theme import translations
Hachi-R Feb 16, 2025
f1e47fc
feat: killing port on start
thegrannychaseroperation Feb 16, 2025
777f857
Merge branch 'feature/custom-themes' of github.com:hydralauncher/hydr…
thegrannychaseroperation Feb 16, 2025
2246775
feat: clearing theme
thegrannychaseroperation Feb 16, 2025
e8d5c62
fix: improve theme import modal close behavior
Hachi-R Feb 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hydralauncher",
"version": "3.1.5",
"version": "3.2.0",
"description": "Hydra",
"main": "./out/main/index.js",
"author": "Los Broxas",
Expand Down Expand Up @@ -36,6 +36,7 @@
"@electron-toolkit/utils": "^3.0.0",
"@fontsource/noto-sans": "^5.1.0",
"@hookform/resolvers": "^3.9.1",
"@monaco-editor/react": "^4.6.0",
"@primer/octicons-react": "^19.9.0",
"@radix-ui/react-dropdown-menu": "^2.1.2",
"@reduxjs/toolkit": "^2.2.3",
Expand All @@ -59,6 +60,7 @@
"i18next-browser-languagedetector": "^7.2.1",
"jsdom": "^24.0.0",
"jsonwebtoken": "^9.0.2",
"kill-port": "^2.0.1",
"knex": "^3.1.0",
"lodash-es": "^4.17.21",
"parse-torrent": "^11.0.17",
Expand Down
32 changes: 29 additions & 3 deletions src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,10 @@
"download_error_gofile_quota_exceeded": "You have exceeded your Gofile monthly quota. Please await the quota to reset.",
"download_error_real_debrid_account_not_authorized": "Your Real-Debrid account is not authorized to make new downloads. Please check your account settings and try again.",
"download_error_not_cached_in_real_debrid": "This download is not available on Real-Debrid and polling download status from Real-Debrid is not yet available.",
"download_error_not_cached_in_torbox": "This download is not available on Torbox and polling download status from Torbox is not yet available."
"download_error_not_cached_in_torbox": "This download is not available on Torbox and polling download status from Torbox is not yet available.",
"game_removed_from_favorites": "Game removed from favorites",
"game_added_to_favorites": "Game added to favorites"
},

"activation": {
"title": "Activate Hydra",
"installation_id": "Installation ID:",
Expand Down Expand Up @@ -303,10 +304,35 @@
"subscription_renew_cancelled": "Automatic renewal is disabled",
"subscription_renews_on": "Your subscription renews on {{date}}",
"bill_sent_until": "Your next bill will be sent until this day",
"no_themes": "Seems like you don't have any themes yet, but no worries, click here to create your first masterpiece.",
"editor_tab_code": "Code",
"editor_tab_info": "Info",
"editor_tab_save": "Save",
"web_store": "Web store",
"clear_themes": "Clear",
"create_theme": "Create",
"create_theme_modal_title": "Create custom theme",
"create_theme_modal_description": "Create a new theme to customize Hydra's appearance",
"theme_name": "Name",
"insert_theme_name": "Insert theme name",
"set_theme": "Set theme",
"unset_theme": "Unset theme",
"delete_theme": "Delete theme",
"edit_theme": "Edit theme",
"delete_all_themes": "Delete all themes",
"delete_all_themes_description": "This will delete all your custom themes",
"delete_theme_description": "This will delete the theme {{theme}}",
"cancel": "Cancel",
"appearance": "Appearance",
"enable_torbox": "Enable Torbox",
"torbox_description": "TorBox is your premium seedbox service rivaling even the best servers on the market.",
"torbox_account_linked": "TorBox account linked",
"real_debrid_account_linked": "Real-Debrid account linked"
"real_debrid_account_linked": "Real-Debrid account linked",
"name_min_length": "Theme name must be at least 3 characters long",
"import_theme": "Import theme",
"import_theme_description": "You will import {{theme}} from the theme store",
"error_importing_theme": "Error importing theme",
"theme_imported": "Theme imported successfully"
},
"notifications": {
"download_complete": "Download complete",
Expand Down
30 changes: 27 additions & 3 deletions src/locales/pt-BR/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,10 @@
"download_error_gofile_quota_exceeded": "Você excedeu sua cota mensal do Gofile. Por favor, aguarde a cota resetar.",
"download_error_real_debrid_account_not_authorized": "Sua conta do Real-Debrid não está autorizada a fazer novos downloads. Por favor, verifique sua assinatura e tente novamente.",
"download_error_not_cached_in_real_debrid": "Este download não está disponível no Real-Debrid e a verificação do status do download não está disponível.",
"download_error_not_cached_in_torbox": "Este download não está disponível no Torbox e a verificação do status do download não está disponível."
"download_error_not_cached_in_torbox": "Este download não está disponível no Torbox e a verificação do status do download não está disponível.",
"game_removed_from_favorites": "Jogo removido dos favoritos",
"game_added_to_favorites": "Jogo adicionado aos favoritos"
},

"activation": {
"title": "Ativação",
"installation_id": "ID da instalação:",
Expand Down Expand Up @@ -293,10 +294,33 @@
"subscription_renew_cancelled": "A renovação automática está desativada",
"subscription_renews_on": "Sua assinatura renova dia {{date}}",
"bill_sent_until": "Sua próxima cobrança será enviada até esse dia",
"no_themes": "Parece que você ainda não tem nenhum tema. Não se preocupe, clique aqui para criar sua primeira obra de arte.",
"editor_tab_save": "Salvar",
"web_store": "Loja de temas",
"clear_themes": "Limpar",
"create_theme": "Criar",
"create_theme_modal_title": "Criar tema customizado",
"create_theme_modal_description": "Criar novo tema para customizar a aparência do Hydra",
"theme_name": "Nome",
"insert_theme_name": "Insira o nome do tema",
"set_theme": "Habilitar tema",
"unset_theme": "Desabilitar tema",
"delete_theme": "Deletar tema",
"edit_theme": "Editar tema",
"delete_all_themes": "Deletar todos os temas",
"delete_all_themes_description": "Isso irá deletar todos os seus temas",
"delete_theme_description": "Isso irá deletar o tema {{theme}}",
"cancel": "Cancelar",
"appearance": "Aparência",
"enable_torbox": "Habilitar Torbox",
"torbox_description": "TorBox é o seu serviço de seedbox premium que rivaliza até com os melhores servidores do mercado.",
"torbox_account_linked": "Conta do TorBox vinculada",
"real_debrid_account_linked": "Conta Real-Debrid associada"
"real_debrid_account_linked": "Conta Real-Debrid associada",
"name_min_length": "O nome do tema deve ter pelo menos 3 caracteres",
"import_theme": "Importar tema",
"import_theme_description": "Você irá importar {{theme}} da loja de temas",
"error_importing_theme": "Erro ao importar tema",
"theme_imported": "Tema importado com sucesso"
},
"notifications": {
"download_complete": "Download concluído",
Expand Down
5 changes: 1 addition & 4 deletions src/main/events/auth/get-session-hash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@ import jwt from "jsonwebtoken";
import { registerEvent } from "../register-event";
import { db, levelKeys } from "@main/level";
import type { Auth } from "@types";
import { Crypto } from "@main/services";

const getSessionHash = async (_event: Electron.IpcMainInvokeEvent) => {
const auth = await db.get<string, Auth>(levelKeys.auth, {
valueEncoding: "json",
});

if (!auth) return null;
const payload = jwt.decode(
Crypto.decrypt(auth.accessToken)
) as jwt.JwtPayload;
const payload = jwt.decode(auth.accessToken) as jwt.JwtPayload;

if (!payload) return null;

Expand Down
10 changes: 10 additions & 0 deletions src/main/events/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ import "./cloud-save/upload-save-game";
import "./cloud-save/delete-game-artifact";
import "./cloud-save/select-game-backup-path";
import "./notifications/publish-new-repacks-notification";
import "./themes/add-custom-theme";
import "./themes/delete-custom-theme";
import "./themes/get-all-custom-themes";
import "./themes/delete-all-custom-themes";
import "./themes/update-custom-theme";
import "./themes/open-editor-window";
import "./themes/get-custom-theme-by-id";
import "./themes/get-active-custom-theme";
import "./themes/close-editor-window";
import "./themes/toggle-custom-theme";
import { isPortableVersion } from "@main/helpers";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: The isPortableVersion import is now separated from other imports by the theme imports. Consider grouping it with other helper/constant imports at the top of the file

Suggested change
import { isPortableVersion } from "@main/helpers";
import { appVersion, defaultDownloadsPath, isStaging } from "@main/constants";
import { ipcMain } from "electron";
import { isPortableVersion } from "@main/helpers";


ipcMain.handle("ping", () => "pong");
Expand Down
4 changes: 2 additions & 2 deletions src/main/events/misc/open-checkout.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { shell } from "electron";
import { registerEvent } from "../register-event";
import { Crypto, HydraApi } from "@main/services";
import { HydraApi } from "@main/services";
import { db, levelKeys } from "@main/level";
import type { Auth } from "@types";

Expand All @@ -14,7 +14,7 @@ const openCheckout = async (_event: Electron.IpcMainInvokeEvent) => {
}

const paymentToken = await HydraApi.post("/auth/payment", {
refreshToken: Crypto.decrypt(auth.refreshToken),
refreshToken: auth.refreshToken,
}).then((response) => response.accessToken);

const params = new URLSearchParams({
Expand Down
12 changes: 12 additions & 0 deletions src/main/events/themes/add-custom-theme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Theme } from "@types";
import { registerEvent } from "../register-event";
import { themesSublevel } from "@main/level";

const addCustomTheme = async (
_event: Electron.IpcMainInvokeEvent,
theme: Theme
) => {
await themesSublevel.put(theme.id, theme);
};

registerEvent("addCustomTheme", addCustomTheme);
11 changes: 11 additions & 0 deletions src/main/events/themes/close-editor-window.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { WindowManager } from "@main/services";
import { registerEvent } from "../register-event";

const closeEditorWindow = async (
_event: Electron.IpcMainInvokeEvent,
themeId?: string
) => {
WindowManager.closeEditorWindow(themeId);
};

registerEvent("closeEditorWindow", closeEditorWindow);
8 changes: 8 additions & 0 deletions src/main/events/themes/delete-all-custom-themes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { themesSublevel } from "@main/level";
import { registerEvent } from "../register-event";

const deleteAllCustomThemes = async (_event: Electron.IpcMainInvokeEvent) => {
await themesSublevel.clear();
};

registerEvent("deleteAllCustomThemes", deleteAllCustomThemes);
11 changes: 11 additions & 0 deletions src/main/events/themes/delete-custom-theme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { themesSublevel } from "@main/level";
import { registerEvent } from "../register-event";

const deleteCustomTheme = async (
_event: Electron.IpcMainInvokeEvent,
themeId: string
) => {
await themesSublevel.del(themeId);
};

registerEvent("deleteCustomTheme", deleteCustomTheme);
9 changes: 9 additions & 0 deletions src/main/events/themes/get-active-custom-theme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { themesSublevel } from "@main/level";
import { registerEvent } from "../register-event";

const getActiveCustomTheme = async () => {
const allThemes = await themesSublevel.values().all();
return allThemes.find((theme) => theme.isActive);
};

registerEvent("getActiveCustomTheme", getActiveCustomTheme);
8 changes: 8 additions & 0 deletions src/main/events/themes/get-all-custom-themes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { themesSublevel } from "@main/level";
import { registerEvent } from "../register-event";

const getAllCustomThemes = async (_event: Electron.IpcMainInvokeEvent) => {
return themesSublevel.values().all();
};

registerEvent("getAllCustomThemes", getAllCustomThemes);
11 changes: 11 additions & 0 deletions src/main/events/themes/get-custom-theme-by-id.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { themesSublevel } from "@main/level";
import { registerEvent } from "../register-event";

const getCustomThemeById = async (
_event: Electron.IpcMainInvokeEvent,
themeId: string
) => {
return themesSublevel.get(themeId);
};

registerEvent("getCustomThemeById", getCustomThemeById);
11 changes: 11 additions & 0 deletions src/main/events/themes/open-editor-window.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { WindowManager } from "@main/services";
import { registerEvent } from "../register-event";

const openEditorWindow = async (
_event: Electron.IpcMainInvokeEvent,
themeId: string
) => {
WindowManager.openEditorWindow(themeId);
};
Comment on lines +4 to +9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: function is marked async but doesn't use await or return a Promise. Either remove async or handle the Promise from openEditorWindow

Suggested change
const openEditorWindow = async (
_event: Electron.IpcMainInvokeEvent,
themeId: string
) => {
WindowManager.openEditorWindow(themeId);
};
const openEditorWindow = (
_event: Electron.IpcMainInvokeEvent,
themeId: string
) => {
WindowManager.openEditorWindow(themeId);
};


registerEvent("openEditorWindow", openEditorWindow);
22 changes: 22 additions & 0 deletions src/main/events/themes/toggle-custom-theme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { themesSublevel } from "@main/level";
import { registerEvent } from "../register-event";

const toggleCustomTheme = async (
_event: Electron.IpcMainInvokeEvent,
themeId: string,
isActive: boolean
) => {
const theme = await themesSublevel.get(themeId);

if (!theme) {
throw new Error("Theme not found");
}

await themesSublevel.put(themeId, {
...theme,
isActive,
updatedAt: new Date(),
});
};

registerEvent("toggleCustomTheme", toggleCustomTheme);
27 changes: 27 additions & 0 deletions src/main/events/themes/update-custom-theme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { themesSublevel } from "@main/level";
import { registerEvent } from "../register-event";
import { WindowManager } from "@main/services";

const updateCustomTheme = async (
_event: Electron.IpcMainInvokeEvent,
themeId: string,
code: string
) => {
const theme = await themesSublevel.get(themeId);

if (!theme) {
throw new Error("Theme not found");
}

await themesSublevel.put(themeId, {
...theme,
code,
updatedAt: new Date(),
});

if (theme.isActive) {
WindowManager.mainWindow?.webContents.send("css-injected", code);
}
};

registerEvent("updateCustomTheme", updateCustomTheme);
23 changes: 3 additions & 20 deletions src/main/events/user-preferences/get-user-preferences.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,10 @@
import { registerEvent } from "../register-event";
import { db, levelKeys } from "@main/level";
import { Crypto } from "@main/services";
import type { UserPreferences } from "@types";

const getUserPreferences = async () =>
db
.get<string, UserPreferences | null>(levelKeys.userPreferences, {
valueEncoding: "json",
})
.then((userPreferences) => {
if (userPreferences?.realDebridApiToken) {
userPreferences.realDebridApiToken = Crypto.decrypt(
userPreferences.realDebridApiToken
);
}

if (userPreferences?.torBoxApiToken) {
userPreferences.torBoxApiToken = Crypto.decrypt(
userPreferences.torBoxApiToken
);
}

return userPreferences;
});
db.get<string, UserPreferences | null>(levelKeys.userPreferences, {
valueEncoding: "json",
});

registerEvent("getUserPreferences", getUserPreferences);
11 changes: 0 additions & 11 deletions src/main/events/user-preferences/update-user-preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { registerEvent } from "../register-event";
import type { UserPreferences } from "@types";
import i18next from "i18next";
import { db, levelKeys } from "@main/level";
import { Crypto } from "@main/services";
import { patchUserProfile } from "../profile/update-profile";

const updateUserPreferences = async (
Expand All @@ -24,16 +23,6 @@ const updateUserPreferences = async (
patchUserProfile({ language: preferences.language }).catch(() => {});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Empty catch block silently ignores profile update failures. Consider at least logging the error

}

if (preferences.realDebridApiToken) {
preferences.realDebridApiToken = Crypto.encrypt(
preferences.realDebridApiToken
);
}

if (preferences.torBoxApiToken) {
preferences.torBoxApiToken = Crypto.encrypt(preferences.torBoxApiToken);
}

if (!preferences.downloadsPath) {
preferences.downloadsPath = null;
}
Expand Down
Loading
Loading