Added plugin dir parameter

- Added plugin dir parameter
- Fixed critical architectural bug that effects plugin UI in production mode
- Updated implementation of embed FS routing
- Minor dark theme update
- Fixed ztnc UI bug for msgbox and confirm box
This commit is contained in:
Toby Chui
2025-03-28 21:24:18 +08:00
parent 3e031605fc
commit 136989f2ea
18 changed files with 152 additions and 126 deletions

View File

@@ -92,7 +92,7 @@
function handleAddNetwork(){
let networkName = $("#networkName").val().trim();
if (networkName == ""){
msgbox("Network name cannot be empty", false, 5000);
parent.msgbox("Network name cannot be empty", false, 5000);
return;
}
@@ -104,7 +104,7 @@
function initGANetID(){
$.get("./api/gan/network/info", function(data){
if (data.error !== undefined){
msgbox(data.error, false, 5000)
parent.msgbox(data.error, false, 5000)
}else{
if (data != ""){
$(".ganControllerID").text(data);
@@ -121,9 +121,9 @@
data: {},
success: function(response) {
if (response.error != undefined){
msgbox(response.error, false, 5000);
parent.msgbox(response.error, false, 5000);
}else{
msgbox("Network added successfully");
parent.msgbox("Network added successfully");
}
console.log("Network added successfully:", response);
listGANet();
@@ -141,7 +141,7 @@
$("#GANetList").empty();
if (data.error != undefined){
console.log(data.error);
msgbox("Unable to load auth token for GANet", false, 5000);
parent.msgbox("Unable to load auth token for GANet", false, 5000);
//token error or no zerotier found
$(".gansnetworks").addClass("disabled");
$("#GANetList").append(`<tr>
@@ -217,23 +217,28 @@
//Remove the given GANet
function removeGANet(netid){
if (confirm("Confirm remove Network " + netid + " PERMANENTLY ?"))
$.cjax({
url: "./api/gan/network/remove",
type: "POST",
dataType: "json",
data: {
id: netid,
},
success: function(data){
if (data.error != undefined){
msgbox(data.error, false, 5000);
}else{
msgbox("Net " + netid + " removed");
}
listGANet();
//Reusing Zoraxy confirm box
parent.confirmBox("Confirm remove " + netid + "?", function(choice){
if (choice == true){
$.cjax({
url: "./api/gan/network/remove",
type: "POST",
dataType: "json",
data: {
id: netid,
},
success: function(data){
if (data.error != undefined){
parent.msgbox(data.error, false, 5000);
}else{
parent.msgbox("Net " + netid + " removed");
}
listGANet();
}
});
}
});
}
function openGANetDetails(netid){