mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
moved lua crutch to kvmd
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
0
configs/nginx/apps/.gitignore
vendored
0
configs/nginx/apps/.gitignore
vendored
@@ -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
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user