mirror of
https://github.com/kenzok8/small-package.git
synced 2026-02-04 05:47:19 +08:00
update 2025-12-18 20:51:18
This commit is contained in:
64
fastnet/Makefile
Normal file
64
fastnet/Makefile
Normal file
@@ -0,0 +1,64 @@
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_ARCH_FASTNET:=$(ARCH)
|
||||
|
||||
PKG_NAME:=fastnet
|
||||
# use PKG_SOURCE_DATE instead of PKG_VERSION for compatible
|
||||
PKG_SOURCE_DATE:=0.7.2
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-binary-$(PKG_SOURCE_DATE).tar.gz
|
||||
PKG_SOURCE_URL:=http://dl.istoreos.com/binary/fastnet/
|
||||
PKG_HASH:=aa8c0a3aa6885536d0ab9efc25df4191de78e3d0bc1077607874f64100d82f98
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-binary-$(PKG_SOURCE_DATE)
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Web Servers/Proxies
|
||||
TITLE:=FastNet - network test Web UI
|
||||
DEPENDS:=@(arm||x86_64||aarch64)
|
||||
PKGARCH:=all
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
FastNet provides network testing tools and a Web UI.
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/config/fastnet
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/postinst
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
[ -f /etc/uci-defaults/fastnet ] && /etc/uci-defaults/fastnet && rm -f /etc/uci-defaults/fastnet
|
||||
exit 0
|
||||
fi
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/fastnet.$(PKG_ARCH_FASTNET) $(1)/usr/sbin/FastNet
|
||||
$(INSTALL_CONF) ./files/fastnet.config $(1)/etc/config/fastnet
|
||||
$(INSTALL_BIN) ./files/fastnet.init $(1)/etc/init.d/fastnet
|
||||
$(INSTALL_BIN) ./files/fastnet.uci-default $(1)/etc/uci-defaults/fastnet
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
5
fastnet/files/fastnet.config
Normal file
5
fastnet/files/fastnet.config
Normal file
@@ -0,0 +1,5 @@
|
||||
config fastnet
|
||||
option enabled '1'
|
||||
option port '3200'
|
||||
option token ''
|
||||
option logger '0'
|
||||
31
fastnet/files/fastnet.init
Normal file
31
fastnet/files/fastnet.init
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
USE_PROCD=1
|
||||
|
||||
get_config() {
|
||||
config_get_bool enabled "$1" enabled 1
|
||||
config_get port "$1" port 3200
|
||||
config_get token "$1" token ""
|
||||
config_get_bool logger "$1" logger 0
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load fastnet
|
||||
config_foreach get_config fastnet
|
||||
[ "$enabled" != 1 ] && return 1
|
||||
|
||||
addr="0.0.0.0:${port}"
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param limits nofile="65535 65535"
|
||||
procd_set_param command /usr/sbin/FastNet web --addr "$addr" --no-open
|
||||
[ -n "$token" ] && procd_append_param command --token "$token"
|
||||
[ "$logger" = 1 ] && procd_set_param stderr 1
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "fastnet"
|
||||
}
|
||||
14
fastnet/files/fastnet.uci-default
Normal file
14
fastnet/files/fastnet.uci-default
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF_UCI >/dev/null
|
||||
delete ucitrack.@fastnet[-1]
|
||||
add ucitrack fastnet
|
||||
set ucitrack.@fastnet[-1].init=fastnet
|
||||
commit ucitrack
|
||||
|
||||
EOF_UCI
|
||||
|
||||
/etc/init.d/fastnet enable
|
||||
/etc/init.d/fastnet start
|
||||
|
||||
exit 0
|
||||
20
luci-app-fastnet/Makefile
Normal file
20
luci-app-fastnet/Makefile
Normal file
@@ -0,0 +1,20 @@
|
||||
# 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 for fastnet
|
||||
LUCI_DEPENDS:=+fastnet
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_VERSION:=0.7.2-r1
|
||||
# PKG_RELEASE MUST be empty for luci.mk
|
||||
PKG_RELEASE:=
|
||||
LUCI_MINIFY_CSS:=0
|
||||
LUCI_MINIFY_JS:=0
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
|
||||
44
luci-app-fastnet/luasrc/controller/fastnet.lua
Normal file
44
luci-app-fastnet/luasrc/controller/fastnet.lua
Normal file
@@ -0,0 +1,44 @@
|
||||
module("luci.controller.fastnet", package.seeall)
|
||||
|
||||
function index()
|
||||
local fs = require "nixio.fs"
|
||||
if not fs.access("/etc/config/fastnet") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "services", "fastnet"}, cbi("fastnet"), _("FastNet"), 50).dependent = true
|
||||
entry({"admin", "services", "fastnet", "status"}, call("action_status")).leaf = true
|
||||
end
|
||||
|
||||
function action_status()
|
||||
local sys = require "luci.sys"
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local http = require "luci.http"
|
||||
|
||||
local function get_host()
|
||||
local host = http.getenv("HTTP_HOST") or http.getenv("SERVER_NAME") or ""
|
||||
host = host:gsub(":%d+$", "")
|
||||
if host == "_redirect2ssl" or host == "redirect2ssl" or host == "" then
|
||||
host = http.getenv("SERVER_ADDR") or "localhost"
|
||||
end
|
||||
return host
|
||||
end
|
||||
|
||||
local running = (sys.call("pidof FastNet >/dev/null") == 0)
|
||||
local host = get_host()
|
||||
local port = uci:get_first("fastnet", "fastnet", "port") or "3200"
|
||||
local token = uci:get_first("fastnet", "fastnet", "token") or ""
|
||||
|
||||
local url = "http://" .. host .. ":" .. port .. "/"
|
||||
if token ~= "" then
|
||||
url = url .. "?token=" .. token
|
||||
end
|
||||
|
||||
http.prepare_content("application/json")
|
||||
http.write_json({
|
||||
running = running,
|
||||
host = host,
|
||||
port = port,
|
||||
url = url
|
||||
})
|
||||
end
|
||||
47
luci-app-fastnet/luasrc/model/cbi/fastnet.lua
Normal file
47
luci-app-fastnet/luasrc/model/cbi/fastnet.lua
Normal file
@@ -0,0 +1,47 @@
|
||||
local sys = require "luci.sys"
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local http = require "luci.http"
|
||||
|
||||
local m = Map("fastnet", translate("FastNet"))
|
||||
m.description = translate("FastNet provides network testing tools and a Web UI.")
|
||||
|
||||
local function get_host()
|
||||
local host = http.getenv("HTTP_HOST") or http.getenv("SERVER_NAME") or ""
|
||||
host = host:gsub(":%d+$", "")
|
||||
if host == "_redirect2ssl" or host == "redirect2ssl" or host == "" then
|
||||
host = http.getenv("SERVER_ADDR") or "localhost"
|
||||
end
|
||||
return host
|
||||
end
|
||||
|
||||
local st = m:section(SimpleSection, translate("Status"))
|
||||
local running = (sys.call("pidof FastNet >/dev/null") == 0)
|
||||
local listen_port = uci:get_first("fastnet", "fastnet", "port") or "3200"
|
||||
local token = uci:get_first("fastnet", "fastnet", "token") or ""
|
||||
local url = "http://" .. get_host() .. ":" .. listen_port .. "/"
|
||||
if token ~= "" then
|
||||
url = url .. "?token=" .. token
|
||||
end
|
||||
|
||||
st.template = "fastnet/status"
|
||||
st.running = running
|
||||
st.url = url
|
||||
|
||||
local s = m:section(TypedSection, "fastnet", translate("Settings"))
|
||||
s.anonymous = true
|
||||
|
||||
local enabled = s:option(Flag, "enabled", translate("Enable"))
|
||||
enabled.default = enabled.enabled
|
||||
|
||||
local port = s:option(Value, "port", translate("Listen Port"))
|
||||
port.datatype = "port"
|
||||
port.default = "3200"
|
||||
|
||||
local token = s:option(Value, "token", translate("API Token"))
|
||||
token.password = true
|
||||
token.rmempty = true
|
||||
|
||||
local logger = s:option(Flag, "logger", translate("Enable Logging"))
|
||||
logger.rmempty = true
|
||||
|
||||
return m
|
||||
21
luci-app-fastnet/luasrc/view/fastnet/status.htm
Normal file
21
luci-app-fastnet/luasrc/view/fastnet/status.htm
Normal file
@@ -0,0 +1,21 @@
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Status%></legend>
|
||||
<div class="cbi-section-node">
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:Status%></label>
|
||||
<div class="cbi-value-field">
|
||||
<% if self.running then %>
|
||||
<span style="color: green; font-weight: bold"><%:Running%></span>
|
||||
<% else %>
|
||||
<span style="color: red; font-weight: bold"><%:Not running%></span>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:Open Web UI%></label>
|
||||
<div class="cbi-value-field">
|
||||
<a href="<%=self.url%>" target="_blank" rel="noreferrer"><%:Open Web UI%></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
39
luci-app-fastnet/po/zh-cn/fastnet.po
Normal file
39
luci-app-fastnet/po/zh-cn/fastnet.po
Normal file
@@ -0,0 +1,39 @@
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8"
|
||||
|
||||
msgid "FastNet"
|
||||
msgstr "FastNet"
|
||||
|
||||
msgid "FastNet provides network testing tools and a Web UI."
|
||||
msgstr "FastNet 提供网络测试工具与 Web 界面。"
|
||||
|
||||
msgid "Settings"
|
||||
msgstr "设置"
|
||||
|
||||
msgid "Enable"
|
||||
msgstr "启用"
|
||||
|
||||
msgid "Listen Host"
|
||||
msgstr "监听地址"
|
||||
|
||||
msgid "Listen Port"
|
||||
msgstr "监听端口"
|
||||
|
||||
msgid "API Token"
|
||||
msgstr "访问 Token"
|
||||
|
||||
msgid "Enable Logging"
|
||||
msgstr "启用日志"
|
||||
|
||||
msgid "Status"
|
||||
msgstr "状态"
|
||||
|
||||
msgid "Running"
|
||||
msgstr "运行中"
|
||||
|
||||
msgid "Not running"
|
||||
msgstr "未运行"
|
||||
|
||||
msgid "Open Web UI"
|
||||
msgstr "打开 Web 界面"
|
||||
|
||||
39
luci-app-fastnet/po/zh_Hans/fastnet.po
Normal file
39
luci-app-fastnet/po/zh_Hans/fastnet.po
Normal file
@@ -0,0 +1,39 @@
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8"
|
||||
|
||||
msgid "FastNet"
|
||||
msgstr "FastNet"
|
||||
|
||||
msgid "FastNet provides network testing tools and a Web UI."
|
||||
msgstr "FastNet 提供网络测试工具与 Web 界面。"
|
||||
|
||||
msgid "Settings"
|
||||
msgstr "设置"
|
||||
|
||||
msgid "Enable"
|
||||
msgstr "启用"
|
||||
|
||||
msgid "Listen Host"
|
||||
msgstr "监听地址"
|
||||
|
||||
msgid "Listen Port"
|
||||
msgstr "监听端口"
|
||||
|
||||
msgid "API Token"
|
||||
msgstr "访问 Token"
|
||||
|
||||
msgid "Enable Logging"
|
||||
msgstr "启用日志"
|
||||
|
||||
msgid "Status"
|
||||
msgstr "状态"
|
||||
|
||||
msgid "Running"
|
||||
msgstr "运行中"
|
||||
|
||||
msgid "Not running"
|
||||
msgstr "未运行"
|
||||
|
||||
msgid "Open Web UI"
|
||||
msgstr "打开 Web 界面"
|
||||
|
||||
5
luci-app-fastnet/root/etc/uci-defaults/50_luci-fastnet
Normal file
5
luci-app-fastnet/root/etc/uci-defaults/50_luci-fastnet
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
||||
|
||||
@@ -11,13 +11,13 @@ LUCI_DEPENDS:=+curl +opkg +luci-base +tar +libuci-lua +mount-utils +luci-lib-tas
|
||||
LUCI_EXTRA_DEPENDS:=luci-lib-taskd (>=1.0.19)
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
PKG_VERSION:=0.1.31-1
|
||||
PKG_VERSION:=0.1.32-1
|
||||
# PKG_RELEASE MUST be empty for luci.mk
|
||||
PKG_RELEASE:=
|
||||
|
||||
ISTORE_UI_VERSION:=0.1.30
|
||||
ISTORE_UI_VERSION:=0.1.32
|
||||
ISTORE_UI_RELEASE:=1
|
||||
PKG_HASH:=74a9732e78351b0a78596a67410bafd838678e047a11dfdf3d40ab9d7ce65a78
|
||||
PKG_HASH:=d4f86a88bfd2d6fdd59d5e7f356c1bd51d333f70271f4f28e45feecee9bc1578
|
||||
|
||||
PKG_SOURCE_URL_FILE:=v$(ISTORE_UI_VERSION)-$(ISTORE_UI_RELEASE).tar.gz
|
||||
PKG_SOURCE:=istore-ui-$(PKG_SOURCE_URL_FILE)
|
||||
|
||||
@@ -31,6 +31,7 @@ function index()
|
||||
entry({"admin", "store", "do_self_upgrade"}, post("do_self_upgrade"))
|
||||
entry({"admin", "store", "toggle_docker"}, post("toggle_docker"))
|
||||
entry({"admin", "store", "toggle_arch"}, post("toggle_arch"))
|
||||
entry({"admin", "store", "toggle_ipv4"}, post("toggle_ipv4"))
|
||||
entry({"admin", "store", "get_block_devices"}, call("get_block_devices"))
|
||||
|
||||
entry({"admin", "store", "configured"}, call("configured"))
|
||||
@@ -93,6 +94,7 @@ local function user_config()
|
||||
local data = {
|
||||
hide_docker = uci:get("istore", "istore", "hide_docker") == "1",
|
||||
ignore_arch = uci:get("istore", "istore", "ignore_arch") == "1",
|
||||
ipv4 = uci:get("istore", "istore", "ipv4") == "1",
|
||||
last_path = uci:get("istore", "istore", "last_path"),
|
||||
super_arch = uci:get("istore", "istore", "super_arch"),
|
||||
channel = uci:get("istore", "istore", "channel")
|
||||
@@ -1039,3 +1041,12 @@ function toggle_arch()
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({code = 200, msg = "Success"})
|
||||
end
|
||||
|
||||
function toggle_ipv4()
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local ipv4 = luci.http.formvalue("ipv4")
|
||||
uci:set("istore", "istore", "ipv4", ipv4 == "true" and "1" or "0")
|
||||
uci:commit("istore")
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({code = 200, msg = "Success"})
|
||||
end
|
||||
|
||||
@@ -221,7 +221,7 @@ try_autoconf() {
|
||||
autoconf_to_env
|
||||
[ -n "$ISTORE_AUTOCONF" ] || return 1
|
||||
echo "Auto configure $ISTORE_AUTOCONF"
|
||||
/usr/libexec/istorea/${ISTORE_AUTOCONF}.sh
|
||||
PATH="$CLEANPATH" /usr/libexec/istorea/${ISTORE_AUTOCONF}.sh
|
||||
}
|
||||
|
||||
try_upgrade_depends() {
|
||||
@@ -336,6 +336,16 @@ usage() {
|
||||
|
||||
is_init >/dev/null 2>&1
|
||||
|
||||
CLEANPATH="$PATH"
|
||||
|
||||
case $action in
|
||||
"update"|"install"|"upgrade"|"opkg"|"check_self_upgrade"|"do_self_upgrade"|"dotrun")
|
||||
if [[ "`uci -q get istore.istore.ipv4`" = "1" ]]; then
|
||||
export PATH="/usr/libexec/istore/ipv4-bin:$CLEANPATH"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
case $action in
|
||||
"update")
|
||||
update
|
||||
|
||||
@@ -5,3 +5,4 @@ config istore 'istore'
|
||||
# option channel 'istore'
|
||||
# option super_arch 'x86_64'
|
||||
# option super_arch 'aarch64'
|
||||
# option ipv4 '0'
|
||||
|
||||
8
luci-app-store/root/usr/libexec/istore/ipv4-bin/curl
Executable file
8
luci-app-store/root/usr/libexec/istore/ipv4-bin/curl
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
newpath=$(echo ":$PATH:" | sed -e 's#:/usr/libexec/istore/ipv4-bin:#:#g' -e 's/^:*//' -e 's/:*$//')
|
||||
[ -z "$newpath" ] && newpath="/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
|
||||
export PATH="$newpath"
|
||||
|
||||
exec curl --ipv4 "$@"
|
||||
8
luci-app-store/root/usr/libexec/istore/ipv4-bin/wget
Executable file
8
luci-app-store/root/usr/libexec/istore/ipv4-bin/wget
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
newpath=$(echo ":$PATH:" | sed -e 's#:/usr/libexec/istore/ipv4-bin:#:#g' -e 's/^:*//' -e 's/:*$//')
|
||||
[ -z "$newpath" ] && newpath="/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
|
||||
export PATH="$newpath"
|
||||
|
||||
exec wget -4 "$@"
|
||||
@@ -21,13 +21,13 @@ define Download/geoip
|
||||
HASH:=6878dbacfb1fcb1ee022f63ed6934bcefc95a3c4ba10c88f1131fb88dbf7c337
|
||||
endef
|
||||
|
||||
GEOSITE_VER:=20251218062844
|
||||
GEOSITE_VER:=20251218102359
|
||||
GEOSITE_FILE:=dlc.dat.$(GEOSITE_VER)
|
||||
define Download/geosite
|
||||
URL:=https://github.com/v2fly/domain-list-community/releases/download/$(GEOSITE_VER)/
|
||||
URL_FILE:=dlc.dat
|
||||
FILE:=$(GEOSITE_FILE)
|
||||
HASH:=a15f6b6b2ec196192ebee5c2b2fb8e2414ac23867fae4d680ecf58974cddff93
|
||||
HASH:=69b16faec259d8a4a5882a78c01ad6ce3f593096c5b260c20f614664d10a213f
|
||||
endef
|
||||
|
||||
GEOSITE_IRAN_VER:=202512150045
|
||||
|
||||
Reference in New Issue
Block a user