luci-app-usb3disable: add package
This commit is contained in:
parent
299cdedb2d
commit
96edfece75
@ -65,7 +65,8 @@ luci-lib-docker source: [lisaac/luci-lib-docker](https://github.com/lisaac/luci-
|
||||
openwrt-iptvhelper source: [riverscn/openwrt-iptvhelper](https://github.com/riverscn/openwrt-iptvhelper).<br>
|
||||
luci-app-autoipsetadder source: [rufengsuixing/luci-app-autoipsetadder](https://github.com/rufengsuixing/luci-app-autoipsetadder).<br>
|
||||
luci-app-adguardhome source: [rufengsuixing/luci-app-adguardhome](https://github.com/rufengsuixing/luci-app-adguardhome).<br/>
|
||||
Rclone-OpenWrt source:[ElonH/Rclone-OpenWrt](https://github.com/ElonH/Rclone-OpenWrt).
|
||||
Rclone-OpenWrt source: [ElonH/Rclone-OpenWrt](https://github.com/ElonH/Rclone-OpenWrt).<br/>
|
||||
luci-app-usb3disable source: [rufengsuixing/luci-app-usb3disable](https://github.com/rufengsuixing/luci-app-usb3disable).
|
||||
|
||||
# License
|
||||
### [GPL v3](https://www.gnu.org/licenses/gpl-3.0.html).
|
||||
|
||||
@ -67,7 +67,7 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_dnsforwarder
|
||||
default n
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_ChinaDNS
|
||||
bool "chinadns"
|
||||
bool "chiandns"
|
||||
default n
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_haproxy
|
||||
|
||||
@ -163,7 +163,7 @@
|
||||
url2='https://ip.skk.moe';
|
||||
window.open(url2);
|
||||
}
|
||||
const $$ = document;
|
||||
const $$ = document;
|
||||
$$.getElementById('ip-webrtc').innerHTML = '查询中...';
|
||||
$$.getElementById('ip-pcol').innerHTML = '查询中...';
|
||||
$$.getElementById('ip-ipify').innerHTML = '查询中...';
|
||||
@ -194,8 +194,7 @@
|
||||
throw error;
|
||||
}),
|
||||
parseIPIpip: (ip, elID) => {
|
||||
|
||||
IP.get(`https://api.skk.moe/network/parseIp/ipip/v3/${ip}`, 'json')
|
||||
IP.get(`https://api.skk.moe/network/parseIp/ipip/v3/${ip}`, 'json')
|
||||
.then(resp => {
|
||||
let x = '';
|
||||
for (let i of resp.data) {
|
||||
@ -261,14 +260,17 @@
|
||||
img.onerror = img.onload = null;
|
||||
$$.getElementById(cbElID).innerHTML = '<span class="sk-text-error">连接超时</span>'
|
||||
}, 5000);
|
||||
|
||||
img.onerror = () => {
|
||||
clearTimeout(timeout);
|
||||
$$.getElementById(cbElID).innerHTML = '<span class="sk-text-error">无法访问</span>'
|
||||
}
|
||||
|
||||
img.onload = () => {
|
||||
clearTimeout(timeout);
|
||||
$$.getElementById(cbElID).innerHTML = '<span class="sk-text-success">连接正常</span>'
|
||||
}
|
||||
|
||||
img.src = `https://${domain}/favicon.ico?${+(new Date)}`
|
||||
},
|
||||
runcheck: () => {
|
||||
@ -279,6 +281,7 @@
|
||||
HTTP.checker('www.youtube.com', 'http-youtube');
|
||||
}
|
||||
};
|
||||
|
||||
HTTP.runcheck();
|
||||
IP.getIpipnetIP();
|
||||
IP.getIpifyIP();
|
||||
@ -290,9 +293,10 @@
|
||||
$$.getElementById('ip-pcol-ipip').innerHTML = `${data.pro} ${data.city} ${data.region} ${pcisp[1]}`;
|
||||
};
|
||||
function getIpsbIP(data){
|
||||
$$.getElementById('ip-ipsb').innerHTML = data.address;
|
||||
$$.getElementById('ip-ipsb-geo').innerHTML = `${data.country} ${data.province} ${data.city} ${data.isp.name}`
|
||||
$$.getElementById('ip-ipsb').innerHTML = data.ip;
|
||||
IP.parseIPIpip(data.ip, 'ip-ipsb-geo');
|
||||
};
|
||||
|
||||
window.onload=myip_Load();
|
||||
|
||||
function myip_Load()
|
||||
@ -306,7 +310,7 @@
|
||||
var sbip = document.getElementsByTagName('HEAD').item(0);
|
||||
var sbipScript= document.createElement("script");
|
||||
sbipScript.defer = "defer";
|
||||
sbipScript.src='https://ip.sb/addrinfo?callback=getIpsbIP';
|
||||
sbipScript.src='https://api-ipv4.ip.sb/jsonip?callback=getIpsbIP';
|
||||
sbip.appendChild(sbipScript);
|
||||
|
||||
const $$ = document;
|
||||
@ -322,14 +326,15 @@
|
||||
$$.getElementById('ip-pcol-ipip').innerHTML = `${data.pro} ${data.city} ${data.region} ${pcisp[1]}`;
|
||||
};
|
||||
function getIpsbIP(data){
|
||||
$$.getElementById('ip-ipsb').innerHTML = data.address;
|
||||
$$.getElementById('ip-ipsb-geo').innerHTML = `${data.country} ${data.province} ${data.city} ${data.isp.name}`
|
||||
$$.getElementById('ip-ipsb').innerHTML = data.ip;
|
||||
IP.parseIPIpip(data.ip, 'ip-ipsb-geo');
|
||||
};
|
||||
|
||||
setTimeout("myip_Load()",1000*10);
|
||||
}
|
||||
|
||||
</script>
|
||||
<script defer="defer" src="https://whois.pconline.com.cn/ipJson.jsp?callback=getPcolIP"></script>
|
||||
<script defer="defer" src="https://ip.sb/addrinfo?callback=getIpsbIP"></script>
|
||||
<script defer="defer" src="https://api-ipv4.ip.sb/jsonip?callback=getIpsbIP"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
31
package/ctcgfw/luci-app-usb3disable/Makefile
Normal file
31
package/ctcgfw/luci-app-usb3disable/Makefile
Normal file
@ -0,0 +1,31 @@
|
||||
# Copyright (C) 2016 Openwrt.org
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI support disable usb3
|
||||
LUCI_DEPENDS:=
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_NAME:=luci-app-usb3disable
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
define Package/luci-app-usb3disable/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci
|
||||
cp -pR ./luasrc/* $(1)/usr/lib/lua/luci
|
||||
$(INSTALL_DIR) $(1)/
|
||||
cp -pR ./root/* $(1)/
|
||||
endef
|
||||
|
||||
define Package/luci-app-usb3disable/postinst
|
||||
#!/bin/sh
|
||||
rm -f /tmp/luci-indexcache
|
||||
rm -f /tmp/luci-modulecache/*
|
||||
exit 0
|
||||
endef
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
|
||||
@ -0,0 +1,6 @@
|
||||
module("luci.controller.usb3disable",package.seeall)
|
||||
nixio=require"nixio"
|
||||
function index()
|
||||
entry({"admin","system","usb3disable"},alias("admin","system","usb3disable","usb3disable"),_("usb3disable"))
|
||||
entry({"admin","system","usb3disable","usb3disable"},cbi("usb3disable"),_("usb3disable"),1)
|
||||
end
|
||||
@ -0,0 +1,45 @@
|
||||
local sys=require("luci.sys")
|
||||
local m,s,o,d,e,p
|
||||
m=Map("usb3disable","usb3disable")
|
||||
|
||||
s=m:section(TypedSection,"usb3disable")
|
||||
s.anonymous=true
|
||||
s.addremove=false
|
||||
e=sys.exec("cat /etc/modules.d/$(ls /etc/modules.d | grep usb3) >/tmp/run/usb3module ; lsmod | awk '{gsub(\"_\",\"-\",$1);print $1}' >>/tmp/run/usb3module ; sort /tmp/run/usb3module | uniq -d | sort -n ; rm /tmp/run/usb3module")
|
||||
if e=="" then
|
||||
o=s:option(Button,"enabled",translate("enable now"))
|
||||
o.optional=false
|
||||
o.inputtitle=translate("enable")
|
||||
o.write=function()
|
||||
sys.exec("cat /etc/modules.d/$(ls /etc/modules.d | grep usb3) | awk '{print \"insmod \"$0}' >/var/run/usb3module ; sh /var/run/usb3module; rm /var/run/usb3module")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin","system","usb3disable"))
|
||||
end
|
||||
else
|
||||
o=s:option(Button,"disabled",translate("disable now"))
|
||||
o.optional=false
|
||||
o.inputtitle=translate("Disable")
|
||||
o.write=function()
|
||||
sys.exec("cat /etc/modules.d/$(ls /etc/modules.d | grep usb3) | sed -n '1!G;h;$p' | awk '{print \"rmmod \"$0}' >/var/run/usb3module ; sh /var/run/usb3module; rm /var/run/usb3module")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin","system","usb3disable"))
|
||||
end
|
||||
end
|
||||
d=sys.exec("ls /etc/modules-boot.d | grep usb3")
|
||||
if d=="" then
|
||||
o=s:option(Button,"enabledstartup",translate("enable on boot"))
|
||||
o.optional=false
|
||||
o.inputtitle=translate("Enable")
|
||||
o.write=function()
|
||||
sys.exec("ln -s /etc/modules.d/*usb3 /etc/modules-boot.d/")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin","system","usb3disable"))
|
||||
end
|
||||
else
|
||||
o=s:option(Button,"disabledstartup",translate("disable on boot"))
|
||||
o.optional=false
|
||||
o.inputtitle=translate("Disable")
|
||||
o.write=function()
|
||||
sys.exec("rm /etc/modules-boot.d/*-usb3")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin","system","usb3disable"))
|
||||
end
|
||||
|
||||
end
|
||||
return m
|
||||
@ -0,0 +1,2 @@
|
||||
|
||||
config usb3disable 'usb3disable'
|
||||
Loading…
Reference in New Issue
Block a user