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:8325,currentPage:1,targetPage:1,total:101,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:[],posts:[{id:108790,num:0,uid:16436,content:'\u003Cp\u003E真离谱,莫名其妙就来威胁我…\u003C/p\u003E\u003Cp\u003E还人肉到我的手机号了,发了一个我没见过的管理后台。\u003C/p\u003E\u003Cp\u003E他发的那个管理后台 ip: 129.204.144.252他的微信号:luckily891\u003C/p\u003E\u003Cp\u003E\u003Cimg alt\u003D\"1\" src\u003D\"https://resource.kaisir.cn/uploads/MarkDownImg/20250413/lOXOtY.png\"\u003E\u003C/p\u003E\u003Cp\u003E\u003Cimg alt\u003D\"2\" src\u003D\"https://resource.kaisir.cn/uploads/MarkDownImg/20250413/CtpsPW.png\"\u003E\u003C/p\u003E\u003Cp\u003E\u003Cimg alt\u003D\"3\" src\u003D\"https://resource.kaisir.cn/uploads/MarkDownImg/20250413/swOc2M.png\"\u003E\u003C/p\u003E\u003Cp\u003E\u003Cimg alt\u003D\"4\" src\u003D\"https://resource.kaisir.cn/uploads/MarkDownImg/20250413/afTScB.png\"\u003E\u003C/p\u003E\u003Cp\u003E\u003Cimg alt\u003D\"5\" src\u003D\"https://resource.kaisir.cn/uploads/MarkDownImg/20250413/ayfCln.jpg\"\u003E\u003C/p\u003E备用图\u003Cp\u003E\u003Cimg alt\u003D\"1\" src\u003D\"https://i.imgur.com/D97Iqp6.png\"\u003E\u003C/p\u003E\u003Cp\u003E\u003Cimg alt\u003D\"2\" src\u003D\"https://i.imgur.com/nEBrtAL.png\"\u003E\u003C/p\u003E\u003Cp\u003E\u003Cimg alt\u003D\"3\" src\u003D\"https://i.imgur.com/pnStbLE.png\"\u003E\u003C/p\u003E\u003Cp\u003E\u003Cimg alt\u003D\"4\" src\u003D\"https://i.imgur.com/yP355KP.png\"\u003E\u003C/p\u003E\u003Cp\u003E\u003Cimg alt\u003D\"5\" src\u003D\"https://i.imgur.com/Cat2iBB.png\"\u003E\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-04-13 13:39:46',updatedAt:'2025-04-16 23:09:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108791,num:1,uid:17932,content:'别搭理',ipRegion:'',updatedByUid:0,createdAt:'2025-04-13 13:42:08',updatedAt:'2025-04-16 23:09:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108792,num:2,uid:9553,content:'蹲个后续,有点意思。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-13 13:48:21',updatedAt:'2025-04-16 23:09:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108793,num:3,uid:18301,content:'如果是我,我会回一句草 nm',ipRegion:'',updatedByUid:0,createdAt:'2025-04-13 13:52:44',updatedAt:'2025-04-16 23:09:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108794,num:4,uid:2327,content:'另类诈骗?',ipRegion:'',updatedByUid:0,createdAt:'2025-04-13 13:56:23',updatedAt:'2025-04-16 23:09:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108795,num:5,uid:23,content:'我也想和他交朋友🥵',ipRegion:'',updatedByUid:0,createdAt:'2025-04-13 13:56:51',updatedAt:'2025-04-16 23:09:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108796,num:6,uid:3617,content:'666',ipRegion:'',updatedByUid:0,createdAt:'2025-04-13 13:56:54',updatedAt:'2025-04-16 23:09:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108797,num:7,uid:18302,content:'一个想当然的人而已,搭理他你就输了',ipRegion:'',updatedByUid:0,createdAt:'2025-04-13 13:58:35',updatedAt:'2025-04-16 23:09:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108798,num:8,uid:2556,content:'有后续了踢一下',ipRegion:'',updatedByUid:0,createdAt:'2025-04-13 14:00:21',updatedAt:'2025-04-16 23:09:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108799,num:9,uid:15859,content:'你回的就很虚吖……如果是我。直接问候他全家。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-13 14:01:29',updatedAt:'2025-04-16 23:09:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108800,num:10,uid:830,content:'可能是黑进去了,来要钱的',ipRegion:'',updatedByUid:0,createdAt:'2025-04-13 14:05:12',updatedAt:'2025-04-16 23:09:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108801,num:11,uid:2327,content:'直接把国安的地址给他',ipRegion:'',updatedByUid:0,createdAt:'2025-04-13 14:08:22',updatedAt:'2025-04-16 23:09:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108802,num:12,uid:433,content:'猜猜我是谁?\u003Cbr\u003E猜不出来。\u003Cbr\u003E你再猜。\u003Cbr\u003E老王?\u003Cbr\u003E对了。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-13 14:09:03',updatedAt:'2025-04-16 23:09:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108803,num:13,uid:18125,content:'那个 ip 访问不了啊',ipRegion:'',updatedByUid:0,createdAt:'2025-04-13 14:09:35',updatedAt:'2025-04-16 23:09:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108804,num:14,uid:616,content:'蹲后续',ipRegion:'',updatedByUid:0,createdAt:'2025-04-13 14:10:47',updatedAt:'2025-04-16 23:09:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108805,num:15,uid:16436,content:'我试了下,还能 ping 通。![image-20250413141259906]( https://resource.kaisir.cn/uploads/MarkDownImg/20250413/Gcvq19.png)',ipRegion:'',updatedByUid:0,createdAt:'2025-04-13 14:13:32',updatedAt:'2025-04-16 23:09:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108806,num:16,uid:16436,content:'哈哈哈 对味儿了',ipRegion:'',updatedByUid:0,createdAt:'2025-04-13 14:13:49',updatedAt:'2025-04-16 23:09:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108807,num:17,uid:5081,content:'以前我会骂他再拉黑,现在我直接拉黑',ipRegion:'',updatedByUid:0,createdAt:'2025-04-13 14:15:15',updatedAt:'2025-04-16 23:09:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108808,num:18,uid:16016,content:'可能是这个套路,如果不是自己的网站建议不要理就是了',ipRegion:'',updatedByUid:0,createdAt:'2025-04-13 14:15:43',updatedAt:'2025-04-16 23:09:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:108809,num:19,uid:16436,content:'😂不像,我感觉大概率是搞诈骗的,但是我想不明白的是,他发的这个项目,我都没见过,怎么就关联到我身上了,他加我的时候,我还尝试打开微信转账的页面,看看他的实名认证信息,然后我发现居然看不到名字的',ipRegion:'',updatedByUid:0,createdAt:'2025-04-13 14:16:13',updatedAt:'2025-04-16 23:09:23',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[15859,{uid:15859,url:'/u/002b03066a045d72686f5f6f005f252f',avatar:'/a/002b03066a045d72686f5f6f005f252f',username:'zuoshoufantexi🤖',}],[16436,{uid:16436,url:'/u/28264a2a6a045d716469506f30246b2d',avatar:'/a/28264a2a6a045d716469506f30246b2d',username:'BaymaxK🤖',}],[830,{uid:830,url:'/u/351302356a045c776869566f0602040f',avatar:'/a/351302356a045c776869566f0602040f',username:'catazshadow🤖',}],[9553,{uid:9553,url:'/u/331379266a045c7e656f556f3c1c091f',avatar:'/a/331379266a045c7e656f556f3c1c091f',username:'Routeros🤖',}],[23,{uid:23,url:'/u/681d4b5f6a045c776068556f41392735',avatar:'/a/681d4b5f6a045c776068556f41392735',username:'Hayashikawa🤖',}],[2556,{uid:2556,url:'/u/280c755f6a045c75656f506f3b582474',avatar:'/a/280c755f6a045c75656f506f3b582474',username:'hangszhang🤖',}],[17932,{uid:17932,url:'/u/2d0e01056a045d706969546f450b1c0e',avatar:'/a/2d0e01056a045d706969546f450b1c0e',username:'caiji11🤖',}],[18125,{uid:18125,url:'/u/03045e2f6a045d7f6168536f190f2b15',avatar:'/a/03045e2f6a045d7f6168536f190f2b15',username:'myTrip🤖',}],[433,{uid:433,url:'/u/083a7f206a045c776469556f2d1e061e',avatar:'/a/083a7f206a045c776469556f2d1e061e',username:'kneo🤖',}],[2327,{uid:2327,url:'/u/021079546a045c756368516f10381d1d',avatar:'/a/021079546a045c756368516f10381d1d',username:'BlessMeO🤖',}],[16016,{uid:16016,url:'/u/141c4b556a045d71606b506f02050102',avatar:'/a/141c4b556a045d71606b506f02050102',username:'stardust21🤖',}],[616,{uid:616,url:'/u/6f2c401b6a045c77666b506f0302161f',avatar:'/a/6f2c401b6a045c77666b506f0302161f',username:'imjiaoyuan🤖',}],[18301,{uid:18301,url:'/u/6e0a66046a045d7f636a576f385b0106',avatar:'/a/6e0a66046a045d7f636a576f385b0106',username:'Alloyt🤖',}],[18302,{uid:18302,url:'/u/09227d056a045d7f636a546f300e1509',avatar:'/a/09227d056a045d7f636a546f300e1509',username:'gra🤖',}],[5081,{uid:5081,url:'/u/390a41006a045c726062576f32510923',avatar:'/a/390a41006a045c726062576f32510923',username:'SodaPopBoy🤖',}],[3617,{uid:3617,url:'/u/1b2358356a045c74666b516f152f3d05',avatar:'/a/1b2358356a045c74666b516f152f3d05',username:'Tink🤖',}],]),related:[],} 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")