Commit 44d0ba96 authored by nanahira's avatar nanahira

optional system conf

parent ed16c36b
......@@ -55,13 +55,15 @@ export class AppDetailComponent implements OnInit, OnChanges {
'mysterious': '迷之物体',
'touhou': '东方 Project',
'touhou_pc98': '东方旧作',
'language': '语言包'
'language': '语言包',
'ygopro': 'YGOPro'
} : {
'recommend': 'Recommended',
'mysterious': 'Something',
'touhou': 'Touhou Project',
'touhou_pc98': 'Touhou old series',
'language': 'Language Pack'
'language': 'Language Pack',
'ygopro': 'YGOPro'
};
}
......
......@@ -42,6 +42,15 @@
</a>
</li>
</ul>
<span i18n *ngIf="grouped_apps.ygopro">YGOPro 各发行版</span>
<ul *ngIf="grouped_apps.recommend" class="nav nav-pills flex-column">
<li *ngFor="let app of grouped_apps.ygopro" class="nav-item">
<a (click)="$event.preventDefault(); chooseApp(app)" [href]="'https://mycard.moe/' + app.id" class="nav-link" [class.active]="app===currentApp">
<img *ngIf="app.icon" class="icon" [src]="app.icon">
{{app.name}}
</a>
</li>
</ul>
<span i18n *ngIf="grouped_apps.mysterious">迷之物体</span>
<ul *ngIf="grouped_apps.mysterious" class="nav nav-pills flex-column">
<li *ngFor="let app of grouped_apps.mysterious" class="nav-item">
......@@ -95,4 +104,4 @@
</div>
</div>
<div id="right-shadow"></div>
\ No newline at end of file
<div id="right-shadow"></div>
......@@ -168,25 +168,27 @@ export class LobbyComponent implements OnInit {
let contains = ['game', 'music', 'book'].map((value) => Category[value]);
let result = {runtime: []};
for (let app of this.apps.values()) {
let tag: string;
let tags: string[];
if (contains.includes(app.category)) {
if (app.isInstalled()) {
tag = 'installed';
tags = ['installed'];
} else {
tag = app.tags ? app.tags[0] : 'test';
tags = app.tags || ['test'];
}
} else {
if (app.isInstalled()) {
tag = 'runtime_installed';
tags = ['runtime_installed'];
} else {
tag = 'runtime';
tags = ['runtime'];
}
}
if (!result[tag]) {
result[tag] = [];
for (const tag of tags) {
if (!result[tag]) {
result[tag] = [];
}
result[tag].push(app);
}
result[tag].push(app);
}
return result;
}
......
......@@ -490,8 +490,12 @@ export class YGOProComponent implements OnInit, OnDestroy {
if (!this.system_conf) {
return null;
}
let data = await fs.readFile(this.system_conf, {encoding: 'utf-8'});
return <any>ini.parse(data);
try {
let data = await fs.readFile(this.system_conf, {encoding: 'utf-8'});
return <any>ini.parse(data);
} catch(e) {
return null;
}
};
/*
......
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