PageSourceSearch

https://cdn.dynamitecircle.com/dc-assets/2026/AdminShortLinksView.CRsxsylL.js

js dynamitecircle.com collected 2026-09-24 09:50:39 UTC 14,315 bytes, 3 lines download raw bytes

1import{n as D}from"./preload-helper.DSVgyDmj.js";import{Dt as P,Nt as _,Pt as Q,Qt as O,Ut as L,Z as S,at as G,ct as v,en as g,ft as C,ht as H,jt as V,kt as n,lt as d,nt as F,ot as s,pn as b,pt as W,st as z,un as j}from"./tiptap.BdaQ6C40.js";import{c as X,s as Y}from"./vendor.mWMwHLVu.js";import{r as Z}from"./auth.DMwxiiT7.js";import{t as J}from"./_plugin-vue_export-helper.Sxs-a3SU.js";import{n as E,t as A}from"./util.Cg1MDIT8.js";import{t as N}from"./axios.BcmOUbFG.js";import{H as K}from"./entry.v2-715-0.js";import{t as ee}from"./CheckIcon.C-kvH8pl.js";import{t as te}from"./PlusIcon.Dw4Jxen-.js";import{t as ae}from"./LoadingSpinner.Drh7oxDc.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"703f8047946e712fb749e5a7aadfc0405ed594c2"};var a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="068627a7-1184-4c5d-be4e-2d885be6bddc",e._sentryDebugIdIdentifier="sentry-dbid-068627a7-1184-4c5d-be4e-2d885be6bddc")}catch{}})();var I={Active:"status-active",All:"status-all",Inactive:"status-inactive"},R={Edited:"scope-edited",Everyone:"scope-everyone",Mine:"scope-mine"},B=async()=>{const e=await Z();return{adminID:e?.uid||"",adminName:e?.displayName||"Admin"}},se=Y("adminShortLinks",()=>{const e=g(null),a=g([]),y=g(!1),f=g(""),h=g(""),k=g({}),$=G(()=>e.value===null),x=i=>y.value?!1:(y.value=i,f.value="",!0),t=()=>y.value=!1,l=async i=>{i!==void 0&&(k.value=i);const{adminID:m}=await B(),p=await A();p.headers={...p.headers,"X-Admin-ID":m};const r=["limit=200"],o=k.value;o.isActive===!0&&r.push("isActive=true"),o.isActive===!1&&r.push("isActive=false"),o.mine?r.push(`createdBy=${encodeURIComponent(m)}`):o.createdBy&&r.push(`createdBy=${encodeURIComponent(o.createdBy)}`),o.editedByMe?r.push(`updatedBy=${encodeURIComponent(m)}`):o.updatedBy&&r.push(`updatedBy=${encodeURIComponent(o.updatedBy)}`),o.q&&o.q.trim()&&r.push(`q=${encodeURIComponent(o.q.trim())}`);const[c,w]=await D(N.get(E(`admin/short-links?${r.join("&")}`),p));return c||!w?.data?.success?(f.value=w?.data?.message||c?.message||"Failed to load short links",e.value=[],!1):(e.value=w.data.items,w.data.reservedSegments&&(a.value=w.data.reservedSegments),!0)};return{filter:k,lastError:f,lastNotice:h,links:e,reservedSegments:a,saving:y,loading:$,createLink:async i=>{if(!x("create"))return null;const{adminID:m,adminName:p}=await B(),[r,o]=await D(N.post(E("admin/short-links"),{adminID:m,adminName:p,code:i.code||"",note:i.note||"",targetURL:i.targetURL},await A()));return t(),r||!o?.data?.success?(f.value=o?.data?.message||r?.message||"Failed to create short link",null):(o.data.isReuse&&o.data.message?h.value=o.data.message:h.value="",await l(),o.data.link||null)},loadLinks:l,rescanLink:async i=>{if(!x(`rescan:${i}`))return null;const{adminID:m,adminName:p}=await B(),[r,o]=await D(N.post(E(`admin/short-links/${i}/rescan`),{adminID:m,adminName:p},await A()));return t(),r||!o?.data?.success?(f.value=o?.data?.message||r?.message||"Rescan failed",null):(o.data.message&&(h.value=o.data.message),await l(),o.data.link||null)},softDeleteLink:async i=>{if(!x(`delete:${i}`))return!1;const{adminID:m,adminName:p}=await B(),r=await A();r.data={adminID:m,adminName:p};const[o,c]=await D(N.delete(E(`admin/short-links/${i}`),r));return t(),o||!c?.data?.success?(f.value=c?.data?.message||o?.message||"Failed to delete short link",!1):(await l(),!0)},updateLink:async(i,m)=>{if(!x(`update:${i}`))return null;const{adminID:p,adminName:r}=await B(),[o,c]=await D(N.patch(E(`admin/short-links/${i}`),{adminID:p,adminName:r,...m},await A()));return t(),o||!c?.data?.success?(f.value=c?.data?.message||o?.message||"Failed to update short link",null):(await l(),c.data.link||null)}}}),oe=H({components:{CheckIcon:ee,LoadingSpinner:ae,PlusIcon:te},setup(){const e=K();P(()=>e.setTitle("Short Links Admin"));const a=se(),{lastError:y,lastNotice:f,links:h,loading:k,reservedSegments:$,saving:x}=X(a);P(()=>a.loadLinks({}));const t=g("");let l=null;const T=()=>{l&&clearTimeout(l),l=setTimeout(()=>{a.loadLinks({...a.filter,q:t.value})},300)},M=[{id:I.All,label:"All"},{id:I.Active,label:"Active"},{id:I.Inactive,label:"Inactive"}],q=[{id:R.Everyone,label:"Everyone"},{id:R.Mine,label:"Created by me"},{id:R.Edited,label:"Edited by me"}],U=g(I.All),i=g(R.Everyone),m=async u=>{u.status&&(U.value=u.status),u.scope&&(i.value=u.scope),await a.loadLinks({editedByMe:i.value===R.Edited,isActive:U.value===I.All?void 0:U.value===I.Active,mine:i.value===R.Mine})},p=g(!1),r=O({code:"",note:"",targetURL:""}),o=g(""),c=O({note:"",targetURL:""});return{activeScope:i,activeStatus:U,applyFilter:m,editForm:c,editing:o,form:r,lastError:y,lastNotice:f,links:h,loading:k,onCreate:async()=>
1{if(!r.targetURL){a.lastError="Target URL is required";return}await a.createLink({code:r.code,note:r.note,targetURL:r.targetURL})&&(r.code="",r.note="",r.targetURL="",p.value=!1)},onDelete:async u=>{confirm(`Soft-delete dc.mba/${u.code}? The slug stays reserved.`)&&await a.softDeleteLink(u.code)},onEdit:u=>{o.value=u.code,c.targetURL=u.targetURL,c.note=u.note||""},onReactivate:async u=>{await a.updateLink(u.code,{isActive:!0})},onRescan:async u=>{await a.rescanLink(u.code)},onSaveEdit:async u=>{await a.updateLink(u,{note:c.note,targetURL:c.targetURL})&&(o.value="")},onSearchInput:T,reservedSegments:$,saving:x,scopeFilters:q,searchQuery:t,showCreate:p,statusFilters:M}}}),re={class:"flex items-center justify-between mb-6"},ne={key:0,class:"bg-red-900/40 border border-red-500/50 text-red-100 px-4 py-2 rounded-xl mb-4 text-sm"},de={key:1,class:"bg-emerald-900/30 border border-emerald-500/40 text-emerald-100 px-4 py-2 rounded-xl mb-4 text-sm"},le={class:"mb-3"},ie={class:"flex flex-wrap items-center gap-2 mb-4 text-xs"},ue=["onClick"],ce=["onClick"],pe={key:2,class:"bg-slate-800/50 border border-slate-700 rounded-xl p-4 mb-6 space-y-3"},me={key:0,class:"text-xs text-slate-500 mt-1"},ve={class:"flex justify-end"},be=["disabled"],ge={key:3},fe={key:4,class:"text-slate-500 text-sm text-center py-10"},ye={key:5,class:"space-y-2"},xe={class:"flex items-start justify-between gap-4"},he={class:"flex-1 min-w-0"},ke={class:"flex items-center gap-2 mb-1"},we=["href"],Le={key:0,class:"text-xs px-2 py-0.5 bg-red-900/40 text-red-300 rounded"},Se=["title"],Ce={key:2,class:"text-xs px-2 py-0.5 bg-emerald-900/30 text-emerald-300 rounded",title:"Google Cloud Web Risk: clean"},Ie={key:3,class:"text-xs px-2 py-0.5 bg-amber-900/30 text-amber-300 rounded",title:"Not yet scanned — legacy doc. Click Rescan to check."},Re=["title"],$e={class:"text-sm text-slate-300 truncate"},Ue={key:0,class:"text-xs text-slate-400 mt-1"},De={key:1,class:"text-xs text-red-300 mt-1"},Ee={class:"text-xs text-slate-500 mt-1"},Ae={class:"flex flex-col gap-2 flex-none"},Ne=["onClick"],Be=["disabled","onClick"],Te=["disabled","onClick"],Fe=["disabled","onClick"],Ve={key:0,class:"mt-4 pt-4 border-t border-slate-700 space-y-3"},je={class:"flex justify-end gap-2"},Me=["disabled","onClick"];function qe(e,a,y,f,h,k){const $=_("PlusIcon"),x=_("LoadingSpinner");return n(),d("div",null,[s("div",re,[a[10]||(a[10]=s("div",{class:"text-white font-semibold text-xl"}," dc.mba URL Shortener ",-1)),s("button",{type:"button",class:"inline-flex items-center px-4 py-2 text-xs font-semibold text-white bg-dc-orange-600 rounded-xl hover:bg-dc-orange-500",onClick:a[0]||(a[0]=t=>e.showCreate=!e.showCreate)},[W($,{class:"w-4 h-4 mr-2"}),C(" "+b(e.showCreate?"Cancel":"New short link"),1)])]),e.lastError?(n(),d("div",ne,b(e.lastError),1)):v("",!0),e.lastNotice?(n(),d("div",de,b(e.lastNotice),1)):v("",!0),s("div",le,[L(s("input",{"onUpdate:modelValue":a[1]||(a[1]=t=>e.searchQuery=t),type:"text",placeholder:"Search by host, path, note, or code (e.g. 'forms.google.com' or 'newsletter')",class:"w-full px-3 py-2 bg-slate-900 border border-slate-700 rounded-xl text-white text-sm placeholder-slate-500",onInput:a[2]||(a[2]=(...t)=>e.onSearchInput&&e.onSearchInput(...t))},null,544),[[S,e.searchQuery]])]),s("div",ie,[a[11]||(a[11]=s("span",{class:"text-slate-500 mr-1"},"Show:",-1)),(n(!0),d(F,null,V(e.statusFilters,t=>(n(),d("button",{key:t.id,type:"button",class:j(["px-3 py-1 rounded-full border transition-colors",e.activeStatus===t.id?"border-dc-orange-500 bg-dc-orange-600 text-white":"border-slate-700 text-slate-400 hover:border-slate-600"]),onClick:l=>e.applyFilter({status:t.id})},b(t.label),11,ue))),128)),a[12]||(a[12]=s("span",{class:"text-slate-700 mx-1"},"·",-1)),(n(!0),d(F,null,V(e.scopeFilters,t=>(n(),d("button",{key:t.id,type:"button",class:j(["px-3 py-1 rounded-full border transition-colors",e.activeScope===t.id?"border-dc-orange-500 bg-dc-orange-600 text-white":"border-slate-700 text-slate-400 hover:border-slate-600"]),onClick:l=>e.applyFilter({scope:t.id})}
1,b(t.label),11,ce))),128))]),e.showCreate?(n(),d("div",pe,[s("div",null,[a[13]||(a[13]=s("label",{class:"block text-xs text-slate-400 mb-1"},[C(" Target URL "),s("span",{class:"text-red-400"},"required")],-1)),L(s("input",{"onUpdate:modelValue":a[3]||(a[3]=t=>e.form.targetURL=t),type:"url",placeholder:"https://forms.google.com/...",class:"w-full px-3 py-2 bg-slate-900 border border-slate-600 rounded-lg text-white text-sm"},null,512),[[S,e.form.targetURL]])]),s("div",null,[a[14]||(a[14]=s("label",{class:"block text-xs text-slate-400 mb-1"}," Custom code (optional — leave empty to auto-generate) ",-1)),L(s("input",{"onUpdate:modelValue":a[4]||(a[4]=t=>e.form.code=t),type:"text",placeholder:"feb2026 or dcbkk26 — lowercase, must contain ≥1 digit",class:"w-full px-3 py-2 bg-slate-900 border border-slate-600 rounded-lg text-white text-sm"},null,512),[[S,e.form.code]]),e.reservedSegments.length?(n(),d("div",me," Reserved (can't be used as code): "+b(e.reservedSegments.join(", ")),1)):v("",!0)]),s("div",null,[a[15]||(a[15]=s("label",{class:"block text-xs text-slate-400 mb-1"}," Note (optional) ",-1)),L(s("input",{"onUpdate:modelValue":a[5]||(a[5]=t=>e.form.note=t),type:"text",placeholder:"What's this code for?",class:"w-full px-3 py-2 bg-slate-900 border border-slate-600 rounded-lg text-white text-sm"},null,512),[[S,e.form.note]])]),s("div",ve,[s("button",{type:"button",class:"inline-flex items-center px-4 py-2 text-xs font-semibold text-white bg-dc-orange-600 rounded-xl hover:bg-dc-orange-500 disabled:opacity-50",disabled:e.saving==="create",onClick:a[6]||(a[6]=(...t)=>e.onCreate&&e.onCreate(...t))},[(n(),z(Q(e.saving==="create"?"LoadingSpinner":"CheckIcon"),{class:"w-4 h-4 mr-2"})),a[16]||(a[16]=C(" Create ",-1))],8,be)])])):v("",!0),e.loading?(n(),d("div",ge,[W(x,{class:"w-10 h-10 mx-auto my-10 text-white animate-spin"})])):e.links&&e.links.length===0?(n(),d("div",fe," No short links yet. Create one above. ")):e.links?(n(),d("div",ye,[(n(!0),d(F,null,V(e.links,t=>(n(),d("div",{key:t.code,class:j(["bg-slate-800/50 border border-slate-700 rounded-xl p-4",{"opacity-50":!t.flags?.isActive}])},[s("div",xe,[s("div",he,[s("div",ke,[s("a",{href:`https://dc.mba/${t.code}`,target:"_blank",rel:"noopener",class:"font-mono text-base text-dc-orange-400 hover:text-dc-orange-300"}," dc.mba/"+b(t.code),9,we),t.flags?.isActive?v("",!0):(n(),d("span",Le," Inactive ")),t.flags?.isBlocked?(n(),d("span",{key:1,class:"text-xs px-2 py-0.5 bg-red-900/60 text-red-100 rounded",title:t.safety?.threatTypes?.join(", ")||"Blocked"}," Blocked ",8,Se)):t.flags?.isScanned&&t.flags?.isSafe?(n(),d("span",Ce," Safe ")):t.flags?.isScanned?v("",!0):(n(),d("span",Ie," Not scanned ")),t.flags?.isBaked?(n(),d("span",{key:4,class:"text-xs px-2 py-0.5 bg-indigo-900/40 text-indigo-200 rounded",title:t.bakedParams?Object.entries(t.bakedParams).map(([l,T])=>`${l}=${T}`).join(" · "):"Locked attribution"}," 🔒 baked ",8,Re)):v("",!0)]),s("div",$e," → "+b(t.targetURL),1),t.note?(n(),d("div",Ue,b(t.note),1)):v("",!0),t.safety?.threatTypes&&t.safety.threatTypes.length?(n(),d("div",De," Threats: "+b(t.safety.threatTypes.join(", ")),1)):v("",!0),s("div",Ee,[C(" Created by "+b(t.createdBy),1),t.updatedBy?(n(),d(F,{key:0},[C(" , last edited by "+b(t.updatedBy),1)],64)):v("",!0)])]),s("div",Ae,[s("button",{type:"button",class:"px-3 py-1.5 text-xs text-white bg-slate-700 rounded-lg hover:bg-slate-600",onClick:l=>e.onEdit(t)}," Edit ",8,Ne),s("button",{type:"button",class:"px-3 py-1.5 text-xs text-amber-300 bg-amber-900/20 rounded-lg hover:bg-amber-900/40",disabled:e.saving===`rescan:${t.code}`,onClick:l=>e.onRescan(t)}," Rescan ",8,Be),t.flags?.isActive?(n(),d("button",{key:0,type:"button",class:"px-3 py-1.5 text-xs text-red-300 bg-red-900/30 rounded-lg hover:bg-red-900/50",disabled:e.saving===`delete:${t.code}`,onClick:l=>e.onDelete(t)}," Delete ",8,Te)):(n(),d("button",{key:1,type:"button",class:"px-3 py-1.5 text-xs text-emerald-300 bg-emerald-900/30 rounded-lg hover:bg-emerald-900/50",disabled:e.saving===`update:${t.code}`,onClick:l=>e.onReactivate(t)}," Reactivate ",8,Fe))])]),e.editing===t.code?(n(),d("div",Ve,[s("div",null,[a[17]||(a[17]=s("label",{class:"block text-xs text-slate-400 mb-1"}," Target URL ",-1)),L(s("input",{"onUpdate:modelValue":a[7]||(a[7]=l=>e.editForm.targetURL=l),type:"url",class:"w-full px-3 py-2 bg-slate-900 border border-slate-600 rounded-lg text-white text-sm"},null,512),[[S,e.editForm.targetURL]])]),s("div",null,[a[18]||(a[18]=s("label",{class:"block text-xs text-slate-400 mb-1"}," Note ",-1)),L(s("input",{"onUpdate:modelValue":a[8]||(a[8]=l=>e.editForm.note=l),type:"text",class:"w-full px-3 py-2 bg-slate-900 border border-slate-600 rounded-lg text-white text-sm"},null,512),[[S,e.editForm.note]])]),s("div",je,[s("button",{type:"button",class:"px-3 py-1.5 text-xs text-slate-300 bg-slate-700 rounded-lg hover:bg-slate-600",onClick:a[9]||(a[9]=l=>e.editing="")}," Cancel "),s("button",{type:"button",class:"inline-flex items-center px-3 py-1.5 text-xs font-semibold text-white bg-dc-orange-600 rounded-lg hover:bg-dc-orange-500 disabled:opacity-50",disabled:e.saving===`update:${t.code}`,onClick:l=>e.onSaveEdit(t.code)},[(n(),z(Q(e.saving===`update:${t.code}`?"LoadingSpinner":"CheckIcon"),{class:"w-4 h-4 mr-2"})),a[19]||(a[19]=C(" Save ",-1))],8,Me)])])):v("",!0)],2))),128))])):v("",!0)])}var st=J(oe,[["render",qe]]);export{st as default};
2
3//# sourceMappingURL=AdminShortLinksView.CRsxsylL.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.