Просмотр исходного кода

fix button keyboard on android

rufengsuixing 5 лет назад
Родитель
Сommit
c566defbf3

+ 6 - 1
luasrc/controller/AdGuardHome.lua

@@ -13,8 +13,13 @@ entry({"admin", "services", "AdGuardHome"},
 	entry({"admin", "services", "AdGuardHome", "doupdate"}, call("do_update"))
 	entry({"admin", "services", "AdGuardHome", "getlog"}, call("get_log"))
 	entry({"admin", "services", "AdGuardHome", "dodellog"}, call("do_dellog"))
+	entry({"admin", "services", "AdGuardHome", "reloadconfig"}, call("reload_config"))
 end 
-
+function reload_config()
+	NXFS.remove("/tmp/AdGuardHometmpconfig.yaml")
+	luci.http.prepare_content("application/json")
+	luci.http.write('')
+end
 function act_status()
 	local e={}
 	binpath=uci:get("AdGuardHome","AdGuardHome","binpath")

+ 3 - 7
luasrc/model/cbi/AdGuardHome/manual.lua

@@ -63,13 +63,14 @@ end
 o.remove = function(self, section, value)
 	NXFS.writefile(escconf, "")
 end
+--- js and reload button
 o = s:option(DummyValue, "")
 o.anonymous=true
 o.template = "AdGuardHome/yamleditor"
 if not NXFS.access(binpath) then
 	o.description=translate("WARNING!!! no bin found apply config will not be test")
 end
---- log
+--- log 
 if (NXFS.access("/tmp/AdGuardHometmpconfig.yaml")) then
 local c=NXFS.readfile("/tmp/AdGuardHometest.log")
 if (c~="") then
@@ -77,15 +78,10 @@ o = s:option(TextValue, "")
 o.readonly=true
 o.rows = 5
 o.rmempty = true
+o.name=""
 o.cfgvalue = function(self, section)
 	return NXFS.readfile("/tmp/AdGuardHometest.log")
 end
---- reload config
-o=s:option(Button,"","")
-o.inputtitle=translate("Reload Config")
-o.write=function()
-	NXFS.remove("/tmp/AdGuardHometmpconfig.yaml")
-end
 end
 end
 return m

+ 3 - 3
luasrc/view/AdGuardHome/AdGuardHome_check.htm

@@ -2,13 +2,13 @@
 <%uci=require"luci.model.uci".cursor()%>
 <%nixio=require"nixio"%>
 
-<input class="cbi-button cbi-button-apply" name="apply_update_button" id="apply_update_button" value="<%:Update core version%>" onclick=" return apply_update() "/>
+<input type="button" class="cbi-button cbi-button-apply" id="apply_update_button" value="<%:Update core version%>" onclick=" return apply_update() "/>
 <% if not nixio.fs.access(uci:get("AdGuardHome","AdGuardHome","configpath"))then %>
-<input class="cbi-button cbi-button-apply" name="to_configpage" id="to_configpage" value="<%:Fast config%>" onclick="location.href='<%=url([[admin]], [[services]], [[AdGuardHome]], [[manual]])%>'"/>
+<input type="button" class="cbi-button cbi-button-apply" id="to_configpage" value="<%:Fast config%>" onclick="location.href='<%=url([[admin]], [[services]], [[AdGuardHome]], [[manual]])%>'"/>
 <%end%>
 
 
-		<textarea id="cbid.logview.1.conf" class="cbi-input-textarea" style="width: 100%;display:none" data-update="change" name="vbid.logview.1.conf" rows="5" cols="60" readonly="readonly" > </textarea>
+		<textarea id="cbid.logview.1.conf" class="cbi-input-textarea" style="width: 100%;display:none" data-update="change" rows="5" cols="60" readonly="readonly" > </textarea>
 <script type="text/javascript">//<![CDATA[
 function apply_update(){
 	XHR.get('<%=url([[admin]], [[services]], [[AdGuardHome]], [[doupdate]])%>',null,function(x, data){}

+ 1 - 1
luasrc/view/AdGuardHome/AdGuardHome_chpass.htm

@@ -46,7 +46,7 @@ function chpass(btn)
 	%> />
 	<% if self.password then %><img src="<%=resource%>/cbi/reload.gif" style="vertical-align:middle" title="<%:Reveal/hide password%>" onclick="var e = document.getElementById('<%=cbid%>'); e.type = (e.type=='password') ? 'text' : 'password';" /><% end %>
 	
-	<input class="cbi-button cbi-button-apply" name="cbid.AdGuardHome.AdGuardHome.applychpass" id="cbid.AdGuardHome.AdGuardHome.applychpass" value="<%:Load culculate model%>" onclick="return chpass(this)"/>
+	<input type="button" class="cbi-button cbi-button-apply" id="cbid.AdGuardHome.AdGuardHome.applychpass" value="<%:Load culculate model%>" onclick="return chpass(this)"/>
 
 	
 <%+cbi/valuefooter%>

+ 11 - 12
luasrc/view/AdGuardHome/log.htm

@@ -1,19 +1,19 @@
 <%+cbi/valueheader%>
-<%uci=require"luci.model.uci".cursor()%>
-<%nixio=require"nixio"%>
-<%logfile=uci:get("AdGuardHome","AdGuardHome","logfile")%>
-<%if (logfile=="syslog" or logfile==nil ) then%>
-<%timereplace=false%>
-<%else%>
-<%timereplace=true%>
-<%end%>
+<%uci=require"luci.model.uci".cursor()
+nixio=require"nixio"
+logfile=uci:get("AdGuardHome","AdGuardHome","logfile")
+if (logfile=="syslog" or logfile==nil ) then
+timereplace=false
+else
+timereplace=true
+end%>
 <input type="checkbox" name="NAME" value="reverse" onclick=" return reverselog()" style="vertical-align:middle;height: auto;" checked><%:reverse%></input>
 <%if timereplace==true then%>
 <input type="checkbox" name="NAME" value="localtime" onclick=" return chlogtime()" style="vertical-align:middle;height: auto;" checked><%:localtime%></input><br>
 <%end%>
-<textarea id="cbid.logview.1.conf" class="cbi-input-textarea" style="width: 100%;display:inline" data-update="change" name="vbid.logview.1.conf" rows="32" cols="60" readonly="readonly" > </textarea>
-<input class="cbi-button cbi-button-apply" name="apply_update_button" id="apply_update_button" value="<%:dellog%>" onclick=" return apply_del_log() "/>
-<input class="cbi-button cbi-button-apply" name="backup" value="<%:download log%>" style=" display:inline;" onclick=" return download_log()" />
+<textarea id="cbid.logview.1.conf" class="cbi-input-textarea" style="width: 100%;display:inline" data-update="change" rows="32" cols="60" readonly="readonly" > </textarea>
+<input type="button" class="cbi-button cbi-button-apply" id="apply_update_button" value="<%:dellog%>" onclick=" return apply_del_log() "/>
+<input type="button" class="cbi-button cbi-button-apply" value="<%:download log%>" style=" display:inline;" onclick=" return download_log()" />
 <script type="text/javascript">//<![CDATA[
 var islogreverse = true;
 var isutc2local = <%=tostring(timereplace)%>;
@@ -80,7 +80,6 @@ if (v==""){strt[i]="";return;}
 var dt = new Date(v.substring(0,19))
   strt[i]=dt.getUTCFullYear()+"/"+p(dt.getUTCMonth()+1)+"/"+p(dt.getUTCDate())+" "+p(dt.getUTCHours())+":"+p(dt.getUTCMinutes())+":"+p(dt.getUTCSeconds())+v.substring(19)
 })
-console.debug("toutc",strt[2]);
 return strt
 }
 function poll_check(){

+ 8 - 0
luasrc/view/AdGuardHome/yamleditor.htm

@@ -21,6 +21,14 @@ foldGutter: true
 }
 );
 //]]>
+function reload_config(){
+	XHR.get('<%=url([[admin]], [[services]], [[AdGuardHome]], [[reloadconfig]])%>', null,
+	function(x, data) {
+	location.reload();
+	});
 </script> 
+<%if NXFS.access("/tmp/AdGuardHometmpconfig.yaml") then%>
+<input type="button" id="apply_update_button" value="<%:Reload Config%>" onclick=" return reload_config() "/>
+<%end%>
 <%+cbi/valuefooter%>