mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
/extensions using lua
This commit is contained in:
@@ -42,15 +42,27 @@ http {
|
|||||||
|
|
||||||
include /etc/nginx/ext.d/*/http-ctx.conf;
|
include /etc/nginx/ext.d/*/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");
|
||||||
|
|
||||||
|
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 manifest = cjson.decode(manifest_file:read("*all"));
|
||||||
|
manifest_file:close();
|
||||||
|
EXTENSIONS[manifest["name"]] = manifest;
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
#PROD server {
|
#PROD server {
|
||||||
#PROD listen 80;
|
#PROD listen 80;
|
||||||
#PROD server_name localhost;
|
#PROD server_name localhost;
|
||||||
#PROD return 301 https://$host$request_uri;
|
#PROD return 301 https://$host$request_uri;
|
||||||
#PROD }
|
|
||||||
|
|
||||||
#PROD lua_shared_dict WS_TOKENS 10m;
|
|
||||||
#PROD init_by_lua_block {
|
|
||||||
#PROD WS_TOKEN_EXPIRES = 10;
|
|
||||||
#PROD }
|
#PROD }
|
||||||
|
|
||||||
server {
|
server {
|
||||||
@@ -84,6 +96,14 @@ http {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location /extensions {
|
||||||
|
default_type "application/json";
|
||||||
|
content_by_lua_block {
|
||||||
|
local cjson = require("cjson");
|
||||||
|
ngx.say(cjson.encode(EXTENSIONS));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
location /kvmd/ws {
|
location /kvmd/ws {
|
||||||
#PROD auth_basic off;
|
#PROD auth_basic off;
|
||||||
#PROD access_by_lua_block {
|
#PROD access_by_lua_block {
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ RUN pacman -Syy \
|
|||||||
nginx-mainline \
|
nginx-mainline \
|
||||||
ustreamer \
|
ustreamer \
|
||||||
socat \
|
socat \
|
||||||
|
lua51-cjson \
|
||||||
&& env MAKEPKGOPTS="--skipchecksums --skippgpcheck" user-packer -S --noconfirm nginx-mainline-mod-lua \
|
&& env MAKEPKGOPTS="--skipchecksums --skippgpcheck" user-packer -S --noconfirm nginx-mainline-mod-lua \
|
||||||
&& pacman -Sc --noconfirm
|
&& pacman -Sc --noconfirm
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user