From 3c59c10a7c740dbed28e7c78bb15f5b0075a9ca3 Mon Sep 17 00:00:00 2001 From: kirillius Date: Sat, 31 Jan 2026 01:13:56 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B2=D1=8B=D0=BF=D0=B8=D0=BB=D0=B8=D0=BB=20ob?= =?UTF-8?q?solete=20=D1=81=D0=BA=D1=80=D0=B8=D0=BF=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 15 +-- assets/App.js | 79 --------------- assets/index.html | 36 ------- assets/jquery-3.7.1.min.js | 2 - assets/jrpc.js | 59 ----------- bin/ovpn-connect | 29 ------ bin/sync-networks | 27 ------ bin/webui | 4 - bin/webui-server | 17 ---- classes/Config.php | 57 ----------- classes/IPluggable.php | 8 -- classes/IPv4Subnet.php | 46 --------- classes/NetworkConfigReader.php | 33 ------- classes/Plugin.php | 49 ---------- classes/PluginContext.php | 43 -------- classes/RPC.php | 167 -------------------------------- classes/RouteUtil.php | 18 ---- classes/RoutingTableReader.php | 39 -------- classes/StaticRPC.php | 15 --- classes/WebRouter.php | 85 ---------------- common.inc.php | 74 -------------- config.json.example | 14 --- loader.php | 15 --- networks/META.json | 35 ------- networks/broadcom.json | 16 --- networks/cloudflare.json | 21 ---- networks/cloudfront.json | 40 -------- networks/cura.json | 9 -- networks/discord.json | 23 ----- networks/flibusta.json | 9 -- networks/github.json | 7 -- networks/google.json | 103 -------------------- networks/habr.json | 9 -- networks/intel.json | 9 -- networks/jetbrains.json | 11 --- networks/lostfilm.json | 7 -- networks/notion.json | 11 --- networks/public dns.json | 10 -- networks/rutor.json | 7 -- networks/rutracker.json | 17 ---- networks/snapeda.json | 8 -- plugins/api/API.php | 32 ------ plugins/api/metadata.json | 5 - plugins/api/plugin.js | 7 -- plugins/custom/Custom.php | 35 ------- plugins/custom/metadata.json | 10 -- plugins/custom/plugin.js | 5 - plugins/named/BindPlugin.php | 57 ----------- plugins/named/metadata.json | 8 -- plugins/named/plugin.js | 21 ---- plugins/netsync/Netsync.php | 79 --------------- plugins/netsync/metadata.json | 7 -- plugins/netsync/plugin.js | 21 ---- plugins/openvpn/Openvpn.php | 44 --------- plugins/openvpn/metadata.json | 6 -- plugins/openvpn/plugin.js | 20 ---- plugins/quagga/QuaggaPlugin.php | 84 ---------------- plugins/quagga/metadata.json | 7 -- plugins/quagga/plugin.js | 20 ---- plugins/updates/Updates.php | 24 ----- plugins/updates/metadata.json | 5 - plugins/updates/plugin.js | 22 ----- restart.php | 12 --- server.php | 4 - 64 files changed, 1 insertion(+), 1817 deletions(-) delete mode 100644 assets/App.js delete mode 100644 assets/index.html delete mode 100644 assets/jquery-3.7.1.min.js delete mode 100644 assets/jrpc.js delete mode 100755 bin/ovpn-connect delete mode 100755 bin/sync-networks delete mode 100644 bin/webui delete mode 100755 bin/webui-server delete mode 100644 classes/Config.php delete mode 100644 classes/IPluggable.php delete mode 100644 classes/IPv4Subnet.php delete mode 100644 classes/NetworkConfigReader.php delete mode 100644 classes/Plugin.php delete mode 100644 classes/PluginContext.php delete mode 100644 classes/RPC.php delete mode 100644 classes/RouteUtil.php delete mode 100644 classes/RoutingTableReader.php delete mode 100644 classes/StaticRPC.php delete mode 100644 classes/WebRouter.php delete mode 100644 common.inc.php delete mode 100644 config.json.example delete mode 100644 loader.php delete mode 100644 networks/META.json delete mode 100644 networks/broadcom.json delete mode 100644 networks/cloudflare.json delete mode 100644 networks/cloudfront.json delete mode 100644 networks/cura.json delete mode 100644 networks/discord.json delete mode 100644 networks/flibusta.json delete mode 100644 networks/github.json delete mode 100644 networks/google.json delete mode 100644 networks/habr.json delete mode 100644 networks/intel.json delete mode 100644 networks/jetbrains.json delete mode 100644 networks/lostfilm.json delete mode 100644 networks/notion.json delete mode 100644 networks/public dns.json delete mode 100644 networks/rutor.json delete mode 100644 networks/rutracker.json delete mode 100644 networks/snapeda.json delete mode 100644 plugins/api/API.php delete mode 100644 plugins/api/metadata.json delete mode 100644 plugins/api/plugin.js delete mode 100755 plugins/custom/Custom.php delete mode 100644 plugins/custom/metadata.json delete mode 100644 plugins/custom/plugin.js delete mode 100644 plugins/named/BindPlugin.php delete mode 100644 plugins/named/metadata.json delete mode 100644 plugins/named/plugin.js delete mode 100644 plugins/netsync/Netsync.php delete mode 100644 plugins/netsync/metadata.json delete mode 100644 plugins/netsync/plugin.js delete mode 100755 plugins/openvpn/Openvpn.php delete mode 100644 plugins/openvpn/metadata.json delete mode 100644 plugins/openvpn/plugin.js delete mode 100644 plugins/quagga/QuaggaPlugin.php delete mode 100644 plugins/quagga/metadata.json delete mode 100644 plugins/quagga/plugin.js delete mode 100644 plugins/updates/Updates.php delete mode 100644 plugins/updates/metadata.json delete mode 100644 plugins/updates/plugin.js delete mode 100644 restart.php delete mode 100644 server.php diff --git a/README.md b/README.md index 7e567ab..1f66fcc 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,5 @@ # Protected Resources Список ресурсов для настройки родительского контроля чтобы заблокировать доступ детям до запрещённых в РФ вражеских сервисов. -## networks +## resources Каталог с файлами сервисов и их подсетей - -### Установка -```shell -apk add php php-session php-curl jq git -cd /opt -git clone https://git.kirillius.ru/kirillius/protected-resources-list.git -cd /opt/protected-resources-list/ -chmod -R +x ./bin -ln -s /opt/protected-resources-list/bin/webui /etc/init.d/webui -cp config.json.example config.json -rc-update add webui -/etc/init.d/webui start -``` \ No newline at end of file diff --git a/assets/App.js b/assets/App.js deleted file mode 100644 index 92baf2c..0000000 --- a/assets/App.js +++ /dev/null @@ -1,79 +0,0 @@ -import {JSONRPC} from "./jrpc.js"; - -const App = { - config: {}, - networks: {}, - RPC: JSONRPC -}; - - -App.auth = async function () { - let authorized = await JSONRPC.__invoke("auth"); - if (!authorized) { - do { - let pass = prompt("Password"); - authorized = await JSONRPC.__invoke("auth", { - "password": pass - }); - - if (!authorized) { - alert("Wrong password"); - } - } while (!authorized); - } - - this.config = await JSONRPC.__invoke("getConfig"); - this.networks = await JSONRPC.__invoke("getNetworks"); - - - for (const key of this.config.plugins) { - $("body").append("<" + "script type='module' src='/plugins/" + key + "/plugin.js'><" + "/script>"); - } - - $("#loading").hide(); - - this.fillNetworks(); - - $("#panel").show(); - - let invalidNetworks = await JSONRPC.__invoke("getInvalidNetworks"); - - if (invalidNetworks.length > 0) { - $("body").append(`There are invalid networks
` + invalidNetworks.join("
") + `
`); - } -} - -App.fillNetworks = function () { - const that = this; - let proto = $("#net-table tr"); - proto.detach(); - - for (const net in this.networks) { - let item = proto.clone(); - item.find("input").prop('checked', this.config.networks.indexOf(net) !== -1).change(function () { - if ($(this).prop('checked')) { - that.config.networks.push(net); - } else { - that.config.networks = that.config.networks.filter(e => e !== net); - } - }); - item.find("span").text(net); - $("#net-table").append(item); - } -} - -App.render = async function () { - await this.auth(); - $("#save").click(function () { - const self = $(this); - self.prop("disabled", true); - (async function () { - await JSONRPC.__invoke("setConfig", App.config); - alert("Config saved!"); - self.prop("disabled", false); - })(); - }); -} - - -export {App}; \ No newline at end of file diff --git a/assets/index.html b/assets/index.html deleted file mode 100644 index bf02845..0000000 --- a/assets/index.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - Routing config - - - -Loading... - - - - - - - - \ No newline at end of file diff --git a/assets/jquery-3.7.1.min.js b/assets/jquery-3.7.1.min.js deleted file mode 100644 index 7f37b5d..0000000 --- a/assets/jquery-3.7.1.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! jQuery v3.7.1 | (c) OpenJS Foundation and other contributors | jquery.org/license */ -!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(ie,e){"use strict";var oe=[],r=Object.getPrototypeOf,ae=oe.slice,g=oe.flat?function(e){return oe.flat.call(e)}:function(e){return oe.concat.apply([],e)},s=oe.push,se=oe.indexOf,n={},i=n.toString,ue=n.hasOwnProperty,o=ue.toString,a=o.call(Object),le={},v=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},y=function(e){return null!=e&&e===e.window},C=ie.document,u={type:!0,src:!0,nonce:!0,noModule:!0};function m(e,t,n){var r,i,o=(n=n||C).createElement("script");if(o.text=e,t)for(r in u)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[i.call(e)]||"object":typeof e}var t="3.7.1",l=/HTML$/i,ce=function(e,t){return new ce.fn.init(e,t)};function c(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!v(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+ge+")"+ge+"*"),x=new RegExp(ge+"|>"),j=new RegExp(g),A=new RegExp("^"+t+"$"),D={ID:new RegExp("^#("+t+")"),CLASS:new RegExp("^\\.("+t+")"),TAG:new RegExp("^("+t+"|[*])"),ATTR:new RegExp("^"+p),PSEUDO:new RegExp("^"+g),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ge+"*(even|odd|(([+-]|)(\\d*)n|)"+ge+"*(?:([+-]|)"+ge+"*(\\d+)|))"+ge+"*\\)|)","i"),bool:new RegExp("^(?:"+f+")$","i"),needsContext:new RegExp("^"+ge+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ge+"*((?:-\\d)?\\d*)"+ge+"*\\)|)(?=[^-]|$)","i")},N=/^(?:input|select|textarea|button)$/i,q=/^h\d$/i,L=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,H=/[+~]/,O=new RegExp("\\\\[\\da-fA-F]{1,6}"+ge+"?|\\\\([^\\r\\n\\f])","g"),P=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},M=function(){V()},R=J(function(e){return!0===e.disabled&&fe(e,"fieldset")},{dir:"parentNode",next:"legend"});try{k.apply(oe=ae.call(ye.childNodes),ye.childNodes),oe[ye.childNodes.length].nodeType}catch(e){k={apply:function(e,t){me.apply(e,ae.call(t))},call:function(e){me.apply(e,ae.call(arguments,1))}}}function I(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(V(e),e=e||T,C)){if(11!==p&&(u=L.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return k.call(n,a),n}else if(f&&(a=f.getElementById(i))&&I.contains(e,a)&&a.id===i)return k.call(n,a),n}else{if(u[2])return k.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&e.getElementsByClassName)return k.apply(n,e.getElementsByClassName(i)),n}if(!(h[t+" "]||d&&d.test(t))){if(c=t,f=e,1===p&&(x.test(t)||m.test(t))){(f=H.test(t)&&U(e.parentNode)||e)==e&&le.scope||((s=e.getAttribute("id"))?s=ce.escapeSelector(s):e.setAttribute("id",s=S)),o=(l=Y(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+Q(l[o]);c=l.join(",")}try{return k.apply(n,f.querySelectorAll(c)),n}catch(e){h(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return re(t.replace(ve,"$1"),e,n,r)}function W(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function F(e){return e[S]=!0,e}function $(e){var t=T.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function B(t){return function(e){return fe(e,"input")&&e.type===t}}function _(t){return function(e){return(fe(e,"input")||fe(e,"button"))&&e.type===t}}function z(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&R(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function X(a){return F(function(o){return o=+o,F(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function U(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function V(e){var t,n=e?e.ownerDocument||e:ye;return n!=T&&9===n.nodeType&&n.documentElement&&(r=(T=n).documentElement,C=!ce.isXMLDoc(T),i=r.matches||r.webkitMatchesSelector||r.msMatchesSelector,r.msMatchesSelector&&ye!=T&&(t=T.defaultView)&&t.top!==t&&t.addEventListener("unload",M),le.getById=$(function(e){return r.appendChild(e).id=ce.expando,!T.getElementsByName||!T.getElementsByName(ce.expando).length}),le.disconnectedMatch=$(function(e){return i.call(e,"*")}),le.scope=$(function(){return T.querySelectorAll(":scope")}),le.cssHas=$(function(){try{return T.querySelector(":has(*,:jqfake)"),!1}catch(e){return!0}}),le.getById?(b.filter.ID=function(e){var t=e.replace(O,P);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(O,P);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):t.querySelectorAll(e)},b.find.CLASS=function(e,t){if("undefined"!=typeof t.getElementsByClassName&&C)return t.getElementsByClassName(e)},d=[],$(function(e){var t;r.appendChild(e).innerHTML="",e.querySelectorAll("[selected]").length||d.push("\\["+ge+"*(?:value|"+f+")"),e.querySelectorAll("[id~="+S+"-]").length||d.push("~="),e.querySelectorAll("a#"+S+"+*").length||d.push(".#.+[+~]"),e.querySelectorAll(":checked").length||d.push(":checked"),(t=T.createElement("input")).setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),r.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&d.push(":enabled",":disabled"),(t=T.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||d.push("\\["+ge+"*name"+ge+"*="+ge+"*(?:''|\"\")")}),le.cssHas||d.push(":has"),d=d.length&&new RegExp(d.join("|")),l=function(e,t){if(e===t)return a=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!le.sortDetached&&t.compareDocumentPosition(e)===n?e===T||e.ownerDocument==ye&&I.contains(ye,e)?-1:t===T||t.ownerDocument==ye&&I.contains(ye,t)?1:o?se.call(o,e)-se.call(o,t):0:4&n?-1:1)}),T}for(e in I.matches=function(e,t){return I(e,null,null,t)},I.matchesSelector=function(e,t){if(V(e),C&&!h[t+" "]&&(!d||!d.test(t)))try{var n=i.call(e,t);if(n||le.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){h(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(O,P),e[3]=(e[3]||e[4]||e[5]||"").replace(O,P),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||I.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&I.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return D.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&j.test(n)&&(t=Y(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(O,P).toLowerCase();return"*"===e?function(){return!0}:function(e){return fe(e,t)}},CLASS:function(e){var t=s[e+" "];return t||(t=new RegExp("(^|"+ge+")"+e+"("+ge+"|$)"))&&s(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=I.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function T(e,n,r){return v(n)?ce.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?ce.grep(e,function(e){return e===n!==r}):"string"!=typeof n?ce.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(ce.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||k,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:S.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof ce?t[0]:t,ce.merge(this,ce.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:C,!0)),w.test(r[1])&&ce.isPlainObject(t))for(r in t)v(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=C.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):v(e)?void 0!==n.ready?n.ready(e):e(ce):ce.makeArray(e,this)}).prototype=ce.fn,k=ce(C);var E=/^(?:parents|prev(?:Until|All))/,j={children:!0,contents:!0,next:!0,prev:!0};function A(e,t){while((e=e[t])&&1!==e.nodeType);return e}ce.fn.extend({has:function(e){var t=ce(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,Ce=/^$|^module$|\/(?:java|ecma)script/i;xe=C.createDocumentFragment().appendChild(C.createElement("div")),(be=C.createElement("input")).setAttribute("type","radio"),be.setAttribute("checked","checked"),be.setAttribute("name","t"),xe.appendChild(be),le.checkClone=xe.cloneNode(!0).cloneNode(!0).lastChild.checked,xe.innerHTML="",le.noCloneChecked=!!xe.cloneNode(!0).lastChild.defaultValue,xe.innerHTML="",le.option=!!xe.lastChild;var ke={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function Se(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&fe(e,t)?ce.merge([e],n):n}function Ee(e,t){for(var n=0,r=e.length;n",""]);var je=/<|&#?\w+;/;function Ae(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function Re(e,t){return fe(e,"table")&&fe(11!==t.nodeType?t:t.firstChild,"tr")&&ce(e).children("tbody")[0]||e}function Ie(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function We(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Fe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(_.hasData(e)&&(s=_.get(e).events))for(i in _.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),C.head.appendChild(r[0])},abort:function(){i&&i()}}});var Jt,Kt=[],Zt=/(=)\?(?=&|$)|\?\?/;ce.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Kt.pop()||ce.expando+"_"+jt.guid++;return this[e]=!0,e}}),ce.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Zt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Zt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=v(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Zt,"$1"+r):!1!==e.jsonp&&(e.url+=(At.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||ce.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=ie[r],ie[r]=function(){o=arguments},n.always(function(){void 0===i?ce(ie).removeProp(r):ie[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Kt.push(r)),o&&v(i)&&i(o[0]),o=i=void 0}),"script"}),le.createHTMLDocument=((Jt=C.implementation.createHTMLDocument("").body).innerHTML="
",2===Jt.childNodes.length),ce.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(le.createHTMLDocument?((r=(t=C.implementation.createHTMLDocument("")).createElement("base")).href=C.location.href,t.head.appendChild(r)):t=C),o=!n&&[],(i=w.exec(e))?[t.createElement(i[1])]:(i=Ae([e],t,o),o&&o.length&&ce(o).remove(),ce.merge([],i.childNodes)));var r,i,o},ce.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(ce.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},ce.expr.pseudos.animated=function(t){return ce.grep(ce.timers,function(e){return t===e.elem}).length},ce.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=ce.css(e,"position"),c=ce(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=ce.css(e,"top"),u=ce.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),v(t)&&(t=t.call(e,n,ce.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},ce.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){ce.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===ce.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===ce.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=ce(e).offset()).top+=ce.css(e,"borderTopWidth",!0),i.left+=ce.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-ce.css(r,"marginTop",!0),left:t.left-i.left-ce.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===ce.css(e,"position"))e=e.offsetParent;return e||J})}}),ce.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;ce.fn[t]=function(e){return M(this,function(e,t,n){var r;if(y(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),ce.each(["top","left"],function(e,n){ce.cssHooks[n]=Ye(le.pixelPosition,function(e,t){if(t)return t=Ge(e,n),_e.test(t)?ce(e).position()[n]+"px":t})}),ce.each({Height:"height",Width:"width"},function(a,s){ce.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){ce.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return M(this,function(e,t,n){var r;return y(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?ce.css(e,t,i):ce.style(e,t,n,i)},s,n?e:void 0,n)}})}),ce.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){ce.fn[t]=function(e){return this.on(t,e)}}),ce.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.on("mouseenter",e).on("mouseleave",t||e)}}),ce.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){ce.fn[n]=function(e,t){return 0getPlugins()["openvpn"] ?? null; - if ($instance === null) { - throw new RuntimeException("Plugin is not enabled"); - } - /** - * @var Custom $instance - */ - - $config = $instance->getRoutingConfig(); - $outfile = $argv[1]; - file_put_contents($outfile, implode("\n", $config)); -} catch (Exception $e) { - echo "\nError:" . $e->getMessage() . "\n"; - exit(1); -} - -exit(0); \ No newline at end of file diff --git a/bin/sync-networks b/bin/sync-networks deleted file mode 100755 index 54db7f4..0000000 --- a/bin/sync-networks +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/php -getPlugins()["netsync"] ?? null; - if ($instance === null) { - throw new RuntimeException("Plugin is not enabled"); - } - /** - * @var Netsync $instance - */ - - $config = $instance->sync(); - - var_dump($config); - -} catch (Exception $e) { - echo "\nError:" . $e->getMessage() . "\n"; - exit(1); -} - -exit(0); \ No newline at end of file diff --git a/bin/webui b/bin/webui deleted file mode 100644 index db03710..0000000 --- a/bin/webui +++ /dev/null @@ -1,4 +0,0 @@ -#!/sbin/openrc-run -command="/opt/protected-resources-list/bin/webui-server" -command_background=true -pidfile="/run/${RC_SVCNAME}.pid" \ No newline at end of file diff --git a/bin/webui-server b/bin/webui-server deleted file mode 100755 index 97ea029..0000000 --- a/bin/webui-server +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -SELFDIR=`dirname $0` -ROOT=`realpath $SELFDIR/..` -CFGFILE=$ROOT/config.json - -if ! test -f "$CFGFILE"; then - echo Config file $CFGFILE not found - exit 1 -fi - -HOST=`jq -r .web.host $CFGFILE` -PORT=`jq -r .web.port $CFGFILE` -#TODO FIXME !!!! -killall php -cd $ROOT -php $ROOT/loader.php --init -php -S $HOST:$PORT $ROOT/server.php \ No newline at end of file diff --git a/classes/Config.php b/classes/Config.php deleted file mode 100644 index 98e4299..0000000 --- a/classes/Config.php +++ /dev/null @@ -1,57 +0,0 @@ -data; - } - - public function fromArray($a) - { - $this->data = $a; - } - - public function __construct() - { - $this->path = dirname(__DIR__) . "/config.json"; - } - - public function read(): void - { - $this->data = @json_decode(@file_get_contents($this->path), true); - if ($this->data == null) { - throw new RuntimeException("Failed to read or parse config file"); - } - } - - public function save(): void - { - file_put_contents($this->path, json_encode($this->data,JSON_PRETTY_PRINT)); - } - - private mixed $data = []; - - - public function offsetExists(mixed $offset): bool - { - return isset($this->data[$offset]); - } - - public function offsetGet(mixed $offset): mixed - { - return $this->data[$offset]; - } - - public function offsetSet(mixed $offset, mixed $value): void - { - $this->data[$offset] = $value; - } - - public function offsetUnset(mixed $offset): void - { - unset($this->data[$offset]); - } -} \ No newline at end of file diff --git a/classes/IPluggable.php b/classes/IPluggable.php deleted file mode 100644 index 60fee4c..0000000 --- a/classes/IPluggable.php +++ /dev/null @@ -1,8 +0,0 @@ -address = $subnetAddress; - if (ip2long($subnetAddress) === false) { - throw new RuntimeException("Invalid subnet address: " . $subnetAddress); - } - $this->prefix = $prefix; - if ($prefix < 0 or $prefix > 32) { - throw new RuntimeException("Invalid subnet prefix: " . $prefix); - } - } - - public function getFirstAddress() - { - $a = ip2long($this->address); - $mask = ip2long($this->getNetMask()); - return long2ip($a & $mask); - } - - public function getLastAddress() - { - return long2ip(ip2long($this->getFirstAddress()) + $this->getAddressCount() - 1); - } - - public function getAddressCount() - { - return pow(2, 32 - $this->prefix); - } - - public function getNetMask() - { - return long2ip(-1 << (32 - $this->prefix)); - } -} \ No newline at end of file diff --git a/classes/NetworkConfigReader.php b/classes/NetworkConfigReader.php deleted file mode 100644 index 7d3d0fb..0000000 --- a/classes/NetworkConfigReader.php +++ /dev/null @@ -1,33 +0,0 @@ -getExtension() === "json") { - $key = $file->getBasename(".json"); - $value = @json_decode(@file_get_contents($file->getPathname()), true); - - if ($value === null) { - throw new RuntimeException("Network file " . $file->getBasename() . " is invalid or cannot be read"); - } - - $this->configs[$key] = $value; - } - } - } - - public function getConfigs(): array - { - return $this->configs; - } -} \ No newline at end of file diff --git a/classes/Plugin.php b/classes/Plugin.php deleted file mode 100644 index 3ab545d..0000000 --- a/classes/Plugin.php +++ /dev/null @@ -1,49 +0,0 @@ -context = $context; - $this->checkConfig(); - $this->config = $this->context->getConfig()[$context->getName()]; - } - - protected function checkConfig(): void - { - $config = $this->context->getConfig(); - $defaults = $this->context->getMetadata()["config"]; - $name = $this->context->getName(); - - if (!isset($config[$name])) { - $config[$name] = $defaults; - return; - } - - foreach ($defaults as $key => $value) { - if (!isset($config[$name][$key])) { - $config[$name][$key] = $value; - } - } - } - - protected function saveConfig() - { - $wrapper = $this->context->getConfig(); - $wrapper[$this->context->getName()] = $this->config; - $wrapper->save(); - } -} \ No newline at end of file diff --git a/classes/PluginContext.php b/classes/PluginContext.php deleted file mode 100644 index d8ccfec..0000000 --- a/classes/PluginContext.php +++ /dev/null @@ -1,43 +0,0 @@ -name; - } - - /** - * @param RPC $RPC - * @param Config $config - * @param array $metadata - * @param string $name - */ - public function __construct(RPC $RPC, Config $config, array $metadata, string $name) - { - $this->name = $name; - $this->RPC = $RPC; - $this->config = $config; - $this->metadata = $metadata; - } - - public function getRPC(): RPC - { - return $this->RPC; - } - - public function getConfig(): Config - { - return $this->config; - } - - public function getMetadata(): array - { - return $this->metadata; - } -} \ No newline at end of file diff --git a/classes/RPC.php b/classes/RPC.php deleted file mode 100644 index 7acc246..0000000 --- a/classes/RPC.php +++ /dev/null @@ -1,167 +0,0 @@ -plugins; - } - - public function __construct() - { - $this->config = new Config(); - $this->config->read(); - - foreach ($this->config["plugins"] as $plugin) { - try { - $meta = $this->getPluginMetadata($plugin); - $inst = $this->loadPlugin($plugin, $meta["class"]); - $inst->onInit(new PluginContext($this, $this->config, $meta, $plugin)); - } catch (Error $e) { - continue; - } - } - } - - private function getPluginMetadata($name): array - { - $root = dirname(__DIR__) . "/plugins/" . $name; - if (!file_exists($root)) { - throw new RuntimeException("Plugin $name dir not found"); - } - $metafile = $root . "/metadata.json"; - if (!file_exists($metafile)) { - throw new RuntimeException("Plugin $name metadata not found"); - } - - $meta = @json_decode(@file_get_contents($metafile), true); - - if ($meta === null) { - throw new RuntimeException("Unable to parse $name plugin metadata"); - } - return $meta; - } - - private function loadPlugin($name, $classname): IPluggable - { - $file = dirname(__DIR__) . "/plugins/" . $name . "/" . $classname . ".php"; - if (!file_exists($file)) { - throw new RuntimeException("Plugin $name class $classname not found"); - } - require_once $file; - - $instance = new $classname(); - if (!($instance instanceof IPluggable)) { - throw new RuntimeException("Class $classname have to implement IPluggable"); - } - - return $this->plugins[$name] = $instance; - } - - public function getConfig(): array - { - $this->checkAuth(); - return $this->config->asArray(); - } - - public function setConfig($config): bool - { - $this->config->fromArray($config); - $this->config->save(); - return true; - } - - private function checkAuth(): void - { - $auth = $_SESSION["auth"] ?? false; - if (!$auth) { - throw new RuntimeException("Unauthorized"); - } - } - - public function getNetworks(): array - { - $this->checkAuth(); - return (new NetworkConfigReader())->getConfigs(); - } - - public function getInvalidNetworks(): array - { - $this->checkAuth(); - $invalid = []; - foreach ((new NetworkConfigReader())->getConfigs() as $config) { - foreach ($config["networks"] as $network) { - if (!RouteUtil::validateSubnet($network)) { - $invalid[] = $network; - } - } - } - return $invalid; - } - - - public function logout(): void - { - $_SESSION["auth"] = false; - } - - public function auth($params): bool - { - if (isset($params["password"])) { - if ($this->comparePassword($params["password"])) { - return $_SESSION["auth"] = true; - } else { - return false; - } - } - return $_SESSION["auth"] ?? false; - } - - private function comparePassword($passwd): bool - { - $pass = $this->config["password"]; - if ($pass["type"] == "plaintext") { - return $pass["data"] == $passwd; - } else if ($pass["type"] == "hash") { - return $this->hash($passwd) == $pass["data"]; - } - return false; - } - - private function hash($what): string - { - return md5(sha1($what) . md5($what)); - } - - private function isInternalMethod($name) - { - $cls = new ReflectionClass(IPluggable::class); - return $cls->hasMethod($name); - } - - public function __invoke($method, $args) - { - $parts = explode("::", $method); - $isPlugin = count($parts) > 1; - - if ($isPlugin) { - $this->checkAuth(); - $plugin = $this->plugins[$parts[0]]; - $methodname = $parts[1]; - if ($this->isInternalMethod($methodname)) { - throw new RuntimeException("Unable to invoke internal methods"); - } - return call_user_func([$plugin, $methodname], $args); - } else { - $cls = new ReflectionClass(__CLASS__); - $method = $cls->getMethod($method); - if (!$method or !$method->isPublic()) { - throw new RuntimeException("Unable to find method"); - } - return $method->invoke($this, $args); - } - } -} \ No newline at end of file diff --git a/classes/RouteUtil.php b/classes/RouteUtil.php deleted file mode 100644 index db9a83a..0000000 --- a/classes/RouteUtil.php +++ /dev/null @@ -1,18 +0,0 @@ -getFirstAddress(); - } catch (Exception $e) { - return false; - } - } -} \ No newline at end of file diff --git a/classes/RoutingTableReader.php b/classes/RoutingTableReader.php deleted file mode 100644 index 6f2c814..0000000 --- a/classes/RoutingTableReader.php +++ /dev/null @@ -1,39 +0,0 @@ -routes; - } - - public function __construct() - { - $result = @shell_exec("ip --json route show"); - - if (!$result) { - throw new RuntimeException("Failed to read routing table"); - } - - - $this->routes = @json_decode($result, true); - - if ($this->routes === null) { - throw new RuntimeException("Failed to parse json output"); - } - - foreach ($this->routes as $key => &$route) { - if ($route["dst"] === "default") { - $route["dst"] = "0.0.0.0/0"; - } elseif (!str_contains($route["dst"], "/")) { - $route["dst"] .= "/32"; - } - } - } -} \ No newline at end of file diff --git a/classes/StaticRPC.php b/classes/StaticRPC.php deleted file mode 100644 index 574c759..0000000 --- a/classes/StaticRPC.php +++ /dev/null @@ -1,15 +0,0 @@ -plugins; - } -} \ No newline at end of file diff --git a/classes/WebRouter.php b/classes/WebRouter.php deleted file mode 100644 index 777fe2d..0000000 --- a/classes/WebRouter.php +++ /dev/null @@ -1,85 +0,0 @@ -requestBody = @file_get_contents('php://input'); - $this->requestedFile = dirname(__DIR__) . "/" . $_SERVER["REQUEST_URI"]; - $this->URI = $_SERVER["REQUEST_URI"]; - } - - public function handleRequest(): void - { - @session_start(); - try { - if (str_starts_with($this->URI, "/assets") or str_starts_with($this->URI, "/plugins") and str_ends_with($this->URI, ".js")) { - $this->handleAsset(); - } elseif (!str_starts_with($this->URI, "/rpc")) { - $this->redirect("/assets/index.html"); - } else { - $this->handleJRPC(); - } - } finally { - session_write_close(); - } - } - - private function handleJRPC(): void - { - try { - $request = @json_decode($this->requestBody, true); - if ($request === null) { - throw new RuntimeException("Failed to parse JRPC"); - } - - foreach (["id", "jsonrpc", "method", "params"] as $param) { - if (!isset($request[$param])) { - throw new RuntimeException("Bad JRPC structure"); - } - } - - $rpc = new RPC(); - $response = $rpc($request["method"], $request["params"]); - - header("content-type: application/json"); - - echo json_encode([ - "jsonrpc" => "2.0", - "id" => $request["id"] ?? 0, - "result" => $response - ]); - - } catch (Throwable $e) { - http_response_code(500); - echo json_encode([ - "jsonrpc" => "2.0", - "id" => $request["id"], - "error" => $e->getMessage() - ]); - } - - } - - private function handleAsset(): void - { - if (!file_exists($this->requestedFile)) { - http_response_code(404); - echo "File not found: " . $this->URI; - } else { - header("content-type: " . mime_content_type($this->requestedFile)); - echo file_get_contents($this->requestedFile); - } - - } - - private function redirect($where): void - { - http_response_code(302); - header("location: " . $where); - } -} \ No newline at end of file diff --git a/common.inc.php b/common.inc.php deleted file mode 100644 index 22c079b..0000000 --- a/common.inc.php +++ /dev/null @@ -1,74 +0,0 @@ - 'text/plain', - 'htm' => 'text/html', - 'html' => 'text/html', - 'php' => 'text/html', - 'css' => 'text/css', - 'js' => 'application/javascript', - 'json' => 'application/json', - 'xml' => 'application/xml', - 'swf' => 'application/x-shockwave-flash', - 'flv' => 'video/x-flv', - - // images - 'png' => 'image/png', - 'jpe' => 'image/jpeg', - 'jpeg' => 'image/jpeg', - 'jpg' => 'image/jpeg', - 'gif' => 'image/gif', - 'bmp' => 'image/bmp', - 'ico' => 'image/vnd.microsoft.icon', - 'tiff' => 'image/tiff', - 'tif' => 'image/tiff', - 'svg' => 'image/svg+xml', - 'svgz' => 'image/svg+xml', - - // archives - 'zip' => 'application/zip', - 'rar' => 'application/x-rar-compressed', - 'exe' => 'application/x-msdownload', - 'msi' => 'application/x-msdownload', - 'cab' => 'application/vnd.ms-cab-compressed', - - // audio/video - 'mp3' => 'audio/mpeg', - 'qt' => 'video/quicktime', - 'mov' => 'video/quicktime', - - // adobe - 'pdf' => 'application/pdf', - 'psd' => 'image/vnd.adobe.photoshop', - 'ai' => 'application/postscript', - 'eps' => 'application/postscript', - 'ps' => 'application/postscript', - - // ms office - 'doc' => 'application/msword', - 'rtf' => 'application/rtf', - 'xls' => 'application/vnd.ms-excel', - 'ppt' => 'application/vnd.ms-powerpoint', - - // open office - 'odt' => 'application/vnd.oasis.opendocument.text', - 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', - ); - - $parts = explode('.', $filename); - $ext = strtolower(array_pop($parts)); - if (array_key_exists($ext, $mime_types)) { - return $mime_types[$ext]; - } elseif (function_exists('finfo_open')) { - $finfo = finfo_open(FILEINFO_MIME); - $mimetype = finfo_file($finfo, $filename); - finfo_close($finfo); - return $mimetype; - } else { - return 'application/octet-stream'; - } - } -} diff --git a/config.json.example b/config.json.example deleted file mode 100644 index 27308e5..0000000 --- a/config.json.example +++ /dev/null @@ -1,14 +0,0 @@ -{ - "password": { - "type": "plaintext", - "data": "admin" - }, - "networks": [ - "google" - ], - "web": { - "port":8000, - "host":"0.0.0.0" - }, - "plugins":["updates"] -} \ No newline at end of file diff --git a/loader.php b/loader.php deleted file mode 100644 index 4880f31..0000000 --- a/loader.php +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/php -getPlugins() as $plugin => $instance) { - /** - * @var IPluggable $instance - */ - $instance->onServerStarted(); - } -} \ No newline at end of file diff --git a/networks/META.json b/networks/META.json deleted file mode 100644 index 9f04e59..0000000 --- a/networks/META.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "description": "facebook, instagram, oculus", - "domains": [], - "networks": [ - "213.102.128.0/24", - "204.15.20.0/22", - "199.201.0.0/16", - "185.89.0.0/16", - "185.60.216.0/21", - "179.60.0.0/16", - "173.252.0.0/16", - "173.194.10.0/24", - "164.163.191.64/26", - "163.70.0.0/16", - "157.240.0.0/16", - "147.75.0.0/16", - "142.250.0.0/15", - "129.134.0.0/16", - "103.4.0.0/16", - "102.221.0.0/16", - "102.132.0.0/16", - "99.84.0.0/16", - "87.245.208.0/24", - "77.240.43.0/24", - "74.119.0.0/16", - "69.171.0.0/16", - "69.63.0.0/16", - "66.220.0.0/16", - "57.141.0.0/16", - "57.144.222.0/24", - "45.64.0.0/16", - "45.130.4.0/24", - "31.13.0.0/16" - ] -} \ No newline at end of file diff --git a/networks/broadcom.json b/networks/broadcom.json deleted file mode 100644 index cf1e8c7..0000000 --- a/networks/broadcom.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "description": "broadcom.com", - "domains": ["broadcom.com","omnissa.com"], - "networks": [ - "172.66.0.165/32", - "162.159.140.167/32", - "54.68.22.26/32", - "50.112.202.115/32", - "52.13.171.212/32", - "2.19.183.16/32", - "2.19.183.47/32", - "129.153.117.201/32", - "23.73.4.0/24", - "184.50.200.7/32" - ] -} diff --git a/networks/cloudflare.json b/networks/cloudflare.json deleted file mode 100644 index 12481ae..0000000 --- a/networks/cloudflare.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "description": "cloudflare", - "domains": [], - "networks": [ - "173.245.48.0/20", - "103.21.244.0/22", - "103.22.200.0/22", - "103.31.4.0/22", - "141.101.64.0/18", - "108.162.192.0/18", - "190.93.240.0/20", - "188.114.96.0/20", - "197.234.240.0/22", - "198.41.128.0/17", - "162.158.0.0/15", - "104.16.0.0/13", - "104.24.0.0/14", - "172.64.0.0/13", - "131.0.72.0/22" - ] -} \ No newline at end of file diff --git a/networks/cloudfront.json b/networks/cloudfront.json deleted file mode 100644 index 40de05f..0000000 --- a/networks/cloudfront.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "description": "amazon cloudfront", - "domains": [], - "networks": [ - "108.138.0.0/15", - "108.156.0.0/14", - "111.13.0.0/16", - "116.129.226.0/24", - "118.193.97.0/24", - "119.147.182.0/24", - "120.232.0.0/16", - "120.52.0.0/16", - "13.0.0.0/8", - "130.176.0.0/16", - "143.204.0.0/16", - "144.220.0.0/16", - "15.128.0.0/9", - "18.0.0.0/8", - "180.163.57.0/24", - "204.246.0.0/16", - "205.251.0.0/16", - "216.137.32.0/19", - "3.0.0.0/8", - "34.128.0.0/9", - "35.0.0.0/8", - "36.103.232.0/24", - "43.218.56.0/24", - "44.0.0.0/8", - "47.129.0.0/16", - "52.0.0.0/8", - "54.0.0.0/8", - "58.254.138.0/24", - "64.252.0.0/16", - "65.8.0.0/16", - "65.9.0.0/16", - "70.132.0.0/18", - "71.152.0.0/17", - "99.0.0.0/8" - ] -} diff --git a/networks/cura.json b/networks/cura.json deleted file mode 100644 index 7e32445..0000000 --- a/networks/cura.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "description": "cura ultimaker", - "domains": [ - "ultimaker.com" - ], - "networks": [ - "188.114.98.0/23" - ] -} \ No newline at end of file diff --git a/networks/discord.json b/networks/discord.json deleted file mode 100644 index da4940d..0000000 --- a/networks/discord.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "description": "discord", - "domains": [], - "networks": [ - "104.16.0.0/12", - "108.177.14.207/32", - "138.128.140.240/28", - "142.250.150.207/32", - "142.251.1.207/32", - "162.159.128.0/20", - "172.64.0.0/14", - "173.194.0.0/16", - "18.165.140.0/25", - "188.114.0.0/16", - "204.11.56.48/32", - "209.85.233.207/32", - "23.227.38.74/32", - "34.0.0.0/7", - "64.233.160.0/21", - "66.22.192.0/18", - "74.125.128.0/17" - ] -} \ No newline at end of file diff --git a/networks/flibusta.json b/networks/flibusta.json deleted file mode 100644 index e1a4f69..0000000 --- a/networks/flibusta.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "description": "flibusta", - "domains": [ - "flibusta.is" - ], - "networks": [ - "179.43.150.83/32" - ] -} \ No newline at end of file diff --git a/networks/github.json b/networks/github.json deleted file mode 100644 index 5ca1e6e..0000000 --- a/networks/github.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "description": "facebook, instagram, oculus", - "domains": ["githubusercontent.com", "github.com"], - "networks": [ - "185.199.0.0/16" - ] -} \ No newline at end of file diff --git a/networks/google.json b/networks/google.json deleted file mode 100644 index c6a75b9..0000000 --- a/networks/google.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "description": "google services (youtube, mail)", - "domains": [ - "youtube.com", - "googlevideo.com", - "ytimg.com", - "youtu.be", - "ggpht.com", - "nhacmp3youtube.com", - "googleusercontent.com", - "googleapis.com", - "gstatic.com", - "google.ac", "google.ad", "google.ae", "google.al", "google.am", "google.as", "google.at", "google.az", - "google.ba", "google.be", "google.bf", "google.bg", "google.bi", "google.bj", "google.bs", "google.bt", - "google.by", "google.ca", "google.cat", "google.cd", "google.cf", "google.cg", "google.ch", "google.ci", - "google.cl", "google.cm", "google.cn", "google.co.ao", "google.co.bw", "google.co.ck", "google.co.cr", - "google.co.id", "google.co.il", "google.co.in", "google.co.jp", "google.co.ke", "google.co.kr", "google.co.ls", - "google.co.ma", "google.co.mz", "google.co.nz", "google.co.th", "google.co.tz", "google.co.ug", "google.co.uk", - "google.co.uz", "google.co.ve", "google.co.vi", "google.co.za", "google.co.zm", "google.co.zw", "google.com", - "google.com.af", "google.com.ag", "google.com.ai", "google.com.ar", "google.com.au", "google.com.bd", "google.com.bh", - "google.com.bn", "google.com.bo", "google.com.br", "google.com.bz", "google.com.co", "google.com.cu", "google.com.cy", - "google.com.do", "google.com.ec", "google.com.eg", "google.com.et", "google.com.fj", "google.com.gh", "google.com.gi", - "google.com.gt", "google.com.hk", "google.com.jm", "google.com.jo", "google.com.kh", "google.com.kw", "google.com.lb", - "google.com.ly", "google.com.mm", "google.com.mt", "google.com.mx", "google.com.my", "google.com.na", "google.com.ng", - "google.com.ni", "google.com.np", "google.com.om", "google.com.pa", "google.com.pe", "google.com.pg", "google.com.ph", - "google.com.pk", "google.com.pr", "google.com.py", "google.com.qa", "google.com.sa", "google.com.sb", "google.com.sg", - "google.com.sl", "google.com.sv", "google.com.tj", "google.com.tr", "google.com.tw", "google.com.ua", "google.com.uy", - "google.com.vc", "google.com.vn", "google.cv", "google.cz", "google.de", "google.dj", "google.dk", "google.dm", - "google.dz", "google.ee", "google.es", "google.fi", "google.fm", "google.fr", "google.ga", "google.ge", "google.gg", - "google.gl", "google.gm", "google.gp", "google.gr", "google.gy", "google.hn", "google.hr", "google.ht", "google.hu", - "google.ie", "google.im", "google.iq", "google.is", "google.it", "google.je", "google.jo", "google.kg", "google.ki", - "google.kz", "google.la", "google.li", "google.lk", "google.lt", "google.lu", "google.lv", "google.md", "google.me", - "google.mg", "google.mk", "google.ml", "google.mn", "google.ms", "google.mu", "google.mv", "google.mw", "google.ne", - "google.nl", "google.no", "google.nr", "google.nu", "google.pl", "google.pn", "google.ps", "google.pt", "google.ro", - "google.rs", "google.ru", "google.rw", "google.sc", "google.se", "google.sh", "google.si", "google.sk", "google.sn", - "google.so", "google.sr", "google.st", "google.td", "google.tg", "google.tl", "google.tm", "google.tn", "google.to", - "google.tt", "google.vg", "google.vu", "google.ws" - ], - "networks": [ - "188.43.61.0/24", - "157.240.252.0/23", - "87.245.216.0/24", - "85.249.244.0/23", - "213.221.56.0/27", - "104.154.0.0/15", - "104.196.0.0/14", - "104.237.160.0/19", - "104.237.160.0/19", - "107.167.160.0/19", - "107.178.192.0/18", - "108.170.192.0/18", - "108.177.0.0/17", - "108.59.80.0/20", - "130.211.0.0/16", - "136.124.0.0/15", - "136.22.0.0/16", - "142.250.0.0/15", - "146.148.0.0/17", - "152.65.0.0/16", - "162.120.128.0/17", - "162.216.148.0/22", - "162.222.176.0/21", - "172.110.32.0/21", - "172.217.0.0/16", - "172.253.0.0/16", - "173.194.0.0/16", - "173.255.112.0/20", - "178.66.83.0/24", - "192.158.28.0/22", - "192.178.0.0/15", - "193.186.4.0/24", - "195.95.178.0/24", - "199.192.112.0/22", - "199.223.232.0/21", - "199.36.154.0/23", - "199.36.156.0/24", - "207.223.160.0/20", - "208.117.224.0/19", - "208.65.152.0/22", - "208.68.108.0/22", - "208.81.188.0/22", - "209.85.0.0/16", - "216.239.32.0/19", - "216.58.192.0/19", - "216.73.80.0/20", - "23.236.48.0/20", - "23.251.128.0/19", - "34.0.0.0/7", - "57.140.192.0/18", - "64.15.112.0/20", - "64.233.0.0/16", - "66.102.0.0/20", - "66.22.228.0/23", - "66.249.64.0/19", - "70.32.128.0/19", - "72.14.192.0/18", - "74.125.0.0/16", - "8.34.208.0/20", - "8.35.192.0/20", - "8.8.4.0/24", - "8.8.8.0/24" - ] -} diff --git a/networks/habr.json b/networks/habr.json deleted file mode 100644 index 3adf98a..0000000 --- a/networks/habr.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "description": "habrahabr", - "domains": [ - "habr.com" - ], - "networks": [ - "178.248.237.68/32" - ] -} diff --git a/networks/intel.json b/networks/intel.json deleted file mode 100644 index 28cd524..0000000 --- a/networks/intel.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "description": "intel website", - "domains": [ - "intel.com" - ], - "networks": [ - "23.42.171.108/32" - ] -} \ No newline at end of file diff --git a/networks/jetbrains.json b/networks/jetbrains.json deleted file mode 100644 index 7838c2a..0000000 --- a/networks/jetbrains.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "description": "jetbrains market", - "domains": ["jetbrains.com"], - "networks": [ - "108.157.229.0/24", - "18.245.46.0/24", - "18.238.243.0/24", - "52.85.49.0/24", - "3.160.150.0/24" - ] -} \ No newline at end of file diff --git a/networks/lostfilm.json b/networks/lostfilm.json deleted file mode 100644 index 12b690c..0000000 --- a/networks/lostfilm.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "description": "lostfilm", - "domains": [], - "networks": [ - "104.21.0.0/17" - ] -} \ No newline at end of file diff --git a/networks/notion.json b/networks/notion.json deleted file mode 100644 index 1e421d1..0000000 --- a/networks/notion.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "description": "notion", - "domains": [ - "notion.so" - ], - "networks": [ - "104.18.39.102/32", - "172.64.148.154/32", - "208.103.161.0/30" - ] -} \ No newline at end of file diff --git a/networks/public dns.json b/networks/public dns.json deleted file mode 100644 index 2f1ec2d..0000000 --- a/networks/public dns.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "description": "google & cloudflare public dns", - "domains": [], - "networks": [ - "1.1.1.1/32", - "1.0.0.1/32", - "8.8.8.8/32", - "8.8.4.4/32" - ] -} \ No newline at end of file diff --git a/networks/rutor.json b/networks/rutor.json deleted file mode 100644 index 5410959..0000000 --- a/networks/rutor.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "description": "rutor", - "domains": ["rutor.info"], - "networks": [ - "193.46.255.29/32" - ] -} \ No newline at end of file diff --git a/networks/rutracker.json b/networks/rutracker.json deleted file mode 100644 index 5cc41f1..0000000 --- a/networks/rutracker.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "description": "rutracker site & trackers", - "domains": [ - "rutracker.org", - "rutracker.cc", - "t-ru.org" - ], - "networks": [ - "104.21.32.39/32", - "172.67.182.196/32", - "188.114.97.0/24", - "188.114.96.0/24", - "104.21.50.150/32", - "172.67.163.237/32", - "188.186.154.0/24" - ] -} \ No newline at end of file diff --git a/networks/snapeda.json b/networks/snapeda.json deleted file mode 100644 index 59d48b4..0000000 --- a/networks/snapeda.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "description": "www.snapeda.com", - "domains": ["snapeda.com"], - "networks": [ - "104.20.16.0/20", - "172.66.144.0/20" - ] -} \ No newline at end of file diff --git a/plugins/api/API.php b/plugins/api/API.php deleted file mode 100644 index 7a922cb..0000000 --- a/plugins/api/API.php +++ /dev/null @@ -1,32 +0,0 @@ -config["key"])) { - $this->generateNewKey(); - } - - $headers = getallheaders(); - - if ($headers and isset($headers["X-Auth"]) and $headers["X-Auth"] == md5($this->config["key"])) { - $_SESSION["auth"] = true; - } - } - - public function generateNewKey(): string - { - $this->config["key"] = sha1(rand() . uniqid()); - $this->saveConfig(); - return $this->config["key"]; - } - - public function getKey(): string - { - return $this->config["key"]; - } - -} \ No newline at end of file diff --git a/plugins/api/metadata.json b/plugins/api/metadata.json deleted file mode 100644 index 8e2b88c..0000000 --- a/plugins/api/metadata.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "class": "API", - "config": { - } -} \ No newline at end of file diff --git a/plugins/api/plugin.js b/plugins/api/plugin.js deleted file mode 100644 index 746ee31..0000000 --- a/plugins/api/plugin.js +++ /dev/null @@ -1,7 +0,0 @@ -import {App} from "/assets/App.js"; - -(async function () { - let key = await App.RPC.__invoke("api::getKey"); - - $("body").append("API Key: " + key + "") -})(); \ No newline at end of file diff --git a/plugins/custom/Custom.php b/plugins/custom/Custom.php deleted file mode 100755 index 8b7e9da..0000000 --- a/plugins/custom/Custom.php +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/php -config = $remote_config["custom"]; - $this->saveConfig(); - - $this->updateConfigFile(); - } - - public function updateConfigFile() - { - $path = dirname(__DIR__, 2) . "/networks/custom.json"; - $current_config = @file_get_contents($path); - $new_config = json_encode($this->config); - if($current_config !== $new_config) { - file_put_contents($path, $new_config); - } - } - - public function onInit(PluginContext $context): void - { - parent::onInit($context); - $this->updateConfigFile(); - } - - -} - diff --git a/plugins/custom/metadata.json b/plugins/custom/metadata.json deleted file mode 100644 index 47d6838..0000000 --- a/plugins/custom/metadata.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "class": "Custom", - "config": { - "description": "Custom routes", - "domains": [ - ], - "networks": [ - ] - } -} \ No newline at end of file diff --git a/plugins/custom/plugin.js b/plugins/custom/plugin.js deleted file mode 100644 index 8381818..0000000 --- a/plugins/custom/plugin.js +++ /dev/null @@ -1,5 +0,0 @@ -import {App} from "/assets/App.js"; - -(async function(){ - await App.RPC.__invoke("custom::updateConfigFile") -})(); \ No newline at end of file diff --git a/plugins/named/BindPlugin.php b/plugins/named/BindPlugin.php deleted file mode 100644 index f4e2c9c..0000000 --- a/plugins/named/BindPlugin.php +++ /dev/null @@ -1,57 +0,0 @@ -getConfigs(); - - //add new routes - foreach ($this->context->getConfig()["networks"] as $key) { - - if (isset($networks[$key])) { - foreach ($networks[$key]["domains"] as $domain) { - $selectedDomains[] = $domain; - } - } - } - - $selectedDomains = array_unique($selectedDomains); - - $data = []; - - foreach ($selectedDomains as $domain) { - $data[] = $this->createForwardRecord($domain); - } - - file_put_contents($this->config["file"], implode("\n", $data)); - - - return shell_exec($this->config["restart_cmd"]); - } - - private function createForwardRecord($domain) - { - $fwd = implode(";", $this->config["forwarders"]) . ";"; - return <<restart(); - } - - public function onSync($remote_config) - { - $this->restart(); - } -} \ No newline at end of file diff --git a/plugins/named/metadata.json b/plugins/named/metadata.json deleted file mode 100644 index ade9a90..0000000 --- a/plugins/named/metadata.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "class": "BindPlugin", - "config": { - "restart_cmd": "/etc/init.d/named restart", - "file": "/var/bind/forward.dns", - "forwarders": ["8.8.8.8", "1.1.1.1"] - } -} \ No newline at end of file diff --git a/plugins/named/plugin.js b/plugins/named/plugin.js deleted file mode 100644 index 3768e35..0000000 --- a/plugins/named/plugin.js +++ /dev/null @@ -1,21 +0,0 @@ -import {App} from "/assets/App.js"; - -(async function () { - $("#buttons").append(``); - $("#restart-bind").click(function () { - - const self = $(this); - self.prop("disabled", true); - (async function () { - try { - alert(await App.RPC.__invoke("named::restart")); - } finally { - setTimeout(() => { - self.prop("disabled", false); - }, 5000); - } - - })(); - - }); -})(); \ No newline at end of file diff --git a/plugins/netsync/Netsync.php b/plugins/netsync/Netsync.php deleted file mode 100644 index 7708bc0..0000000 --- a/plugins/netsync/Netsync.php +++ /dev/null @@ -1,79 +0,0 @@ -config["master"]; - $key = $this->config["key"]; - - if (empty($key)) { - throw new RuntimeException("API key is empty"); - } - - $ch = curl_init("http://" . $host . "/rpc"); - - - curl_setopt($ch, CURLOPT_HEADER, false); - curl_setopt($ch, CURLOPT_POST, true); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([ - "jsonrpc" => "2.0", - "id" => "1", - "method" => "getConfig", - "params" => [] - ])); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - - curl_setopt($ch, CURLOPT_HTTPHEADER, [ - "X-Auth: " . md5($key), - "Content-type: application/json" - ]); - - $output = curl_exec($ch); - try { - if ($err = curl_error($ch)) { - throw new RuntimeException("Failed to fetch remote API: " . $err); - } - } finally { - curl_close($ch); - } - - $header = @json_decode($output, true); - - $remote_config = $header["result"] ?? null; - - $networks = $remote_config["networks"] ?? null; - if ($remote_config === null or $networks === null) { - throw new RuntimeException("Response has invalid data"); - } - - $available = array_keys((new NetworkConfigReader())->getConfigs()); - - $remote_enabled = array_filter($networks, function ($e) use ($available) { - return in_array($e, $available); - }); - $wrapper = $this->context->getConfig(); - $local_enabled = $wrapper["networks"]; - $diff = array_diff($remote_enabled, $local_enabled); - if (count($diff) > 0) { - $wrapper["networks"] = array_values($remote_enabled); - $wrapper->save(); - } - - $last_hash = $this->config["last_hash"] ?? ""; - $current_hash = md5(json_encode($remote_config)); - if ($last_hash != $current_hash) { - foreach ($this->context->getRPC()->getPlugins() as $plugin) { - /** - * @var IPluggable $plugin - */ - - $plugin->onSync($remote_config); - } - $this->config["last_hash"] = $current_hash; - $this->saveConfig(); - } - - return $diff; - } -} \ No newline at end of file diff --git a/plugins/netsync/metadata.json b/plugins/netsync/metadata.json deleted file mode 100644 index 534dff2..0000000 --- a/plugins/netsync/metadata.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "class": "Netsync", - "config": { - "master": "127.0.0.1:8001", - "key": "" - } -} \ No newline at end of file diff --git a/plugins/netsync/plugin.js b/plugins/netsync/plugin.js deleted file mode 100644 index adceea8..0000000 --- a/plugins/netsync/plugin.js +++ /dev/null @@ -1,21 +0,0 @@ -import {App} from "/assets/App.js"; - -(async function () { - $("#buttons").append(``); - $("#sync").click(function () { - - const self = $(this); - self.prop("disabled", true); - (async function () { - try { - alert(await App.RPC.__invoke("netsync::sync")); - } finally { - setTimeout(() => { - location.reload(); - }, 5000); - } - - })(); - - }); -})(); \ No newline at end of file diff --git a/plugins/openvpn/Openvpn.php b/plugins/openvpn/Openvpn.php deleted file mode 100755 index b2f9a89..0000000 --- a/plugins/openvpn/Openvpn.php +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/php -config["restart_cmd"]); - } - - - public function getRoutingConfig(): array - { - $networks = (new NetworkConfigReader())->getConfigs(); - $data = []; - - //add new routes - foreach ($this->context->getConfig() ["networks"] as $key) { - if (isset($networks[$key])) { - foreach ($networks[$key]["networks"] as $route) { - $parts = explode("/", $route); - $mask = long2ip(-1 << (32 - (int)$parts[1])); - $dst = $parts[0]; - $data[] = "push \"route {$dst} {$mask}\""; - } - } - } - - return $data; - } - - public function onServerStarted() - { - $this->restart(); - } - - public function onSync($remote_config) - { - $this->restart(); - } -} - diff --git a/plugins/openvpn/metadata.json b/plugins/openvpn/metadata.json deleted file mode 100644 index f9f7930..0000000 --- a/plugins/openvpn/metadata.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "class": "Openvpn", - "config": { - "restart_cmd": "/etc/init.d/openvpn restart" - } -} \ No newline at end of file diff --git a/plugins/openvpn/plugin.js b/plugins/openvpn/plugin.js deleted file mode 100644 index 2954ee3..0000000 --- a/plugins/openvpn/plugin.js +++ /dev/null @@ -1,20 +0,0 @@ -import {App} from "/assets/App.js"; -(async function () { - $("#buttons").append(``); - $("#restart-ovpn").click(function () { - if (confirm("Are you sure?")) { - const self = $(this); - self.prop("disabled", true); - (async function () { - try { - alert(await App.RPC.__invoke("openvpn::restart")); - } finally { - setTimeout(() => { - self.prop("disabled", false); - }, 5000); - } - - })(); - } - }); -})(); \ No newline at end of file diff --git a/plugins/quagga/QuaggaPlugin.php b/plugins/quagga/QuaggaPlugin.php deleted file mode 100644 index 413f00c..0000000 --- a/plugins/quagga/QuaggaPlugin.php +++ /dev/null @@ -1,84 +0,0 @@ -config["file"]; - - if (!file_exists($configfile)) { - throw new RuntimeException("Quagga config file not found"); - } - - $networks = (new NetworkConfigReader())->getConfigs(); - $routeParser = new RoutingTableReader(); - $routes = $routeParser->getRoutes(); - $defGatewayInterface = ""; - $defGateway = ""; - - foreach ($routes as $route) { - if ($route["dst"] === "0.0.0.0/0") { - $defGatewayInterface = $route["dev"]; - $defGateway = $route["gateway"]; - break; - } - } - - if (!$defGatewayInterface) { - throw new RuntimeException("Failed to detect default gateway interface"); - } - - $contents = file_get_contents($configfile); - $lines = explode("\n", $contents); - - //remove existing routes - foreach ($lines as $key => $line) { - if (str_starts_with($line, self::REM_PREFIX) or str_starts_with($line, "ip route ") and str_contains($line . " ", $defGateway . " ")) { - unset($lines[$key]); - } - } - - - //add new routes - foreach ($this->context->getConfig()["networks"] as $key) { - $lines[] = self::REM_PREFIX . $key; - if (isset($networks[$key])) { - foreach ($networks[$key]["networks"] as $route) { - $lines[] = "ip route " . $route . " " . $defGateway; - } - } - } - - foreach ($lines as $key => $line) { - if (trim($line) === "") { - unset($lines[$key]); - } - } - - - $backupFile = $configfile . ".sav"; - - unlink($backupFile); - rename($configfile, $backupFile); - file_put_contents($configfile, implode("\n", $lines)); - - sleep(10); - - //restart zebra - return shell_exec($this->config["restart_cmd"]); - } - - public function onServerStarted() - { - $this->restart(); - } - - public function onSync($remote_config) - { - $this->restart(); - } -} \ No newline at end of file diff --git a/plugins/quagga/metadata.json b/plugins/quagga/metadata.json deleted file mode 100644 index 2e19a60..0000000 --- a/plugins/quagga/metadata.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "class": "QuaggaPlugin", - "config": { - "restart_cmd": "/etc/init.d/zebra restart", - "file": "/etc/quagga/zebra.conf" - } -} \ No newline at end of file diff --git a/plugins/quagga/plugin.js b/plugins/quagga/plugin.js deleted file mode 100644 index 1bff20e..0000000 --- a/plugins/quagga/plugin.js +++ /dev/null @@ -1,20 +0,0 @@ -import {App} from "/assets/App.js"; -(async function () { - $("#buttons").append(``); - $("#restart-quagga").click(function () { - if (confirm("Are you sure?")) { - const self = $(this); - self.prop("disabled", true); - (async function () { - try { - alert(await App.RPC.__invoke("quagga::restart")); - } finally { - setTimeout(() => { - self.prop("disabled", false); - }, 5000); - } - - })(); - } - }); -})(); \ No newline at end of file diff --git a/plugins/updates/Updates.php b/plugins/updates/Updates.php deleted file mode 100644 index 12e54aa..0000000 --- a/plugins/updates/Updates.php +++ /dev/null @@ -1,24 +0,0 @@ -&1 | grep refs")); - $parts = explode(" ", trim($data)); - if (count($parts) < 3) { - return null; - } - - return $parts[0] != $parts[1]; - } - - public function install(): string|bool|null - { - return @shell_exec("git --no-pager pull --verbose 2>&1"); - } - - -} \ No newline at end of file diff --git a/plugins/updates/metadata.json b/plugins/updates/metadata.json deleted file mode 100644 index 58df75b..0000000 --- a/plugins/updates/metadata.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "class": "Updates", - "config": { - } -} \ No newline at end of file diff --git a/plugins/updates/plugin.js b/plugins/updates/plugin.js deleted file mode 100644 index b94a84c..0000000 --- a/plugins/updates/plugin.js +++ /dev/null @@ -1,22 +0,0 @@ -import {JSONRPC} from "/assets/jrpc.js"; - -(async function () { - $("#panel").prepend(`
Checking for updates...

`); - let state = (await JSONRPC.__invoke("updates::check")); - if (state === null) { - $("#update-panel").html(`Error checking updates`); - } else if (state === false) { - $("#update-panel").html(`There is no updates`); - } else if (state === true) { - $("#update-panel").html(`Some updates are available `); - $("#update-panel button").click(async function () { - $("#panel").hide(); - $("#loading").show().text("Installing updates..."); - try { - alert(await JSONRPC.__invoke("updates::install")); - } finally { - setTimeout(() => location.reload(), 1000); - } - }); - } -})(); \ No newline at end of file diff --git a/restart.php b/restart.php deleted file mode 100644 index df4c10f..0000000 --- a/restart.php +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/php -handleRequest(); \ No newline at end of file