File tree Expand file tree Collapse file tree 4 files changed +10
-10
lines changed
Expand file tree Collapse file tree 4 files changed +10
-10
lines changed Original file line number Diff line number Diff 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
1616export 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" ,
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { version } from "../../package.json";
33export const ExtVersion = version ;
44
55export const ExtServer = "https://ext.scriptcat.org/" ;
6- export const ExtServerApi = ExtServer + " api/v1/" ;
6+ export const ExtServerApi = ` ${ ExtServer } api/v1/` ;
77
88export const ExternalWhitelist = [
99 "greasyfork.org" ,
Original file line number Diff line number Diff 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 ( ) ,
Original file line number Diff line number Diff 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
3434export 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
You can’t perform that action at this time.
0 commit comments