gluon-luci-portconfig: portconfig.lua: change spaces to tabs (#998)
This commit is contained in:
		
							parent
							
								
									2ddf77fc81
								
							
						
					
					
						commit
						d09351c97c
					
				| @ -7,7 +7,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); | |||||||
| you may not use this file except in compliance with the License. | you may not use this file except in compliance with the License. | ||||||
| You may obtain a copy of the License at | You may obtain a copy of the License at | ||||||
| 
 | 
 | ||||||
|         http://www.apache.org/licenses/LICENSE-2.0 | http://www.apache.org/licenses/LICENSE-2.0 | ||||||
| 
 | 
 | ||||||
| $Id$ | $Id$ | ||||||
| ]]-- | ]]-- | ||||||
| @ -75,11 +75,11 @@ o.rmempty = false | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| if dns then | if dns then | ||||||
|   s = f:section(SimpleSection, nil, nil) | 	s = f:section(SimpleSection, nil, nil) | ||||||
| 
 | 
 | ||||||
|   o = s:option(DynamicList, "dns", translate("Static DNS servers")) | 	o = s:option(DynamicList, "dns", translate("Static DNS servers")) | ||||||
|   o:write(nil, uci:get("gluon-wan-dnsmasq", dns, "server")) | 	o:write(nil, uci:get("gluon-wan-dnsmasq", dns, "server")) | ||||||
|   o.datatype = "ipaddr" | 	o.datatype = "ipaddr" | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| s = f:section(SimpleSection, nil, nil) | s = f:section(SimpleSection, nil, nil) | ||||||
| @ -89,80 +89,79 @@ o.default = uci:get_bool("network", "mesh_wan", "auto") and o.enabled or o.disab | |||||||
| o.rmempty = false | o.rmempty = false | ||||||
| 
 | 
 | ||||||
| if sysconfig.lan_ifname then | if sysconfig.lan_ifname then | ||||||
|   o = s:option(Flag, "mesh_lan", translate("Enable meshing on the LAN interface")) | 	o = s:option(Flag, "mesh_lan", translate("Enable meshing on the LAN interface")) | ||||||
|   o.default = uci:get_bool("network", "mesh_lan", "auto") and o.enabled or o.disabled | 	o.default = uci:get_bool("network", "mesh_lan", "auto") and o.enabled or o.disabled | ||||||
|   o.rmempty = false | 	o.rmempty = false | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| if uci:get('system', 'gpio_switch_poe_passthrough') then | if uci:get('system', 'gpio_switch_poe_passthrough') then | ||||||
|   s = f:section(SimpleSection, nil, nil) | 	s = f:section(SimpleSection, nil, nil) | ||||||
|   o = s:option(Flag, "poe_passthrough", translate("Enable PoE passthrough")) | 	o = s:option(Flag, "poe_passthrough", translate("Enable PoE passthrough")) | ||||||
|   o.default = uci:get_bool("system", "gpio_switch_poe_passthrough", "value") and o.enabled or o.disabled | 	o.default = uci:get_bool("system", "gpio_switch_poe_passthrough", "value") and o.enabled or o.disabled | ||||||
|   o.rmempty = false | 	o.rmempty = false | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| function f.handle(self, state, data) | function f.handle(self, state, data) | ||||||
|   if state == FORM_VALID then | 	if state == FORM_VALID then | ||||||
|     uci:set("network", "wan", "proto", data.ipv4) | 	uci:set("network", "wan", "proto", data.ipv4) | ||||||
|     if data.ipv4 == "static" then | 	if data.ipv4 == "static" then | ||||||
|       uci:set("network", "wan", "ipaddr", data.ipv4_addr:trim()) | 		uci:set("network", "wan", "ipaddr", data.ipv4_addr:trim()) | ||||||
|       uci:set("network", "wan", "netmask", data.ipv4_netmask:trim()) | 		uci:set("network", "wan", "netmask", data.ipv4_netmask:trim()) | ||||||
|       uci:set("network", "wan", "gateway", data.ipv4_gateway:trim()) | 		uci:set("network", "wan", "gateway", data.ipv4_gateway:trim()) | ||||||
|     else | 	else | ||||||
|       uci:delete("network", "wan", "ipaddr") | 		uci:delete("network", "wan", "ipaddr") | ||||||
|       uci:delete("network", "wan", "netmask") | 		uci:delete("network", "wan", "netmask") | ||||||
|       uci:delete("network", "wan", "gateway") | 		uci:delete("network", "wan", "gateway") | ||||||
|     end | 	end | ||||||
| 
 | 
 | ||||||
|     uci:set("network", "wan6", "proto", data.ipv6) | 	uci:set("network", "wan6", "proto", data.ipv6) | ||||||
|     if data.ipv6 == "static" then | 	if data.ipv6 == "static" then | ||||||
|       uci:set("network", "wan6", "ip6addr", data.ipv6_addr:trim()) | 		uci:set("network", "wan6", "ip6addr", data.ipv6_addr:trim()) | ||||||
|       uci:set("network", "wan6", "ip6gw", data.ipv6_gateway:trim()) | 		uci:set("network", "wan6", "ip6gw", data.ipv6_gateway:trim()) | ||||||
|     else | 	else | ||||||
|       uci:delete("network", "wan6", "ip6addr") | 		uci:delete("network", "wan6", "ip6addr") | ||||||
|       uci:delete("network", "wan6", "ip6gw") | 		uci:delete("network", "wan6", "ip6gw") | ||||||
|     end | 	end | ||||||
| 
 | 
 | ||||||
|     uci:set("network", "mesh_wan", "auto", data.mesh_wan) | 	uci:set("network", "mesh_wan", "auto", data.mesh_wan) | ||||||
| 
 | 
 | ||||||
|     if sysconfig.lan_ifname then | 	if sysconfig.lan_ifname then | ||||||
|       uci:set("network", "mesh_lan", "auto", data.mesh_lan) | 		uci:set("network", "mesh_lan", "auto", data.mesh_lan) | ||||||
| 
 | 
 | ||||||
|       local doit | 		local doit | ||||||
|       if data.mesh_lan == '1' then | 		if data.mesh_lan == '1' then | ||||||
|         doit = uci.remove_from_set | 		doit = uci.remove_from_set | ||||||
|       else | 		else | ||||||
|         doit = uci.add_to_set | 		doit = uci.add_to_set | ||||||
|       end | 		end | ||||||
| 
 | 
 | ||||||
|       for _, lanif in ipairs(lutil.split(sysconfig.lan_ifname, ' ')) do | 		for _, lanif in ipairs(lutil.split(sysconfig.lan_ifname, ' ')) do | ||||||
|         doit(uci, "network", "client", "ifname", lanif) | 		doit(uci, "network", "client", "ifname", lanif) | ||||||
|       end | 		end | ||||||
|     end | 	end | ||||||
| 
 | 
 | ||||||
|     uci:save("network") | 	uci:save("network") | ||||||
|     uci:commit("network") | 	uci:commit("network") | ||||||
| 
 | 
 | ||||||
|     if uci:get('system', 'gpio_switch_poe_passthrough') then | 	if uci:get('system', 'gpio_switch_poe_passthrough') then | ||||||
|         uci:set('system', 'gpio_switch_poe_passthrough', 'value', data.poe_passthrough) | 	uci:set('system', 'gpio_switch_poe_passthrough', 'value', data.poe_passthrough) | ||||||
|         uci:save('system') | 	uci:save('system') | ||||||
|         uci:commit('system') | 	uci:commit('system') | ||||||
|     end | 	end | ||||||
| 
 | 
 | ||||||
|     if dns then | 	if dns then | ||||||
|       if #data.dns > 0 then | 		if #data.dns > 0 then | ||||||
|         uci:set("gluon-wan-dnsmasq", dns, "server", data.dns) | 		uci:set("gluon-wan-dnsmasq", dns, "server", data.dns) | ||||||
|       else | 		else | ||||||
|         uci:delete("gluon-wan-dnsmasq", dns, "server") | 		uci:delete("gluon-wan-dnsmasq", dns, "server") | ||||||
|       end | 		end | ||||||
| 
 | 
 | ||||||
|       uci:save("gluon-wan-dnsmasq") | 		uci:save("gluon-wan-dnsmasq") | ||||||
|       uci:commit("gluon-wan-dnsmasq") | 		uci:commit("gluon-wan-dnsmasq") | ||||||
|     end | 	end | ||||||
|   end | 	end | ||||||
| 
 | 
 | ||||||
|   return true | 	return true | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| return f | return f | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user