Commit a47c6d3e authored by nanahira's avatar nanahira

apps.json type

parent 35525669
export namespace AppsJson {
export enum Locale {
zh_CN = 'zh-CN',
en_US = 'en-US',
ja_JP = 'ja-JP',
ko_KR = 'ko-KR',
pt_BR = 'pt-BR',
zh_HK = 'zh-HK',
zh_TW = 'zh-TW',
}
export enum Platform {
Linux = 'linux',
macOS = 'darwin',
Windows = 'win32',
}
export type LocaleWise<T> = Record<Locale, T>;
export type PlatformWise<T> = Record<Platform, T>;
export interface Developer {
name: string;
url: string;
}
export interface Trailer {
type: string;
url: string;
url2?: string;
}
export interface Action {
interpreter?: string;
execute: string;
args: any[];
env: Record<string, string>;
open?: string;
}
export type PlatformAction = Record<string, Action>;
export interface News {
url: string;
image: string;
title: string;
text: string;
updated_at: string;
}
export interface NetworkServer {
id: string;
url: string;
}
export interface Network {
protocol: string;
port: number;
servers: NetworkServer[];
}
export interface Syncable {
sync: boolean;
}
export interface Price {
cny: number;
usd: number;
}
export interface App {
id: string;
key?: string;
name?: LocaleWise<string>;
description?: LocaleWise<string>;
developers?: LocaleWise<Developer[]>;
publishers?: LocaleWise<Developer[]>;
released_at?: string;
category?: string;
tags?: string[];
trailer?: Trailer[];
dependencies?: PlatformWise<string[]>;
references?: PlatformWise<string[]>;
author?: string;
homepage?: string;
locales?: string[];
actions?: PlatformWise<PlatformAction>;
version?: PlatformWise<string>;
news?: LocaleWise<News[]>;
conference?: string;
icon?: string;
cover?: string;
background?: string;
parent?: string;
network?: Network;
updated_at?: string;
files?: Record<string, Syncable>;
data?: Record<string, LocaleWise<string[]>>;
price?: Price;
}
}
......@@ -7,18 +7,18 @@ import {remote} from 'electron';
import * as sudo from 'electron-sudo';
import * as fs from 'fs';
import * as glob from 'glob';
import * as ini from 'ini';
import * as path from 'path';
import * as readline from 'readline';
import 'rxjs/Rx';
import {Observable, Observer} from 'rxjs/Rx';
import {Action, App, AppStatus} from './app';
import {App, AppStatus} from './app';
import {AppLocal} from './app-local';
import {DownloadService, DownloadStatus} from './download.service';
import {InstallOption} from './install-option';
import {LoginService} from './login.service';
import {SettingsService} from './settings.sevices';
import {ComparableSet} from './shared/ComparableSet';
import {AppsJson} from './apps-json-type';
import Timer = NodeJS.Timer;
import ReadableStream = NodeJS.ReadableStream;
......@@ -86,7 +86,7 @@ export class AppsService {
try {
let data = await this.http.get(appsURL)
.timeout(5000)
.map((response) => response.json()).toPromise();
.map((response) => response.json()).toPromise<AppsJson.App[]>();
let keys_data = await this.http.get(keysURL, {
search: {
user_id: this.loginService.user.email
......
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=apps-json-type.js.map
\ No newline at end of file
{"version":3,"file":"apps-json-type.js","sourceRoot":"","sources":["apps-json-type.ts"],"names":[],"mappings":""}
\ No newline at end of file
export namespace AppsJson {
export interface Name {
'zh-CN': string;
'en-US': string;
}
export interface Description {
'zh-CN': string;
'en-US': string;
}
export interface ZhCN {
name: string;
url: string;
}
export interface Developers {
'zh-CN': ZhCN[];
}
export interface ZhCN2 {
name: string;
url: string;
}
export interface Publishers {
'zh-CN': ZhCN2[];
}
export interface Trailer {
type: string;
url: string;
url2: string;
}
export interface Dependencies {
win32: string[];
darwin: string[];
linux: any[];
}
export interface References {
win32: string[];
darwin: string[];
}
export interface Env {
}
export interface Action {
interpreter?: string;
execute: string;
args: any[];
env: Record<string, string>;
open: string;
}
export interface Env2 {
}
export interface Custom {
execute: string;
args: any[];
env: Env2;
}
export interface Install {
execute: string;
args: string[];
}
export interface Env3 {
}
export interface Network {
execute: string;
args: any[];
env: Env3;
}
export interface Env4 {
LANG: string;
WINEDEBUG: string;
}
export interface Main2 {
execute: string;
args: any[];
open: string;
env: Env4;
}
export interface Env5 {
LANG: string;
}
export interface Custom2 {
execute: string;
args: any[];
open: string;
env: Env5;
}
export interface Install2 {
execute: string;
args: string[];
open: string;
}
export interface Env6 {
LANG: string;
}
export interface Network2 {
execute: string;
args: any[];
open: string;
env: Env6;
}
export interface Env7 {
}
export interface Main3 {
execute: string;
args: any[];
env: Env7;
}
export interface Linux {
main: Main3;
}
export type PlatformAction = Record<string, Action>;
export interface Actions {
win32: PlatformAction;
darwin: PlatformAction;
linux: PlatformAction;
}
export interface Version {
win32: string;
darwin: string;
linux: string;
}
export interface Server {
id: string;
url: string;
}
export interface Network3 {
protocol: string;
port: number;
servers: Server[];
}
export interface DeckYdk {
sync: boolean;
}
export interface SingleLua {
sync: boolean;
}
export interface ReplayYrp {
sync: boolean;
}
export interface Files {
'deck/*.ydk': DeckYdk;
'single/*.lua': SingleLua;
'replay/*.yrp': ReplayYrp;
}
export interface Windbot {
'zh-CN': string[];
'en-US': string[];
}
export interface Data {
windbot: Windbot;
}
export interface Price {
cny: number;
usd: number;
}
export interface App {
id: string;
name: Name;
description: Description;
developers: Developers;
publishers: Publishers;
released_at: string;
category: string;
tags: string[];
trailer: Trailer[];
dependencies: Dependencies;
references: References;
author: string;
homepage: string;
locales: string[];
actions: Actions;
version: Version;
news: any;
conference: string;
icon: string;
cover: string;
background: string;
parent: string;
network: Network3;
updated_at: string;
files: Files;
data: Data;
price: Price;
}
}
{"version":3,"file":"patch-linux-wine.js","sourceRoot":"","sources":["patch-linux-wine.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2BAAoC;AAEpC,4BAA4B;AAE5B;;QACC,MAAM,IAAI,GAAmB,IAAI,CAAC,KAAK,CAAC,MAAM,aAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;QACrF,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACvB,OAAO,CAAC,GAAG,CAAC,WAAW,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;YACjC,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;YAC5B,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAC5C,KAAK,MAAM,CAAC,UAAU,EAAE,MAAM,CAA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AC,EAAE,IAAI,UAAU,EAAE,CAAC,CAAC;oBAC7D,MAAM,CAAC,IAAI,GAAG,SAAS,CAAC;oBACxB,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC;iBAC/B;aACJ;SACJ;QACD,MAAM,aAAE,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACvE,CAAC;CAAA;AACD,IAAI,EAAE,CAAC"}
\ No newline at end of file
import { promises as fs } from 'fs';
import { AppsJson } from './apps-json-type';
import { AppsJson } from '../app/apps-json-type';
import * as _ from 'lodash';
async function main() {
const apps: AppsJson.App[] = JSON.parse(await fs.readFile(process.argv[2], 'utf-8'));
for (const app of apps) {
console.log(`Reading ${app.id}`);
const actions = app.actions;
actions.linux = _.cloneDeep(actions.darwin);
for (const [actionName, action] of Object.entries(actions.linux)) {
if (action.open === 'wine') {
console.log(`Patching Linux action ${app.id}-${actionName}`);
action.open = undefined;
action.interpreter = 'wine';
}
}
}
await fs.writeFile(process.argv[2], JSON.stringify(apps, null, 2));
const apps: AppsJson.App[] = JSON.parse(await fs.readFile(process.argv[2], 'utf-8'));
for (const app of apps) {
console.log(`Reading ${app.id}`);
const actions = app.actions;
actions.linux = _.cloneDeep(actions.darwin);
for (const [actionName, action] of Object.entries(actions.linux)) {
if (action.open === 'wine') {
console.log(`Patching Linux action ${app.id}-${actionName}`);
action.open = undefined;
action.interpreter = 'wine';
}
}
}
await fs.writeFile(process.argv[2], JSON.stringify(apps, null, 2));
}
main();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment