Commit e676ab65 authored by 神楽坂玲奈's avatar 神楽坂玲奈

fix

parent 783a2327
......@@ -118,7 +118,7 @@
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
<button i18n type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
<button i18n id="submit" type="submit" [disabled]="!theForm.form.valid" class="btn btn-primary">安装</button>
</div>
</form>
......
......@@ -541,6 +541,9 @@ export class AppsService {
app.local = local;
this.saveAppLocal(app);
app.status.status = "ready";
if (app.id == 'ygopro') {
localStorage.removeItem('ygopro-locale')
}
} catch (e) {
console.log("exception in doInstall", e);
throw e;
......
/**
* Created by zh99998 on 16/9/2.
*/
import {Component} from "@angular/core";
@Component({
moduleId: module.id,
selector: 'community',
templateUrl: 'community.component.html',
styleUrls: ['community.component.css'],
})
export class CommunityComponent {
}
......@@ -9,6 +9,7 @@ import {DownloadService} from "./download.service";
import {Http, URLSearchParams} from "@angular/http";
import {shell} from "electron";
import WebViewElement = Electron.WebViewElement;
import {SettingsService} from "./settings.sevices";
@Component({
moduleId: module.id,
......@@ -24,7 +25,7 @@ export class LobbyComponent implements OnInit {
currentApp: App;
private apps: Map<string,App>;
constructor(private appsService: AppsService, private loginService: LoginService) {
constructor(private appsService: AppsService, private loginService: LoginService, private settingsService: SettingsService) {
}
async ngOnInit() {
......@@ -38,6 +39,13 @@ export class LobbyComponent implements OnInit {
params.set('jid', this.loginService.user.username + '@mycard.moe');
params.set('password', this.loginService.user.external_id.toString());
params.set('nickname', this.loginService.user.username);
switch(this.settingsService.getLocale()){
case 'zh-CN':
params.set('language', 'cn');
break;
default:
params.set('language', 'en');
}
if (this.currentApp.conference) {
params.set('autojoin', this.currentApp.conference + '@conference.mycard.moe');
}
......
<webview [src]="url" (will-navigate)="return_sso($event.url)" (did-get-redirect-request)="return_sso($event.newURL)"></webview>
\ No newline at end of file
<webview [src]="url" (will-navigate)="return_sso($event.url)" (did-get-redirect-request)="return_sso($event.newURL)" (new-window)="openExternal($event.url)"></webview>
\ No newline at end of file
......@@ -6,6 +6,7 @@ import {LoginService} from "./login.service";
import * as crypto from "crypto";
import * as querystring from "querystring";
import * as url from "url";
import {shell} from "electron";
@Component({
moduleId: module.id,
......@@ -46,4 +47,7 @@ export class LoginComponent {
this.loginService.login(user);
}
openExternal(url: string) {
shell.openExternal(url);
}
}
......@@ -39,4 +39,4 @@
<login class="page" *ngIf="!loginService.logged_in"></login>
<store class="page" *ngIf="loginService.logged_in" [hidden]="currentPage != 'store'"></store>
<lobby class="page" *ngIf="loginService.logged_in" [hidden]="currentPage != 'lobby'"></lobby>
<webview class="page" *ngIf="loginService.logged_in" [hidden]="currentPage != 'community'" src="https://ygobbs.com"></webview>
<webview class="page" *ngIf="loginService.logged_in" [hidden]="currentPage != 'community'" src="https://ygobbs.com" (new-window)="openExternal($event.url)"></webview>
import {Component, Renderer, ChangeDetectorRef, OnInit, ElementRef, ViewChild} from "@angular/core";
import {remote} from "electron";
import {remote, shell} from "electron";
import {LoginService} from "./login.service";
const autoUpdater: Electron.AutoUpdater = remote.getGlobal('autoUpdater');
declare const $: any;
......@@ -89,4 +89,8 @@ export class MyCardComponent implements OnInit {
$(element.nativeElement).tooltip({placement: 'bottom', container: 'body'})
}
}
openExternal(url: string) {
shell.openExternal(url);
}
}
......@@ -8,7 +8,6 @@ import {StoreComponent} from "./store.component";
import {LobbyComponent} from "./lobby.component";
import {AppDetailComponent} from "./app-detail.component";
import {RosterComponent} from "./roster.component";
import {CommunityComponent} from "./community.component";
import {YGOProComponent} from "./ygopro.component";
import {AppsService} from "./apps.service";
import {SettingsService} from "./settings.sevices";
......@@ -19,7 +18,7 @@ import {DownloadService} from "./download.service";
imports: [BrowserModule, FormsModule, ReactiveFormsModule, HttpModule],
declarations: [
MyCardComponent, LoginComponent, StoreComponent, LobbyComponent,
CommunityComponent, AppDetailComponent, RosterComponent, YGOProComponent,
AppDetailComponent, RosterComponent, YGOProComponent,
],
bootstrap: [MyCardComponent],
providers: [
......
......@@ -16,7 +16,7 @@ export class SettingsService {
static defaultLibraries = [
{
"default": true,
path: path.join(remote.app.getPath("appData"), "library")
path: path.join(remote.app.getPath("appData"), "MyCardLibrary")
},
];
libraries: Library[];
......
......@@ -27,7 +27,7 @@
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="myModalLabel1">单人模式</h4>
<h4 i18n class="modal-title" id="myModalLabel1">单人模式</h4>
</div>
<div class="modal-body">
<label i18n>选择对手</label>
......
......@@ -121,9 +121,9 @@ export class YGOProComponent implements OnInit {
}
}
ngOnInit() {
async ngOnInit() {
this.system_conf = path.join(this.app.local!.path, 'system.conf');
this.refresh();
await this.refresh();
let modal = $('#game-list-modal');
......@@ -262,7 +262,7 @@ export class YGOProComponent implements OnInit {
win.minimize();
let locale = this.settingsService.getLocale();
if (localStorage.getItem('ygopro-locale') != locale) {
console.log(`try convert ygopro locale to ${locale}`)
console.log(`try convert ygopro locale to ${locale}`);
try {
await new Promise((resolve, reject) => {
let source = fs.createReadStream(path.join(this.app.local!.path, 'locales', locale, 'strings.conf'));
......@@ -296,7 +296,7 @@ export class YGOProComponent implements OnInit {
reject(error)
});
});
localStorage.setItem('ygopro-locale', locale)
localStorage.setItem('ygopro-locale', locale);
console.log(`convert ygopro locale to ${locale} success`)
} catch (error) {
console.error(`convert ygopro locale to ${locale} failed`, error)
......@@ -311,8 +311,9 @@ export class YGOProComponent implements OnInit {
reject(error);
win.restore()
});
child.on('exit', (code, signal) => {
child.on('exit', async(code, signal) => {
// error 触发之后还可能会触发exit,但是Promise只承认首次状态转移,因此这里无需重复判断是否已经error过。
await this.refresh();
resolve();
win.restore()
})
......
......@@ -2052,8 +2052,8 @@
}
},
"version": {
"win32": "1.033.C-7",
"darwin": "1.033.C-7"
"win32": "1.033.C-8",
"darwin": "1.033.C-8"
},
"news": {
"zh-CN": [
......
......@@ -40,7 +40,7 @@
// candy init
const params = new URLSearchParams(location.search);
Candy.View.Template.Login.form = '<form method="post" id="login-form" class="login-form">' + '<input type="hidden" id="nickname" name="nickname" value="' + params.nickname + '"/>' + '{{#displayUsername}}<input type="hidden" id="username" name="username" value="' + params.jid + '"/>' + '{{#displayDomain}} <span class="at-symbol">@</span> ' + '<select id="domain" name="domain">{{#domains}}<option value="{{domain}}">{{domain}}</option>{{/domains}}</select>' + "{{/displayDomain}}" + "{{/displayUsername}}" + '{{#presetJid}}<input type="hidden" id="username" name="username" value="{{presetJid}}"/>{{/presetJid}}' + '{{#displayPassword}}<input type="hidden" id="password" name="password" value="' + params.password + '"/>{{/displayPassword}}' + '<input type="submit" class="button" value="{{_loginSubmit}}" /></form>';;
Candy.View.Template.Login.form = '<form method="post" id="login-form" class="login-form">' + '<input type="hidden" id="nickname" name="nickname" value="' + params.nickname + '"/>' + '{{#displayUsername}}<input type="hidden" id="username" name="username" value="' + params.jid + '"/>' + '{{#displayDomain}} <span class="at-symbol">@</span> ' + '<select id="domain" name="domain">{{#domains}}<option value="{{domain}}">{{domain}}</option>{{/domains}}</select>' + "{{/displayDomain}}" + "{{/displayUsername}}" + '{{#presetJid}}<input type="hidden" id="username" name="username" value="{{presetJid}}"/>{{/presetJid}}' + '{{#displayPassword}}<input type="hidden" id="password" name="password" value="' + params.password + '"/>{{/displayPassword}}' + '<input type="submit" class="button" value="{{_loginSubmit}}" /></form>';
Candy.Util.setCookie('candy-nostatusmessages', '1', 365);
Candy.init('wss://chat.mycard.moe:5280/websocket', {
......@@ -49,7 +49,7 @@
autojoin: params.get('autojoin') && [params.get('autojoin')],
resource: 'mycard-' + Math.random().toString().split('.')[1]
},
view: {assets: 'res/', language: 'cn'}
view: {assets: 'res/', language: params.get('language')}
});
Candy.Core.connect(params.get('jid'), params.get('password'), params.get('nickname'));
......
This diff is collapsed.
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