This commit is contained in:
julien 2025-06-19 16:37:39 +02:00
parent bcb7070067
commit 1a9e755b11
3 changed files with 15 additions and 12 deletions

View File

@ -209,7 +209,7 @@ func PathValidationHandler(w http.ResponseWriter, r *http.Request) {
}
var requestBody struct {
Path string `json:"path"`
PathName string `json:"pathName"`
}
if err := json.NewDecoder(r.Body).Decode(&requestBody); err != nil {
@ -217,9 +217,10 @@ func PathValidationHandler(w http.ResponseWriter, r *http.Request) {
return
}
err := IsPathValid(requestBody.Path)
err := IsPathValid(requestBody.PathName)
response := map[string]string{
"path": requestBody.Path,
"pathName": requestBody.PathName,
"status": "valid",
}
@ -235,6 +236,7 @@ func PathValidationHandler(w http.ResponseWriter, r *http.Request) {
}
}
type StreamPageData struct {
StreamURL string
}

View File

@ -4,12 +4,12 @@ async function validatePath() {
const pathInput = document.getElementById('path-input');
const statusIcon = document.getElementById('path-status-icon');
const validateBtn = document.getElementById('validate-btn');
const inputPathNameHidden = document.getElementById('pathName');
const inputNamePathSection = document.getElementById('namePath');
const inputPath=document.getElementById('path');
const inputPathV=document.getElementById('namePath');
const path = pathInput.value;
const pathName = pathInput.value.trim();
if (!path) {
if (!pathName) {
statusIcon.innerHTML = '<i class="fas fa-times has-text-danger"></i>';
validateBtn.disabled = true;
return;
@ -21,14 +21,14 @@ async function validatePath() {
const response = await fetch('/validate-path', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ path }),
body: JSON.stringify({ pathName: pathName }), // ⚠️ on envoie pathName !
});
if (response.ok) {
statusIcon.innerHTML = '<i class="fas fa-check-square"></i>';
validateBtn.disabled = false;
inputPath.value=path;
inputPathV.style.display="block";
inputPathNameHidden.value = pathName; // on stocke le PathName dans le hidden pour le form
inputNamePathSection.style.display = "block";
} else {
const result = await response.json();
statusIcon.innerHTML = '<i class="fas fa-exclamation-triangle"></i>';
@ -41,6 +41,7 @@ async function validatePath() {
console.error('Request failed:', error);
}
}
function disableAllInputPath(id){
console.log(this)
var inputs = document.querySelectorAll('#path-'+id+' .fff');

View File

@ -18,7 +18,7 @@
<div class="field has-addons">
<div class="field">
<label class="label">Enter Path:</label>
<label class="label">Nom du dossier :</label>
<div class="control has-icons-right">
<input type="text" id="path-input" class="input" placeholder="Enter path..." oninput="validatePath()" />
<span class="icon is-small is-right has-text-success">