Skip to content

Commit 66964e5

Browse files
committed
🎨 修复 ESLint 代码风格问题
1 parent 84e7087 commit 66964e5

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

pkg/filesystem/auth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function GetNetDiskToken(netDiskType: NetDiskType): Promise<{
1010
msg: string;
1111
data: { token: { access_token: string; refresh_token: string } };
1212
}> {
13-
return fetch(ExtServerApi + `auth/net-disk/token?netDiskType=${netDiskType}`).then((resp) => resp.json());
13+
return fetch(`${ExtServerApi}auth/net-disk/token?netDiskType=${netDiskType}`).then((resp) => resp.json());
1414
}
1515

1616
export function RefreshToken(
@@ -21,7 +21,7 @@ export function RefreshToken(
2121
msg: string;
2222
data: { token: { access_token: string; refresh_token: string } };
2323
}> {
24-
return fetch(ExtServerApi + `auth/net-disk/token/refresh?netDiskType=${netDiskType}`, {
24+
return fetch(`${ExtServerApi}auth/net-disk/token/refresh?netDiskType=${netDiskType}`, {
2525
method: "POST",
2626
headers: {
2727
"Content-Type": "application/json",

src/app/const.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { version } from "../../package.json";
33
export const ExtVersion = version;
44

55
export const ExtServer = "https://ext.scriptcat.org/";
6-
export const ExtServerApi = ExtServer + "api/v1/";
6+
export const ExtServerApi = `${ExtServer}api/v1/`;
77

88
export const ExternalWhitelist = [
99
"greasyfork.org",

src/app/service/resource/manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ export class ResourceManager extends Manager {
384384
url: u.url,
385385
content: "",
386386
contentType: (contentType || "application/octet-stream").split(";")[0],
387-
hash: hash,
387+
hash,
388388
base64: "",
389389
type,
390390
createtime: Date.now(),

src/pkg/utils/datatype.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,27 @@ export function base64ToUint8(b64: string): Uint8Array<ArrayBuffer> {
1818
if (typeof (Uint8Array as any).fromBase64 === "function") {
1919
// JS 2025
2020
return (Uint8Array as any).fromBase64(b64) as Uint8Array<ArrayBuffer>;
21-
} else if (typeof Buffer !== "undefined" && typeof Buffer.from === "function") {
21+
} if (typeof Buffer !== "undefined" && typeof Buffer.from === "function") {
2222
// Node.js
2323
return Uint8Array.from(Buffer.from(b64, "base64"));
24-
} else {
24+
}
2525
// Fallback
2626
const bin = atob(b64);
2727
const ab = new ArrayBuffer(bin.length);
2828
const out = new Uint8Array<ArrayBuffer>(ab); // <- Uint8Array<ArrayBuffer>
2929
for (let i = 0, l = bin.length; i < l; i++) out[i] = bin.charCodeAt(i);
3030
return out;
31-
}
31+
3232
}
3333

3434
export function uint8ToBase64(uint8arr: Uint8Array<ArrayBufferLike>): string {
3535
if (typeof (uint8arr as any).toBase64 === "function") {
3636
// JS 2025
3737
return (uint8arr as any).toBase64() as string;
38-
} else if (typeof Buffer !== "undefined" && typeof Buffer.from === "function") {
38+
} if (typeof Buffer !== "undefined" && typeof Buffer.from === "function") {
3939
// Node.js
4040
return Buffer.from(uint8arr).toString("base64") as string;
41-
} else {
41+
}
4242
// Fallback
4343
let binary = "";
4444
let i = 0;
@@ -48,7 +48,7 @@ export function uint8ToBase64(uint8arr: Uint8Array<ArrayBufferLike>): string {
4848
}
4949
binary += String.fromCharCode(...(i ? uint8arr.slice(i) : uint8arr));
5050
return btoa(binary) as string;
51-
}
51+
5252
}
5353

5454
// Split Uint8Array (or ArrayBuffer) into 2MB chunks as Uint8Array views

0 commit comments

Comments
 (0)