Add new dependencies and update file paths
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -166,4 +166,5 @@ body.dark-theme .navbar-toggler-icon {
|
||||
.btn-icon {
|
||||
border-radius: 50%;
|
||||
padding: 0.5em;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -470,12 +470,14 @@ async function getUserIdFromFolder(username) {
|
||||
async function showFileInfo(fileLink) {
|
||||
let data;
|
||||
try {
|
||||
let response = await fetch(`/file_info.json`);
|
||||
let response = await fetch('/data/file_info.json');
|
||||
if (!response.ok) {
|
||||
throw new Error('Network response was not ok');
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
data = await response.json();
|
||||
let fileContent = await response.text();
|
||||
data = JSON.parse(fileContent);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
Swal.fire({
|
||||
position: 'top',
|
||||
icon: 'error',
|
||||
@@ -487,9 +489,8 @@ async function showFileInfo(fileLink) {
|
||||
return;
|
||||
}
|
||||
|
||||
let fileName = fileLink.split('/').pop();
|
||||
let pathParts = fileLink.split('/');
|
||||
if (pathParts.length < 2) {
|
||||
if (pathParts.length < 4) {
|
||||
Swal.fire({
|
||||
position: 'top',
|
||||
icon: 'error',
|
||||
@@ -500,18 +501,16 @@ async function showFileInfo(fileLink) {
|
||||
});
|
||||
return;
|
||||
}
|
||||
let username = pathParts[1].replace('.', '');
|
||||
console.log('Extracted username:', username);
|
||||
|
||||
let userId = await getUserIdFromFolder(username);
|
||||
console.log('Obtained userId:', userId);
|
||||
let fileName = pathParts.pop();
|
||||
let userId = pathParts.pop();
|
||||
|
||||
let fileInfo = data.find(file => file.fileName === fileName && file.Id === userId);
|
||||
console.log('Found fileInfo:', fileInfo);
|
||||
if (!fileInfo) {
|
||||
Swal.fire({
|
||||
position: 'top',
|
||||
icon: 'error',
|
||||
title: `Aucune information trouvée pour le fichier ${fileName} pour l'utilisateur ${username}.`,
|
||||
title: `Aucune information trouvée pour le fichier ${fileName} pour l'utilisateur avec l'ID ${userId}.`,
|
||||
showConfirmButton: false,
|
||||
timer: 1800,
|
||||
toast: true,
|
||||
@@ -534,3 +533,32 @@ async function showFileInfo(fileLink) {
|
||||
confirmButtonText: 'Fermer'
|
||||
});
|
||||
}
|
||||
|
||||
async function displayMetadata() {
|
||||
const response = await fetch('/build-metadata');
|
||||
if (!response.ok) {
|
||||
console.error('Failed to fetch metadata');
|
||||
return;
|
||||
}
|
||||
|
||||
const metadata = await response.json();
|
||||
if (!metadata) {
|
||||
console.error('No metadata provided');
|
||||
return;
|
||||
}
|
||||
|
||||
document.getElementById('buildVersion').textContent = metadata.build_version;
|
||||
document.getElementById('nodeVersion').textContent = metadata.node_version;
|
||||
document.getElementById('expressVersion').textContent = metadata.express_version;
|
||||
document.getElementById('buildSha').textContent = metadata.build_sha;
|
||||
document.getElementById('osType').textContent = metadata.os_type;
|
||||
document.getElementById('osRelease').textContent = metadata.os_release;
|
||||
|
||||
const modal = document.getElementById('metadataModal');
|
||||
modal.style.display = 'block';
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
const modal = document.getElementById('metadataModal');
|
||||
modal.style.display = 'none';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user