mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2024-12-24 18:48:14 +03:00
Remove namespace and export default interface
This commit is contained in:
parent
3049aaeff2
commit
3d10bfc3c7
2 changed files with 63 additions and 65 deletions
38
src/ts/GIJSON.d.ts
vendored
38
src/ts/GIJSON.d.ts
vendored
|
@ -1,14 +1,12 @@
|
||||||
declare module GIJSON {
|
interface VoicePack {
|
||||||
|
|
||||||
interface VoicePack {
|
|
||||||
language: string;
|
language: string;
|
||||||
name: string;
|
name: string;
|
||||||
path: string;
|
path: string;
|
||||||
size: string;
|
size: string;
|
||||||
md5: string;
|
md5: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Latest {
|
interface Latest {
|
||||||
name: string;
|
name: string;
|
||||||
version: string;
|
version: string;
|
||||||
path: string;
|
path: string;
|
||||||
|
@ -18,9 +16,9 @@ declare module GIJSON {
|
||||||
voice_packs: VoicePack[];
|
voice_packs: VoicePack[];
|
||||||
decompressed_path: string;
|
decompressed_path: string;
|
||||||
segments: any[];
|
segments: any[];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Diff {
|
interface Diff {
|
||||||
name: string;
|
name: string;
|
||||||
version: string;
|
version: string;
|
||||||
path: string;
|
path: string;
|
||||||
|
@ -28,33 +26,33 @@ declare module GIJSON {
|
||||||
md5: string;
|
md5: string;
|
||||||
is_recommended_update: boolean;
|
is_recommended_update: boolean;
|
||||||
voice_packs: VoicePack[];
|
voice_packs: VoicePack[];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Game {
|
interface Game {
|
||||||
latest: Latest;
|
latest: Latest;
|
||||||
diffs: Diff[];
|
diffs: Diff[];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Plugins {
|
interface Plugins {
|
||||||
name: string;
|
name: string;
|
||||||
version: string;
|
version: string;
|
||||||
path: string;
|
path: string;
|
||||||
size: string;
|
size: string;
|
||||||
md5: string;
|
md5: string;
|
||||||
entry: string;
|
entry: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Plugin {
|
interface Plugin {
|
||||||
plugins: Plugins[];
|
plugins: Plugins[];
|
||||||
version: string;
|
version: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DeprecatedPackage {
|
interface DeprecatedPackage {
|
||||||
name: string;
|
name: string;
|
||||||
md5: string;
|
md5: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Data {
|
interface Data {
|
||||||
game: Game;
|
game: Game;
|
||||||
plugin: Plugin;
|
plugin: Plugin;
|
||||||
web_url: string;
|
web_url: string;
|
||||||
|
@ -62,12 +60,10 @@ declare module GIJSON {
|
||||||
pre_download_game?: any;
|
pre_download_game?: any;
|
||||||
deprecated_packages: DeprecatedPackage[];
|
deprecated_packages: DeprecatedPackage[];
|
||||||
sdk?: any;
|
sdk?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Type {
|
export default interface GIJSON {
|
||||||
retcode: number;
|
retcode: number;
|
||||||
message: string;
|
message: string;
|
||||||
data: Data;
|
data: Data;
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,3 +1,5 @@
|
||||||
|
import GIJSON from "./GIJSON";
|
||||||
|
|
||||||
const https = require('https');
|
const https = require('https');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
@ -74,7 +76,7 @@ export class Genshinlib
|
||||||
response.on('data', (chunk: any) => data += chunk);
|
response.on('data', (chunk: any) => data += chunk);
|
||||||
|
|
||||||
response.on('end', () => {
|
response.on('end', () => {
|
||||||
let jsondata: GIJSON.Type = JSON.parse(data);
|
let jsondata: GIJSON = JSON.parse(data);
|
||||||
|
|
||||||
return jsondata.message === 'OK' ? resolve(jsondata.data) : reject(null);
|
return jsondata.message === 'OK' ? resolve(jsondata.data) : reject(null);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue