PageSourceSearch

https://www.ottohub.cn/assets/commentApi-CZfXaEOY.js

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

1import{c as e,l as t,o as n,s as r,t as i}from"./apiResponse-C8fEm_-L.js";var a=new Map,o=new Map,s=15e3;function c(e,t){return`${t?.method??`GET`}:${e}`}async function l(e,t,n){let r=c(e,t),i=t?.cache===`no-store`,l=n?.cacheMs??s;if(!i){let e=a.get(r);if(e&&e.expires>Date.now())return e.data}let u=o.get(r);if(u)return u;let d=fetch(e,t).then(async e=>{let t=await e.json();return e.ok&&!i&&a.set(r,{data:t,expires:Date.now()+l}),t}).finally(()=>{o.delete(r)});return o.set(r,d),d}function u(e){if(!e||typeof e!=`object`)return[];let t=e;if(t.status===`error`)return[];let n=t.data;if(n&&typeof n==`object`){let e=n.comment_list;if(Array.isArray(e))return e}return Array.isArray(t.comment_list)?t.comment_list:[]}var d={missing_argument:`缺少必要参数`,error_token:`无效的登录凭证`,content_too_long:`评论内容过长`,content_too_short:`评论内容过短`,error_type:`参数类型错误`,error_vid:`无效的视频ID`,error_bid:`无效的动态ID`,error_vcid:`无效的视频评论ID`,error_bcid:`无效的动态评论ID`,error_parent_vcid:`无效的评论ID`,error_parent_bcid:`无效的评论ID`,error_parent:`不支持多层回复`,warn:`评论包含敏感内容,已送审`,blocked:`已被相关用户拉黑`,no_permission:`无权删除该评论`,too_many_requests:`评论过于频繁,请稍后再试`,already_pinned:`该评论已置顶`,pin_not_found:`该评论未置顶`,pin_limit_reached:`置顶数量已达上限`,not_root_comment:`仅允许置顶根评论`,system_error:`系统错误,请稍后重试`};function f(e){return{isPinned:Number(e.is_pinned)===1||e.is_pinned===!0,pinOrder:Number(e.pin_order)||0}}function p(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.status===`error`)return{ok:!1,message:h(t.message,`操作失败`)};let n=t.data;if(!n||typeof n!=`object`)return{ok:!0,isPinned:1,pinOrder:0};let r=n;return{ok:!0,isPinned:Number(r.is_pinned)||1,pinOrder:Number(r.pin_order)||0}}async function m(e,t,r,i,a=`操作失败`){try{let o=await fetch(e,{method:t,headers:{"Content-Type":`application/json`},body:JSON.stringify(i??{token:r}),cache:`no-store`}),s=await n(o);if(s&&typeof s==`object`&&s.status===`error`)return{ok:!1,message:String(s.message??``)||g(o,s,a)||a};let c=g(o,s,a);return c?{ok:!1,message:c}:p(s)??{ok:!0,isPinned:1,pinOrder:0}}catch{return{ok:!1,message:a}}}function h(e,t=`操作失败`){return i(e,d,t)}function g(e,t,n=`操作失败`){return r(e,t,{messages:d,fallback:n})}var _=3;function v(e){return new Promise(t=>{window.setTimeout(t,e)})}function y(e){return e.includes(`请稍后`)?e:`${e},请稍后重试`}function b(e,t){if(e&&(e.status===408||e.status===429||e.status>=500))return!0;let n=t.toLowerCase();return n.includes(`failed to fetch`)||n.includes(`networkerror`)||n.includes(`network`)||n.includes(`too_many_requests`)||n.includes(`请求过于频繁`)||n.includes(`暂时不可用`)||n.includes(`网关`)||n.includes(`gateway`)||n.includes(`unavailable`)||n.includes(`稍后重试`)}function x(e,t){return(t&&t.status===503?700:400)*(e+1)}async function S(e,t=`获取评论失败`){let r=y(t);for(let i=0;i<=_;i++)try{let a=await fetch(e,{cache:`no-store`}),o=await n(a),s=g(a,o,t);if(!s&&o!=null)return{ok:!0,data:o};if(r=s??y(t),i<_&&b(a,r)){await v(x(i,a));continue}return{ok:!1,message:r}}catch{if(r=y(t),i<_){await v(x(i,null));continue}return{ok:!1,message:r}}return{ok:!1,message:r}}function C(e,n){return t(`/api/comment/blogs/${encodeURIComponent(e)}`,{parent_bcid:n.parentBcid,offset:n.offset,num:n.num,cid_asc:n.cidAsc===void 0?void 0:+!!n.cidAsc,include_pinned:n.includePinned===!1?0:n.includePinned===!0?1:void 0,token:n.token})}async function w(t){try{let r=await fetch(`${e}/api/comment/blogs/${encodeURIComponent(t.bid)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:t.token,parent_bcid:t.parentBcid,content:t.content}),cache:`no-store`}),i=g(r,await n(r),`发送评论失败,请稍后重试`);return i?{ok:!1,message:i}:{ok:!0}}catch{return{ok:!1,message:`发送评论失败,请稍后重试`}}}async function T(t,n){return m(`${e}/api/comment/blog-comments/${encodeURIComponent(t)}/pin`,`POST`,n,{token:n},`置顶评论失败`)}async function E(t,n){return m(`${e}/api/comment/blog-comments/${encodeURIComponent(t)}/pin`,`DELETE`,n,{token:n},`取消置顶失败`)}async function D(t,n,r){return m(`${e}/api/comment/blog-comments/${encodeURIComponent(t)}/pin/sort`,`PUT`,n,{token:n,pin_order:r},`调整置顶排序失败`)}async function O(t,r){try{let i=await fetch(`${e}/api/comment/blog-comments/${encodeURIComponent(t)}`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:r}),cache:`no-store`}),a=g(i,await n(i),`删除评论失败`);return a?{ok:!1,message:a}:{ok:!0}}catch{return{ok:!1,message:`删除评论失败`}}}function k(e,n){return t(`/api/comment/videos/${encodeURIComponent(e)}`,{parent_vcid:n.parentVcid,offset:n.offset,num:n.num,cid_asc:n.cidAsc===void 0?void 0:+!!n.cidAsc,include_pinned:n.includePinned===!1?0:n.includePinned===!0?1:void 0,token:n.token})}async function A(t){try{let r=await fetch(`${e}/api/comment/videos/${encodeURIComponent(t.vid)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:t.token,parent_vcid:t.parentVcid,content:t.content}),cache:`no-store`}),i=g(r,await n(r),`发送评论失败,请稍后重试`);return i?{ok:!1,message:i}:{ok:!0}}catch{return{ok:!1,message:`发送评论失败,请稍后重试`}}}async function j(t,n){return m(`${e}/api/comment/video-comments/${encodeURIComponent(t)}/pin`,`POST`,n,{token:n},`置顶评论失败`)}async function M(t,n){return m(`${e}/api/comment/video-comments/${encodeURIComponent(t)}/pin`,`DELETE`,n,{token:n},`取消置顶失败`)}async function N(t,n,r){return m(`${e}/api/comment/video-comments/${encodeURIComponent(t)}/pin/sort`,`PUT`,n,{token:n,pin_order:r},`调整置顶排序失败`)}async function P(t,r){try{let i=await fetch(`${e}/api/comment/video-comments/${encodeURIComponent(t)}`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:r}),cache:`no-store`}),a=g(i,await n(i),`删除评论失败`);return a?{ok:!1,message:a}:{ok:!0}}catch{return{ok:!1,message:`删除评论失败`}}}function F(e,t,n=500){/!\[[^\]]*]\(/.test(t)?window.setTimeout(e,n):e()}export{l as _,S as a,T as c,A as d,F as f,M as g,E as h,P as i,j as l,N as m,k as n,f as o,D as p,O as r,u as s,C as t,w 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.