1.1
This commit is contained in:
parent
5680d76e8b
commit
cf12c943f7
5 changed files with 935 additions and 512 deletions
|
|
@ -57,6 +57,9 @@
|
||||||
<entry name="BIpostebalka" type="Bool">
|
<entry name="BIpostebalka" type="Bool">
|
||||||
<default>true</default>
|
<default>true</default>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry name="BIpostfirewall" type="Bool">
|
||||||
|
<default>true</default>
|
||||||
|
</entry>
|
||||||
<entry name="BIdevicesupdate" type="Bool">
|
<entry name="BIdevicesupdate" type="Bool">
|
||||||
<default>true</default>
|
<default>true</default>
|
||||||
</entry>
|
</entry>
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ KCM.SimpleKCM {
|
||||||
property alias cfg_BIpostebalka: showSwitchEbalkaBI.checked
|
property alias cfg_BIpostebalka: showSwitchEbalkaBI.checked
|
||||||
property alias cfg_BIdevicesupdate: showDevicesActionsBI.checked
|
property alias cfg_BIdevicesupdate: showDevicesActionsBI.checked
|
||||||
property alias cfg_BIfeaturesupdate: showFeaturesActionsBI.checked
|
property alias cfg_BIfeaturesupdate: showFeaturesActionsBI.checked
|
||||||
|
property alias cfg_BIpostfirewall: showFirewallActionsBI.checked
|
||||||
property alias cfg_BIautoupdate: showAutoUpdateBI.checked
|
property alias cfg_BIautoupdate: showAutoUpdateBI.checked
|
||||||
|
|
||||||
property alias cfg_SBdisplay: showSB.checked
|
property alias cfg_SBdisplay: showSB.checked
|
||||||
|
|
@ -84,6 +85,7 @@ KCM.SimpleKCM {
|
||||||
}
|
}
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Kirigami.FormData.label: i18n("Ping")
|
Kirigami.FormData.label: i18n("Ping")
|
||||||
|
enabled: false
|
||||||
CheckBox {
|
CheckBox {
|
||||||
id: enablePing
|
id: enablePing
|
||||||
}
|
}
|
||||||
|
|
@ -137,6 +139,10 @@ KCM.SimpleKCM {
|
||||||
id: showFeaturesActionsBI
|
id: showFeaturesActionsBI
|
||||||
text: i18n("Features actions")
|
text: i18n("Features actions")
|
||||||
}
|
}
|
||||||
|
CheckBox {
|
||||||
|
id: showFirewallActionsBI
|
||||||
|
text: i18n("Firewall actions")
|
||||||
|
}
|
||||||
CheckBox {
|
CheckBox {
|
||||||
id: showAutoUpdateBI
|
id: showAutoUpdateBI
|
||||||
text: i18n("AutoUpdate actions")
|
text: i18n("AutoUpdate actions")
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -134,6 +134,30 @@ function fetchStats() {
|
||||||
xhr.send();
|
xhr.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GET firewall
|
||||||
|
function fetchFirewall() {
|
||||||
|
|
||||||
|
let xhr = getXhr();
|
||||||
|
|
||||||
|
if (!xhr) {
|
||||||
|
console.log("Pool full, retrying...");
|
||||||
|
setTimeout(() => fetchFirewall(), 100);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
xhr.open("GET", "http://10.7.0.1:7777/meowrok/get");
|
||||||
|
xhr.onreadystatechange = function() {
|
||||||
|
if (xhr.readyState === XMLHttpRequest.DONE) {
|
||||||
|
if (xhr.status === 200) {
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
WorkerScript.sendMessage({ "action": "fetch_firewall", "data": response });
|
||||||
|
} else {
|
||||||
|
console.error("Failed to fetch firewall:", xhr.status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xhr.send();
|
||||||
|
}
|
||||||
|
|
||||||
// POST select country
|
// POST select country
|
||||||
function selectCountry(code, provider) {
|
function selectCountry(code, provider) {
|
||||||
//isLoading = true;
|
//isLoading = true;
|
||||||
|
|
@ -336,17 +360,94 @@ function connectById(iface) {
|
||||||
xhr.send(data);
|
xhr.send(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// POST aff rule to firewall
|
||||||
|
function firewallAddRule(dst, ext, local_port, port, proto) {
|
||||||
|
//isLoading = true;
|
||||||
|
|
||||||
|
let xhr = getXhr();
|
||||||
|
|
||||||
|
if (!xhr) {
|
||||||
|
console.log("Pool full, retrying...");
|
||||||
|
setTimeout(() => firewallAddRule(dst, ext, local_port, port, proto), 100);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
xhr.open("POST", "http://10.7.0.1:7777/meowrok/add");
|
||||||
|
xhr.setRequestHeader("Content-Type", "application/json");
|
||||||
|
|
||||||
|
var data = JSON.stringify({
|
||||||
|
"dst": dst,
|
||||||
|
"ext": ext,
|
||||||
|
"local_port": local_port,
|
||||||
|
"port": port,
|
||||||
|
"proto": proto
|
||||||
|
});
|
||||||
|
|
||||||
|
xhr.onreadystatechange = function() {
|
||||||
|
if (xhr.readyState === XMLHttpRequest.DONE) {
|
||||||
|
//isLoading = false;
|
||||||
|
if (xhr.status === 200) {
|
||||||
|
console.log("Success: rule added!");
|
||||||
|
WorkerScript.sendMessage({ "action": "post_ruleadd", "status": xhr.status});
|
||||||
|
} else {
|
||||||
|
console.error("POST failed:", xhr.status);
|
||||||
|
WorkerScript.sendMessage({ "action": "post_ruleadd", "status": xhr.status});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xhr.send(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// POST drop rule from firewall
|
||||||
|
function firewallDropRule(dst, ext, local_port, port, proto) {
|
||||||
|
//isLoading = true;
|
||||||
|
|
||||||
|
let xhr = getXhr();
|
||||||
|
|
||||||
|
if (!xhr) {
|
||||||
|
console.log("Pool full, retrying...");
|
||||||
|
setTimeout(() => firewallDropRule(dst, ext, local_port, port, proto), 100);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
xhr.open("POST", "http://10.7.0.1:7777/meowrok/drop");
|
||||||
|
xhr.setRequestHeader("Content-Type", "application/json");
|
||||||
|
|
||||||
|
var data = JSON.stringify({
|
||||||
|
"dst": dst,
|
||||||
|
"ext": ext,
|
||||||
|
"local_port": local_port,
|
||||||
|
"port": port,
|
||||||
|
"proto": proto
|
||||||
|
});
|
||||||
|
|
||||||
|
xhr.onreadystatechange = function() {
|
||||||
|
if (xhr.readyState === XMLHttpRequest.DONE) {
|
||||||
|
//isLoading = false;
|
||||||
|
if (xhr.status === 200) {
|
||||||
|
console.log("Success: rule dropped!");
|
||||||
|
WorkerScript.sendMessage({ "action": "post_ruledrop", "status": xhr.status});
|
||||||
|
} else {
|
||||||
|
console.error("POST failed:", xhr.status);
|
||||||
|
WorkerScript.sendMessage({ "action": "post_ruledrop", "status": xhr.status});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xhr.send(data);
|
||||||
|
}
|
||||||
|
|
||||||
WorkerScript.onMessage = function(message) {
|
WorkerScript.onMessage = function(message) {
|
||||||
const actions = {
|
const actions = {
|
||||||
"fetch_routes": () => fetchRoutes(message),
|
"fetch_routes": () => fetchRoutes(message),
|
||||||
"fetch_stats": () => fetchStats(message),
|
"fetch_stats": () => fetchStats(message),
|
||||||
"fetch_profile": () => fetchProfile(message),
|
"fetch_profile": () => fetchProfile(message),
|
||||||
|
"fetch_firewall": () => fetchFirewall(message),
|
||||||
"post_country": () => selectCountry(message.code, message.provider),
|
"post_country": () => selectCountry(message.code, message.provider),
|
||||||
"post_share": () => switchShare(message.bool),
|
"post_share": () => switchShare(message.bool),
|
||||||
"post_ebalka": () => switchEbalka(message.bool, message.ip),
|
"post_ebalka": () => switchEbalka(message.bool, message.ip),
|
||||||
"post_name": () => renameDevice(message.ip, message.name),
|
"post_name": () => renameDevice(message.ip, message.name),
|
||||||
"post_feature": () => switchFeature(message.name, message.value),
|
"post_feature": () => switchFeature(message.name, message.value),
|
||||||
"post_idconnect": () => connectById(message.iface),
|
"post_idconnect": () => connectById(message.iface),
|
||||||
|
"post_ruleadd": () => firewallAddRule(message.dst, message.ext, message.local_port, message.port, message.proto),
|
||||||
|
"post_ruledrop": () => firewallDropRule(message.dst, message.ext, message.local_port, message.port, message.proto),
|
||||||
"ping": () => keepAlivePing(message)
|
"ping": () => keepAlivePing(message)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
"Icon": "preferences-system-network-proxy",
|
"Icon": "preferences-system-network-proxy",
|
||||||
"Id": "com.umorist47.meowrelaygui",
|
"Id": "com.umorist47.meowrelaygui",
|
||||||
"Name": "MeowRelay",
|
"Name": "MeowRelay",
|
||||||
"Version": "1.0",
|
"Version": "1.1",
|
||||||
"Website": "",
|
"Website": "",
|
||||||
"License": "GPL3"
|
"License": "GPL3"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue