diff --git a/examples/streaming_web/frontend/dist/assets/config-Bg4sgpja.css b/examples/streaming_web/frontend/dist/assets/config-Bg4sgpja.css deleted file mode 100644 index 96a9c6c..0000000 --- a/examples/streaming_web/frontend/dist/assets/config-Bg4sgpja.css +++ /dev/null @@ -1 +0,0 @@ -body{font-family:Roboto,sans-serif;background-color:#f2f2f2;margin:0;padding:20px}.container{max-width:800px;margin:0 auto;background-color:#fff;padding:30px;border-radius:8px;box-shadow:0 0 10px #0000001a}h1{text-align:center;color:#333}button{padding:10px 20px;margin-top:10px;margin-right:10px;font-size:16px;cursor:pointer;background-color:#007bff;color:#fff;border:none;border-radius:5px}button:hover{background-color:#0056b3}.buttons,#form-controls{text-align:center}.config-item{background-color:#fafafa;border:1px solid #ddd;border-radius:8px;padding:20px;margin-bottom:20px}.config-item label{display:block;margin-bottom:15px;font-weight:700}.config-item input[type=text],.config-item input[type=date],.config-item select{width:100%;padding:8px;margin-top:5px;font-size:16px;border:1px solid #ccc;border-radius:4px}.config-item input[type=checkbox]{margin-right:10px}field set{border:1px solid #ccc;border-radius:8px;padding:15px;margin-top:20px}legend{font-weight:700;color:#007bff;padding:0 10px}.config-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px}.config-header .site-stream{display:flex;align-items:center;gap:10px}.config-header .delete-config-btn{background-color:transparent;color:#ff5c5c;border:none;font-size:24px;cursor:pointer}.config-header .delete-config-btn:hover{color:#e60000}.notification-item{position:relative;border:1px solid #ccc;padding:15px;margin-bottom:15px;border-radius:8px;background-color:#f9f9f9}.notification-item .delete-notification{position:absolute;top:0;right:0;transform:translate(50%,-50%);background:#ff5c5c;border:none;font-size:16px;cursor:pointer;color:#fff;width:24px;height:24px;border-radius:50%;padding:0;line-height:1;box-sizing:border-box;display:flex;align-items:center;justify-content:center}.notification-item .delete-notification:hover{background:#e60000}.notification-item .delete-notification i{color:#fff}.notification-content label{display:block;margin-bottom:10px;font-weight:400}.notification-content input,.notification-content select{width:100%;padding:8px;margin-top:5px;font-size:16px;border:1px solid #ccc;border-radius:4px}.error-message{color:red;font-size:14px;margin-bottom:5px}@media (max-width: 600px){.config-header{flex-direction:column;align-items:flex-start}.config-header .site-stream{flex-direction:column;gap:5px}button{width:100%;margin:10px 0}.buttons,#form-controls{text-align:center}}.error{border:1px solid red!important}button,.delete-notification{transition:background-color .3s,color .3s}input,select{transition:border-color .3s}input:focus,select:focus{border-color:#007bff}.hidden{display:none} diff --git a/examples/streaming_web/frontend/dist/assets/config-BheEa4pg.js b/examples/streaming_web/frontend/dist/assets/config-BheEa4pg.js new file mode 100644 index 0000000..269b3c2 --- /dev/null +++ b/examples/streaming_web/frontend/dist/assets/config-BheEa4pg.js @@ -0,0 +1 @@ +import"./modulepreload-polyfill-B5Qt9EMX.js";const v=document.getElementById("config-container"),D=document.getElementById("edit-btn"),N=document.getElementById("add-config-btn"),M=document.getElementById("save-btn"),j=document.getElementById("cancel-btn"),W=document.getElementById("form-controls");let m=[],k=!1;function y(){return new Date().toISOString().split("T")[0]}async function B(){try{const i=await fetch("/api/config");if(!i.ok)throw new Error("Failed to fetch configuration.");m=(await i.json()).config.map(o=>({...o,notifications:Object.entries(o.notifications).map(([u,t])=>({token:u,language:t}))})),h()}catch(i){console.error(i)}}function $(i){return i.replace(/_/g," ").replace(/\b\w/g,l=>l.toUpperCase())}function g(){const i=v.children;m=Array.from(i).map((l,o)=>{const u=l.querySelectorAll("input, select"),t={notifications:[],detection_items:{}};u.forEach(n=>{const{name:r,type:_}=n;if(r==="line_token"||r==="language"){const c=n.getAttribute("data-notif-index");t.notifications[c]||(t.notifications[c]={token:"",language:"en"}),r==="line_token"?t.notifications[c].token=n.value.trim():t.notifications[c].language=n.value}else r==="expire_date"?t.expire_date=n.value.trim():r==="detect_with_server"?t.detect_with_server=n.checked:r==="store_in_redis"?t.store_in_redis=n.checked:r.startsWith("detect_")?t.detection_items[r]=n.checked:r==="work_start_hour"?t.work_start_hour=parseInt(n.value,10):r==="work_end_hour"?t.work_end_hour=parseInt(n.value,10):r&&(t[r]=n.value.trim())});const e=l.querySelector("input[name='no_expire_date']");return e&&(e.checked?t.expire_date="No Expire Date":(!t.expire_date||t.expire_date==="No Expire Date")&&(t.expire_date=y())),t.notifications=t.notifications.filter(n=>n.token),t.store_in_redis=!!t.store_in_redis,t})}function h(){v.innerHTML="";const i=document.getElementById("config-item-template"),l=document.getElementById("notification-item-template");m.forEach((o,u)=>{const t=i.content.cloneNode(!0),e=t.querySelector(".config-item"),n=e.querySelector("input[name='site']"),r=e.querySelector("input[name='stream_name']"),_=e.querySelector("input[name='video_url']"),c=e.querySelector("select[name='model_key']"),s=e.querySelector("input[name='expire_date']"),p=e.querySelector("input[type='text'][value='No Expire Date']"),A=e.querySelector("input[name='detect_with_server']"),T=e.querySelector("input[name='store_in_redis']"),H=e.querySelectorAll("input[type='checkbox'][name^='detect_']:not([name='detect_with_server']):not([name='store_in_redis'])"),O=e.querySelector("select[name='work_start_hour']"),F=e.querySelector("select[name='work_end_hour']"),S=e.querySelector(".add-notification"),w=e.querySelector(".delete-config-btn"),q=e.querySelector(".expire-date-container");n.value=o.site||"",r.value=o.stream_name||"",_.value=o.video_url||"",c.value=o.model_key||"yolo11n",O.value=o.work_start_hour!==void 0?o.work_start_hour:7,F.value=o.work_end_hour!==void 0?o.work_end_hour:18,o.expire_date==="No Expire Date"?(s.value="",s.style.display="none",p.style.display=""):(s.value=o.expire_date||y(),s.style.display="",p.style.display="none"),A.checked=!!o.detect_with_server,T.checked=!!o.store_in_redis,H.forEach(a=>{const d=a.name;a.checked=!!o.detection_items[d];const f=a.parentElement;f.lastChild.textContent=$(d)});const C=e.querySelector(".notifications-container");if(C.innerHTML="",o.notifications.forEach((a,d)=>{const f=l.content.cloneNode(!0),E=f.querySelector(".notification-item"),b=E.querySelector("input[name='line_token']"),I=E.querySelector("select[name='language']"),L=E.querySelector(".delete-notification");b.value=a.token,I.value=a.language,b.setAttribute("data-notif-index",d),I.setAttribute("data-notif-index",d),k?L.style.display="block":L.style.display="none",C.appendChild(f)}),k){const a=document.createElement("input");a.type="checkbox",a.name="no_expire_date",a.checked=o.expire_date==="No Expire Date",a.id=`no-expire-date-${u}`;const d=document.createElement("label");d.htmlFor=`no-expire-date-${u}`,d.appendChild(a),d.appendChild(document.createTextNode(" No Expire Date")),q.appendChild(document.createElement("br")),q.appendChild(d),a.checked?(s.style.display="none",p.style.display=""):(s.style.display="",p.style.display="none"),a.addEventListener("change",()=>{a.checked?(s.value="",s.style.display="none",p.style.display=""):(s.style.display="",p.style.display="none",(!o.expire_date||o.expire_date==="No Expire Date")&&(s.value=y(),o.expire_date=y()))})}else o.expire_date==="No Expire Date"?(s.style.display="none",p.style.display=""):(s.style.display="",p.style.display="none");k?(w.style.display="block",S.style.display="inline-block"):(w.style.display="none",S.style.display="none"),w.addEventListener("click",()=>{g(),m.splice(u,1),h()}),C.addEventListener("click",a=>{if(a.target.closest(".delete-notification")){const d=a.target.closest(".notification-item"),f=parseInt(d.querySelector("input[name='line_token']").getAttribute("data-notif-index"));g(),m[u].notifications.splice(f,1),h()}}),S.addEventListener("click",()=>{g(),m[u].notifications.push({token:"",language:"en"}),h()}),e.querySelectorAll("input, select").forEach(a=>{k?a.removeAttribute("disabled"):a.setAttribute("disabled","true")}),v.appendChild(t)})}function x(i){k=i,h(),D.classList.toggle("hidden",i),N.classList.toggle("hidden",!i),W.classList.toggle("hidden",!i),i||B()}async function U(){document.querySelectorAll(".error-message").forEach(l=>l.remove()),document.querySelectorAll(".error").forEach(l=>l.classList.remove("error"));let i=!0;try{g();const l=m.map((e,n)=>{const r=v.children[n];if(["site","stream_name","video_url"].forEach(_=>{if(!e[_]){i=!1;const c=r.querySelector(`input[name='${_}']`);if(c&&(c.classList.add("error"),!c.previousElementSibling||!c.previousElementSibling.classList.contains("error-message"))){const s=document.createElement("div");s.className="error-message",s.textContent="This field is required.",c.parentNode.insertBefore(s,c)}}}),e.work_start_hour>=e.work_end_hour){i=!1;const _=r.querySelector("select[name='work_start_hour']"),c=r.querySelector("select[name='work_end_hour']");if(_.classList.add("error"),c.classList.add("error"),!c.previousElementSibling||!c.previousElementSibling.classList.contains("error-message")){const s=document.createElement("div");s.className="error-message",s.textContent="Work Start Hour cannot be greater than or equal to Work End Hour.",c.parentNode.insertBefore(s,c)}}return e.expire_date!=="No Expire Date"&&!e.expire_date&&(e.expire_date=y()),e});if(!i)return;const u=l.map(e=>{const n={};return e.notifications.forEach(r=>{n[r.token]=r.language}),{...e,notifications:n,no_expire_date:void 0}}).map(e=>{const n={...e};return Object.keys(n).forEach(r=>{n[r]===void 0&&delete n[r]}),n});if(!(await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:u})})).ok)throw new Error("Failed to save configuration.");x(!1)}catch(l){console.error(l)}}D.addEventListener("click",()=>x(!0));j.addEventListener("click",()=>x(!1));M.addEventListener("click",U);N.addEventListener("click",()=>{g();const i=y();m.push({site:"",stream_name:"",video_url:"",model_key:"yolo11n",expire_date:i,detect_with_server:!1,store_in_redis:!1,work_start_hour:7,work_end_hour:18,notifications:[],detection_items:{detect_no_safety_vest_or_helmet:!1,detect_near_machinery_or_vehicle:!1,detect_in_restricted_area:!1}}),h(),x(!0)});document.addEventListener("DOMContentLoaded",B); diff --git a/examples/streaming_web/frontend/dist/assets/config-BrNUDwsF.css b/examples/streaming_web/frontend/dist/assets/config-BrNUDwsF.css new file mode 100644 index 0000000..cd15af9 --- /dev/null +++ b/examples/streaming_web/frontend/dist/assets/config-BrNUDwsF.css @@ -0,0 +1 @@ +body{font-family:Roboto,sans-serif;background-color:#f2f2f2;margin:0;padding:20px}.container{max-width:800px;margin:0 auto;background-color:#fff;padding:30px;border-radius:8px;box-shadow:0 0 10px #0000001a}h1{text-align:center;color:#333}button{padding:10px 20px;margin-top:10px;margin-right:10px;font-size:16px;cursor:pointer;background-color:#007bff;color:#fff;border:none;border-radius:5px}button:hover{background-color:#0056b3}.buttons,#form-controls{text-align:center}.config-item{background-color:#fafafa;border:1px solid #ddd;border-radius:8px;padding:20px;margin-bottom:20px}.config-item label{display:block;margin-bottom:15px;font-weight:700}.config-item input[type=text],.config-item input[type=date],.config-item select{width:100%;padding:8px;margin-top:5px;font-size:16px;border:1px solid #ccc;border-radius:4px}.config-item input[type=checkbox]{margin-right:10px}fieldset{border:1px solid #ccc;border-radius:8px;padding:15px;margin-top:20px}legend{font-weight:700;color:#007bff;padding:0 10px}.config-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px}.config-header .site-stream{display:flex;align-items:center;gap:10px}.config-header .delete-config-btn{background-color:transparent;color:#ff5c5c;border:none;font-size:24px;cursor:pointer}.config-header .delete-config-btn:hover{color:#e60000}.work-hours{display:flex;flex-direction:row;gap:20px;margin-bottom:15px}.work-hours-label{font-weight:700;display:flex;flex-direction:column}.notification-item{position:relative;border:1px solid #ccc;padding:15px;margin-bottom:15px;border-radius:8px;background-color:#f9f9f9}.notification-item .delete-notification{position:absolute;top:0;right:0;transform:translate(50%,-50%);background:#ff5c5c;border:none;font-size:16px;cursor:pointer;color:#fff;width:24px;height:24px;border-radius:50%;padding:0;line-height:1;box-sizing:border-box;display:flex;align-items:center;justify-content:center}.notification-item .delete-notification:hover{background:#e60000}.notification-item .delete-notification i{color:#fff}.notification-content label{display:block;margin-bottom:10px;font-weight:400}.notification-content input,.notification-content select{width:100%;padding:8px;margin-top:5px;font-size:16px;border:1px solid #ccc;border-radius:4px}.error-message{color:red;font-size:14px;margin-bottom:5px}@media (max-width: 600px){.config-header{flex-direction:column;align-items:flex-start}.config-header .site-stream{flex-direction:column;gap:5px}button{width:100%;margin:10px 0}.buttons,#form-controls{text-align:center}.work-hours{flex-direction:column}}.error{border:1px solid red!important}button,.delete-notification{transition:background-color .3s,color .3s}input,select{transition:border-color .3s}input:focus,select:focus{border-color:#007bff}.hidden{display:none} diff --git a/examples/streaming_web/frontend/dist/assets/config-Dm3IWCdK.js b/examples/streaming_web/frontend/dist/assets/config-Dm3IWCdK.js deleted file mode 100644 index d8bfd57..0000000 --- a/examples/streaming_web/frontend/dist/assets/config-Dm3IWCdK.js +++ /dev/null @@ -1,73 +0,0 @@ -import"./modulepreload-polyfill-B5Qt9EMX.js";const v=document.getElementById("config-container"),x=document.getElementById("edit-btn"),b=document.getElementById("add-config-btn"),$=document.getElementById("save-btn"),k=document.getElementById("cancel-btn"),S=document.getElementById("form-controls");let f=[],o=!1;async function h(){try{const e=await fetch("/api/config");if(!e.ok)throw new Error("Failed to fetch configuration.");f=(await e.json()).config.map(a=>({...a,notifications:Object.entries(a.notifications).map(([d,t])=>({token:d,language:t}))})),u()}catch(e){console.error(e)}}function D(e){return e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function y(){const e=v.children;f=Array.from(e).map((n,a)=>{const d=n.querySelectorAll("input, select"),t={notifications:[],detection_items:{}};return d.forEach(i=>{if(i.name==="line_token"||i.name==="language"){const s=i.getAttribute("data-notif-index");t.notifications[s]||(t.notifications[s]={token:"",language:"en"}),i.name==="line_token"?t.notifications[s].token=i.value.trim():i.name==="language"&&(t.notifications[s].language=i.value)}else i.name==="no_expire_date"?(t.no_expire_date=i.checked,i.checked&&(t.expire_date="No Expire Date")):i.name==="expire_date"?(!t.expire_date&&i.type==="date"&&(t.expire_date=i.value||new Date().toISOString().split("T")[0]),t.previous_expire_date=i.value):i.name.startsWith("detect_")?i.name==="detect_with_server"?t.detect_with_server=i.checked:t.detection_items[i.name]=i.checked:i.name&&(t[i.name]=i.value.trim())}),t})}function u(){v.innerHTML="",f.forEach((e,n)=>{const a=document.createElement("div");a.className="config-item";let d;e.expire_date==="No Expire Date"?d="":e.expire_date?d=e.expire_date:(d=new Date().toISOString().split("T")[0],e.expire_date=d),a.innerHTML=` -