mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
21 lines
631 B
TypeScript
21 lines
631 B
TypeScript
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>(levelKeys.userPreferences, {
|
|
valueEncoding: "json",
|
|
})
|
|
.then((userPreferences) => {
|
|
if (userPreferences.realDebridApiToken) {
|
|
userPreferences.realDebridApiToken = Crypto.decrypt(
|
|
userPreferences.realDebridApiToken
|
|
);
|
|
}
|
|
|
|
return userPreferences;
|
|
});
|
|
|
|
registerEvent("getUserPreferences", getUserPreferences);
|