From 44f23d5616d5b096c7e83a951abf325a01130b7f Mon Sep 17 00:00:00 2001 From: zh99998 Date: Mon, 5 Dec 2016 22:04:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=81=8A=E5=A4=A9=E5=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/lobby.component.ts | 12 ++++-------- candy/index.html | 11 +++++++---- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/app/lobby.component.ts b/app/lobby.component.ts index 3716b176..847e9c37 100644 --- a/app/lobby.component.ts +++ b/app/lobby.component.ts @@ -8,9 +8,6 @@ import {App, Category} from "./app"; import {DownloadService} from "./download.service"; import {InstallService} from "./install.service"; import {Http, URLSearchParams} from "@angular/http"; -import * as path from "path"; -import {InstallOption} from "./install-option"; -import {AppLocal} from "./app-local"; import WebViewElement = Electron.WebViewElement; @Component({ @@ -33,7 +30,7 @@ export class LobbyComponent implements OnInit { async ngOnInit() { this.apps = await this.appsService.loadApps(); - this.chooseApp(Array.from(this.apps.values()).find(app => app.isInstalled()) || this.apps.get("ygopro")); + this.chooseApp(Array.from(this.apps.values()).find(app => app.isInstalled()) || this.apps.get("ygopro")!); // 初始化聊天室 let url = new URL('candy/index.html', location.href); @@ -41,7 +38,9 @@ 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); - params.set('autojoin', this.currentApp.conference + '@conference.mycard.moe'); + if (this.currentApp.conference) { + params.set('autojoin', this.currentApp.conference + '@conference.mycard.moe'); + } this.candy_url = url; } @@ -52,9 +51,6 @@ export class LobbyComponent implements OnInit { } } - - - get grouped_apps() { let contains = ["game", "music", "book"].map((value) => Category[value]); let result = {runtime: []}; diff --git a/candy/index.html b/candy/index.html index dfe73d4c..006f6efb 100644 --- a/candy/index.html +++ b/candy/index.html @@ -26,8 +26,11 @@ require('electron-cookies'); // https://github.com/hstove/electron-cookies ipcRenderer.on('join', (event, message) => { - Candy.Core.Action.Jabber.Room.Join(message); - Candy.View.Pane.Chat.setActiveTab(message); + if (Candy.View.Pane.Chat.rooms[message]) { + Candy.View.Pane.Room.show(message); + } else { + Candy.Core.Action.Jabber.Room.Join(message); + } }); // fix @@ -37,13 +40,13 @@ // candy init const params = new URLSearchParams(location.search); - Candy.View.Template.Login.form = '' + Candy.View.Template.Login.form = '';; Candy.Util.setCookie('candy-nostatusmessages', '1', 365); Candy.init('wss://chat.mycard.moe:5280/websocket', { core: { debug: false, - autojoin: [params.get('autojoin')], + autojoin: params.get('autojoin') && [params.get('autojoin')], resource: 'mycard-' + Math.random().toString().split('.')[1] }, view: {assets: 'res/', language: 'cn'}