web_sandbox_console 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/app/assets/javascripts/web_sandbox_console/code_editor.js +0 -0
- data/app/assets/javascripts/web_sandbox_console/codemirror.js +9778 -0
- data/app/assets/javascripts/web_sandbox_console/matchbrackets.js +158 -0
- data/app/assets/javascripts/web_sandbox_console/ruby.js +298 -0
- data/app/assets/stylesheets/web_sandbox_console/application.css +24 -10
- data/app/assets/stylesheets/web_sandbox_console/codemirror.css +349 -0
- data/app/assets/stylesheets/web_sandbox_console/common.css +1 -1
- data/app/assets/stylesheets/web_sandbox_console/docs.css +274 -0
- data/app/assets/stylesheets/web_sandbox_console/lucario.css +45 -0
- data/app/controllers/web_sandbox_console/authorization_controller.rb +3 -1
- data/app/views/layouts/web_sandbox_console/application.html.erb +2 -2
- data/app/views/web_sandbox_console/authorization/auth_page.html.erb +2 -2
- data/app/views/web_sandbox_console/home/download_page.html.erb +1 -1
- data/app/views/web_sandbox_console/home/index.html.erb +52 -14
- data/lib/web_sandbox_console/version.rb +1 -1
- metadata +9 -3
- data/app/views/web_sandbox_console/authorization/fetch_token.js.erb +0 -3
@@ -0,0 +1,45 @@
|
|
1
|
+
/*
|
2
|
+
Name: lucario
|
3
|
+
Author: Raphael Amorim
|
4
|
+
|
5
|
+
Original Lucario color scheme (https://github.com/raphamorim/lucario)
|
6
|
+
*/
|
7
|
+
|
8
|
+
.cm-s-lucario.CodeMirror, .cm-s-lucario .CodeMirror-gutters {
|
9
|
+
background-color: #2b3e50 !important;
|
10
|
+
color: #f8f8f2 !important;
|
11
|
+
border: none;
|
12
|
+
}
|
13
|
+
.cm-s-lucario .CodeMirror-gutters { color: #2b3e50; }
|
14
|
+
.cm-s-lucario .CodeMirror-cursor { border-left: solid thin #E6C845; }
|
15
|
+
.cm-s-lucario .CodeMirror-linenumber { color: #f8f8f2; }
|
16
|
+
.cm-s-lucario .CodeMirror-selected { background: #243443; }
|
17
|
+
.cm-s-lucario .CodeMirror-line::selection, .cm-s-lucario .CodeMirror-line > span::selection, .cm-s-lucario .CodeMirror-line > span > span::selection { background: #243443; }
|
18
|
+
.cm-s-lucario .CodeMirror-line::-moz-selection, .cm-s-lucario .CodeMirror-line > span::-moz-selection, .cm-s-lucario .CodeMirror-line > span > span::-moz-selection { background: #243443; }
|
19
|
+
.cm-s-lucario span.cm-comment { color: #5c98cd; }
|
20
|
+
.cm-s-lucario span.cm-string, .cm-s-lucario span.cm-string-2 { color: #E6DB74; }
|
21
|
+
.cm-s-lucario span.cm-number { color: #ca94ff; }
|
22
|
+
.cm-s-lucario span.cm-variable { color: #f8f8f2; }
|
23
|
+
.cm-s-lucario span.cm-variable-2 { color: #f8f8f2; }
|
24
|
+
.cm-s-lucario span.cm-def { color: #72C05D; }
|
25
|
+
.cm-s-lucario span.cm-operator { color: #66D9EF; }
|
26
|
+
.cm-s-lucario span.cm-keyword { color: #ff6541; }
|
27
|
+
.cm-s-lucario span.cm-atom { color: #bd93f9; }
|
28
|
+
.cm-s-lucario span.cm-meta { color: #f8f8f2; }
|
29
|
+
.cm-s-lucario span.cm-tag { color: #ff6541; }
|
30
|
+
.cm-s-lucario span.cm-attribute { color: #66D9EF; }
|
31
|
+
.cm-s-lucario span.cm-qualifier { color: #72C05D; }
|
32
|
+
.cm-s-lucario span.cm-property { color: #f8f8f2; }
|
33
|
+
.cm-s-lucario span.cm-builtin { color: #72C05D; }
|
34
|
+
.cm-s-lucario span.cm-variable-3, .cm-s-lucario span.cm-type { color: #ffb86c; }
|
35
|
+
|
36
|
+
.cm-s-lucario .CodeMirror-activeline-background { background: #243443; }
|
37
|
+
.cm-s-lucario .CodeMirror-matchingbracket { text-decoration: underline; color: white !important; }
|
38
|
+
|
39
|
+
|
40
|
+
/* 特殊部分 补充 */
|
41
|
+
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
|
42
|
+
.cm-s-default span.cm-arrow { color: red; }
|
43
|
+
|
44
|
+
|
45
|
+
|
@@ -8,6 +8,8 @@ module WebSandboxConsole
|
|
8
8
|
def fetch_token
|
9
9
|
@token = SecureRandom.uuid
|
10
10
|
save_cache_token(@token)
|
11
|
+
flash[:notice] = "令牌: #{@token},此令牌先保存,后续使用。"
|
12
|
+
redirect_to auth_page_path
|
11
13
|
end
|
12
14
|
|
13
15
|
# 授权
|
@@ -42,7 +44,7 @@ module WebSandboxConsole
|
|
42
44
|
|
43
45
|
if times > 20
|
44
46
|
flash[:notice] = '一天内获取令牌不允许超过20次'
|
45
|
-
|
47
|
+
redirect_to root_path
|
46
48
|
end
|
47
49
|
cache.write('fetch_token_times', times + 1)
|
48
50
|
end
|
@@ -15,7 +15,7 @@
|
|
15
15
|
<b>
|
16
16
|
<img src="/assets/web_sandbox_console/logo-icon.png" />
|
17
17
|
</b>
|
18
|
-
<span style="left-padding: 10px;">运维控制台</span>
|
18
|
+
<span style="left-padding: 10px;" class="font-color">运维控制台</span>
|
19
19
|
</a>
|
20
20
|
</div>
|
21
21
|
|
@@ -59,7 +59,7 @@
|
|
59
59
|
<li>
|
60
60
|
<%= link_to "https://github.com/dongmy54/web_sandbox_console", target: "_blank", class: 'waves-effect waves-dark' do %>
|
61
61
|
<i class="fa fa-bookmark-o"></i>
|
62
|
-
<span class="hide-menu
|
62
|
+
<span class="hide-menu">说明文档</span>
|
63
63
|
<% end %>
|
64
64
|
</li>
|
65
65
|
</ul>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<h3>升级授权</h3>
|
2
2
|
|
3
3
|
<p>
|
4
|
-
<%= link_to '获取令牌', fetch_token_path
|
4
|
+
<%= link_to '获取令牌', fetch_token_path %>
|
5
5
|
<span> PS: 注意获取令牌一天最多20次,有效期仅5分钟</span>
|
6
6
|
</p>
|
7
7
|
|
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
<h4>说明令牌使用说明:</h4>
|
22
22
|
<div>
|
23
|
-
<pre>
|
23
|
+
<pre class="no-border">
|
24
24
|
require 'openssl'
|
25
25
|
require 'base64'
|
26
26
|
|
@@ -1,27 +1,65 @@
|
|
1
1
|
<h3>执行代码</h3>
|
2
2
|
|
3
|
-
<
|
3
|
+
<style type="text/css">
|
4
|
+
.wrapper-console {
|
5
|
+
position: relative;
|
6
|
+
top: 8px;
|
7
|
+
width: 100%;
|
8
|
+
height: 300px;
|
9
|
+
}
|
10
|
+
|
11
|
+
.left {
|
12
|
+
height: 100%;
|
13
|
+
/* 为了不占用绝对定位的宽度 这里计算下宽度*/
|
14
|
+
width: calc(100% - 200px);
|
15
|
+
}
|
16
|
+
|
17
|
+
.right {
|
18
|
+
position: absolute;
|
19
|
+
width: 180px;
|
20
|
+
top: 0;
|
21
|
+
bottom: 0;
|
22
|
+
right: 0;
|
23
|
+
padding-left: 15px;
|
24
|
+
}
|
25
|
+
</style>
|
26
|
+
|
27
|
+
|
28
|
+
<div class="wrapper-console">
|
4
29
|
<%= form_tag(web_sandbox_console.eval_code_path, remote: true, class: 'form') do %>
|
5
|
-
<div class= "
|
6
|
-
<%= text_area_tag :code, '', class: 'text_area_box'%>
|
30
|
+
<div class= "left">
|
31
|
+
<%= text_area_tag :code, '# 这里输入ruby代码...', class: 'text_area_box'%>
|
7
32
|
</div>
|
8
33
|
|
9
|
-
<div class="
|
10
|
-
<div
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
<%= submit_tag '提交', data: { disable_with: "已发送,处理中..." }, class: 'send-button' %></div>
|
18
|
-
<div class="margin-t-10"><%= submit_tag '异步执行', data: { disable_with: "已发送,处理中..." }, class: 'send-button' %></div>
|
34
|
+
<div class="right">
|
35
|
+
<div style="position: absolute;bottom: 0;">
|
36
|
+
<% if session[:pass_auth] %>
|
37
|
+
<p class="tip">授权成功</p>
|
38
|
+
<p class="tip">(当前修改将写入数据库)</p>
|
39
|
+
<% end %>
|
40
|
+
<%= submit_tag '提交', data: { disable_with: "已发送,处理中..." }, class: 'send-button margin-t-10' %>
|
41
|
+
<%= submit_tag '异步执行', data: { disable_with: "已发送,处理中..." }, class: 'send-button margin-t-10' %>
|
19
42
|
</div>
|
20
43
|
</div>
|
21
44
|
<% end %>
|
22
45
|
</div>
|
23
46
|
|
24
|
-
|
47
|
+
<div style="margin-top: 50px;">
|
48
|
+
<%= button_tag '清除输出', type: 'button', onclick: "$('.output-content').empty();", class: 'clear-button' %>
|
49
|
+
<div>
|
25
50
|
|
26
51
|
<div class="output-content">
|
27
52
|
</div>
|
53
|
+
|
54
|
+
|
55
|
+
<script>
|
56
|
+
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
57
|
+
mode: "text/x-ruby",
|
58
|
+
matchBrackets: true,
|
59
|
+
indentUnit: 2,
|
60
|
+
indentWithTabs: true,
|
61
|
+
theme: 'lucario',
|
62
|
+
tabSize: 2,
|
63
|
+
lineNumbers: true
|
64
|
+
});
|
65
|
+
</script>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web_sandbox_console
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dongmingyan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -52,10 +52,17 @@ files:
|
|
52
52
|
- app/assets/config/web_sandbox_console_manifest.js
|
53
53
|
- app/assets/images/web_sandbox_console/logo-icon.png
|
54
54
|
- app/assets/javascripts/web_sandbox_console/application.js
|
55
|
+
- app/assets/javascripts/web_sandbox_console/code_editor.js
|
56
|
+
- app/assets/javascripts/web_sandbox_console/codemirror.js
|
55
57
|
- app/assets/javascripts/web_sandbox_console/home.js
|
58
|
+
- app/assets/javascripts/web_sandbox_console/matchbrackets.js
|
59
|
+
- app/assets/javascripts/web_sandbox_console/ruby.js
|
56
60
|
- app/assets/stylesheets/web_sandbox_console/application.css
|
61
|
+
- app/assets/stylesheets/web_sandbox_console/codemirror.css
|
57
62
|
- app/assets/stylesheets/web_sandbox_console/common.css
|
63
|
+
- app/assets/stylesheets/web_sandbox_console/docs.css
|
58
64
|
- app/assets/stylesheets/web_sandbox_console/home.css
|
65
|
+
- app/assets/stylesheets/web_sandbox_console/lucario.css
|
59
66
|
- app/controllers/web_sandbox_console/application_controller.rb
|
60
67
|
- app/controllers/web_sandbox_console/authorization_controller.rb
|
61
68
|
- app/controllers/web_sandbox_console/home_controller.rb
|
@@ -65,7 +72,6 @@ files:
|
|
65
72
|
- app/models/web_sandbox_console/application_record.rb
|
66
73
|
- app/views/layouts/web_sandbox_console/application.html.erb
|
67
74
|
- app/views/web_sandbox_console/authorization/auth_page.html.erb
|
68
|
-
- app/views/web_sandbox_console/authorization/fetch_token.js.erb
|
69
75
|
- app/views/web_sandbox_console/home/do_view_file.js.erb
|
70
76
|
- app/views/web_sandbox_console/home/download_page.html.erb
|
71
77
|
- app/views/web_sandbox_console/home/eval_code.js.erb
|