moved lua crutch to kvmd

This commit is contained in:
Devaev Maxim
2018-11-18 08:11:18 +03:00
parent 51dd9a7428
commit 9762c82d0a
15 changed files with 98 additions and 51 deletions

View File

@@ -1,5 +1,5 @@
# Don't touch this file otherwise your device may stop working.
# You can find a workable configuration in /usr/share/kvmd/configs/kvmd.
# You can find a working configuration in /usr/share/kvmd/configs.default/kvmd.
kvmd:
server:
@@ -9,6 +9,7 @@ kvmd:
info:
meta: /etc/kvmd/meta.yaml
extras: /usr/share/kvmd/extras
hid:
pinout:

View File

@@ -1,5 +1,5 @@
# Don't touch this file otherwise your device may stop working.
# You can find a workable configuration in /usr/share/kvmd/configs/kvmd.
# You can find a workable configuration in /usr/share/kvmd/configs.default/kvmd.
kvmd:
server:
@@ -9,6 +9,7 @@ kvmd:
info:
meta: /etc/kvmd/meta.yaml
extras: /usr/share/kvmd/extras
hid:
pinout:

View File

View File

@@ -1,8 +0,0 @@
{
"name": "KVM",
"description": "Open KVM session in a web browser",
"icon": "/svg/kvm.svg",
"path": "/kvm.html",
"place": 0,
"keyboard_cap": true
}

View File

@@ -6,7 +6,7 @@ worker_processes 4;
# error_log /tmp/nginx.error.log;
error_log stderr;
include /etc/nginx/apps/*/main-ctx.conf;
include /usr/share/kvmd/extras/*/nginx.main-ctx.conf;
events {
worker_connections 1024;
@@ -40,26 +40,12 @@ http {
server 127.0.0.1:8082 fail_timeout=0s max_fails=0;
}
include /etc/nginx/apps/*/http-ctx.conf;
include /usr/share/kvmd/extras/*/nginx.http-ctx.conf;
lua_shared_dict WS_TOKENS 10m;
init_by_lua_block {
WS_TOKEN_EXPIRES = 10;
local cjson = require("cjson");
local io = require("io");
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();
apps[app] = manifest;
end
APPS_JSON = cjson.encode(apps);
}
#PROD lua_shared_dict WS_TOKENS 10m;
#PROD init_by_lua_block {
#PROD WS_TOKEN_EXPIRES = 10;
#PROD }
#PROD server {
#PROD listen 80;
@@ -98,13 +84,6 @@ http {
}
}
location /get_apps {
default_type "application/json";
content_by_lua_block {
ngx.say(APPS_JSON);
}
}
location /kvmd/ws {
#PROD auth_basic off;
#PROD access_by_lua_block {
@@ -165,6 +144,6 @@ http {
proxy_ignore_headers X-Accel-Buffering;
}
include /etc/nginx/apps/*/server-ctx.conf;
include /usr/share/kvmd/extras/*/nginx.server-ctx.conf;
}
}