1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-04-25 16:58:06 +08:00
shaoying 0bc0e17674 opt ssh
Change-Id: I86d3d3a981795d3180ffd6f1a7468fcefbca8030
2019-03-17 11:40:23 +08:00

377 lines
11 KiB
Cheetah
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{{define "head"}}
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=0.7">
<link rel="shortcut icon" type="image/ico" href="/favicon.ico">
<title>code</title>
<style>
html, body {
height:100%;
width:100%;
margin:0px;
background-color:#d8d8d8;
}
fieldset {
margin-top:8px;
}
legend {
font-size:16px;
font-weight:bold;
font-family:monospace;
}
</style>
<style>
{{$toolkit_view := conf . "route" "toolkit_view"}}
div.workflow {
color:#e6dd37;
font-size:14px;
font-family:monospace;
background-color:#498bb1a8;
border:solid 3px red;
width:60px;
height:20px;
overflow:scroll;
position:fixed;
top:{{index $toolkit_view "top"}}px;
left:{{index $toolkit_view "left"}}px;
}
div.workflow:hover, div.workflow.max {
width:{{index $toolkit_view "width"}}px;
height:{{index $toolkit_view "height"}}px;
}
div.workflow div:hover, div.workflow li li:hover {
background-color:red;
}
div.workflow div.stick, div.workflow li li.stick {
background-color:red;
}
div.workflow li>label.result{
background-color:rgba(0,0,0,0.2);
padding:0 5px;
border:2px solid green;
margin-left: 10px;
}
div.workflow li>input {
background-color:rgba(0,0,0,0.2);
}
form.option div {
float:left;
}
textarea.clipboard {
color:white;
background-color:#272822;
width:600px;
}
form.option div {
float:left;
}
form.option hr {
clear:both;
}
form.option label.keymap {
color:red;
display:none;
}
form.option label.keymap.show {
display:inline;
}
form.option input {
margin-right:10px;
}
form.option input.cmd {
color:white;
background-color:#272822;
padding-left:10px;
width:600px;
}
form.option input.file_cmd {
color:white;
background-color:#272822;
padding-left:10px;
width:400px;
}
form.option input.file_name {
width:200px;
}
form.option.exec input {
color:white;
background-color:#272822;
padding-left:10px;
width:600px;
}
form.option select {
margin-right:10px;
}
table.append {
font-size:14px;
overflow: auto;
}
table.append tr:hover {
background-color:lightgreen;
}
table.append th {
font-family:monospace;
background-color:lightgreen;
cursor:pointer;
}
table.append th.order {
background-color:red;
cursor:pointer;
}
table.append td {
max-width:1200px;
font-family:monospace;
padding-left: 10px;
padding-right: 20px;
}
table.append td.clip {
background-color:red;
}
table.append td:hover {
background-color:red;
}
code.result pre {
color:white;
font-size:14px;
background-color:#272822;
overflow:scroll;
padding:5px;
border:solid 2px green;
border-left:solid 4px green;
margin:0;
}
code.result pre.clipboard {
height:2em;
}
</style>
</head>
<body onkeydown="return onaction(event, 'scroll')" onkeyup="return onaction(event, 'keymap')">
<script>
var session ={{option . "session"}}
var bench_data ={{option . "bench_data"}}
</script>
{{end}}
{{define "void"}}{{end}}
{{define "detail"}}{{detail .}}{{end}}
{{define "option"}}{{option .}}{{end}}
{{define "append"}}{{append .}}{{end}}
{{define "result"}}{{result .}}{{end}}
{{define "clipboard"}}
<fieldset><legend>clipboard</legend>
<datalist id="clipstack"></datalist>
<datalist id="clistack"></datalist>
<textarea class="clipboard"></textarea>
</fieldset>
{{end}}
{{define "toolkit"}}
{{$bench_data := option . "bench_data"}}
{{$username := option . "username"|option}}
<div class="workflow">
<div>&nbsp;bench (Ctrl+B)</div>
<ul class="toolkit">
<li><div>粘贴板</div>
<ul class="txt">
<li data-action="save_txt">+ 保存粘贴板(Ctrl+S)</li>
<li data-action="create_txt">+ 添加粘贴板(Ctrl+Y)</li>
<li data-action="quick_txt">+ 快捷粘贴板(Ctrl+P)</li>
</ul>
</li>
<li><div>命令行</div>
<ul class="cmd">
{{range $name, $cmd := conf . "toolkit"}}
<li>{{$name}} <input type="text" data-cmd="{{$name}}" onkeyup="onaction(event, 'toolkit')"><label class="result"></label></li>
{{end}}
<li class="stick" data-action="shrink_cmd">+ 折叠命令行(Ctrl+Z)</li>
<li data-action="create_cmd">+ 添加命令行(Ctrl+M)</li>
{{range $index, $cmd := index $bench_data "commands"}}
<li class="cmd{{$index}}" data-cmd="{{$index}}">{{index $cmd "now"|option}} {{$index}}: {{index $cmd "cmd"|option}}</li>
{{end}}
</ul>
</li>
<li><div>工作流</div>
<ul class="fly">
<li data-action="refresh_fly">+ 刷新工作流(Ctrl+R)</li>
<li data-action="create_fly">+ 添加工作流(Ctrl+T)</li>
{{range $key, $item := work .}}
<li data-key="{{$key}}">{{index $item "create_time"}} {{index $item "data" "name"}}({{slice $key 0 6}})</li>
{{end}}
<li data-action="rename_fly">+ 命名工作流</li>
<li data-action="remove_fly">+ 删除工作流</li>
</ul>
</li>
</ul>
</div>
{{end}}
{{define "componet"}}
<fieldset><legend title="{{option .Meta "help"}}">{{option .Meta "name"}}({{option .Meta "help"}})</legend>
{{$form_type := option . "form_type"|meta}}
{{$msg := .}}
{{if eq $form_type "upload"}}
{{end}}
<form class="option {{option .Meta "componet_name"}}"
data-componet_group="{{option . "componet_group"|meta}}"
data-componet_name="{{option . "componet_name"|meta}}"
{{if eq $form_type "upload"}}
method="POST" action="/upload" enctype="multipart/form-data"
onsubmit="onaction(event,'upload')"
{{end}}
>
<input style="display:none"></input>
{{range $index, $input := option . "inputs"}}
<div>
{{$type := index $input "type"}}
{{$value := index $input "value" | parse $msg}}
{{if index $input "label"}}
<label>{{index $input "label"}} : </label>
{{end}}
{{if eq $type "button"}}
<input type="button" onclick="return onaction(event, 'cmd')" value="{{$value}}">
{{else if eq $type "submit"}}
<input type="submit" value="{{$value}}">
{{else if eq $type "file"}}
<input type="file" name="{{index $input "name"}}">
{{else if eq $type "choice"}}
{{$default_value := index $input "value"}}
<select name="{{index $input "name"}}" onchange="return onaction(event, 'cmd')">
{{range $index, $value := index $input "choice"}}
{{$val := index $value "value"}}
{{if eq $default_value $val}}
<option value="{{index $value "value"}}" selected>{{index $value "name"}}</option>
{{else}}
<option value="{{index $value "value"}}">{{index $value "name"}}</option>
{{end}}
{{end}}
</select>
{{else if eq $type "password"}}
<input
type="password"
name="{{index $input "name"}}"
value="{{$value}}"
class="{{index $input "class"}}"
onclick="return onaction(event, 'click')"
onkeyup="return onaction(event, 'input')">
{{else}}
<input
name="{{index $input "name"}}"
value="{{$value}}"
class="{{index $input "class"}}"
{{if index $input "clipstack"}}
list="{{index $input "clipstack"}}"
{{else}}
list="clipstack"
{{end}}
onclick="return onaction(event, 'click')"
onkeyup="return onaction(event, 'input')">
{{end}}
</div>
{{end}}
<hr/>
</form>
{{if eq $form_type "upload"}}
{{end}}
{{if index .Meta "display_append"}}
{{option .Meta "display_append"}}
{{else}}
<table class="append {{option .Meta "componet_name"}}">
{{$msg := .}}
<tr>{{range $field := append .}}<th>{{$field}}</th>{{end}}</tr>
{{range $line := table .}}
<tr>{{range $field := append $msg}}<td>{{index $line $field|unescape}}</td>{{end}}</tr>
{{end}}
</table>
{{end}}
{{if index .Meta "display_result"}}
{{option .Meta "display_result"}}
{{else}}
<code class="result {{option .Meta "componet_name"}}"><pre>{{result .Meta}}</pre></code>
{{end}}
</fieldset>
{{end}}
{{define "mp"}}
<script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
<script>
{{$token := cmd . "context chat js_token"}}
wx.config({
debug: true,
appId: {{append $token "appid"|meta}},
timestamp: {{append $token "timestamp"|meta}},
nonceStr: {{append $token "nonce"|meta}},
signature: {{append $token "signature"|meta}},
jsApiList: [
"scanQRCode",
"chooseImage",
"closeWindow",
"openAddress",
],
})
wx.ready(function(){
})
wx.error(function(res){
})
function scan(event) {
alert("begin scan")
wx.scanQRCode({
needResult: 0,
scanType: ["qrCode", "barCode"],
desc: "what",
success: function(res) {
alert(res.resultStr)
},
fail: function(res) {
alert(res.errMsg)
},
})
}
function close() {
wx.closeWindow({
success: function(res) {
alert(res.resultStr)
},
fail: function(res) {
alert(res.errMsg)
},
})
}
function choose() {
wx.chooseImage({
count: 1, // 默认9
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success: function (res) {
var localIds = res.localIds; // 返回选定照片的本地ID列表localId可以作为img标签的src属性显示图片
},
fail: function(res) {
alert(res.errMsg)
},
});
}
function wopen(event) {
wx.openAddress({success: function(res) {
context.Command("show", res)
}})
}
</script>
{{end}}
{{define "tail"}}
<script src="/static/librarys/context.js"></script>
<script src="/static/librarys/code.js"></script>
</body>
{{end}}