Commit 44d0ba96 authored by nanahira's avatar nanahira

optional system conf

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