From a4d8f0ae4fc6b1b76d73537bcc35ac2dd048cfd9 Mon Sep 17 00:00:00 2001 From: shaoying Date: Sun, 30 May 2021 23:37:22 +0800 Subject: [PATCH] add state.rewrite --- page/index.js | 3 +-- plugin/state.js | 4 ++++ proto.js | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/page/index.js b/page/index.js index ff21aa40..743a0e26 100644 --- a/page/index.js +++ b/page/index.js @@ -118,13 +118,12 @@ Volcanos({name: "chat", iceberg: "/chat/", volcano: "/frame.js", "spide", "share", "cache", "story", ]}, "aaa": {name: "权限 aaa", index: [ - "user", "sess", "role", + "user", "sess", "role", "totp", ]}, "nfs": {name: "文件 nfs", index: [ "nfs.cat", "nfs.dir", "nfs.tail", "nfs.trash", ]}, "ssh": {name: "脚本 ssh", index: [ - "aaa.totp", "web.code.tmux.session", "connect", "session", "service", "channel", ]}, }}, diff --git a/plugin/state.js b/plugin/state.js index 49dde83f..590c2d6e 100644 --- a/plugin/state.js +++ b/plugin/state.js @@ -2,6 +2,10 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, conf, }, _process: function(can, msg) { return can.core.CallFunc([can.onimport, msg.Option("_process")], [can, msg]) }, + _rewrite: function(can, msg, _arg) { can.Option(msg._arg[0], msg._arg[1]) + can.onappend._output(can, can.Conf(), {}, can.Pack()) + return true + }, _refresh: function(can, msg) { can.core.Timer(parseInt(msg.Option("_delay")||"500"), function() { var sub = can.request({}, {_count: parseInt(msg.Option("_count"))-1}) diff --git a/proto.js b/proto.js index 2dd9f17f..22755ff0 100644 --- a/proto.js +++ b/proto.js @@ -38,6 +38,7 @@ var Volcanos = shy("火山架", {args: {}, pack: {}, libs: [], cache: {}}, [], f for (var i = 0; i < cache.length; i++) { var sub = cache[i] if (typeof cb == "function" && cb(can, name, sub)) { continue } if (can[sub._name] && can[sub._name]._merge && can[sub._name]._merge(can, sub)) { continue } + if (sub._name == "onkeypop") { can[sub._name] = sub; continue } !can[sub._name] && (can[sub._name] = {}); for (var k in sub) { can[sub._name].hasOwnProperty(k) || (can[sub._name][k] = sub[k]) }