Skip to content
This repository was archived by the owner on Jul 27, 2023. It is now read-only.

Commit

Permalink
update@20230505
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed May 5, 2023
1 parent 893cd02 commit aa2f0dd
Show file tree
Hide file tree
Showing 50 changed files with 8,340 additions and 0 deletions.
50 changes: 50 additions & 0 deletions iptvhelper/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright 2019 Shun Li <[email protected]>
# Licensed to the public under the GNU General Public License v3.

include $(TOPDIR)/rules.mk

PKG_NAME:=iptvhelper
PKG_VERSION:=0.1.1
PKG_RELEASE:=1
PKG_MAINTAINER:=Shun Li <[email protected]>
PKG_LICENSE:=GPL-3.0

include $(INCLUDE_DIR)/package.mk

define Package/iptvhelper
SECTION:=net
CATEGORY:=Network
SUBMENU:=Routing and Redirection
DEPENDS:= \
+ipset \
+iptables
TITLE:=Scripts for configure IPTV easily
MAINTAINER:=Shun Li <[email protected]>
PKGARCH:=all
endef

define Package/iptvhelper/description
Scripts for configure IPTV easily
endef

define Package/iptvhelper/conffiles
/etc/config/iptvhelper
/etc/firewall.iptvhelper
endef

define Build/Compile
endef

define Package/iptvhelper/postinst
#!/bin/sh
endef

define Package/iptvhelper/postrm
#!/bin/sh
endef

define Package/iptvhelper/install
$(CP) ./files/* $(1)
endef

$(eval $(call BuildPackage,iptvhelper))
8 changes: 8 additions & 0 deletions iptvhelper/files/etc/config/iptvhelper
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
config tvbox 'default'
option disabled '1'
option respawn '1'
option mac '00:00:00:00:00:00'
option ipset '1'
option dns_redir '1'


2 changes: 2 additions & 0 deletions iptvhelper/files/etc/firewall.iptvhelper
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
test -s "/etc/init.d/iptvhelper" && /etc/init.d/iptvhelper reload
127 changes: 127 additions & 0 deletions iptvhelper/files/etc/init.d/iptvhelper
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
#!/bin/sh /etc/rc.common
# Copyright 2019 Shun Li <[email protected]>
# Licensed to the public under the GNU General Public License v3.

START=95
USE_PROCD=1

_ipt() {
cmd="$(echo "$@" | sed 's|-A|-D|g;s|-I|-D|g')"
while iptables $cmd &>/dev/null; do
:
done
iptables $@
}

destroy_iptv_ipset() {
for ip_set in $(ipset list | awk '/iptvhelper/ {print $2}'); do ipset destroy $ip_set; done
}

clear_iptv_rules() {
iptables-save --counters | grep -v "iptvhelper-rule" | iptables-restore --counters
}

append_arg() {
local cfg="$1"
local var="$2"
local opt="$3"
local def="$4"
local val

config_get val "$cfg" "$var"
[ -n "$val" -o -n "$def" ] && procd_append_param command $opt "${val:-$def}"
}

append_bool() {
local cfg="$1"
local var="$2"
local opt="$3"
local def="$4"
local val

config_get_bool val "$cfg" "$var" "$def"
[ "$val" = 1 ] && procd_append_param command "$opt"
}

start_instance() {
local cfg="$1"
local aux

config_get_bool aux "$cfg" 'disabled' '0'
[ "$aux" = 1 ] && return 1

logger "iptvhelper.$cfg: instance starting"

local IPTV_MAC
local IPTV_DNS_REDIR
local IPTV_IPSET

config_get IPTV_MAC $cfg mac
config_get IPTV_DNS_REDIR $cfg dns_redir
config_get IPTV_IPSET $cfg ipset
logger "iptvhelper.$cfg: topbox mac=$IPTV_MAC"

if [[ $IPTV_DNS_REDIR == '1' ]]; then
logger "iptvhelper.$cfg: topbox DNS redierct enabled"
_ipt -t nat -A PREROUTING -m mac --mac-source $IPTV_MAC -m comment --comment "iptvhelper-rule" -p udp --dport 53 -j REDIRECT --to-ports 53
fi

if [[ $IPTV_IPSET='1' ]]; then
logger "iptvhelper.$cfg: topbox ipset enabled"
if ! ipset -q list iptvhelper_$cfg >/dev/null; then
ipset create iptvhelper_$cfg nethash
fi
_ipt -t nat -I PREROUTING -m mac --mac-source $IPTV_MAC -m comment --comment "iptvhelper-rule" -m set ! --match-set iptvhelper_$cfg dst -m conntrack --ctstate NEW -j LOG --log-prefix "iptvhelper.$cfg:"
procd_open_instance
procd_set_param command /usr/sbin/iptvhelper.sh $cfg
config_get_bool aux "$cfg" 'respawn' '0'
[ "$aux" = 1 ] && procd_set_param respawn
procd_set_param pidfile /var/run/iptvhelper_$cfg.pid
procd_close_instance
fi
}

service_triggers() {
procd_add_reload_trigger "iptvhelper"
}

start_service() {
logger "iptvhelper: starting"
echo "iptvhelper: starting"
config_load iptvhelper
config_foreach start_instance tvbox
if uci -q show firewall >/dev/null; then
if ! uci -q get firewall.iptvhelper >/dev/null; then
uci -q batch <<-EOF >/dev/null
set firewall.iptvhelper=include
set firewall.iptvhelper.type='script'
set firewall.iptvhelper.path='/etc/firewall.iptvhelper'
set firewall.iptvhelper.family='any'
set firewall.iptvhelper.reload='1'
commit firewall
EOF
fi
fi
}

stop_service() {
if uci -q show firewall >/dev/null; then
if uci -q get firewall.iptvhelper >/dev/null; then
uci delete firewall.iptvhelper
uci commit firewall
fi
fi
for pid in $(ps | grep -v awk | awk '/iptvhelper.sh/ {print $1}'); do kill -9 $pid; done
for pid in $(ps | grep -v awk | awk '/logread -e iptvhelper/ {print $1}'); do kill -9 $pid; done
clear_iptv_rules
destroy_iptv_ipset
logger "iptvhelper: stopped"
echo "iptvhelper: stopped"
}

reload_service() {
logger "iptvhelper: reloading"
echo "iptvhelper: reloading"
stop
start
}
24 changes: 24 additions & 0 deletions iptvhelper/files/usr/sbin/iptvhelper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh

# Copyright 2019 Shun Li <[email protected]>
# Licensed to the public under the GNU General Public License v3.

add_to_set() {
local ip=$1
local cfg=$2
local subnet=$ip/24
ping -W1 -c1 $ip &>/dev/null && return
if ! ipset -q test iptvhelper_$cfg $subnet; then
ipset add iptvhelper_$cfg $subnet
echo added $subnet to set iptvhelper_$cfg
fi
}

echo $1

logread -e "iptvhelper\.$1" -f |
while read line; do
ip=$(echo "$line" | sed -r 's|.*DST=([0-9.]+).*|\1|')
echo requested $ip
add_to_set $ip $1 &
done
21 changes: 21 additions & 0 deletions luci-app-dockerman/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
include $(TOPDIR)/rules.mk

LUCI_TITLE:=LuCI Support for docker
LUCI_DEPENDS:=@(aarch64||arm||x86_64) \
+luci-compat \
+luci-lib-docker \
+luci-lib-ip \
+docker \
+dockerd +cgroupfs-mount \
+ttyd
LUCI_PKGARCH:=all

PKG_LICENSE:=AGPL-3.0
PKG_MAINTAINER:=lisaac <[email protected]> \
Florian Eckert <[email protected]>

PKG_VERSION:=v0.5.25

include $(TOPDIR)/feeds/luci/luci.mk

# call BuildPackage - OpenWrt buildroot signature
1 change: 1 addition & 0 deletions luci-app-dockerman/depends.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ttyd docker-cli
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
.fb-container {
margin-top: 1rem;
}
.fb-container .cbi-button {
height: 1.8rem;
}
.fb-container .cbi-input-text {
margin-bottom: 1rem;
width: 100%;
}
.fb-container .panel-title {
padding-bottom: 0;
width: 50%;
border-bottom: none;
}
.fb-container .panel-container {
display: flex;
align-items: center;
justify-content: space-between;
padding-bottom: 1rem;
border-bottom: 1px solid #eee;
}
.fb-container .upload-container {
display: none;
margin: 1rem 0;
}
.fb-container .upload-file {
margin-right: 2rem;
}
.fb-container .cbi-value-field {
text-align: left;
}
.fb-container .parent-icon strong {
margin-left: 1rem;
}
.fb-container td[class$="-icon"] {
cursor: pointer;
}
.fb-container .file-icon, .fb-container .folder-icon, .fb-container .link-icon {
position: relative;
}
.fb-container .file-icon:before, .fb-container .folder-icon:before, .fb-container .link-icon:before {
display: inline-block;
width: 1.5rem;
height: 1.5rem;
content: '';
background-size: contain;
margin: 0 0.5rem 0 1rem;
vertical-align: middle;
}
.fb-container .file-icon:before {
background-image: url(file-icon.png);
}
.fb-container .folder-icon:before {
background-image: url(folder-icon.png);
}
.fb-container .link-icon:before {
background-image: url(link-icon.png);
}
@media screen and (max-width: 480px) {
.fb-container .upload-file {
width: 14.6rem;
}
.fb-container .cbi-value-owner,
.fb-container .cbi-value-perm {
display: none;
}
}

.cbi-section-table {
width: 100%;
}

.cbi-section-table-cell {
text-align: right;
}

.cbi-button-install {
border-color: #c44;
color: #c44;
margin-left: 3px;
}

.cbi-value-field {
padding: 10px 0;
}

.parent-icon {
height: 1.8rem;
padding: 10px 0;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit aa2f0dd

Please sign in to comment.