mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-01-23 13:34:54 +03:00
fix: removing unused navigate
This commit is contained in:
parent
c59b039eb4
commit
8b47082047
3
src/main/level/index.ts
Normal file
3
src/main/level/index.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export { db } from "./level";
|
||||
|
||||
export * from "./sublevels";
|
4
src/main/level/level.ts
Normal file
4
src/main/level/level.ts
Normal file
@ -0,0 +1,4 @@
|
||||
import { levelDatabasePath } from "@main/constants";
|
||||
import { Level } from "level";
|
||||
|
||||
export const db = new Level(levelDatabasePath, { valueEncoding: "json" });
|
7
src/main/level/sublevels/games.ts
Normal file
7
src/main/level/sublevels/games.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { Game } from "@types";
|
||||
import { db } from "../level";
|
||||
import { levelKeys } from "./keys";
|
||||
|
||||
export const gamesSublevel = db.sublevel<string, Game>(levelKeys.games, {
|
||||
valueEncoding: "json",
|
||||
});
|
1
src/main/level/sublevels/index.ts
Normal file
1
src/main/level/sublevels/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from "./games";
|
8
src/main/level/sublevels/keys.ts
Normal file
8
src/main/level/sublevels/keys.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import type { GameShop } from "@types";
|
||||
|
||||
export const levelKeys = {
|
||||
games: "games",
|
||||
game: (shop: GameShop, objectId: string) => `${shop}:${objectId}`,
|
||||
user: "user",
|
||||
auth: "auth",
|
||||
};
|
28
src/main/services/crypto.ts
Normal file
28
src/main/services/crypto.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import { safeStorage } from "electron";
|
||||
import { logger } from "./logger";
|
||||
|
||||
export class Crypto {
|
||||
public static encrypt(str: string) {
|
||||
if (safeStorage.isEncryptionAvailable()) {
|
||||
return safeStorage.encryptString(str).toString("base64");
|
||||
} else {
|
||||
logger.warn(
|
||||
"Encrypt method returned raw string because encryption is not available"
|
||||
);
|
||||
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
public static decrypt(b64: string) {
|
||||
if (safeStorage.isEncryptionAvailable()) {
|
||||
return safeStorage.decryptString(Buffer.from(b64, "base64"));
|
||||
} else {
|
||||
logger.warn(
|
||||
"Decrypt method returned raw string because encryption is not available"
|
||||
);
|
||||
|
||||
return b64;
|
||||
}
|
||||
}
|
||||
}
|
23
src/types/level.types.ts
Normal file
23
src/types/level.types.ts
Normal file
@ -0,0 +1,23 @@
|
||||
export type SubscriptionStatus = "active" | "pending" | "cancelled";
|
||||
|
||||
export interface Subscription {
|
||||
id: string;
|
||||
status: SubscriptionStatus;
|
||||
plan: { id: string; name: string };
|
||||
expiresAt: string | null;
|
||||
paymentMethod: "pix" | "paypal";
|
||||
}
|
||||
|
||||
export interface Auth {
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
tokenExpirationTimestamp: number;
|
||||
}
|
||||
|
||||
export interface User {
|
||||
id: string;
|
||||
displayName: string;
|
||||
profileImageUrl: string | null;
|
||||
backgroundImageUrl: string | null;
|
||||
subscription: Subscription | null;
|
||||
}
|
Loading…
Reference in New Issue
Block a user