PageSourceSearch

https://www.ottohub.cn/assets/slideshowApi-D_gn_C-h.js

js ottohub.cn collected 2026-10-06 13:14:40 UTC 3,626 bytes, 1 lines download raw bytes

1import{c as e,o as t,r as n,s as r}from"./apiResponse-C8fEm_-L.js";var i={missing_argument:`缺少必要参数`,error_token:`登录失效,请重新登录`,Token_required:`请先登录`,"Token required":`请先登录`,no_permission:`仅管理员可操作`,error_type:`参数类型错误`,error_id:`幻灯片不存在`,system_error:`系统错误,请稍后重试`,"Not found":`接口不存在`,"Method not allowed":`请求方法不允许`};function a(e){let t=(e||``).trim();return t?/^https?:\/\//i.test(t)?t:t.startsWith(`//`)?`https:${t}`:t.startsWith(`/`)?`https://api.ottohub.cn${t}`:`https://${t}`:``}function o(t=``,n){let r=t?t.startsWith(`/`)?t:`/${t}`:``,i=new URL(`${e}/api/slideshow${r}`);if(n)for(let[e,t]of Object.entries(n))t!=null&&t!==``&&i.searchParams.set(e,String(t));return i.toString()}function s(e){if(!e||typeof e!=`object`)return[];let t=e,n=(t.data&&typeof t.data==`object`?t.data:t).slides;return Array.isArray(n)?n.filter(e=>!!e&&typeof e==`object`).map(e=>({id:Number(e.id)||0,img_url:typeof e.img_url==`string`?a(e.img_url):``,title:typeof e.title==`string`?e.title:``,href:typeof e.href==`string`?e.href:``,is_enabled:+(Number(e.is_enabled)===1),sort_order:Number(e.sort_order)||0,created_at:typeof e.created_at==`string`?e.created_at:void 0,updated_at:typeof e.updated_at==`string`?e.updated_at:void 0})).filter(e=>e.id>0):[]}function c(e){if(!e||typeof e!=`object`)return null;let t=e,n=(t.data&&typeof t.data==`object`?t.data:t).slide;return!n||typeof n!=`object`?null:s({data:{slides:[n]}})[0]??null}function l(e){return e===408||e===429||e===502||e===503||e===504||e===524}async function u(e,t,n=2){let r=null;for(let i=0;i<=n;i++){try{let a=await fetch(e,{...t,cache:`no-store`});if(r=a,!l(a.status)||i===n)return a}catch(e){if(i===n)throw e}await new Promise(e=>setTimeout(e,250*(i+1)))}return r}async function d(e,a){let o=await t(e),s=r(e,o,{messages:i,fallback:e.status===503?`服务繁忙,请稍后重试`:a});if(s)throw!o&&l(e.status)?Error(n(e.status,`服务繁忙,请稍后重试`)):Error(s);return o}async function f(){let e=await fetch(o(`/active`),{cache:`no-store`}),n=await t(e);if(!n||typeof n!=`object`||n.status===`error`)return[];let r=(n.data&&typeof n.data==`object`?n.data:n)?.slides;return Array.isArray(r)?r.filter(e=>!!e&&typeof e==`object`).map(e=>({img_url:typeof e.img_url==`string`?a(e.img_url):``,title:typeof e.title==`string`?e.title:``,href:typeof e.href==`string`?e.href:``})).filter(e=>!!e.img_url):[]}async function p(e,t={}){let n=s(await d(await u(o(``,{token:e,sort_by:t.sort_by??`sort_order`,order:t.order??`asc`})),`获取幻灯片列表失败`));return(t.is_enabled===0||t.is_enabled===1)&&(n=n.filter(e=>e.is_enabled===t.is_enabled)),n}async function m(e,t){let n=c(await d(await u(o(),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e,...t})}),`创建幻灯片失败`));if(!n)throw Error(`创建成功但未返回幻灯片数据`);return n}async function h(e,t,n){let r=c(await d(await u(o(`/${t}`),{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e,...n})}),`更新幻灯片失败`));if(!r)throw Error(`更新成功但未返回幻灯片数据`);return r}async function g(e,t){await d(await u(o(`/${t}`,{token:e}),{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e})}),`删除幻灯片失败`)}async function _(e,t){return s(await d(await u(o(`/reorder`),{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e,items:t})}),`调整顺序失败`))}export{a,p as i,g as n,_ as o,f as r,h as s,m as t};

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.