PageSourceSearch

https://cdn.lenouvelliste.com/static/_nuxt/ygZJZOQB.js

js lenouvelliste.com collected 2026-09-24 17:35:26 UTC 3,119 bytes, 1 lines download raw bytes

1import{aD as k,W as b,$ as g,N as w,a as C,U as $}from"./DUI6oj1T.js";import{u as S,m as c}from"./stYBArND.js";import{a as h}from"./CIs0LXPT.js";import{u as R}from"./1kG215BS.js";const _=()=>{const o=$(),r=S(),{user:m}=k(r),l=async()=>{const e=performance.now();try{if(await h(`${o.public.apiUrl}/logout`,{method:"POST",headers:{Authorization:`Bearer ${r.token}`}},"$9ioqdAMJ62"),r.reset(),o.public.enablePerformanceMonitoring){const t=performance.now()-e;c.trackCache("auth/logout","SUCCESS",t)}}catch(t){if(o.public.enablePerformanceMonitoring){const n=performance.now()-e;c.trackCache("auth/logout","ERROR",n)}throw t}},p=async()=>{const e=performance.now();try{const{data:t}=await h(`${o.public.apiUrl}/user`,{pick:["id","first_name","last_name","username","email","photo","country","town"],headers:{Authorization:`Bearer ${r.token}`},server:!1,key:`user-${r.token?.slice(-8)}`},"$CgLXfqWdtm");if(t.value&&r.setUser(t.value),o.public.enablePerformanceMonitoring){const n=performance.now()-e;c.trackCache("auth/user","SUCCESS",n)}}catch(t){if(o.public.enablePerformanceMonitoring){const n=performance.now()-e;c.trackCache("auth/user","ERROR",n)}throw t}},d=async(e,t=null)=>{const n=performance.now();try{const a=await $fetch(`${o.public.apiUrl}/oauth/${e}`,{method:"POST",headers:R(),body:{access_book_token:t}});if(a){if(f(),o.public.enablePerformanceMonitoring){const u=performance.now()-n;c.trackCache(`auth/oauth/${e}`,"SUCCESS",u)}return a}return null}catch(a){if(o.public.enablePerformanceMonitoring){const u=performance.now()-n;c.trackCache(`auth/oauth/${e}`,"ERROR",u)}throw a}},s=b("intended_url",{maxAge:15552e3,domain:".lenouvelliste.com",sameSite:"none",secure:!0,path:"/"}),i=g(),f=(e="")=>{if(e.length>0)s.value=e;else{const t=i.options?.history?.state?.back;t?.toString().includes("/article")?s.value=t.toString():i.currentRoute.value.fullPath.includes("/article")?s.value=i.currentRoute.value.fullPath:s.value=null}};return{logout:l,fetchUser:p,user:m,fetchOauthUrl:d,setIntendedUrl:f,redirect:()=>{s.value?i.push(s.value):i.push("/"),s.value=null},refreshAccessToken:async()=>{if(r.refreshToken)try{const{data:e}=await $fetch(`${o.public.apiUrl}/auth/v1/token/refresh/`,{method:"POST",body:{refresh:r.refreshToken}});r.setToken(e.token.access),r.refreshTokenCookie=e.token.refresh,console.log("Access token refreshed successfully")}catch(e){l(),console.error("Token refresh failed:",e)}},canAccessFullContent:e=>{if(!r.loggedIn)return!1;if(!e?.is_premium)return!0;const t=r.user;return t?.subscription_status==="active"||t?.subscription_status==="trial"},fetchFullArticle:async e=>{if(!r.loggedIn||!r.token)throw w({statusCode:401,statusMessage:"Authentication required"});const t=performance.now();try{const{locale:n}=C(),a=await $fetch(`/api/${n.value}/articles/full/${e}`,{headers:{Authorization:`Bearer ${r.token}`}});if(o.public.enablePerformanceMonitoring){const u=performance.now()-t;c.trackCache(`articles/full/${e}`,"SUCCESS",u)}return a}catch(n){if(o.public.enablePerformanceMonitoring){const a=performance.now()-t;c.trackCache(`articles/full/${e}`,"ERROR",a)}throw n}}}};export{_ as u};

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.