Commit 402fcdc7 authored by 神楽坂玲奈's avatar 神楽坂玲奈

custom

parent da462e73
...@@ -31,5 +31,5 @@ unzip -o aria2-1.28.0-win-32bit-build1.zip aria2-1.28.0-win-32bit-build1/aria2c. ...@@ -31,5 +31,5 @@ unzip -o aria2-1.28.0-win-32bit-build1.zip aria2-1.28.0-win-32bit-build1/aria2c.
mv aria2-1.28.0-win-32bit-build1/aria2c.exe bin mv aria2-1.28.0-win-32bit-build1/aria2c.exe bin
rm -rf aria2-1.28.0-win-32bit-build1 aria2-1.27.1-win-32bit-build1.zip rm -rf aria2-1.28.0-win-32bit-build1 aria2-1.27.1-win-32bit-build1.zip
curl -L 'http://downloads.sourceforge.net/project/msys2/REPOS/MSYS2/i686/bsdtar-3.2.1-1-i686.pkg.tar.xz' | tar --strip-components=2 -C bin -Jxf - usr/bin/bsdtar.exe curl -L 'http://downloads.sourceforge.net/project/msys2/REPOS/MSYS2/i686/bsdtar-3.2.1-1-i686.pkg.tar.xz' | tar --strip-components=2 -C bin -Jxf - usr/bin/bsdtar.exe
curl -L 'http://downloads.sourceforge.net/project/msys2/Base/i686/msys2-base-i686-20161025.tar.xz' | tar --strip-components=3 -C bin -Jxf - msys32/usr/bin/msys-2.0.dll msys32/usr/bin/msys-bz2-1.dll msys32/usr/bin/msys-gcc_s-1.dll msys32/usr/bin/msys-iconv-2.dll msys32/usr/bin/msys-lzma-5.dll msys32/usr/bin/msys-lzo2-2.dll msys32/usr/bin/msys-nettle-6.dll msys32/usr/bin/msys-xml2-2.dll msys32/usr/bin/msys-z.dll curl -L 'http://downloads.sourceforge.net/project/msys2/Base/i686/msys2-base-i686-20161025.tar.xz' | tar --strip-components=3 -C bin -Jxf - msys32/usr/bin/msys-2.0.dll msys32/usr/bin/msys-bz2-1.dll msys32/usr/bin/msys-gcc_s-1.dll msys32/usr/bin/msys-iconv-2.dll msys32/usr/bin/msys-lzma-5.dll msys32/usr/bin/msys-lzo2-2.dll msys32/usr/bin/msys-nettle-6.dll msys32/usr/bin/msys-xml2-2.dll msys32/usr/bin/msys-z.dll msys32/usr/bin/sha256sum.exe
``` ```
\ No newline at end of file
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
value="{{currentApp.status.progress}}" max="{{currentApp.status.total}}"></progress> value="{{currentApp.status.progress}}" max="{{currentApp.status.total}}"></progress>
<div *ngIf="currentApp.status.status==='ready' && (currentApp.id != 'ygopro')"> <div *ngIf="currentApp.status.status==='ready' && (currentApp.id != 'ygopro')">
<button (click)="runApp(currentApp)" type="button" class="btn btn-primary">运行</button> <button (click)="runApp(currentApp)" type="button" class="btn btn-primary">运行</button>
<button type="button" data-toggle="modal" data-target="#settings-modal" class="btn btn-secondary">设置</button> <button *ngIf="currentApp.actions.get('custom')" (click)="custom(currentApp)" type="button" class="btn btn-secondary">设置</button>
<!--<button (click)="appsService.browse(currentApp)" type="button" class="btn btn-secondary">游览本地文件</button>--> <!--<button (click)="appsService.browse(currentApp)" type="button" class="btn btn-secondary">游览本地文件</button>-->
<div id="network" *ngIf="currentApp.network && currentApp.network.protocol == 'maotama'"> <div id="network" *ngIf="currentApp.network && currentApp.network.protocol == 'maotama'">
...@@ -119,51 +119,51 @@ ...@@ -119,51 +119,51 @@
</button> </button>
</div> </div>
<div class="modal fade" id="settings-modal" tabindex="-1"> <!--<div class="modal fade" id="settings-modal" tabindex="-1">-->
<div class="modal-dialog" role="document"> <!--<div class="modal-dialog" role="document">-->
<div class="modal-content"> <!--<div class="modal-content">-->
<div class="modal-header"> <!--<div class="modal-header">-->
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <!--<button type="button" class="close" data-dismiss="modal" aria-label="Close">-->
<span aria-hidden="true">&times;</span> <!--<span aria-hidden="true">&times;</span>-->
</button> <!--</button>-->
<h4 class="modal-title">{{'settings'|translate}}</h4> <!--<h4 class="modal-title">{{'settings'|translate}}</h4>-->
<ul class="nav nav-tabs"> <!--<ul class="nav nav-tabs">-->
<li class="nav-item"> <!--<li class="nav-item">-->
<a class="nav-link active" data-toggle="tab" href="#general"> {{'general'|translate}} </a> <!--<a class="nav-link active" data-toggle="tab" href="#general"> {{'general'|translate}} </a>-->
</li> <!--</li>-->
<li class="nav-item"> <!--<li class="nav-item">-->
<a class="nav-link" data-toggle="tab" href="#updates"> {{'updates'|translate}} </a> <!--<a class="nav-link" data-toggle="tab" href="#updates"> {{'updates'|translate}} </a>-->
</li> <!--</li>-->
<li class="nav-item"> <!--<li class="nav-item">-->
<a class="nav-link" data-toggle="tab" href="#local-files"> {{'local files'|translate}} </a> <!--<a class="nav-link" data-toggle="tab" href="#local-files"> {{'local files'|translate}} </a>-->
</li> <!--</li>-->
</ul> <!--</ul>-->
</div> <!--</div>-->
<div class="modal-body"> <!--<div class="modal-body">-->
<div class="tab-content"> <!--<div class="tab-content">-->
<div id="general" role="tabpanel" class="tab-pane fade active"> <!--<div id="general" role="tabpanel" class="tab-pane fade active">-->
</div> <!--</div>-->
<div id="updates" role="tabpanel" class="tab-pane fade"> <!--<div id="updates" role="tabpanel" class="tab-pane fade">-->
</div> <!--</div>-->
<div id="local-files" role="tabpanel" class="tab-pane fade"> <!--<div id="local-files" role="tabpanel" class="tab-pane fade">-->
<div class="list-inline"> <!--<div class="list-inline">-->
<button type="button" [disabled]="!currentApp.isInstalled()" (click)="uninstall()"> <!--<button type="button" [disabled]="!currentApp.isInstalled()" (click)="uninstall()">-->
{{'uninstall'|translate}} <!--{{'uninstall'|translate}}-->
</button> <!--</button>-->
<i *ngIf="uninstalling" class="fa fa-circle-o-notch fa-spin fa-3x fa-fw"></i> <!--<i *ngIf="uninstalling" class="fa fa-circle-o-notch fa-spin fa-3x fa-fw"></i>-->
<span class="sr-only">Loading...</span> <!--<span class="sr-only">Loading...</span>-->
</div> <!--</div>-->
</div> <!--</div>-->
</div> <!--</div>-->
</div> <!--</div>-->
<div> <!--<div>-->
</div> <!--</div>-->
</div> <!--</div>-->
</div> <!--</div>-->
</div><!-- Modal --> <!--</div>&lt;!&ndash; Modal &ndash;&gt;-->
<div class="modal fade" id="install-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" <div class="modal fade" id="install-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"
*ngIf="installConfig"> *ngIf="installConfig">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
......
...@@ -42,7 +42,7 @@ export class AppDetailComponent implements OnInit { ...@@ -42,7 +42,7 @@ export class AppDetailComponent implements OnInit {
} }
get libraries(): string[] { get libraries(): string[] {
return this.settingsService.getLibraries().map((item)=>item.path); return this.settingsService.getLibraries().map((item) => item.path);
} }
get news() { get news() {
...@@ -97,7 +97,7 @@ export class AppDetailComponent implements OnInit { ...@@ -97,7 +97,7 @@ export class AppDetailComponent implements OnInit {
let options = this.installConfig; let options = this.installConfig;
let dependencies = currentApp.findDependencies(); let dependencies = currentApp.findDependencies();
let apps = dependencies.concat(currentApp).filter((app)=>!app.isInstalled()); let apps = dependencies.concat(currentApp).filter((app) => !app.isInstalled());
for (let reference of options.references) { for (let reference of options.references) {
if (reference.install) { if (reference.install) {
...@@ -110,24 +110,24 @@ export class AppDetailComponent implements OnInit { ...@@ -110,24 +110,24 @@ export class AppDetailComponent implements OnInit {
try { try {
let downloadApps = await this.downloadService.addUris(apps, downloadPath); let downloadApps = await this.downloadService.addUris(apps, downloadPath);
this.downloadService.getProgress(currentApp) this.downloadService.getProgress(currentApp)
.subscribe((progress)=> { .subscribe((progress) => {
currentApp.status.status = "downloading"; currentApp.status.status = "downloading";
currentApp.status.progress = progress.progress; currentApp.status.progress = progress.progress;
currentApp.status.total = progress.total; currentApp.status.total = progress.total;
this.ref.detectChanges(); this.ref.detectChanges();
}, },
(error)=> { (error) => {
}, },
()=> { () => {
// 避免安装过快 // 避免安装过快
if (currentApp.status.status === "downloading") { if (currentApp.status.status === "downloading") {
currentApp.status.status = "waiting"; currentApp.status.status = "waiting";
this.ref.detectChanges(); this.ref.detectChanges();
} }
}); });
await Promise.all(downloadApps.map((app)=> { await Promise.all(downloadApps.map((app) => {
return this.downloadService.getComplete(app) return this.downloadService.getComplete(app)
.then((completeApp: App)=> { .then((completeApp: App) => {
return this.installService.add(completeApp, options); return this.installService.add(completeApp, options);
}); });
})); }));
...@@ -152,6 +152,10 @@ export class AppDetailComponent implements OnInit { ...@@ -152,6 +152,10 @@ export class AppDetailComponent implements OnInit {
this.appsService.runApp(app); this.appsService.runApp(app);
} }
custom(app: App) {
this.appsService.runApp(app, 'custom');
}
copy(text) { copy(text) {
clipboard.writeText(text); clipboard.writeText(text);
} }
......
...@@ -122,21 +122,28 @@ export class AppsService { ...@@ -122,21 +122,28 @@ export class AppsService {
return children; return children;
} }
async runApp(app: App) { async runApp(app: App, action_name='main') {
let children = this.findChildren(app); let children = this.findChildren(app);
let cwd = (<AppLocal>app.local).path; let cwd = (<AppLocal>app.local).path;
let action: Action = <Action>app.actions.get('main'); let action: Action = <Action>app.actions.get(action_name);
let args: string[] = []; let args: string[] = [];
let env = {}; let env = {};
for (let child of children) { for (let child of children) {
if (child.isInstalled()) { if (child.isInstalled()) {
let _action = child.actions.get('main'); let _action = child.actions.get(action_name);
if (_action) { if (_action) {
action = _action action = _action
} }
} }
} }
let execute = path.join(cwd, action.execute); let execute = path.join(cwd, action.execute);
if(app.id == 'th123'){
let th105 = <App>app.references.get('th105');
if(th105.isInstalled()){
const config_file = path.join((<AppLocal>app.local).path, 'np21nt.ini');
}
}
if (action.open) { if (action.open) {
let np2 = <App>action.open; let np2 = <App>action.open;
let openAction: Action; let openAction: Action;
...@@ -173,14 +180,13 @@ export class AppsService { ...@@ -173,14 +180,13 @@ export class AppsService {
args = args.concat(openAction.args); args = args.concat(openAction.args);
let wine = <App>openAction.open; let wine = <App>openAction.open;
openPath = (<AppLocal>wine.local).path; openPath = (<AppLocal>wine.local).path;
openAction = <Action>(<App>openAction.open).actions.get("main"); openAction = <Action>(<App>openAction.open).actions.get('main');
cwd = (<AppLocal>np2.local).path; cwd = (<AppLocal>np2.local).path;
} }
args = args.concat(openAction.args); args = args.concat(openAction.args);
args.push(action.execute); args.push(action.execute);
execute = path.join(openPath, openAction.execute); execute = path.join(openPath, openAction.execute);
env = Object.assign(env, openAction.env); env = Object.assign(env, openAction.env);
} }
args = args.concat(action.args); args = args.concat(action.args);
env = Object.assign(env, action.env); env = Object.assign(env, action.env);
......
This diff is collapsed.
...@@ -39,7 +39,7 @@ install: ...@@ -39,7 +39,7 @@ install:
- mv aria2-1.28.0-win-32bit-build1/aria2c.exe bin - mv aria2-1.28.0-win-32bit-build1/aria2c.exe bin
- rm -rf aria2-1.28.0-win-32bit-build1 aria2-1.27.1-win-32bit-build1.zip - rm -rf aria2-1.28.0-win-32bit-build1 aria2-1.27.1-win-32bit-build1.zip
- curl -L 'http://downloads.sourceforge.net/project/msys2/REPOS/MSYS2/i686/bsdtar-3.2.1-1-i686.pkg.tar.xz' | tar --strip-components=2 -C bin -Jxf - usr/bin/bsdtar.exe - curl -L 'http://downloads.sourceforge.net/project/msys2/REPOS/MSYS2/i686/bsdtar-3.2.1-1-i686.pkg.tar.xz' | tar --strip-components=2 -C bin -Jxf - usr/bin/bsdtar.exe
- curl -L 'http://downloads.sourceforge.net/project/msys2/Base/i686/msys2-base-i686-20161025.tar.xz' | tar --strip-components=3 -C bin -Jxf - msys32/usr/bin/msys-2.0.dll msys32/usr/bin/msys-bz2-1.dll msys32/usr/bin/msys-gcc_s-1.dll msys32/usr/bin/msys-iconv-2.dll msys32/usr/bin/msys-lzma-5.dll msys32/usr/bin/msys-lzo2-2.dll msys32/usr/bin/msys-nettle-6.dll msys32/usr/bin/msys-xml2-2.dll msys32/usr/bin/msys-z.dll - curl -L 'http://downloads.sourceforge.net/project/msys2/Base/i686/msys2-base-i686-20161025.tar.xz' | tar --strip-components=3 -C bin -Jxf - msys32/usr/bin/msys-2.0.dll msys32/usr/bin/msys-bz2-1.dll msys32/usr/bin/msys-gcc_s-1.dll msys32/usr/bin/msys-iconv-2.dll msys32/usr/bin/msys-lzma-5.dll msys32/usr/bin/msys-lzo2-2.dll msys32/usr/bin/msys-nettle-6.dll msys32/usr/bin/msys-xml2-2.dll msys32/usr/bin/msys-z.dll msys32/usr/bin/sha256sum.exe
- ps: Install-Product node - ps: Install-Product node
- npm install - npm install
......
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