diff --git a/configs/nginx/ext.d/.gitignore b/configs/nginx/apps/.gitignore similarity index 100% rename from configs/nginx/ext.d/.gitignore rename to configs/nginx/apps/.gitignore diff --git a/configs/nginx/apps/kvm/manifest.json b/configs/nginx/apps/kvm/manifest.json new file mode 100644 index 00000000..710af6f0 --- /dev/null +++ b/configs/nginx/apps/kvm/manifest.json @@ -0,0 +1,6 @@ +{ + "name": "KVM", + "description": "Open KVM session in a web browser", + "path": "/kvm.html", + "place": 0 +} diff --git a/configs/nginx/nginx.conf b/configs/nginx/nginx.conf index ce4b5799..22271d20 100644 --- a/configs/nginx/nginx.conf +++ b/configs/nginx/nginx.conf @@ -6,7 +6,7 @@ worker_processes 4; # error_log /tmp/nginx.error.log; error_log stderr; -include /etc/nginx/ext.d/*/main-ctx.conf; +include /etc/nginx/apps/*/main-ctx.conf; events { worker_connections 1024; @@ -40,7 +40,7 @@ http { server 127.0.0.1:8082 fail_timeout=0s max_fails=0; } - include /etc/nginx/ext.d/*/http-ctx.conf; + include /etc/nginx/apps/*/http-ctx.conf; lua_shared_dict WS_TOKENS 10m; init_by_lua_block { @@ -49,14 +49,16 @@ http { local cjson = require("cjson"); local io = require("io"); - EXTENSIONS = {}; - local extensions_dir_path = "/etc/nginx/ext.d"; - for extension in io.popen("ls " .. extensions_dir_path):lines() do - local manifest_file = assert(io.open(extensions_dir_path .. "/" .. extension .. "/manifest.json", "r")); + local apps = {}; + local apps_dir_path = "/etc/nginx/apps"; + for app in io.popen("ls " .. apps_dir_path):lines() do + local manifest_file = assert(io.open(apps_dir_path .. "/" .. app .. "/manifest.json", "r")); local manifest = cjson.decode(manifest_file:read("*all")); manifest_file:close(); - EXTENSIONS[manifest["name"]] = manifest; + apps[app] = manifest; end + + APPS_JSON = cjson.encode(apps); } #PROD server { @@ -84,7 +86,7 @@ http { index index.html; } - location /wsauth { + location /ws_auth { # Workaround for Safari: https://bugs.webkit.org/show_bug.cgi?id=80362 #PROD access_by_lua_block { #PROD local token = ngx.encode_base64(ngx.sha1_bin(ngx.var.http_Authorization)); @@ -96,11 +98,10 @@ http { } } - location /extensions { + location /get_apps { default_type "application/json"; content_by_lua_block { - local cjson = require("cjson"); - ngx.say(cjson.encode(EXTENSIONS)); + ngx.say(APPS_JSON); } } @@ -110,7 +111,7 @@ http { #PROD local token = ngx.var.cookie_WS_ACCESS_TOKEN; #PROD local value, _ = ngx.shared.WS_TOKENS:get(token); #PROD if value == nil then -#PROD ngx.exec("/wsauth"); +#PROD ngx.exec("/ws_auth"); #PROD end #PROD } rewrite ^/kvmd/ws$ /ws break; @@ -164,6 +165,6 @@ http { proxy_ignore_headers X-Accel-Buffering; } - include /etc/nginx/ext.d/*/server-ctx.conf; + include /etc/nginx/apps/*/server-ctx.conf; } } diff --git a/web/apps/.gitignore b/web/apps/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/web/index.html b/web/index.html index d8de279f..64ecdab0 100644 --- a/web/index.html +++ b/web/index.html @@ -1,606 +1,6 @@
- -
- Esc
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
F11
F12
~
`
!
1
@
2
#
3
$
4
%
5
^
6
&
7
*
8
(
9
)
0
_
-
+
=
↤
⇤
⇥
Q
W
E
R
T
Y
U
I
O
P
{
[
}
]
|
\
Caps Lock
A
S
D
F
G
H
J
K
L
:
;
"
'
Enter
↵
•
Shift
Z
X
C
V
B
N
M
<
,
>
.
?
/
•
Shift
•
Ctrl
•
Win
•
Alt
•
Alt
•
Win
•
Ctrl
•
Pt/Sq
ScrLk
P/Brk
Ins
Home
PgUp
Del
End
PgDn
↑
←
↓
→
Esc
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
F11
F12
•
Pt/Sq
ScrLk
P/Brk
Ins
Home
End
Del
~
`
!
1
@
2
#
3
$
4
%
5
^
6
&
7
*
8
(
9
)
0
_
-
+
=
↤
⇤
⇥
Q
W
E
R
T
Y
U
I
O
P
{
[
}
]
|
\
Caps Lock
A
S
D
F
G
H
J
K
L
:
;
"
'
Enter
↵
•
Shift
Z
X
C
V
B
N
M
<
,
>
.
?
/
PgUp
↑
PgDn
•
Ctrl
•
Win
•
Alt
•
Alt
•
Win
•
Shift
•
Ctrl
←
↓
→
|
- |
-
-
|
- |||||||||
+ Esc
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
F11
F12
~
`
!
1
@
2
#
3
$
4
%
5
^
6
&
7
*
8
(
9
)
0
_
-
+
=
↤
⇤
⇥
Q
W
E
R
T
Y
U
I
O
P
{
[
}
]
|
\
Caps Lock
A
S
D
F
G
H
J
K
L
:
;
"
'
Enter
↵
•
Shift
Z
X
C
V
B
N
M
<
,
>
.
?
/
•
Shift
•
Ctrl
•
Win
•
Alt
•
Alt
•
Win
•
Ctrl
•
Pt/Sq
ScrLk
P/Brk
Ins
Home
PgUp
Del
End
PgDn
↑
←
↓
→
Esc
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
F11
F12
•
Pt/Sq
ScrLk
P/Brk
Ins
Home
End
Del
~
`
!
1
@
2
#
3
$
4
%
5
^
6
&
7
*
8
(
9
)
0
_
-
+
=
↤
⇤
⇥
Q
W
E
R
T
Y
U
I
O
P
{
[
}
]
|
\
Caps Lock
A
S
D
F
G
H
J
K
L
:
;
"
'
Enter
↵
•
Shift
Z
X
C
V
B
N
M
<
,
>
.
?
/
PgUp
↑
PgDn
•
Ctrl
•
Win
•
Alt
•
Alt
•
Win
•
Shift
•
Ctrl
←
↓
→
|
+ |
+
+
|
+ |||||||||