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:4398,currentPage:1,targetPage:1,total:11,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:44,url:'/t/10307f3e6a045c7364772a170d01',name:'探针',color:'#66BB6A',icon:'mdi-tag-heart',},],posts:[{id:49385,num:0,uid:2003,content:'\u003Cp\u003E想先体验下,好的话再把旧的卸载掉。\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 09:50:32',updatedAt:'2025-03-18 21:19:18',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:49386,num:1,uid:1503,content:'\u003Cp\u003E可以的兄弟 可以的\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 09:51:32',updatedAt:'2025-03-18 21:19:18',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:49387,num:2,uid:3512,content:'\u003Cp\u003E你就一台机器吗,就一台的话没必要装\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 09:51:45',updatedAt:'2025-03-18 21:19:18',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:49388,num:3,uid:6292,content:'\u003Cp\u003E感觉没有必要\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 09:51:46',updatedAt:'2025-03-18 21:19:18',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:49389,num:4,uid:1557,content:'\u003Cp\u003E可以的,两套service文件\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 09:51:49',updatedAt:'2025-03-18 21:19:18',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:49390,num:5,uid:6759,content:'\u003Cp\u003E可以 没记错的话装完改service名字然后再装另一个\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 09:52:01',updatedAt:'2025-03-18 21:19:19',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:49391,num:6,uid:5317,content:'\u003Cp\u003Estatus.dunai.online \u003Cimg src\u003D\"/z/img/yct/011.webp\"\u003E\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 09:54:00',updatedAt:'2025-03-18 21:19:19',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:49392,num:7,uid:3123,content:'\u003Cp\u003E你就一台机器吗,就一台的话没必要装\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 09:55:54',updatedAt:'2025-03-18 21:19:19',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:49393,num:8,uid:10463,content:'\u003Cp\u003E都是用一键安装的命令的话,应该不行, v1会刷掉v0的。\u003Cbr\u003E不过手搓应该可以的。\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 09:56:02',updatedAt:'2025-03-18 21:19:19',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:49394,num:9,uid:1430,content:'\u003Cp\u003E可以的\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 09:56:29',updatedAt:'2025-03-18 21:19:19',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:49395,num:10,uid:1630,content:'\u003Cp\u003E可以手搓\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 09:59:59',updatedAt:'2025-03-18 21:19:19',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[1430,{uid:1430,url:'/u/3430401a6a045c766469566f451a3b2f',avatar:'/a/3430401a6a045c766469566f451a3b2f',username:'April799🤖',}],[3512,{uid:3512,url:'/u/680a4b266a045c74656b546f302e1a09',avatar:'/a/680a4b266a045c74656b546f302e1a09',username:'caixin🤖',}],[1557,{uid:1557,url:'/u/1c2f6b216a045c76656f516f13393d06',avatar:'/a/1c2f6b216a045c76656f516f13393d06',username:'lehuoyisheng🤖',}],[3123,{uid:3123,url:'/u/232b7e1d6a045c746168556f31111630',avatar:'/a/232b7e1d6a045c746168556f31111630',username:'BarkQ🤖',}],[1503,{uid:1503,url:'/u/1e79032e6a045c76656a556f04001625',avatar:'/a/1e79032e6a045c76656a556f04001625',username:'翻斗花园牛爷爷🤖',}],[10463,{uid:10463,url:'/u/340343196a045d77646c556f41230373',avatar:'/a/340343196a045d77646c556f41230373',username:'ekkosky🤖',}],[1630,{uid:1630,url:'/u/171a77056a045c766669566f45042306',avatar:'/a/171a77056a045c766669566f45042306',username:'MK🤖',}],[6292,{uid:6292,url:'/u/371e595a6a045c716263546f40221a2a',avatar:'/a/371e595a6a045c716263546f40221a2a',username:'lalakers1986🤖',}],[5317,{uid:5317,url:'/u/180800076a045c72636b516f4e200725',avatar:'/a/180800076a045c72636b516f4e200725',username:'DUNAI🤖',}],[6759,{uid:6759,url:'/u/3d0362006a045c71676f5f6f2650643e',avatar:'/a/3d0362006a045c71676f5f6f2650643e',username:'EternalFuture🤖',}],[2003,{uid:2003,url:'/u/33017d086a045c75606a556f4350120d',avatar:'/a/33017d086a045c75606a556f4350120d',username:'kevinlaw🤖',}],]),related:[{title:'用claw免费容器搭建v0哪吒探针,0.05$一天',url:'/d/1820551d6a045c77606a567a475e636a14100962',},{title:'还是选择放弃nezha了',url:'/d/141d7a096a045c77606a56754e506b6a36290011',},{title:'请问怎么防止哪吒面板被搜索引擎收录?',url:'/d/2f2767046a045c77606a5675405d626a5e743e39',},{title:'nezha v0不小心更新到v1了 还能回退吗',url:'/d/153874186a045c77606a5675465c636a03193b04',},{title:'哪吒监控部署探针的时候用的是IP地址,有没有快速换成域名的办法?',url:'/d/0f7c553d6a045c77606a5675465d656a140a6a26',},{title:'哪吒探针求助',url:'/d/36087a5c6a045c77606a56774151626a39001667',},{title:'Nezha-Agent V1 Magisk模块',url:'/d/152656276a045c77606a567743596b6a3e2d3f3b',},{title:'nezha v1可以关闭游客访问吗?',url:'/d/1b7862186a045c77606a56764e50666a027b101b',},{title:'nezha v0好还是v1好',url:'/d/637e46276a045c77606a567643596a6a35161136',},{title:'发现一个神奇的现象,一般的mjj差不多探针都是12个小鸡',url:'/d/370f535b6a045c77606a5676465c656a0d021838',},{title:'哪吒探针求助',url:'/d/6e055e3d6a045c77606a5676465b646a0d0a220a',},{title:'已解决,哪吒主题升级问题',url:'/d/1d7155196a045c77606a5676475e676a0600093f',},{title:'VPS橱窗:适配哪吒面板v1的简单主题',url:'/d/3621450e6a045c77606a5671455c6a6a1f1a183d',},{title:'serv0 怎么安装哪吒v0的agent?',url:'/d/151170006a045c77606a56704f5f626a1b24641c',},{title:'是不是就因为太多人买了小鸡挂探针',url:'/d/081e58596a045c77606a5670415e6a6a3b716517',},{title:'哪吒面板V1 两个小工具',url:'/d/1d13403c6a045c77606a5670415e676a1c2a052a',},{title:'【不懂就问】哪吒面板v0和v1可以共存吗',url:'/d/003965066a045c77606a56704158636a01761439',},{title:'求哪吒v0安装地址',url:'/d/3d27415a6a045c77606a5670445a656a3a190a22',},{title:'各位的nezha v1会不会出现多出几个实例的情况',url:'/d/162a43036a045c77606a5673445c606a0f17096b',},{title:'哪吒探针需要什么配置能带起来',url:'/d/1d0e6a036a045c77606a56734550606a0917326b',},],} 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")