no xss
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
moerp 2024-02-06 15:46:53 +01:00
parent c7bf411f01
commit 54c67cf5c2
2 changed files with 18 additions and 20 deletions

View File

@ -10,7 +10,7 @@ COPY start.sh ${APP_DIR}/
WORKDIR ${APP_DIR} WORKDIR ${APP_DIR}
RUN \ RUN \
apk add --no-cache build-base libpq-dev && \ apk add --no-cache build-base libpq-dev npm && \
pip install --upgrade pip && \ pip install --upgrade pip && \
pip install -r requirements.txt && \ pip install -r requirements.txt && \
if [ "${VERSION_ID2}" != "" ]; then VERSION_ID=${VERSION_ID2}; else VERSION_ID=${VERSION_ID1}; fi && \ if [ "${VERSION_ID2}" != "" ]; then VERSION_ID=${VERSION_ID2}; else VERSION_ID=${VERSION_ID1}; fi && \

View File

@ -130,26 +130,24 @@
function loadDatabaseEntries() { function loadDatabaseEntries() {
fetch('/get_database_entries') // Pfad zur entsprechenden Flask-Route fetch('/get_database_entries') // Pfad zur entsprechenden Flask-Route
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
const tableBody = document.getElementById('database-nutrition-table').getElementsByTagName('tbody')[0]; const tableBody = document.getElementById('database-nutrition-table').getElementsByTagName('tbody')[0];
tableBody.innerHTML = ''; tableBody.innerHTML = ''; // Das Löschen ist hier in Ordnung, da wir nur den Inhalt entfernen
data.forEach(entry => { data.forEach(entry => {
const row = tableBody.insertRow(); const row = tableBody.insertRow();
row.insertCell(0).innerHTML = entry.food; Object.keys(entry).forEach((key, index) => {
row.insertCell(1).innerHTML = entry.kcal; const cell = row.insertCell(index);
row.insertCell(2).innerHTML = entry.ew; cell.innerText = entry[key]; // Verwendung von innerText statt innerHTML
row.insertCell(3).innerHTML = entry.fett; });
row.insertCell(4).innerHTML = entry.kh;
row.insertCell(5).innerHTML = entry.bst; // Kein Bedarf, die Kommentare zu wiederholen die Methode ist selbsterklärend
row.insertCell(6).innerHTML = entry.ca; });
})
.catch(error => console.error('Fehler:', error));
}
// ... Fügen Sie weitere Zellen für die anderen Werte hinzu ...
});
})
.catch(error => console.error('Fehler:', error));
}
document.addEventListener('DOMContentLoaded', loadDatabaseEntries); document.addEventListener('DOMContentLoaded', loadDatabaseEntries);