From 20ad6179b69174b52ed0db0d996aeadebfc599eb Mon Sep 17 00:00:00 2001 From: shy Date: Tue, 2 Jan 2024 16:15:38 +0800 Subject: [PATCH] opt aaa.sess --- index.css | 9 +++++---- lib/misc.js | 3 +-- lib/user.js | 8 +++----- panel/header.js | 3 ++- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/index.css b/index.css index 06c9e190..487f4bc7 100644 --- a/index.css +++ b/index.css @@ -37,7 +37,7 @@ body { --action-height:32px; --status-height:var(--action-height); --footer-height:var(--action-height); --header-height:48px; --desktop-height:684px; --float-height:480px; --plug-height:var(--story-height); --story-height:var(--float-height); --desktop-width:1200px; --float-width:1200px; --plug-width:800px; - --textarea-height:96px; --qrcode-height:260px; --iframe-height:420px; + --textarea-height:96px; --qrcode-height:364px; --iframe-height:420px; --river-margin:80px; --action-margin:200px; --desktop-icon-size:80px; --plugin-padding:10px; --plugin-margin:var(--plugin-padding); --legend-padding:20px; --title-margin:var(--legend-padding); @@ -52,6 +52,7 @@ body { font-family:var(--body-font-family); } body { background-color:var(--body-bg-color); color:var(--body-fg-color); } // body { background-color:var(--body-bg-color); color:var(--body-fg-color); background-position: center; background-image: url(/require/usr/icons/background.jpg); } body.windows { --code-font-family:"Courier New"; } +body.mobile { --qrcode-height:284px; } body.cmd { background-color:var(--plugin-bg-color); --plug-width:1200px; --plug-height:480px; @@ -597,9 +598,9 @@ fieldset.draw>div.output>div.layout>div.layout>div.profile table { width:100%; } fieldset.draw>form.option>div.item.pid>input { width:var(--button-width) !important; } fieldset.draw.trends div.output { overflow:hidden; } fieldset.draw.trends div.output svg { background-color:#1b5b738c; } -fieldset.form>div.output { text-align:center; } -fieldset.form>div.output div.info { font-size:20px; padding:40px 20px; overflow:auto; } -fieldset.form>div.output input[type=button] { font-size:24px; border:var(--notice-bg-color) solid 1px; height:48px; width:240px; margin:40px; } +fieldset.form>div.output>div.code { text-align:center; } +fieldset.form>div.output>div.code>div.info { font-size:20px; padding:40px 20px; overflow:auto; } +fieldset.form>div.output>div.code>input[type=button] { font-size:24px; border:var(--notice-bg-color) solid 1px; height:48px; width:240px; margin:40px; } fieldset>div.output.form { padding:20px; display:flex; flex-direction:column; align-items:center; justify-content:center; } fieldset>div.output.form>div.item { text-align:left; margin:10px; } fieldset>div.output.form>div.item>span { padding:var(--input-padding); } diff --git a/lib/misc.js b/lib/misc.js index 37c2b5d1..66fc6a9e 100644 --- a/lib/misc.js +++ b/lib/misc.js @@ -150,8 +150,7 @@ Volcanos("misc", { var msg = can.request(); can.page.exportValue(can, msg), can.core.List(msg.Option(), function(value) { args[value] = msg.Option(value) }) var url = location.protocol.replace(ice.HTTP, "ws")+"//"+location.host+"/space/"; if (url.indexOf(html.CHROME) == 0) { url = "ws://localhost:9020/space/" } try { var socket = new WebSocket(can.base.MergeURL(url, args)); _msg = _msg || can.request()._caller() } catch {} - can._socket = socket, socket.onclose = function() { can.misc.Log(html.WSS, cli.CLOSE, args) - if (socket._close) { return } + can._socket = socket, socket.onclose = function() { can.misc.Log(html.WSS, cli.CLOSE, args); if (socket._close) { return } can.base.isFunc(onclose)? onclose(socket): can.core.Timer(can.base.random(3000, 300), function() { args.name = args.name||can._wss_name, can.misc.WSS(can, args, cb, onopen, onerror, onclose, _msg) }) diff --git a/lib/user.js b/lib/user.js index ee31d336..6335d389 100644 --- a/lib/user.js +++ b/lib/user.js @@ -260,7 +260,7 @@ Volcanos("user", { return can.base.isFunc(_cb) && _cb(), _cb = null, true } can.core.Timer(1000, function() { check() }), can.onimport.theme(can) } - if (cmd == cli.PWD) { if (check()) { return } can.page.ClassList.add(can, document.body, aaa.LOGIN), can.ondaemon._list[0] = arg[0] + if (cmd == cli.PWD) { if (check()) { return } can.page.ClassList.add(can, document.body, aaa.LOGIN), can._wss_name = can.ondaemon._list[0] = arg[0] var _list = [], list = {}; _msg.Table(function(value) { if (value.order == "") {} else if (value.type == mdb.PLUGIN) { _list.push(value.name), list[value.name] = function(target) { can.onappend.plugin(can, {space: value.space, index: value.index, args: can.core.Split(value.args), style: html.OUTPUT}, function(sub) { var run = sub.run; sub.run = function(event, cmds, cb) { var msg = can.request(event, {space: arg[0]}); can.page.exportValue(can, msg), run(event, cmds, cb) } @@ -273,11 +273,9 @@ Volcanos("user", { can.page.Appends(can, ui.display, [{text: ["或命令行授权: ", html.LABEL]}, {text: ["$ "+_cmd, "", html.ITEM], title: "点击复制,并后台执行此命令,即可登录", style: {cursor: "copy"}, onclick: function() { can.user.copy(event, can, _cmd) }}]) can.page.Append(can, ui.display, [{text: ["或第三方授权: ", html.LABEL]}, {view: [["sso", html.FLEX]], list: _msg.Table(function(value) { return value.type == "oauth" && {view: [[html.ITEM, html.FLEX]], title: "点击跳转,授权登录", list: [{img: can.misc.Resource(can, value.icons)}, {text: value.name}], onclick: function() { can.user.jumps(value.link) }} - }) }]) - return true + }) }]), cb && cb(); return true } else if (cmd == ice.MSG_SESSID) { - if (!can.misc.CookieSessid(can, arg[0])) { can.user.info.sessid = arg[0] } check(), cb && cb() - return true + if (!can.misc.CookieSessid(can, arg[0])) { can.user.info.sessid = arg[0] } check(), cb && cb(); return true } }) }, logout: function(can) { can.user.toastConfirm(can, aaa.LOGOUT, "", function() { can.runAction({}, aaa.LOGOUT, [], function(msg) { diff --git a/panel/header.js b/panel/header.js index 021e0731..89aff5ca 100644 --- a/panel/header.js +++ b/panel/header.js @@ -63,7 +63,8 @@ Volcanos(chat.ONACTION, {_init: function(can) {}, onsize: function(can) { can.ConfHeight(can._target.offsetHeight), can.ConfWidth(can._target.offsetWidth) }, onmain: function(can) { if (!can.user.isMailMaster) { if (can.misc.Search(can, ice.MSG_SESSID)) { can.misc.CookieSessid(can, can.misc.Search(can, ice.MSG_SESSID)); return can.misc.Search(can, ice.MSG_SESSID, "") } } - function lang(msg, cb) { can.user.info.language = msg.SearchOrOption(aaa.LANGUAGE) + function lang(msg, cb) { + can.user.info.language = msg.SearchOrOption(aaa.LANGUAGE) can.user.info.language? can.require([can.misc.Resource(can, nfs.SRC_TEMPLATE+web.CHAT_HEADER+"/language/"+can.user.info.language+".js")], cb, function(can, name, sub) { can.base.Copy(can.user._trans, sub._trans) }): cb && cb() can.onmotion.delay(can, function() { can.onimport._language(can) }) }