mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-30 16:25:13 +08:00
🌴 Sync 2026-03-05 23:51:42
This commit is contained in:
1 parent
0d155c70be
commit
32600acc60
14258 files changed
+3954570
No files matched your search
@@ -0,0 +1,19 @@
|
||||
# Copyright (C) 2016 Openwrt.org
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-mproxy
|
||||
PKG_VERSION:=1.0.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
LUCI_TITLE:=LuCI support for Mproxy
|
||||
LUCI_PKGARCH:=all
|
||||
LUCI_DEPENDS:=+mproxy
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
module("luci.controller.mproxy", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/mproxy") then
|
||||
return
|
||||
end
|
||||
local page
|
||||
page = entry({"admin", "services", "mproxy"}, cbi("mproxy"), _("Mproxy Server"), 100)
|
||||
page.i18n = "mproxy"
|
||||
page.dependent = true
|
||||
end
|
||||
@@ -0,0 +1,37 @@
|
||||
local m,s,o
|
||||
local SYS = require "luci.sys"
|
||||
|
||||
|
||||
if SYS.call("pidof mproxy >/dev/null") == 0 then
|
||||
Status = translate("<strong><font color=\"green\">Mproxy is Running</font></strong>")
|
||||
else
|
||||
Status = translate("<strong><font color=\"red\">Mproxy is Not Running</font></strong>")
|
||||
end
|
||||
|
||||
m = Map("mproxy")
|
||||
m.title = translate("Mproxy Server")
|
||||
m.description = translate("A mini HTTP/HTTPS Proxy Server for Something")
|
||||
|
||||
s = m:section(TypedSection, "mproxy", "")
|
||||
s.addremove = false
|
||||
s.anonymous = true
|
||||
s.description = translate(string.format("%s<br /><br />", Status))
|
||||
|
||||
enable = s:option(Flag, "enabled", translate("Enable"))
|
||||
enable.default = 0
|
||||
enable.rmempty = false
|
||||
|
||||
port = s:option(Value, "port", translate("Port"))
|
||||
port.datatype = "range(1,65535)"
|
||||
|
||||
redir = s:option(Value, "redir", translate("Redirect to Local Port"))
|
||||
redir.datatype = "range(1,65535)"
|
||||
redir.rmempty = false
|
||||
redir.description = translate("Redirecting traffic incoming to the specified local port")
|
||||
|
||||
function m.on_after_commit(self)
|
||||
os.execute("uci set firewall.mproxy.dest_port=$(uci get mproxy.config.port) && uci commit firewall && /etc/init.d/firewall restart")
|
||||
os.execute("/etc/init.d/mproxy restart")
|
||||
end
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,26 @@
|
||||
msgid "Port"
|
||||
msgstr "端口"
|
||||
|
||||
msgid "<strong><font color=\"green\">Mproxy is Running</font></strong>"
|
||||
msgstr "<strong><font color=\"green\">Mproxy 正在运行</font></strong>"
|
||||
|
||||
msgid "<strong><font color=\"red\">Mproxy is Not Running</font></strong>"
|
||||
msgstr "<strong><font color=\"red\">Mproxy 未运行</font></strong>"
|
||||
|
||||
msgid "Mproxy Server"
|
||||
msgstr "Mproxy 代理服务器"
|
||||
|
||||
msgid "A mini HTTP/HTTPS Proxy Server for Something"
|
||||
msgstr "最小的 HTTP/HTTPS 代理,可以用来做某些事情"
|
||||
|
||||
msgid "Redirect to Local Port"
|
||||
msgstr "重定向到本地端口"
|
||||
|
||||
msgid "Redirecting traffic incoming to the specified local port"
|
||||
msgstr "将流量无条件转发至特定本地端口"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
zh-cn
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
config mproxy 'config'
|
||||
option enabled '0'
|
||||
option redir '1194'
|
||||
option port '9090'
|
||||
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (c) 2011-2015 OpenWrt.org
|
||||
|
||||
START=90
|
||||
|
||||
start(){
|
||||
enable=$(uci get mproxy.config.enabled 2>/dev/null)
|
||||
port=$(uci get mproxy.config.port)
|
||||
redir=$(uci get mproxy.config.redir)
|
||||
if [ $enable -eq 1 ]; then
|
||||
[ ! -f /etc/rc.d/S90mproxy ] && /etc/init.d/mproxy enable
|
||||
/usr/bin/mproxy -l $port -r 127.0.0.1:$redir -d
|
||||
else
|
||||
/etc/init.d/mproxy disable
|
||||
fi
|
||||
}
|
||||
|
||||
stop(){
|
||||
pid=$(ps | grep 'mproxy -l' | grep -v grep | cut -c 0-6)
|
||||
kill -9 $pid
|
||||
}
|
||||
|
||||
restart(){
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci delete firewall.mproxy
|
||||
uci add firewall rule
|
||||
uci rename firewall.@rule[-1]="mproxy"
|
||||
uci set firewall.@rule[-1].name="mproxy"
|
||||
uci set firewall.@rule[-1].target="ACCEPT"
|
||||
uci set firewall.@rule[-1].src="wan"
|
||||
uci set firewall.@rule[-1].proto="tcp"
|
||||
uci set firewall.@rule[-1].dest_port="9090"
|
||||
uci commit firewall;
|
||||
|
||||
/etc/init.d/mproxy enable
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"luci-app-mproxy": {
|
||||
"description": "Grant UCI access for luci-app-mproxy",
|
||||
"read": {
|
||||
"uci": [ "mproxy" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "mproxy" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"config": "mproxy",
|
||||
"init": "mproxy"
|
||||
}
|
||||
Reference in new issue
Block a user