Commit 44f23d56 authored by 神楽坂玲奈's avatar 神楽坂玲奈

修正聊天室

parent 78adf928
......@@ -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()) || <App>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: []};
......
......@@ -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 = '<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', {
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'}
......
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