From cf5438a996c3daa35d4e93cd772f26dcd317a2d1 Mon Sep 17 00:00:00 2001 From: CN_SZTL Date: Fri, 3 Apr 2020 02:05:17 +0800 Subject: [PATCH] luci-app-mia: remove duplicate package --- package/lienol/luci-app-mia/Makefile | 17 --- .../luci-app-mia/luasrc/controller/mia.lua | 17 --- .../luci-app-mia/luasrc/model/cbi/mia.lua | 44 ------- .../luci-app-mia/luasrc/view/mia/index.htm | 17 --- .../luci-app-mia/luasrc/view/mia/mia.htm | 3 - package/lienol/luci-app-mia/po/zh-cn/mia.po | 2 - .../lienol/luci-app-mia/root/etc/config/mia | 3 - .../lienol/luci-app-mia/root/etc/init.d/mia | 111 ------------------ .../etc/uci-defaults/luci-app-control-mia | 11 -- 9 files changed, 225 deletions(-) delete mode 100644 package/lienol/luci-app-mia/Makefile delete mode 100644 package/lienol/luci-app-mia/luasrc/controller/mia.lua delete mode 100644 package/lienol/luci-app-mia/luasrc/model/cbi/mia.lua delete mode 100644 package/lienol/luci-app-mia/luasrc/view/mia/index.htm delete mode 100644 package/lienol/luci-app-mia/luasrc/view/mia/mia.htm delete mode 100644 package/lienol/luci-app-mia/po/zh-cn/mia.po delete mode 100644 package/lienol/luci-app-mia/root/etc/config/mia delete mode 100755 package/lienol/luci-app-mia/root/etc/init.d/mia delete mode 100755 package/lienol/luci-app-mia/root/etc/uci-defaults/luci-app-control-mia diff --git a/package/lienol/luci-app-mia/Makefile b/package/lienol/luci-app-mia/Makefile deleted file mode 100644 index 80a8e03714..0000000000 --- a/package/lienol/luci-app-mia/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# 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 Mia -LUCI_PKGARCH:=all -PKG_VERSION:=1.0 -PKG_RELEASE:=3-20190309 - -include $(TOPDIR)/feeds/luci/luci.mk - -# call BuildPackage - OpenWrt buildroot signature - - diff --git a/package/lienol/luci-app-mia/luasrc/controller/mia.lua b/package/lienol/luci-app-mia/luasrc/controller/mia.lua deleted file mode 100644 index 4096b41894..0000000000 --- a/package/lienol/luci-app-mia/luasrc/controller/mia.lua +++ /dev/null @@ -1,17 +0,0 @@ -module("luci.controller.mia", package.seeall) - -function index() - if not nixio.fs.access("/etc/config/mia") then return end - - entry({"admin", "control"}, firstchild(), "Control", 44).dependent = false - entry({"admin", "control", "mia"}, cbi("mia"), _("时间控制"), 10).dependent = - true - entry({"admin", "control", "mia", "status"}, call("status")).leaf = true -end - -function status() - local e = {} - e.status = luci.sys.call("iptables -L FORWARD |grep MIA >/dev/null") == 0 - luci.http.prepare_content("application/json") - luci.http.write_json(e) -end diff --git a/package/lienol/luci-app-mia/luasrc/model/cbi/mia.lua b/package/lienol/luci-app-mia/luasrc/model/cbi/mia.lua deleted file mode 100644 index ab5083bf33..0000000000 --- a/package/lienol/luci-app-mia/luasrc/model/cbi/mia.lua +++ /dev/null @@ -1,44 +0,0 @@ -local o = require "luci.sys" -local a, t, e -a = Map("mia", translate("上网时间管理"), - translate("上网时间段控制系统。")) -a.template = "mia/index" -t = a:section(TypedSection, "basic", translate("Running Status")) -t.anonymous = true -e = t:option(DummyValue, "mia_status", translate("当前状态")) -e.template = "mia/mia" -e.value = translate("Collecting data...") -t = a:section(TypedSection, "basic", translate("基本设置")) -t.anonymous = true -e = t:option(Flag, "enable", translate("开启")) -e.rmempty = false -t = a:section(TypedSection, "macbind", translate("客户端设置")) -t.template = "cbi/tblsection" -t.anonymous = true -t.addremove = true -e = t:option(Flag, "enable", translate("开启控制")) -e.rmempty = false -e = t:option(Value, "macaddr", translate("黑名单MAC")) -e.rmempty = true -o.net.mac_hints(function(t, a) e:value(t, "%s (%s)" % {t, a}) end) -e = t:option(Value, "timeon", translate("禁止上网开始时间")) -e.default = "00:00" -e.optional = false -e = t:option(Value, "timeoff", translate("取消禁止上网时间")) -e.default = "23:59" -e.optional = false -e = t:option(Flag, "z1", translate("周一")) -e.rmempty = true -e = t:option(Flag, "z2", translate("周二")) -e.rmempty = true -e = t:option(Flag, "z3", translate("周三")) -e.rmempty = true -e = t:option(Flag, "z4", translate("周四")) -e.rmempty = true -e = t:option(Flag, "z5", translate("周五")) -e.rmempty = true -e = t:option(Flag, "z6", translate("周六")) -e.rmempty = true -e = t:option(Flag, "z7", translate("周日")) -e.rmempty = true -return a diff --git a/package/lienol/luci-app-mia/luasrc/view/mia/index.htm b/package/lienol/luci-app-mia/luasrc/view/mia/index.htm deleted file mode 100644 index b1b54ac5d5..0000000000 --- a/package/lienol/luci-app-mia/luasrc/view/mia/index.htm +++ /dev/null @@ -1,17 +0,0 @@ -<%# - Copyright 2016 Chen RuiWei - Licensed to the public under the Apache License 2.0. --%> - -<% include("cbi/map") %> - \ No newline at end of file diff --git a/package/lienol/luci-app-mia/luasrc/view/mia/mia.htm b/package/lienol/luci-app-mia/luasrc/view/mia/mia.htm deleted file mode 100644 index 5559002773..0000000000 --- a/package/lienol/luci-app-mia/luasrc/view/mia/mia.htm +++ /dev/null @@ -1,3 +0,0 @@ -<%+cbi/valueheader%> -<%=pcdata(self:cfgvalue(section) or self.default or "")%> -<%+cbi/valuefooter%> \ No newline at end of file diff --git a/package/lienol/luci-app-mia/po/zh-cn/mia.po b/package/lienol/luci-app-mia/po/zh-cn/mia.po deleted file mode 100644 index a883cf73ab..0000000000 --- a/package/lienol/luci-app-mia/po/zh-cn/mia.po +++ /dev/null @@ -1,2 +0,0 @@ -msgid "Control" -msgstr "管控" diff --git a/package/lienol/luci-app-mia/root/etc/config/mia b/package/lienol/luci-app-mia/root/etc/config/mia deleted file mode 100644 index 0c4c4f6bcd..0000000000 --- a/package/lienol/luci-app-mia/root/etc/config/mia +++ /dev/null @@ -1,3 +0,0 @@ - -config basic - option enable '0' diff --git a/package/lienol/luci-app-mia/root/etc/init.d/mia b/package/lienol/luci-app-mia/root/etc/init.d/mia deleted file mode 100755 index 84990ecec5..0000000000 --- a/package/lienol/luci-app-mia/root/etc/init.d/mia +++ /dev/null @@ -1,111 +0,0 @@ -#!/bin/sh /etc/rc.common -# -# Copyright (C) 2015 OpenWrt-dist -# Copyright (C) 2016 fw867 -# -# This is free software, licensed under the GNU General Public License v3. -# See /LICENSE for more information. -# - -START=99 - -CONFIG=mia - -uci_get_by_type() { - local index=0 - if [ -n $4 ]; then - index=$4 - fi - local ret=$(uci get $CONFIG.@$1[$index].$2 2>/dev/null) - echo ${ret:=$3} -} - -is_true() { - case $1 in - 1|on|true|yes|enabled) echo 0;; - *) echo 1;; - esac -} - -load_config() { - ENABLED=$(uci_get_by_type basic enable) - return $(is_true $ENABLED) -} - -add_rule(){ -local kp_enabled=0 -local ss_enabled=0 -[ `iptables -t nat -L SS 2>/dev/null |wc -l` -gt 0 ] && ss_enabled=1 -[ `iptables -t nat -L KOOLPROXY 2>/dev/null |wc -l` -gt 0 ] && kp_enabled=1 -for i in $(seq 0 100) -do - local enable=$(uci_get_by_type macbind enable '' $i) - local macaddr=$(uci_get_by_type macbind macaddr '' $i) - local timeon=$(uci_get_by_type macbind timeon '' $i) - local timeoff=$(uci_get_by_type macbind timeoff '' $i) - local z1=$(uci_get_by_type macbind z1 '' $i) - local z2=$(uci_get_by_type macbind z2 '' $i) - local z3=$(uci_get_by_type macbind z3 '' $i) - local z4=$(uci_get_by_type macbind z4 '' $i) - local z5=$(uci_get_by_type macbind z5 '' $i) - local z6=$(uci_get_by_type macbind z6 '' $i) - local z7=$(uci_get_by_type macbind z7 '' $i) - [ "$z1" == "1" ] && Z1="Mon," - [ "$z2" == "1" ] && Z2="Tue," - [ "$z3" == "1" ] && Z3="Wed," - [ "$z4" == "1" ] && Z4="Thu," - [ "$z5" == "1" ] && Z5="Fri," - [ "$z6" == "1" ] && Z6="Sat," - [ "$z7" == "1" ] && Z7="Sun" - if [ -z $enable ] || [ -z $macaddr ] || [ -z $timeoff ] || [ -z $timeon ]; then - break - fi - if [ "$enable" == "1" ]; then - iptables -t filter -I MIA -m mac --mac-source $macaddr -m time --kerneltz --timestart $timeon --timestop $timeoff --weekdays $Z1$Z2$Z3$Z4$Z5$Z6$Z7 -j DROP - [ "$ss_enabled" -eq 1 ] && iptables -t nat -I SS $((i+1)) -m mac --mac-source $macaddr -m time --kerneltz --timestart $timeon --timestop $timeoff --weekdays $Z1$Z2$Z3$Z4$Z5$Z6$Z7 -j RETURN - [ "$kp_enabled" -eq 1 ] && [ -z `iptables -t nat -L KOOLPROXY | grep -w RETURN | grep -w "$macaddr"` ] && iptables -t nat -I KOOLPROXY $((i+1)) -m mac --mac-source $macaddr -m time --kerneltz --timestart $timeon --timestop $timeoff --weekdays $Z1$Z2$Z3$Z4$Z5$Z6$Z7 -j RETURN - fi - for n in $(seq 1 7) - do - unset "Z$n" - done -done -} - -get_kp_disrule(){ - macaddr=$1 - local is_kp_disrule=0 - index=`uci show koolproxy |grep -w "$macaddr" |awk -F'.' '{print $2}'` - [ -n "$indexs" ] && [ `uci -q get koolproxy.$index.filter_mode` == "disable" ] && is_kp_disrule=1 -} - -del_rule(){ - type=$1 - blackMacAdd=$(iptables -t nat -L $type | grep -w RETURN | grep -w "MAC" | awk '{print $7}') - [ -n "$blackMacAdd" ] && { - for macaddrb in $blackMacAdd - do - [ "$type" == "KOOLPROXY" ] && { - get_kp_disrule $macaddrb - [ "$is_kp_disrule" -eq 1 ] && continue - } - iptables -t nat -D $type -m mac --mac-source $macaddrb -j RETURN - done - } -} - -start(){ - ! load_config && exit 0 - iptables -L FORWARD|grep -c MIA 2>/dev/null && [ $? -eq 0 ] && exit 0; - iptables -t filter -N MIA - iptables -t filter -I FORWARD -m comment --comment "Rule For Control" -j MIA - add_rule -} -stop(){ - iptables -t filter -D FORWARD -m comment --comment "Rule For Control" -j MIA - iptables -t filter -F MIA - iptables -t filter -X MIA - [ `iptables -t nat -L SS 2>/dev/null |wc -l` -gt 0 ] && del_rule SS - [ `iptables -t nat -L KOOLPROXY 2>/dev/null |wc -l` -gt 0 ] && del_rule KOOLPROXY -} - diff --git a/package/lienol/luci-app-mia/root/etc/uci-defaults/luci-app-control-mia b/package/lienol/luci-app-mia/root/etc/uci-defaults/luci-app-control-mia deleted file mode 100755 index 5ee8ec5283..0000000000 --- a/package/lienol/luci-app-mia/root/etc/uci-defaults/luci-app-control-mia +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -uci -q batch <<-EOF >/dev/null - delete ucitrack.@mia[-1] - add ucitrack mia - set ucitrack.@mia[-1].init=mia - commit ucitrack -EOF - -rm -f /tmp/luci-indexcache -exit 0