1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Add backup to VPS interface and simplify IPv6 enable/disable

This commit is contained in:
Ycarus (Yannick Chabanois) 2019-10-09 18:40:05 +02:00
parent e9556c107c
commit 88706de9b2
9 changed files with 142 additions and 116 deletions

View file

@ -19,6 +19,8 @@ function index()
entry({"admin", "system", "openmptcprouter", "settings"}, template("openmptcprouter/settings"), _("Advanced Settings"), 3).leaf = true
entry({"admin", "system", "openmptcprouter", "settings_add"}, post("settings_add")).leaf = true
entry({"admin", "system", "openmptcprouter", "update_vps"}, post("update_vps")).leaf = true
entry({"admin", "system", "openmptcprouter", "backup"}, template("openmptcprouter/backup"), _("Backup on server"), 3).leaf = true
entry({"admin", "system", "openmptcprouter", "backupgr"}, post("backupgr")).leaf = true
entry({"admin", "system", "openmptcprouter", "debug"}, template("openmptcprouter/debug"), _("Show all settings"), 5).leaf = true
end
@ -263,9 +265,10 @@ function wizard_add()
ucic:commit("network")
-- Enable/disable IPv6
local disable_ipv6 = luci.http.formvalue("enableipv6") or "1"
local ut = require "luci.util"
local result = ut.ubus("openmptcprouter", "set_ipv6_state", { disable_ipv6 = disable_ipv6 })
local disableipv6 = luci.http.formvalue("enableipv6") or "1"
ucic:set("openmptcprouter","settings","disable_ipv6",disable_ipv6)
--local ut = require "luci.util"
--local result = ut.ubus("openmptcprouter", "set_ipv6_state", { disable_ipv6 = disableipv6 })
-- Get VPN set by default
local default_vpn = luci.http.formvalue("default_vpn") or "glorytun_tcp"
@ -699,6 +702,17 @@ function update_vps()
end
end
function backupgr()
local get_backup = luci.http.formvalue("restore") or ""
if get_backup ~= "" then
luci.sys.call("/etc/init.d/openmptcprouter-vps backup_get >/dev/null 2>/dev/null")
end
local send_backup = luci.http.formvalue("save") or ""
if send_backup ~= "" then
luci.sys.call("/etc/init.d/openmptcprouter-vps backup_send >/dev/null 2>/dev/null")
end
end
function get_device(interface)
local dump = require("luci.util").ubus("network.interface.%s" % interface, "status", {})
return dump['l3_device']