const{createApp}=Vue const{createVuetify,useGoTo,useDisplay}=Vuetify var data={alert:{show:false,color:'success',text:'',timeout:0,},theme:{dark:false,},nav:{showDrawer:false,showTOC:true,tocPanel:0,tab:'account',post:{discussionId:2324,currentPage:1,targetPage:1,total:12,anchor:0,goToOptions:{container:null,duration:0,easing:'easeInOutCubic',offset:-100,},worker:null,task:[],active:[],apiLock:[],originLike:new Map([]),},related:{block:1,}},search:{width:80,text:null,loading:false,},tags:[{id:3,url:'/t/2b05770f6a045c7763772a264105',name:'Bandwagon',color:'#FF8F00',icon:'mdi-server-plus',},{id:68,url:'/t/370f51226a045c71687715031322',name:'CloudFlare',color:'#66BB6A',icon:'mdi-tag-heart',},],posts:[{id:27863,num:0,uid:2005,content:'\u003Cp\u003E瞬间绿了,比dns解锁强\u003Cbr\u003E\u003Cimg src\u003D\"https://i.111666.best/image/eo3VR7616Uyih1AfUXAqhq.jpg\" alt\u003D\"image\"\u003E\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-12 17:20:02',updatedAt:'2025-03-15 13:48:27',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:27864,num:1,uid:1738,content:'\u003Cp\u003E然后速度慢了...\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-12 17:20:25',updatedAt:'2025-03-15 13:48:27',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:27865,num:2,uid:1703,content:'\u003Cp\u003E要那么绿干嘛 看片不需要 \u003Cimg src\u003D\"/z/img/ac/13.webp\"\u003E\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-12 17:20:58',updatedAt:'2025-03-15 13:48:27',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:27866,num:3,uid:1934,content:'\u003Cp\u003E美西再套warp,那太慢了\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-12 17:21:51',updatedAt:'2025-03-15 13:48:27',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:27867,num:4,uid:2005,content:'\u003Cp\u003E落地用来解锁奈飞影响速度吗?\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-12 17:22:35',updatedAt:'2025-03-15 13:48:27',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:27868,num:5,uid:1605,content:'\u003Cp\u003E自己有dns解锁\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-12 17:22:56',updatedAt:'2025-03-15 13:48:27',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:27869,num:6,uid:2005,content:'\u003Cp\u003E此套非彼套\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-12 17:23:08',updatedAt:'2025-03-15 13:48:27',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:27870,num:7,uid:5255,content:'\u003Cp\u003E 难道不影响?落地访问奈飞慢,这边就慢\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-12 17:34:05',updatedAt:'2025-03-15 13:48:27',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:27871,num:8,uid:2093,content:'\u003Cp\u003E 是把cf套在了瓦工后面作为落地使用了?\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-12 17:39:58',updatedAt:'2025-03-15 13:48:27',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:27872,num:9,uid:1402,content:'\u003Cp\u003E是把cf套在了瓦工后面作为落地使用了?\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-12 18:40:44',updatedAt:'2025-03-15 13:48:27',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:27873,num:10,uid:1651,content:'\u003Cp\u003E代价就是不极致了\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-12 18:57:15',updatedAt:'2025-03-15 13:48:27',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:27874,num:11,uid:4392,content:'\u003Cp\u003E还是分流比较好,cf warp的ip大部分都是高风险的,风险高起来连它自家的5s盾都要频繁弹\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-12 19:52:14',updatedAt:'2025-03-15 13:48:27',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[2005,{uid:2005,url:'/u/1e244a2c6a045c75606a536f461f633f',avatar:'/a/1e244a2c6a045c75606a536f461f633f',username:'languang666🤖',}],[1605,{uid:1605,url:'/u/35257e256a045c76666a536f1f583c17',avatar:'/a/35257e256a045c76666a536f1f583c17',username:'wo280943888🤖',}],[4392,{uid:4392,url:'/u/2c20460e6a045c736363546f070a0436',avatar:'/a/2c20460e6a045c736363546f070a0436',username:'coolnom🤖',}],[2093,{uid:2093,url:'/u/110b625a6a045c756063556f4f33350b',avatar:'/a/110b625a6a045c756063556f4f33350b',username:'hongyanfoxin🤖',}],[1703,{uid:1703,url:'/u/167c655a6a045c76676a556f13070021',avatar:'/a/167c655a6a045c76676a556f13070021',username:'minikoro🤖',}],[1651,{uid:1651,url:'/u/2e79631b6a045c76666f576f060d1b08',avatar:'/a/2e79631b6a045c76666f576f060d1b08',username:'JaneSmith🤖',}],[1402,{uid:1402,url:'/u/692a5d3b6a045c76646a546f2721113e',avatar:'/a/692a5d3b6a045c76646a546f2721113e',username:'JustDooo🤖',}],[1934,{uid:1934,url:'/u/133376216a045c766969526f383a0a13',avatar:'/a/133376216a045c766969526f383a0a13',username:'RerrentLinden🤖',}],[5255,{uid:5255,url:'/u/330265236a045c72626f536f0f100237',avatar:'/a/330265236a045c72626f536f0f100237',username:'向前一镖🤖',}],[1738,{uid:1738,url:'/u/3026780b6a045c7667695e6f442c0913',avatar:'/a/3026780b6a045c7667695e6f442c0913',username:'hkfires🤖',}],]),related:[{title:'瓦工 SG CN2 46刀,市场价去到多少?听说线路很好。',url:'/d/2f01760c6a045c77606a567a475f656a06241e24',},{title:'赛博大善人cloudflare首席技术官的快乐妙妙屋',url:'/d/6d10050b6a045c77606a56754e5c656a1f2b291d',},{title:'求推荐个三网优化的鸡 要买',url:'/d/3d275f096a045c77606a567540516b6a227b1130',},{title:'请教各位,Bwg 跟Dmit 哪个能打一点?',url:'/d/1c1a06596a045c77606a5675405e656a002b6330',},{title:'XUGOU - 轻量级系统监控平台,基于 CloudFlare 零成本部署!',url:'/d/0a21430f6a045c77606a56744f58656a0f741e25',},{title:'请问付了一年前斯巴达的服务工单还能正常用吗,和搬瓦工 Plan 比该留哪一个',url:'/d/372a0a356a045c77606a56744551666a28162401',},{title:'瓦工的v6将来会做优化吗?',url:'/d/3f2c581f6a045c77606a5674465a656a3d253964',},{title:'测试一下刚刚收到的临期瓦工The DC9 Plan VPS 曾经的梦中情机',url:'/d/6d3f7f256a045c77606a56774f51636a1d772516',},{title:'你们对瓦工的megabox满意吗',url:'/d/6f207b016a045c77606a56774f5f646a240c2234',},{title:'cloudflare新工具,文件转markdown',url:'/d/0c7c573f6a045c77606a56774f5c676a182e2227',},{title:'去年的瓦工DC9 ,有人要么?$35.42 USD( 已出)',url:'/d/0e0f68246a045c77606a56774f5c616a262f0662',},{title:'搬瓦工 dc9 不到一个月,2025-04-15到期,放生了,改过邮 20出',url:'/d/382f74076a045c77606a56774f5a616a1b70061d',},{title:'我这个bwg的powerbox还能卖多少?',url:'/d/030660086a045c77606a5677405d616a5f700125',},{title:'biggerbox升级megabox pro记录贴',url:'/d/1e1874086a045c77606a5677405b646a3d373725',},{title:'瓦工日本还会重新推出吗',url:'/d/0d11035d6a045c77606a567742506b6a3f223d6b',},{title:'搬瓦工逆天 Bug',url:'/d/2e195c1c6a045c77606a567742516a6a357b360a',},{title:'支持白名单的 Cloudflare 代理 Docker 镜像',url:'/d/37307a356a045c77606a5677425a6b6a21013c15',},{title:'150折价出瓦工BIGGERBOX',url:'/d/2c0660276a045c77606a5677435f666a152f0210',},{title:'MINIBOX也是CN2GIA了吗?',url:'/d/193068356a045c77606a5677435c656a29101015',},{title:'[出] 搬瓦工DC99机房POWERBOX-30-1536',url:'/d/020f7c2e6a045c77606a5677435c666a08053a22',},],} const App={setup(){const goTo=useGoTo() const{mdAndUp}=useDisplay() return{goTo,mdAndUp}},data(){return data;},mounted(){const themeDark=localStorage.getItem("themeDark") if(themeDark!==null){this.theme.dark=JSON.parse(themeDark)} if(this.nav.post.total>(this.nav.post.currentPage-1)*100+20){let moreLen=100 if(this.nav.post.total({id:null,num:(this.nav.post.currentPage-1)*100+v,uid:null,content:null,ipRegion:null,updatedByUid:null,createdAt:null,updatedAt:null,mentionNum:null,mentionedBy:null,mentionUsers:null,likeUsers:null,})) this.posts.push(...morePosts.slice(20))} this.workerStart() const hash=window.location.hash const match=hash.match(/#(\d+)/) if(match){const n=parseInt(match[1],10) if(n>=(this.nav.post.currentPage-1)*100&&n{this.jumpTo(n)})}} this.$nextTick(()=>{this.addHeadingIds() tocbot.init({tocSelector:'.toc',contentSelector:'#post-content-0',headingSelector:'h2, h3, h4',headingsOffset:100,scrollSmoothOffset:-100,scrollSmooth:true,collapseDepth:6,onClick:function(e){setTimeout(()=>{history.replaceState(null,'',window.location.pathname+window.location.search)},0)},}) tocbot.refresh()});},beforeUnmount(){this.workerStop() if(this.quill){this.quill.destroy() this.quill=null}},computed:{dposts(){return this.posts.slice(20);},},created(){},methods:{successAlert(msg){this.alert={show:true,color:'success',text:msg,timeout:1500,}},failureAlert(msg){this.alert={show:true,color:'error',text:msg,timeout:5000,}},flipThemeDark(){this.theme.dark=!this.theme.dark localStorage.setItem("themeDark",JSON.stringify(this.theme.dark))},toSearch(){if(!this.search.text){this.failureAlert('搜索词不能为空') return} let keywords=this.search.text.trim() if(keywords.length<1){this.failureAlert('搜索词不能为空') return} if(keywords.length>100){this.failureAlert('搜索词过长') return} this.doSearch(keywords)},toReg(){window.location.href="/reg"},toLogin(){window.location.href="/login"},toPage(){let url=window.location.href url=url.replace(/(\/\d+)?(#[0-9]+)?$/,this.nav.post.targetPage>1?`/${this.nav.post.targetPage}`:'') window.location.href=url},toLoadRelated({done}){if(this.my&&this.my.uid){this.apiLoadRelated({done})}else{done('ok')}},workerStart(){this.nav.post.worker=setInterval(()=>{this.workerLoad()},500);},workerStop(){if(this.nav.post.worker){clearInterval(this.nav.post.worker);this.nav.post.worker=null;}},async jumpTo(num){const page=Math.floor(num/100)+1 const i=num-(page-1)*100 if(page===this.nav.post.currentPage){this.goTo("#post-"+num,this.nav.post.goToOptions) if(!this.posts[i].id){const block=Math.floor(num/20)+1 this.nav.post.apiLock[block]=true await this.apiLoadPosts(block) this.$nextTick(()=>{this.goTo("#post-"+num,this.nav.post.goToOptions)})}}else{let url=window.location.href url=url.replace(/(\/\d+)?(#[0-9]+)?$/,page>1?`/${page}`:'') url=url+"#"+num window.location.href=url}},postIntersect(num){return(isIntersecting,entries,observer)=>{if(isIntersecting){this.nav.post.task.push(num) this.nav.post.active.push(num) this.nav.post.active=this.nav.post.active.filter(item=>Math.abs(item-num)<=5) this.nav.post.active.sort((a,b)=>a-b)}else{this.nav.post.active=this.nav.post.active.filter(item=>item!==num)} if(this.nav.post.active[0]){this.nav.post.anchor=this.nav.post.active[0]}else{this.nav.post.anchor=0}}},async apiLoadPosts(block){try{const response=await axios.post('/fapi/v1/post/block/'+block,{discussionId:this.nav.post.discussionId,}) if(response.data.code===0){response.data.data.posts.forEach(post=>{const i=post.num%100 Object.assign(this.posts[i],post)}) response.data.data.users.forEach(user=>{this.usersMap.set(user.uid,user)})}else{this.failureAlert('回帖数据加载失败: '+response.data.msg)}}catch(error){this.failureAlert('回帖数据加载失败: '+error)} this.nav.post.apiLock[block]=false},workerLoad(){while(this.nav.post.task.length){const num=this.nav.post.task.pop() const i=num-(this.nav.post.currentPage-1)*100 if(!this.posts[i].id){const block=Math.floor(num/20)+1 if(!this.nav.post.apiLock[block]){this.nav.post.apiLock[block]=true this.apiLoadPosts(block)}}}},getTimeInfo(t){if(!t){return ""} const now=new Date();const then=new Date(t);const diff=now-then;const minute=60*1000;const hour=minute*60;const day=hour*24;const month=day*30;const year=month*12;if(diffpost.num===num) if(!post){return "#"+num} const uid=post.uid const username=this.usersMap.get(uid)?.username if(!username){return "#"+num} return username},getUsernameByPostId(id){const post=this.posts.find(post=>post.id===id) if(!post){return "#"+this.getPostNumByPostId(id)} const uid=post.uid const username=this.usersMap.get(uid).username if(!username){return "#"+this.getPostNumByPostId(id)} return username},getPostNumByPostId(id){const post=this.posts.find(post=>post.id===id) return post.num},getPostById(id){const post=this.posts.find(post=>post.id===id) return post},getPostByNum(num){const post=this.posts.find(post=>post.num===num) return post},getAvatarByUid(uid){const avatar=this.usersMap.get(uid)?.avatar if(!avatar){return this.getRandomAvatar()} return avatar},getAvatarByPostNum(num){const post=this.posts.find(post=>post.num===num) if(!post){return this.getRandomAvatar()} const uid=post.uid return this.getAvatarByUid(uid)},getRandomAvatar(){const num=Math.floor(Math.random()*100) return "https://randomuser.me/api/portraits/men/"+num+".jpg"},getUrlByUid(uid){const url=this.usersMap.get(uid)?.url if(!url){return ""} return url},getTextByPostNum(num){const post=this.posts.find(post=>post.num===num) if(!post||!post.content){return '点击跳转到#'+num+'查看'} const parser=new DOMParser() const doc=parser.parseFromString(post.content,'text/html') const text=doc.body.textContent||'' return text.slice(0,100)},addHeadingIds(){const content=document.getElementById('post-content-0') if(!content){this.nav.showTOC=false return} const headings=content.querySelectorAll('h2, h3, h4') headings.forEach((heading,index)=>{if(!heading.id){heading.id=`toc-nav-${index}`}}) if(headings.length==0){this.nav.showTOC=false}},async doSearch(keywords){this.search.loading=true try{const response=await axios.post('/fapi/v1/search',{keywords:keywords,}) if(response.data.code===0){if(response.data.data.hash&&response.data.data.hash.length===32){window.location.href="/s/"+response.data.data.hash}else{this.failureAlert('搜索失败: 搜索服务异常')}}else{this.failureAlert('搜索失败: '+response.data.msg)}}catch(error){this.failureAlert('搜索失败: '+error)} this.search.loading=false},debounce(fn,delay){let timer=null return function(...args){if(timer)clearTimeout(timer) timer=setTimeout(()=>{fn.apply(this,args)},delay);};},},watch:{'nav.post.targetPage':{handler:async function(newV,oldV){this.toPage()},immediate:false},},} const vuetify=createVuetify({defaults:{global:{ripple:true,},},}) const app=createApp(App) app.use(vuetify).mount("#app")