Fixes for file editor (#170)

Various fixes for the file editor by Ebolam
This commit is contained in:
ebolam 2022-07-19 18:50:03 -04:00 committed by GitHub
parent 68110c5930
commit 2b53598307
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 5 deletions

View File

@ -6200,9 +6200,9 @@ def popup_edit(data):
return
if session['popup_jailed_dir'] is None:
emit("popup_edit_file", {"file": data, "text": open(data, 'r').read()});
emit("popup_edit_file", {"file": data, "text": open(data, 'r', encoding='utf-8').read()});
elif session['popup_jailed_dir'] in data:
emit("popup_edit_file", {"file": data, "text": open(data, 'r').read()});
emit("popup_edit_file", {"file": data, "text": open(data, 'r', encoding='utf-8').read()});
else:
print("User is trying to delete files in your server outside the jail. Blocked. Jailed Dir: {} Requested Dir: {}".format(session['popup_jailed_dir'], data))

View File

@ -3434,6 +3434,10 @@ function popup_breadcrumbs(data) {
function popup_edit_file(data) {
var popup_list = document.getElementById('popup_list');
var accept = document.getElementById("popup_accept");
accept.classList.add("btn-secondary");
accept.classList.remove("btn-primary");
accept.textContent = "Save";
//first, let's clear out our existing data
while (popup_list.firstChild) {
popup_list.removeChild(popup_list.firstChild);
@ -3444,6 +3448,7 @@ function popup_edit_file(data) {
var textarea = document.getElementById("filecontents");
socket.emit("popup_change_file", {"file": textarea.getAttribute("filename"), "data": textarea.value});
document.getElementById("popup").classList.add("hidden");
this.classList.add("hidden");
};
var textarea = document.createElement("textarea");
@ -3454,7 +3459,9 @@ function popup_edit_file(data) {
textarea.value = data.text;
textarea.onblur = function () {
var accept = document.getElementById("popup_accept");
accept.classList.remove("disabled");
accept.classList.remove("hidden");
accept.classList.remove("btn-secondary");
accept.classList.add("btn-primary");
};
popup_list.append(textarea);

View File

@ -340,7 +340,7 @@
<div id="sppopup">
<div class="popuptitlebar">
<div class="popuptitletext">Select A Soft Prompt To Use</div>
<button class="btn btn-primary"><span class="oi" style="color: white;" data-glyph="folder" onclick="socket.emit('show_folder_soft_prompt', {});"></span></button>
<button class="btn btn-primary" onclick="socket.emit('show_folder_soft_prompt', {});"><span class="oi" style="color: white;" data-glyph="folder"></span></button>
</div>
<div id="splistcontent">
</div>
@ -354,7 +354,7 @@
<div id="uspopup">
<div class="popuptitlebar">
<div class="popuptitletext">Select userscripts to load; drag-and-drop to reorder</div>
<button class="btn btn-primary"><span class="oi" style="color: white;" data-glyph="folder" onclick="socket.emit('show_folder_usersripts', {});"></span></button>
<button class="btn btn-primary" onclick="socket.emit('show_folder_usersripts', {});"><span class="oi" style="color: white;" data-glyph="folder"></span></button>
</div>
<div class="usheadergrid">
<div>[AVAILABLE]</div>