PageSourceSearch

https://cloud.linkwarden.app/_next/static/chunks/pages/settings/access-tokens-8e5aaac3c71e648e.js

js linkwarden.app collected 2026-09-24 09:13:40 UTC 14,010 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2647],{20667:(e,t,s)=>{"use strict";s.d(t,{A:()=>l});var a=s(6029),n=s(55729);function r(e){let t=0;for(;e;){let s=window.getComputedStyle(e).getPropertyValue("z-index"),a=Number(s);if("auto"!==s&&!isNaN(a)){t=a;break}e=e.parentElement}return t}function l(e){let{children:t,onClickOutside:s,className:l,style:i,onMount:o}=e,c=(0,n.useRef)(null);return(0,n.useEffect)(()=>{function e(e){let t=e.target;if(!t.closest("[data-ignore-click-away]")&&c.current&&!c.current.contains(t)){let a=r(c.current);r(t)<=a&&s(e)}}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[c,s]),(0,n.useEffect)(()=>{c.current&&o&&o(c.current.getBoundingClientRect())},[]),(0,a.jsx)("div",{ref:c,className:l,style:i,children:t})}},21400:(e,t,s)=>{"use strict";s.r(t),s.d(t,{__N_SSP:()=>N,default:()=>k});var a=s(6029),n=s(98558),r=s(55729),l=s(83248),i=s(19784),o=s(58578),c=s(32764),d=s(35270),u=s(14187),x=s(12482),h=s(93251),m=s(16932),f=s(35460),p=s(52113),j=s(73639),v=s(36919);function b(e){let{onClose:t}=e,{t:s}=(0,u.Bd)(),[n,x]=(0,r.useState)(""),f=(()=>{let e=(0,h.jE)();return(0,m.n)({mutationFn:async e=>{let t=await fetch("/api/v1/tokens",{body:JSON.stringify(e),method:"POST",headers:{"Content-Type":"application/json"}}),s=await t.json();if(!t.ok)throw Error(s.response);return s.response},onSuccess:t=>{e.setQueryData(["tokens"],e=>[...e,t.token])}})})(),[b,y]=(0,r.useState)({name:"",expires:0}),[g,w]=(0,r.useState)(!1),N=async()=>{if(!g){w(!0);let e=o.Ay.loading(s("creating_token"));await f.mutateAsync(b,{onSettled:(t,s)=>{w(!1),o.Ay.dismiss(e),s?o.Ay.error(s.message):x(t.secretKey)}})}},k=(0,r.useRef)(null);return(0,r.useLayoutEffect)(()=>{var e;null==(e=k.current)||e.focus()},[]),(0,a.jsx)(c.A,{toggleModal:t,children:n?(0,a.jsxs)("div",{className:"flex flex-col justify-center space-y-4",children:[(0,a.jsx)("p",{className:"text-xl font-thin",children:s("access_token_created")}),(0,a.jsx)("p",{children:s("token_creation_notice")}),(0,a.jsx)("div",{className:"relative",children:(0,a.jsxs)("div",{className:"w-full hide-scrollbar overflow-x-auto whitespace-nowrap rounded-md p-2 bg-base-200 border-neutral-content border-solid border flex items-center gap-2 justify-between pr-14",children:[n,(0,a.jsx)("div",{className:"absolute right-0 px-2 border-neutral-content border-solid border-r bg-base-200",children:(0,a.jsx)(p.A,{text:n})})]})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:"text-xl font-thin",children:s("create_access_token")}),(0,a.jsx)(v.w,{className:"my-3"}),(0,a.jsxs)("div",{className:"flex sm:flex-row flex-col gap-2 items-center",children:[(0,a.jsxs)("div",{className:"w-full",children:[(0,a.jsx)("p",{className:"mb-2",children:s("name")}),(0,a.jsx)(l.A,{ref:k,value:b.name,onChange:e=>y({...b,name:e.target.value}),placeholder:s("token_name_placeholder"),className:"bg-base-200"})]}),(0,a.jsxs)("div",{className:"w-full sm:w-fit",children:[(0,a.jsx)("p",{className:"mb-2",children:s("expires_in")}),(0,a.jsxs)(j.rI,{children:[(0,a.jsx)(j.ty,{asChild:!0,children:(0,a.jsx)(d.$,{variant:"metal",className:"whitespace-nowrap w-32",children:(e=>{switch(e){case i.P3.sevenDays:return s("7_days");case i.P3.oneMonth:return s("30_days");case i.P3.twoMonths:return s("60_days");case i.P3.threeMonths:return s("90_days");case i.P3.never:return s("no_expiration")}})(b.expires)})}),(0,a.jsx)(j.SQ,{children:(0,a.jsxs)(j.Hr,{value:b.expires.toString(),onValueChange:e=>y({...b,expires:Number(e)}),children:[(0,a.jsx)(j.Ht,{value:i.P3.sevenDays.toString(),children:s("7_days")}),(0,a.jsx)(j.Ht,{value:i.P3.oneMonth.toString(),children:s("30_days")}),(0,a.jsx)(j.Ht,{value:i.P3.twoMonths.toString(),children:s("60_days")}),(0,a.jsx)(j.Ht,{value:i.P3.threeMonths.toString(),children:s("90_days")}),(0,a.jsx)(j.Ht,{value:i.P3.never.toString(),children:s("no_expiration")})]})})]})]})]}),(0,a.jsx)("div",{className:"flex justify-end items-center mt-5",children:(0,a.jsx)(d.$,{variant:"primary",onClick:N,children:s("create_token")})})]})})}function y(e){let{onClose:t,activeToken:s}=e,{t:n}=(0,u.Bd)(),[l,i]=(0,r.useState)(s),x=(()=>{let e=(0,h.jE)();return(0,m.n)({mutationFn:async e=>{let t=await fetch("/api/v1/tokens/".concat(e),{method:"DELETE"}),s=await t.json();if(!t.ok)throw Error(s.response);return s.response},onSuccess:(t,s)=>{e.setQueryData(["tokens"],e=>e.filter(e=>e.id!==s))}})})();(0,r.useEffect)(()=>{i(s)},[s]);let f=async()=>{let e=o.Ay.loading(n("deleting"));await x.mutateAsync(l.id,{onSettled:(s,a)=>{o.Ay.dismiss(e),a?o.Ay.error(a.message):(t(),o.Ay.success(n("token_revoked")))}})};return(0,a.jsxs)(c.A,{toggleModal:t,children:[(0,a.jsx)("p",{className:"text-xl font-thin text-red-500",children:n("revoke_token")}),(0,a.jsx)(v.w,{className:"my-3"}),(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsx)("p",{children:n("revoke_confirmation")}),(0,a.jsxs)(d.$,{className:"ml-auto",variant:"destructive",onClick:f,children:[(0,a.jsx)("i",{className:"bi-trash text-xl"}),n("revoke")]})]})]})}var g=s(29035);let w=()=>{let[e,t]=(0,r.useState)(!1),[s,n]=(0,r.useState)(!1),[l,i]=(0,r.useState)(null),{t:o}=(0,u.Bd)(),{data:c=[]}=(()=>{let{status:e}=(0,f.useSession)();return(0,x.I)({queryKey:["tokens"],queryFn:async()=>{let e=await fetch("/api/v1/tokens");if(!e.ok)throw Error("Failed to fetch tokens.");return(await e.json()).response},enabled:"authenticated"===e})})();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("i",{className:"bi-key text-primary text-2xl"}),(0,a.jsx)("p",{className:"capitalize text-3xl font-thin inline",children:o("access_tokens")})]}),(0,a.jsx)(v.w,{className:"my-3"}),(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsx)("p",{children:o("access_tokens_description")}),(0,a.jsx)(d.$,{className:"ml-auto",variant:"primary",onClick:()=>{t(!0)},children:o("new_token")}),c.length>0&&(0,a.jsxs)("table",{className:"table mt-2 overflow-x-auto",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:o("name")}
1),(0,a.jsx)("th",{children:o("created")}),(0,a.jsx)("th",{children:o("expires")}),(0,a.jsx)("th",{})]})}),(0,a.jsx)("tbody",{children:c.map((e,t)=>(0,a.jsx)(r.Fragment,{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:e.isSession?"text-primary":"",children:e.isSession?(0,a.jsx)(g.Bc,{children:(0,a.jsxs)(g.m_,{children:[(0,a.jsxs)(g.k$,{children:[" ",e.name]}),(0,a.jsx)(g.ZI,{children:(0,a.jsx)("p",{children:o("permanent_session")})})]})}):e.name}),(0,a.jsx)("td",{children:new Date(e.createdAt).toLocaleDateString(o("locale"),{month:"short",day:"numeric",year:"numeric"})}),(0,a.jsx)("td",{children:new Date(e.expires).toLocaleDateString(o("locale"),{month:"short",day:"numeric",year:"numeric"})}),(0,a.jsx)("td",{children:(0,a.jsx)(d.$,{variant:"ghost",size:"icon",className:"hover:text-error ml-auto block",onClick:()=>{i(e),n(!0)},children:(0,a.jsx)("i",{className:"bi-x text-lg"})})})]})},t))})]})]}),e&&(0,a.jsx)(b,{onClose:()=>t(!1)}),s&&l&&(0,a.jsx)(y,{onClose:()=>{n(!1),i(null)},activeToken:l})]})};w.getLayout=function(e){return(0,a.jsx)(n.A,{children:e})};var N=!0;let k=w},32764:(e,t,s)=>{"use strict";s.d(t,{A:()=>d});var a=s(6029),n=s(55729),r=s(56760),l=s(20667),i=s(60087),o=s(67665),c=s(35270);function d(e){let{toggleModal:t,className:s,children:d,dismissible:u=!0,hideCloseButton:x}=e,[h,m]=n.useState(!0),{width:f}=(0,o.A)();return((0,n.useEffect)(()=>{if(f>=640)return document.body.style.overflow="hidden",document.body.style.position="relative",()=>{document.body.style.overflow="auto",document.body.style.position=""}},[]),f<640)?(0,a.jsx)(i._s.Root,{open:h,onClose:()=>u&&m(!1),onAnimationEnd:e=>!e&&t(),dismissible:u,children:(0,a.jsxs)(i._s.Portal,{children:[(0,a.jsx)(i._s.Overlay,{className:"fixed inset-0 bg-black/40 z-40"}),(0,a.jsx)(i._s.Content,{className:"flex flex-col rounded-t-xl h-[90%] mt-24 fixed bottom-0 left-0 right-0 z-50",children:(0,a.jsxs)("div",{className:"p-4 bg-base-100 rounded-t-xl flex-1 border-neutral-content border-t overflow-y-auto","data-testid":"mobile-modal-container",children:[(0,a.jsx)("div",{className:"mx-auto w-12 h-1.5 flex-shrink-0 rounded-full bg-neutral mb-5","data-testid":"mobile-modal-slider"}),d]})})]})}):r.createPortal((0,a.jsx)("div",{className:"overflow-y-auto pt-2 sm:py-2 fixed top-0 bottom-0 right-0 left-0 bg-black bg-opacity-10 backdrop-blur-sm flex justify-center items-center fade-in z-40","data-testid":"modal-outer",children:(0,a.jsx)(l.A,{onClickOutside:()=>u&&t(),className:"w-full mt-auto sm:m-auto sm:w-11/12 sm:max-w-xl ".concat(s||""),children:(0,a.jsxs)("div",{className:"slide-up mt-auto sm:m-auto relative border-neutral-content rounded-t-xl sm:rounded-xl border-t sm:border shadow-xl p-5 bg-base-100 overflow-y-auto sm:overflow-y-visible","data-testid":"modal-container",children:[u&&!x&&(0,a.jsx)(c.$,{variant:"ghost",size:"icon",onClick:t,className:"absolute top-4 right-3 z-10 rounded-full",children:(0,a.jsx)("i",{className:"bi-x text-neutral text-xl","data-testid":"close-modal-button"})}),d]})})}),document.body)}},52113:(e,t,s)=>{"use strict";s.d(t,{A:()=>i});var a=s(6029),n=s(55729),r=s(35270);async function l(e){var t;if("undefined"!=typeof navigator&&(null==(t=navigator.clipboard)?void 0:t.writeText))try{return await navigator.clipboard.writeText(e),!0}catch(e){}if("undefined"==typeof document||!document.body)return!1;let s=document.createElement("textarea");s.value=e,s.setAttribute("readonly",""),s.style.position="fixed",s.style.opacity="0",s.style.pointerEvents="none",document.body.appendChild(s),s.focus(),s.select(),s.setSelectionRange(0,e.length);try{return document.execCommand("copy")}finally{s.remove()}}let i=e=>{let{text:t}=e,[s,i]=(0,n.useState)(!1),o=async()=>{try{if(!await l(t))return;i(!0),setTimeout(()=>{i(!1)},1e3)}catch(e){console.log(e)}};return(0,a.jsx)(r.$,{variant:"ghost",type:"button",size:"icon",onClick:o,children:s?(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",className:"h-5 w-5 text-success",viewBox:"0 0 16 16",children:(0,a.jsx)("path",{d:"M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0"})}):(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",className:"h-5 w-5",viewBox:"0 0 16 16",children:(0,a.jsx)("path",{fillRule:"evenodd",d:"M4 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8a2  2 0 0 1-2 2H6a2 2 0 0 1-2-2zm2-1a1 1 0 0 0-1  1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0  0 0-1-1zM2 5a1 1 0 0 0-1 1v8a1 1 0 0  0 1 1h8a1 1 0 0 0 1-1v-1h1v1a2 2 0 0 1-2  2H2a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h1v1z"})})})}},57343:(e,t,s)=>{"use strict";s.d(t,{A:()=>h});var a=s(6029),n=s(82203),r=s.n(n),l=s(81278),i=s(55729),o=s(14187),c=s(2871),d=s(1525),u=s(35270),x=s(45933);function h(e){let{links:t,className:s,toggleSidebar:n,sidebarIsCollapsed:h}=e,{t:m}=(0,o.Bd)(),f=(0,l.useRouter)(),[p,j]=(0,i.useState)("");return(0,i.useEffect)(()=>{j(f.asPath)},[f]),(0,a.jsx)(c.A,{className:s,toggleSidebar:n,sidebarIsCollapsed:h,children:e=>{let{collapsed:s}=e,n=(0,a.jsx)("div",{className:(0,x.cn)("flex flex-col gap-2",s&&"gap-3"),children:t.map(e=>(0,a.jsx)(d.A,{title:e.title,href:e.href,icon:e.icon,active:p===e.href,sidebarIsCollapsed:s},e.href))});return(0,a.jsxs)(a.Fragment,{children:[s?(0,a.jsx)("div",{className:"flex flex-col items-center shrink-0",children:(0,a.jsx)(c.M,{icon:"bi-chevron-left",variant:"ghost",label:m("back_to_dashboard"),tooltipSide:"right",onClick:()=>f.push("/dashboard")})}):(0,a.jsx)("div",{className:"shrink-0 pt-1 px-1",children:(0,a.jsx)(u.$,{asChild:!0,size:"sm",variant:"ghost",className:"justify-start w-full h-8",children:(0,a.jsxs)(r(),{href:"/dashboard",children:[(0,a.jsx)("i",{className:"bi-chevron-left text-md"}),(0,a.jsx)("p",{children:m("back_to_dashboard")})]})})}),s?(0,a.jsx)("div",{className:"flex-1 min-h-0 flex flex-col items-center justify-center",children:n}):(0,a.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto mt-1 p-1",children:n})]})}})}},83248:(e,t,s)=>{"use strict";s.d(t,{A:()=>l});var a=s(6029),n=s(23994);let r=(0,s(55729).forwardRef)((e,t)=>{let{className:s,type:r="text",...l}=e;return(0,a.jsx)("input",{ref:t,type:r,className:(0,n.cn)("w-full rounded-md p-2 border-neutral-content border-solid border outline-none focus:border-primary duration-100",s),...l})});r.displayName="TextInput";let l=r},96539:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/settings/access-tokens",function(){return s(21400)}])},98558:(e,t,s)=>{"use strict";s.d(t,{A:()=>d});var a=s(6029),n=s(14187),r=s(38544),l=s(43003),i=s(57343);function o(e){let{className:t,toggleSidebar:s,sidebarIsCollapsed:o}=e,{t:c}=(0,n.Bd)(),{data:d}=(0,r.Jd)(),{data:u}=(0,l.UK)(),x=[{title:c("account"),href:"/settings/account",icon:"bi-person"},{title:c("preference"),href:"/settings/preference",icon:"bi-sliders"},{title:"RSS Subscriptions",href:"/settings/rss-subscriptions",icon:"bi-rss"},{title:c("access_tokens"),href:"/settings/access-tokens",icon:"bi-key"},{title:c("password"),href:"/settings/password",icon:"bi-lock"}];return(null==u?void 0:u.STRIPE_ENABLED)&&!(null==d?void 0:d.parentSubscriptionId)&&x.push({title:c("billing"),href:"/settings/billing",icon:"bi-credit-card"}),(0,a.jsx)(i.A,{className:t,toggleSidebar:s,sidebarIsCollapsed:o,links:x})}s(55729);var c=s(62127);function d(e){let{children:t}=e,{sidebarIsCollapsed:s,toggleSidebar:n}=(0,c.A)();return(0,a.jsxs)("div",{className:"flex","data-testid":"settings-wrapper",children:[(0,a.jsx)(o,{toggleSidebar:n,sidebarIsCollapsed:s}),(0,a.jsx)("div",{className:"".concat(s?"":"lg:w-[calc(100%-288px)]"," w-[c
1alc(100%-56px)] sm:pb-0 pb-20 flex flex-col h-screen overflow-y-auto"),children:(0,a.jsx)("div",{className:"p-3 mx-auto w-full max-w-3xl min-[2000px]:max-w-6xl",children:t})})]})}}},e=>{e.O(0,[8986,2203,3458,7129,7113,87,5051,636,6593,8792],()=>e(e.s=96539)),_N_E=e.O()}]);

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.