PageSourceSearch

https://www.ottohub.cn/assets/danmakuApi-I3LatYNp.js

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

1import{c as e,l as t,o as n}from"./apiResponse-C8fEm_-L.js";var r=new Map,i=new Map;function a(e){if(!e||typeof e!=`object`)return[];let t=e;if(Array.isArray(t.data))return t.data;if(t.data&&typeof t.data==`object`){let e=t.data;if(Array.isArray(e.danmaku_list))return e.danmaku_list;if(Array.isArray(e.list))return e.list}return Array.isArray(t.danmaku_list)?t.danmaku_list:Array.isArray(e)?e:[]}function o(e){if(e===`top`||e===5||e===`5`)return 5;if(e===`bottom`||e===4||e===`4`)return 4;if(e===`scroll`||e===1||e===`1`)return 1;let t=Number(e);return t===5||t===4||t===1?t:1}function s(e){return{text:String(e.text??``),time:Number(e.time)||0,mode:o(e.mode),color:e.color?.startsWith(`#`)||String(e.color??``).startsWith(`rgb`)?String(e.color):`#${e.color||`FFFFFF`}`,fontSize:Number(String(e.font_size??``).replace(`px`,``))||25,danmakuId:e.danmaku_id==null?void 0:String(e.danmaku_id),uid:e.uid==null?void 0:String(e.uid)}}function c(e){if(e){r.delete(e),i.delete(e);return}r.clear(),i.clear()}async function l(e,o=!1){let c=String(e);if(!o&&r.has(c))return r.get(c);let l=i.get(c);if(l&&!o)return l;let u=(async()=>{let e=await fetch(t(`/api/danmaku/${encodeURIComponent(c)}`),{cache:`default`}),i=await n(e);if(i&&typeof i==`object`&&i.status===`error`)throw Error(String(i.message||`获取滚幕失败`));let o=a(i).filter(e=>!!e&&typeof e==`object`).map(s);return r.set(c,o),o})();i.set(c,u);try{return await u}finally{i.get(c)===u&&i.delete(c)}}async function u(t){let n=t.color.startsWith(`#`)?t.color.slice(1):t.color,r=await(await fetch(`${e}/api/danmaku`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:t.token,vid:t.vid,text:t.text,time:t.time,mode:t.mode,color:n,font_size:t.fontSize,render:``}),cache:`no-store`})).json();if(r&&r.status===`error`)throw Error(String(r.message||`发送滚幕失败`));c(t.vid);let i=o(t.mode);return{text:t.text,time:t.time,mode:i,color:t.color.startsWith(`#`)?t.color:`#${t.color}`,fontSize:parseInt(t.fontSize.replace(`px`,``),10)||25,uid:void 0}}function d(e){return e.replace(/!\[[^\]]*]\([^)]*\)/g,``).replace(/\s+/g,` `).trim()}async function f(t,n){let r=await(await fetch(`${e}/api/danmaku/${encodeURIComponent(t)}`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:n}),cache:`no-store`})).json();return r&&r.status===`error`?{ok:!1,message:String(r.message||`system_error`)}:{ok:!0}}async function p(t,n,r){let i=await(await fetch(`${e}/api/moderation/danmakus/${encodeURIComponent(t)}/report`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:n,reason:r}),cache:`no-store`})).json();return i&&i.status===`error`?{ok:!1,message:String(i.message||`system_error`)}:{ok:!0}}export{o as a,c as i,f as n,p as o,l as r,u as s,d 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.