4 Commits
v1.0.2 ... v1.1

Author SHA1 Message Date
c10ac8669c Deletes work, tested on DWS
All checks were successful
Docker Build and Publish / build (release) Successful in 6s
2025-01-31 18:54:04 -05:00
682cdfa95c update listener model 2025-01-31 18:49:44 -05:00
0436d6e24a update app.py to provide nonce
All checks were successful
Docker Build and Publish / build (release) Successful in 6s
2025-01-31 18:41:44 -05:00
3e11c63e33 Fix admin page nonce
All checks were successful
Docker Build and Publish / build (release) Successful in 33s
2025-01-31 18:32:33 -05:00
2 changed files with 9 additions and 7 deletions

1
app.py
View File

@ -331,6 +331,7 @@ def admin():
photos=photos,
accent_color=config["appearance"]["accent_color"],
config=config,
nonce=g.csp_nonce,
)
@app.route("/admin/logout")

View File

@ -261,7 +261,7 @@
</div>
</div>
</div>
<script nonce="{{ g.csp_nonce }}">
<script nonce="{{ nonce }}">
function makeEditable(element) {
const value = element.textContent;
const input = document.createElement('input');
@ -284,7 +284,8 @@
});
});
function saveChanges(button) {
function saveChanges(event) {
const button = event.target;
const row = button.closest('tr');
const photoId = row.dataset.id;
const updatedData = {};
@ -313,9 +314,9 @@
alert('An error occurred while saving changes.');
});
}
function deletePhoto(button) {
function deletePhoto(event) {
if (confirm('Are you sure you want to delete this photo?')) {
const button = event.target;
const row = button.closest('tr');
const photoId = row.dataset.id;
@ -337,9 +338,9 @@
});
}
}
document.getElementById('delete-btn').addEventListener('click', deletePhoto);
document.getElementById('save-btn').addEventListener('click', saveChanges);
document.getElementById('delete-btn').addEventListener('click', (event) => deletePhoto(event));
document.getElementById('save-btn').addEventListener('click', (event) => saveChanges(event));
document.getElementById('profile_image_upload').addEventListener('change', async (e) => {
const file = e.target.files[0];