mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-01 16:44:23 +08:00
🔥 Sync 2026-04-14 01:23:04
This commit is contained in:
1 parent
010610b1e5
commit
b9b070f39f
25 files changed
+261
-178
No files matched your search
@@ -5,8 +5,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=internet-detector-mod-telegram
|
||||
PKG_VERSION:=1.7.2
|
||||
PKG_RELEASE:=2
|
||||
PKG_VERSION:=1.7.3
|
||||
PKG_RELEASE:=3
|
||||
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/luci-app-internet-detector>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
+7
-2
@@ -31,6 +31,7 @@ local Module = {
|
||||
curlParams = "-s -g --no-keepalive",
|
||||
proxyAuthString = "",
|
||||
proxyString = "",
|
||||
ifaceString = "",
|
||||
status = nil,
|
||||
_enabled = false,
|
||||
_deadCounter = 0,
|
||||
@@ -85,6 +86,9 @@ function Module:init(t)
|
||||
t.proxy_port,
|
||||
self.proxyAuthString)
|
||||
end
|
||||
if t.iface then
|
||||
self.ifaceString = " --interface " .. t.iface
|
||||
end
|
||||
if tonumber(t.message_at_startup) == 1 then
|
||||
self._msgSentDisconnect = false
|
||||
self._disconnected = false
|
||||
@@ -138,9 +142,10 @@ function Module:httpRequest(url)
|
||||
|
||||
self.debugOutput(string.format("--- %s ---", self.name))
|
||||
|
||||
local curl = string.format(
|
||||
'%s%s --connect-timeout %s %s "%s"; printf "\n$?";',
|
||||
local curl = string.format(
|
||||
'%s%s%s --connect-timeout %s %s "%s"; printf "\n$?";',
|
||||
self.curlExec,
|
||||
self.ifaceString,
|
||||
self.proxyString,
|
||||
self.connectTimeout,
|
||||
self.curlParams,
|
||||
|
||||
+7
-4
@@ -13,11 +13,12 @@ if(!curlExec) {
|
||||
die('Error! Curl not found!');
|
||||
}
|
||||
|
||||
function httpRequest(url, proxyType, proxyHost, proxyPort, proxyUser, proxyPasswd) {
|
||||
function httpRequest(url, proxyType, proxyHost, proxyPort, proxyUser, proxyPasswd, iface) {
|
||||
let retCode = 1;
|
||||
let data = '';
|
||||
let proxyAuthString = '';
|
||||
let proxyString = '';
|
||||
let ifaceString = iface ? (' --interface ' + iface) : '';
|
||||
|
||||
if(!url) {
|
||||
return { retCode: 1, data };
|
||||
@@ -38,14 +39,14 @@ function httpRequest(url, proxyType, proxyHost, proxyPort, proxyUser, proxyPassw
|
||||
proxyAuthString);
|
||||
}
|
||||
const curl = sprintf(
|
||||
'%s%s --connect-timeout %s %s "%s"; printf "\n$?";',
|
||||
'%s%s%s --connect-timeout %s %s "%s"; printf "\n$?";',
|
||||
curlExec,
|
||||
ifaceString,
|
||||
proxyString,
|
||||
curlConnectTimeout,
|
||||
curlParams,
|
||||
url
|
||||
);
|
||||
|
||||
const fd = popen(curl, 'r');
|
||||
if(fd) {
|
||||
data = fd.read('all');
|
||||
@@ -98,6 +99,7 @@ const methods = {
|
||||
proxyPort : 'String',
|
||||
proxyUser : 'String',
|
||||
proxyPasswd: 'String',
|
||||
iface : 'String',
|
||||
},
|
||||
call: function(request) {
|
||||
const botToken = request.args?.botToken;
|
||||
@@ -108,7 +110,8 @@ const methods = {
|
||||
request.args.proxyHost,
|
||||
request.args.proxyPort,
|
||||
request.args.proxyUser,
|
||||
request.args.proxyPasswd
|
||||
request.args.proxyPasswd,
|
||||
request.args.iface
|
||||
);
|
||||
if(ret.retCode == 0 && length(ret.data) > 0) {
|
||||
return parseResponse(ret.data);
|
||||
|
||||
Reference in new issue
Block a user