diff --git a/package/lean/luci-app-ssr-plus/Makefile b/package/lean/luci-app-ssr-plus/Makefile index 051fea6327..a19e9a4011 100644 --- a/package/lean/luci-app-ssr-plus/Makefile +++ b/package/lean/luci-app-ssr-plus/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-ssr-plus -PKG_RELEASE:=139 +PKG_RELEASE:=140 PKG_VERSION:=1 define Package/$(PKG_NAME)/config diff --git a/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua b/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua index 81d25ccecd..a4c2008e52 100644 --- a/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua +++ b/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua @@ -8,6 +8,7 @@ local fs = require "nixio.fs" local sys = require "luci.sys" local sid = arg[1] local uuid = luci.sys.exec("cat /proc/sys/kernel/random/uuid") +local http = require "luci.http" local function isKcptun(file) if not fs.access(file, "rwx", "rx", "rx") then @@ -165,11 +166,11 @@ o.rmempty = true o:depends("type", "ss") -- Shadowsocks Plugin -o = s:option(Value, "plugin", "Plugin") +o = s:option(Value, "plugin", translate("Plugin")) o.rmempty = true o:depends("type", "ss") -o = s:option(Value, "plugin_opts", "Plugin Opts") +o = s:option(Value, "plugin_opts", translate("Plugin Opts")) o.rmempty = true o:depends("type", "ss") @@ -366,6 +367,54 @@ o.rmempty = true o.default = "8" o:depends("mux", "1") +-- [[ Cert ]]-- +o = s:option(Flag, "certificate", translate("Self-signed Certificate")) +o.rmempty = true +o.default = "0" +o:depends("type", "trojan") +o:depends("type", "v2ray") +o.description = translate("If you have a self-signed certificate,please check the box") + +o = s:option(DummyValue, "upload", translate("Upload")) +o.template = "shadowsocksr/certupload" +o:depends("certificate", 1) + +cert_dir = "/etc/ssl/private/" +local path + +http.setfilehandler( + function(meta, chunk, eof) + if not fd then + if (not meta) or (not meta.name) or (not meta.file) then return end + fd = nixio.open(cert_dir .. meta.file, "w") + if not fd then + path = translate("Create upload file error.") + return + end + end + if chunk and fd then + fd:write(chunk) + end + if eof and fd then + fd:close() + fd = nil + path = '/etc/ssl/private/' .. meta.file .. '' + end + end + ) +if luci.http.formvalue("upload") then + local f = luci.http.formvalue("ulfile") + if #f <= 0 then + path = translate("No specify upload file.") + end +end + +o = s:option(Value, "certpath", translate("Current Certificate Path")) +o:depends("certificate", 1) +o:value("/etc/ssl/private/") +o.description = translate("Please confirm the current certificate path") +o.default = "/etc/ssl/private/" + o = s:option(Flag, "fast_open", translate("TCP Fast Open")) o.rmempty = true o.default = "0" diff --git a/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/certupload.htm b/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/certupload.htm new file mode 100644 index 0000000000..27ad7ae83b --- /dev/null +++ b/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/certupload.htm @@ -0,0 +1,4 @@ +<%+cbi/valueheader%> + + +<%+cbi/valuefooter%> \ No newline at end of file diff --git a/package/lean/luci-app-ssr-plus/po/zh_Hans/luci-app-ssr-plus.po b/package/lean/luci-app-ssr-plus/po/zh_Hans/luci-app-ssr-plus.po index 83e94494ae..724c31e829 100644 --- a/package/lean/luci-app-ssr-plus/po/zh_Hans/luci-app-ssr-plus.po +++ b/package/lean/luci-app-ssr-plus/po/zh_Hans/luci-app-ssr-plus.po @@ -794,6 +794,27 @@ msgstr "SOCKS(4/5)代理" msgid "Enable SOCKS Proxy" msgstr "启用 SOCKS 代理" +msgid "Self-signed Certificate" +msgstr "自签证书" + +msgid "If you have a self-signed certificate,please check the box" +msgstr "如果你使用自签证书,请选择" + +msgid "upload" +msgstr "上传" + +msgid "Upload" +msgstr "上传" + +msgid "No specify upload file." +msgstr "没有上传证书" + +msgid "Current Certificate Path" +msgstr "当前证书路径" + +msgid "Please confirm the current certificate path" +msgstr "请选择确认所传证书,证书不正确将无法运行" + #~ msgid "ShadowSocksR Client" #~ msgstr "ShadowSocksR 客户端"