fix
1
dist/client/_astro/_page_.RC7LoXVl.css
vendored
Normal file
7
dist/client/_astro/hoisted.ClNlXW51.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
const d={file:"#new-image-file",image:"#new-image-field",thumb:"#new-thumb-field",preview:"#new-image-preview",status:"#upload-status",button:"#new-upload-btn"},u=(e,t)=>{const n=document.querySelector(d.status);n&&(n.textContent=t,n.className="text-xs rounded-lg px-2.5 py-1 "+(e==="busy"?"bg-gray-100 text-gray-600":e==="ok"?"bg-green-50 text-green-700":e==="err"?"bg-red-50 text-brand":"text-gray-400"))},m=e=>{const t=document.querySelector(d.preview);t&&(t.innerHTML=e?`<img src="${e}" alt="" class="w-full h-full object-cover" />`:'<span class="text-gray-400 text-sm">تصویری انتخاب نشده</span>')},l={async uploadImage(e){const t=new FormData;t.append("image",e);const n=await fetch("/api/admin/upload",{method:"POST",body:t}),r=await n.json().catch(()=>({error:"پاسخ نامعتبر سرور"}));if(!n.ok||r.error)throw new Error(r.error??"آپلود ناموفق بود");return r},async runTassAgent(e=3){const t=await fetch("/api/agents/tass",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({limit:e})});if(!t.ok)throw new Error("خطا در اجرای agent");return t.json()},initUpload(){const e=document.querySelector(d.file);if(!e)return;const t=document.querySelector(d.image),n=document.querySelector(d.thumb),r=document.querySelector(d.button),c=()=>{const a=t?.value??"";document.querySelectorAll("[data-insert-image]").forEach(o=>{o.dataset.insertImage=a,o.disabled=!a})},i=(a,o)=>{t&&(t.value=a),n&&(n.value=o),m(o||a),c()},s=async a=>{u("busy","در حال آپلود و پردازش..."),r&&(r.disabled=!0);try{const o=await l.uploadImage(a);i(o.image,o.thumbnail),u("ok","تصویر آپلود شد و آماده استفاده است.")}catch(o){u("err",o instanceof Error?o.message:"آپلود ناموفق بود.")}finally{r&&(r.disabled=!1)}};e.addEventListener("change",()=>{const a=e.files?.[0];a&&s(a)}),r?.addEventListener("click",()=>{const a=e.files?.[0];a?s(a):u("err","ابتدا یک فایل انتخاب کنید.")}),c()},initEditor(){const e=document.querySelector("#post-body-editor");if(!e)return;const t=n=>{const r=e.selectionStart,c=e.selectionEnd,i=e.value.slice(0,r),s=e.value.slice(c),a=i.endsWith(`
|
||||
`)||i.length===0?"":`
|
||||
|
||||
`,o=s.startsWith(`
|
||||
`)||s.length===0?"":`
|
||||
|
||||
`;e.value=`${i}${a}${n}${o}${s}`,e.focus();const g=i.length+a.length+n.length;e.setSelectionRange(g,g)};document.querySelectorAll("[data-insert-image]").forEach(n=>{n.addEventListener("click",()=>{const r=n.dataset.insertImage;r&&t(`[image:${r}|توضیح تصویر]`)})}),document.querySelectorAll("[data-editor-command]").forEach(n=>{n.addEventListener("click",()=>{const r=n.dataset.editorCommand;r==="heading"&&t("## تیتر میانی"),r==="quote"&&t("> متن نقلقول"),r==="separator"&&t("---")})})},initConfirm(){document.querySelectorAll("[data-confirm-form]").forEach(e=>{e.addEventListener("submit",t=>{const n=e.dataset.confirmMessage||"برای تایید حذف عبارت confirm را تایپ کنید.",r=window.prompt(n);if(r!=="confirm"){t.preventDefault(),window.alert("حذف لغو شد. عبارت واردشده باید دقیقاً confirm باشد.");return}const c=e.querySelector("[data-confirm-input]");c&&(c.value=r)})})},initTass(){const e=document.querySelector("#run-tass-agent"),t=document.querySelector("#tass-agent-result");!e||!t||e.addEventListener("click",async()=>{e.disabled=!0,e.textContent="در حال اجرا...",t.classList.remove("hidden"),t.textContent="در حال دریافت و ترجمه خبرها...";try{const n=await l.runTassAgent(3);t.textContent=JSON.stringify(n,null,2)}catch(n){t.textContent=n instanceof Error?n.message:"خطا در اجرای agent"}finally{e.disabled=!1,e.textContent="اجرای agent و ساخت پست"}})},initTabs(){const t=document.querySelector("[data-active-tab]")?.dataset.activeTab??"pending",n=Array.from(document.querySelectorAll("[data-tab]")),r=Array.from(document.querySelectorAll("[data-panel]")),c=i=>{n.forEach(s=>{const a=s.dataset.tab===i;s.classList.toggle("bg-brand",a),s.classList.toggle("text-white",a),s.classList.toggle("border-brand",a),s.classList.toggle("bg-white",!a),s.classList.toggle("text-gray-700",!a),s.classList.toggle("border-gray-200",!a),a?s.setAttribute("aria-current","page"):s.removeAttribute("aria-current")}),r.forEach(s=>{s.classList.toggle("hidden",s.dataset.panel!==i)})};c(t),n.forEach(i=>{i.addEventListener("click",s=>{const a=i.dataset.tab;if(!a)return;s.preventDefault(),c(a);const o=new URL(window.location.href);o.searchParams.set("tab",a),o.searchParams.delete("pendingPage"),o.searchParams.delete("approvedPage"),o.searchParams.delete("edit"),window.history.pushState({},"",o)})}),window.addEventListener("popstate",()=>{const i=new URLSearchParams(window.location.search);c(i.get("tab")||t)})}};l.initTabs();l.initUpload();l.initEditor();l.initConfirm();l.initTass();
|
||||
BIN
dist/client/assets/logo.png
vendored
Normal file
|
After Width: | Height: | Size: 934 KiB |
BIN
dist/client/uploads/0dfaf688-a3f5-4914-b0a5-14a720c212bf.webp
vendored
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
dist/client/uploads/10d5c9bf-849e-4ddd-a7d8-dd5dc6a2e666.webp
vendored
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
dist/client/uploads/15a3a254-12db-4851-a434-cae6e631838d.webp
vendored
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
dist/client/uploads/23ed9cea-411b-4169-a905-a40bd503d8c6.webp
vendored
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
dist/client/uploads/2d77aee7-e390-4ca2-8100-d0e6528c145a.webp
vendored
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
dist/client/uploads/3b043c9d-57bf-46f2-9fb2-9c8be53bbcf5.webp
vendored
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
dist/client/uploads/553d2a2a-b924-401e-988d-1db34a907355.webp
vendored
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
dist/client/uploads/70cc796b-ee3c-49c8-8939-d0fe0dde1554.webp
vendored
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
BIN
dist/client/uploads/7c59fcfa-93cc-4d1d-b2be-d491eb482302.webp
vendored
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
dist/client/uploads/9de7af87-a5f2-4299-bc4e-6c3a17ee9f4d.webp
vendored
Normal file
|
After Width: | Height: | Size: 9.5 KiB |
BIN
dist/client/uploads/ad228b50-fe89-40a6-b17d-87440c24d6a5.webp
vendored
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
dist/client/uploads/af246b9a-cf64-43c2-934d-edb5d8f0b8ee.webp
vendored
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
dist/client/uploads/d0858db4-fcc3-43b4-b120-53cc41a4473c.webp
vendored
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
dist/client/uploads/d3a18a75-4a6f-48c6-b3a5-c10f6fe798d7.webp
vendored
Normal file
|
After Width: | Height: | Size: 8.6 KiB |
BIN
dist/client/uploads/eaebf85a-c702-4eb6-ae0d-02a752761ea5.webp
vendored
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
dist/client/uploads/eb8a9dae-70da-4887-8a36-75f660ccd42a.webp
vendored
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
dist/client/uploads/f1b83771-f192-46f1-8629-6982d42c3b48.webp
vendored
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
dist/client/uploads/fcdcd26a-1029-46ec-adae-8013cbe48022.webp
vendored
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
dist/client/uploads/thumbs/0dfaf688-a3f5-4914-b0a5-14a720c212bf-thumb.webp
vendored
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
dist/client/uploads/thumbs/10d5c9bf-849e-4ddd-a7d8-dd5dc6a2e666-thumb.webp
vendored
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
dist/client/uploads/thumbs/15a3a254-12db-4851-a434-cae6e631838d-thumb.webp
vendored
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
dist/client/uploads/thumbs/23ed9cea-411b-4169-a905-a40bd503d8c6-thumb.webp
vendored
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
dist/client/uploads/thumbs/2d77aee7-e390-4ca2-8100-d0e6528c145a-thumb.webp
vendored
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
dist/client/uploads/thumbs/3b043c9d-57bf-46f2-9fb2-9c8be53bbcf5-thumb.webp
vendored
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
dist/client/uploads/thumbs/553d2a2a-b924-401e-988d-1db34a907355-thumb.webp
vendored
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
dist/client/uploads/thumbs/70cc796b-ee3c-49c8-8939-d0fe0dde1554-thumb.webp
vendored
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
dist/client/uploads/thumbs/7c59fcfa-93cc-4d1d-b2be-d491eb482302-thumb.webp
vendored
Normal file
|
After Width: | Height: | Size: 9.0 KiB |
BIN
dist/client/uploads/thumbs/9de7af87-a5f2-4299-bc4e-6c3a17ee9f4d-thumb.webp
vendored
Normal file
|
After Width: | Height: | Size: 7.1 KiB |
BIN
dist/client/uploads/thumbs/ad228b50-fe89-40a6-b17d-87440c24d6a5-thumb.webp
vendored
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
dist/client/uploads/thumbs/af246b9a-cf64-43c2-934d-edb5d8f0b8ee-thumb.webp
vendored
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
dist/client/uploads/thumbs/d0858db4-fcc3-43b4-b120-53cc41a4473c-thumb.webp
vendored
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
BIN
dist/client/uploads/thumbs/d3a18a75-4a6f-48c6-b3a5-c10f6fe798d7-thumb.webp
vendored
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
BIN
dist/client/uploads/thumbs/eaebf85a-c702-4eb6-ae0d-02a752761ea5-thumb.webp
vendored
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
dist/client/uploads/thumbs/eb8a9dae-70da-4887-8a36-75f660ccd42a-thumb.webp
vendored
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
dist/client/uploads/thumbs/f1b83771-f192-46f1-8629-6982d42c3b48-thumb.webp
vendored
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
BIN
dist/client/uploads/thumbs/fcdcd26a-1029-46ec-adae-8013cbe48022-thumb.webp
vendored
Normal file
|
After Width: | Height: | Size: 23 KiB |