From 86588f07922169244086c4037689c385a7381ba0 Mon Sep 17 00:00:00 2001 From: Ycarus Date: Thu, 13 Sep 2018 15:07:30 +0200 Subject: [PATCH] Fix glorytun interface --- .../luasrc/model/cbi/glorytun.lua | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/luci-app-glorytun/luasrc/model/cbi/glorytun.lua b/luci-app-glorytun/luasrc/model/cbi/glorytun.lua index 8d6709d17..1a36cda2d 100644 --- a/luci-app-glorytun/luasrc/model/cbi/glorytun.lua +++ b/luci-app-glorytun/luasrc/model/cbi/glorytun.lua @@ -58,20 +58,29 @@ function s.create(self, name) luci.cbi.CREATE_PREFIX .. self.config .. "." .. self.sectiontype .. ".text" ) - if string.len(name)>3 and not name:match("[^a-zA-Z0-9_]") then - uci:section( - "glorytun", "glorytun", name, - uci:get_all( "glorytun_recipes", recipe ) - ) + if #name > 3 and not name:match("[^a-zA-Z0-9_]") then + --uci:section( + -- "glorytun", "glorytun", name, + -- uci:get_all( "glorytun_recipes", recipe ) + --) + local recipe_data = uci:get_all( "glorytun_recipes", recipe ) + uci:set("glorytun", name,"glorytun") + local k, v + for k, v in pairs(recipe_data) do + uci:set("glorytun", name, k,v) + end uci:delete("glorytun", name, "_role") uci:delete("glorytun", name, "_description") + uci:commit("glorytun") uci:save("glorytun") luci.http.redirect( self.extedit:format(name) ) - else + elseif #name > 0 then self.invalid_cts = true end + + return 0 end