added --remote not allowing navigation outside of the model folder for custom models.

added a delete custom models option (will not delete models outside of the models directory, nor will it delete non-model directories)
This commit is contained in:
ebolam
2022-06-14 19:11:30 -04:00
parent 780548fba9
commit 462206fa86
4 changed files with 84 additions and 8 deletions

View File

@@ -1017,6 +1017,14 @@ function buildLoadModelList(ar, menu, breadcrumbs) {
$("#loadmodellistbreadcrumbs").append("<hr size='1'>")
}
for(i=0; i<ar.length; i++) {
if (Array.isArray(ar[i][0])) {
full_path = ar[i][0][0];
folder = ar[i][0][1];
} else {
full_path = "";
folder = ar[i][0];
}
var html
html = "<div class=\"flex\">\
<div class=\"loadlistpadding\"></div>"
@@ -1027,13 +1035,14 @@ function buildLoadModelList(ar, menu, breadcrumbs) {
//this is a model
html = html + "<div class=\"loadlistpadding\"></div>"
}
if (Array.isArray(ar[i][0])) {
full_path = ar[i][0][0];
folder = ar[i][0][1];
//now let's do the delete icon if applicable
if (['NeoCustom', 'GPT2Custom'].includes(menu) && !ar[i][3]) {
html = html + "<span class=\"loadlisticon loadmodellisticon-folder oi oi-x allowed\" aria-hidden=\"true\" onclick='if(confirm(\"This will delete the selected folder with all contents. Are you sure?\")) { socket.send({\"cmd\": \"delete_model\", \"data\": \""+full_path.replaceAll("\\", "\\\\")+"\", \"menu\": \""+menu+"\"});}'></span>"
} else {
full_path = "";
folder = ar[i][0];
html = html + "<div class=\"loadlistpadding\"></div>"
}
html = html + "<div class=\"loadlistpadding\"></div>\
<div class=\"loadlistitem\" id=\"loadmodel"+i+"\" name=\""+ar[i][1]+"\" pretty_name=\""+full_path+"\">\
<div>"+folder+"</div>\