mirror of
https://github.com/Nezumi-2711/next-gdrive-index.git
synced 2026-09-22 13:38:38 +00:00
Merge pull request #46 from mbahArip/v2
fix: `@typescript-eslint/prefer-nullish-coalescing` when building
This commit is contained in:
@@ -213,9 +213,7 @@ export async function GetReadme(id: string | null = null): Promise<
|
|||||||
file = data.files[0];
|
file = data.files[0];
|
||||||
} else {
|
} else {
|
||||||
file = data.files.find((file) => file.mimeType === "text/markdown");
|
file = data.files.find((file) => file.mimeType === "text/markdown");
|
||||||
if (!file) {
|
file ??= data.files.find((file) => file.mimeType === 'application/vnd.google-apps.shortcut');
|
||||||
file = data.files.find((file) => file.mimeType === "application/vnd.google-apps.shortcut");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file)
|
if (!file)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class EncryptionService {
|
|||||||
|
|
||||||
const iv = crypto.getRandomValues(new Uint8Array(12));
|
const iv = crypto.getRandomValues(new Uint8Array(12));
|
||||||
const alg = { name: "AES-GCM", iv };
|
const alg = { name: "AES-GCM", iv };
|
||||||
const keyhash = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(forceKey ? forceKey : this.key));
|
const keyhash = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(forceKey ?? this.key));
|
||||||
|
|
||||||
const encodedData = new TextEncoder().encode(data);
|
const encodedData = new TextEncoder().encode(data);
|
||||||
const secretKey = await crypto.subtle.importKey("raw", keyhash, alg, false, ["encrypt"]);
|
const secretKey = await crypto.subtle.importKey("raw", keyhash, alg, false, ["encrypt"]);
|
||||||
@@ -45,7 +45,7 @@ class EncryptionService {
|
|||||||
if (!cipherText || !iv) throw new Error("Invalid hash format.");
|
if (!cipherText || !iv) throw new Error("Invalid hash format.");
|
||||||
|
|
||||||
const alg = { name: "AES-GCM", iv: new Uint8Array(Buffer.from(iv, "hex")) };
|
const alg = { name: "AES-GCM", iv: new Uint8Array(Buffer.from(iv, "hex")) };
|
||||||
const keyhash = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(forceKey ? forceKey : this.key));
|
const keyhash = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(forceKey ?? this.key));
|
||||||
|
|
||||||
const secretKey = await crypto.subtle.importKey("raw", keyhash, alg, false, ["decrypt"]);
|
const secretKey = await crypto.subtle.importKey("raw", keyhash, alg, false, ["decrypt"]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user