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:6541,currentPage:1,targetPage:1,total:57,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:15,url:'/t/0f074b236a045c7665770f3a1528',name:'软路由',color:'#66BB6A',icon:'mdi-router-wireless-settings',},],posts:[{id:79602,num:0,uid:805,content:'\u003Cp\u003E总共 100M 的带宽,有 30 户使用,我该如何抢占到这 100M 中的最大值,使用 OpenWrt, 求大佬\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-25 08:57:26',updatedAt:'2025-03-27 11:47:30',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:79603,num:1,uid:880,content:'拉一根一个月没几个钱。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-25 09:02:07',updatedAt:'2025-03-27 11:47:30',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:79604,num:2,uid:1191,content:'5G 信号可以的话不如考虑整个 CPE',ipRegion:'',updatedByUid:0,createdAt:'2025-03-25 09:02:42',updatedAt:'2025-03-27 11:47:30',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:79605,num:3,uid:2546,content:'100M ,30 个人🥵 \u003Cbr\u003E还不如买个流量卡',ipRegion:'',updatedByUid:0,createdAt:'2025-03-25 09:07:01',updatedAt:'2025-03-27 11:47:30',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:79606,num:4,uid:3823,content:'100m 下行?还是上行啊',ipRegion:'',updatedByUid:0,createdAt:'2025-03-25 09:07:08',updatedAt:'2025-03-27 11:47:30',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:79607,num:5,uid:805,content:'城中村无法自己拉宽带',ipRegion:'',updatedByUid:0,createdAt:'2025-03-25 09:08:42',updatedAt:'2025-03-27 11:47:30',mentionNum:0,mentionedBy:[15,],mentionUsers:[],likeUsers:[],},{id:79608,num:6,uid:805,content:'Download',ipRegion:'',updatedByUid:0,createdAt:'2025-03-25 09:08:55',updatedAt:'2025-03-27 11:47:30',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:79609,num:7,uid:878,content:'考虑换掉这种居住环境吗',ipRegion:'',updatedByUid:0,createdAt:'2025-03-25 09:11:12',updatedAt:'2025-03-27 11:47:30',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:79610,num:8,uid:5765,content:'使用 mwan ,插 N 根网线聚合,然后卖掉网线和路由器,购买 5Gcpe',ipRegion:'',updatedByUid:0,createdAt:'2025-03-25 09:12:54',updatedAt:'2025-03-27 11:47:30',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:79611,num:9,uid:805,content:'我北京月薪到手 5200 , 房租水电这种环境也得 1400 , 住不起更贵的了',ipRegion:'',updatedByUid:0,createdAt:'2025-03-25 09:13:27',updatedAt:'2025-03-27 11:47:30',mentionNum:0,mentionedBy:[37,46,],mentionUsers:[],likeUsers:[],},{id:79612,num:10,uid:3823,content:'深圳城中村二手房东公寓?感觉熟悉味道了',ipRegion:'',updatedByUid:0,createdAt:'2025-03-25 09:14:32',updatedAt:'2025-03-27 11:47:30',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:79613,num:11,uid:5758,content:'没一点办法',ipRegion:'',updatedByUid:0,createdAt:'2025-03-25 09:15:56',updatedAt:'2025-03-27 11:47:30',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:79614,num:12,uid:4961,content:'最靠谱的就是用密码进后台,先试试手机号、身份证后六位和弱密码,一点点试',ipRegion:'',updatedByUid:0,createdAt:'2025-03-25 09:17:53',updatedAt:'2025-03-27 11:47:30',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:79615,num:13,uid:805,content:'北京贫民窟棚户区',ipRegion:'',updatedByUid:0,createdAt:'2025-03-25 09:18:21',updatedAt:'2025-03-27 11:47:30',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:79616,num:14,uid:5080,content:'我操,瞬间觉得我一个人 500M 是多豪。。。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-25 09:24:38',updatedAt:'2025-03-27 11:47:30',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:79617,num:15,uid:880,content:'#5 \u003Cbr\u003E你是问过了运营商还是听人家说的,我以前也是城中村,直接从窗户走了一根光纤进来的。缺点就是客厅的窗户一直关不严。\u003Cbr\u003E\u003Cbr\u003E我建议你先到运营商的宽带专线提单子,然后会有师傅联系你的,你们再商讨方案。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-25 09:29:36',updatedAt:'2025-03-27 11:47:30',mentionNum:5,mentionedBy:[18,],mentionUsers:[],likeUsers:[],},{id:79618,num:16,uid:5869,content:'北京一个月 5200 不考虑换工作? 9 年前我大学毕业实习,都不止这么点',ipRegion:'',updatedByUid:0,createdAt:'2025-03-25 09:37:12',updatedAt:'2025-03-27 11:47:30',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:79619,num:17,uid:993,content:'5200 的话应该再想办法去搞钱,不能纠结于网速。。。等搞多了钱,网速自然就会上来。。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-25 09:39:31',updatedAt:'2025-03-27 11:47:30',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:79620,num:18,uid:584,content:'#15 会被人剪,我深圳拉过,很多城中村就是那么恶心。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-25 09:46:40',updatedAt:'2025-03-27 11:47:30',mentionNum:15,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:79621,num:19,uid:4969,content:'房东的光猫 cpu 和内存都被榨干了,怎么折腾都是卡。\u003Cbr\u003E\u003Cbr\u003E去给房东换个路由器 设置规则每个 ip 最大带宽。\u003Cbr\u003E\u003Cbr\u003E你也可以发起局域网攻击,大家都没法用。。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-25 09:47:49',updatedAt:'2025-03-27 11:47:30',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[5869,{uid:5869,url:'/u/0f7102046a045c72686c5f6f3d5e0913',avatar:'/a/0f7102046a045c72686c5f6f3d5e0913',username:'Jinnrry🤖',}],[12620,{uid:12620,url:'/u/6d057b396a045d756668566f3b1e650f',avatar:'/a/6d057b396a045d756668566f3b1e650f',username:'sunfly🤖',}],[4961,{uid:4961,url:'/u/093b02016a045c73696c576f40280422',avatar:'/a/093b02016a045c73696c576f40280422',username:'HFX3389🤖',}],[1191,{uid:1191,url:'/u/280a7d2e6a045c766163576f201a2731',avatar:'/a/280a7d2e6a045c766163576f201a2731',username:'KimGuo🤖',}],[4969,{uid:4969,url:'/u/0b7c683d6a045c73696c5f6f3e1f1c72',avatar:'/a/0b7c683d6a045c73696c5f6f3e1f1c72',username:'ixixi🤖',}],[878,{uid:878,url:'/u/30397e056a045c77686d5e6f4e58643f',avatar:'/a/30397e056a045c77686d5e6f4e58643f',username:'asunayuki0088🤖',}],[880,{uid:880,url:'/u/3c085b586a045c776862566f045b6037',avatar:'/a/3c085b586a045c776862566f045b6037',username:'somebody1🤖',}],[13521,{uid:13521,url:'/u/28785a5c6a045d746568576f0f306612',avatar:'/a/28785a5c6a045d746568576f0f306612',username:'490454744🤖',}],[2546,{uid:2546,url:'/u/1c1101376a045c75656e506f351b0500',avatar:'/a/1c1101376a045c75656e506f351b0500',username:'x86🤖',}],[5080,{uid:5080,url:'/u/342b58596a045c726062566f051c2b14',avatar:'/a/342b58596a045c726062566f051c2b14',username:'Alias2023🤖',}],[5758,{uid:5758,url:'/u/1b1e0b146a045c72676f5e6f1c201128',avatar:'/a/1b1e0b146a045c72676f5e6f1c201128',username:'MRG0🤖',}],[584,{uid:584,url:'/u/372f012a6a045c776562526f423f0b08',avatar:'/a/372f012a6a045c776562526f423f0b08',username:'hokori🤖',}],[993,{uid:993,url:'/u/6c7f7f1f6a045c776963556f133b1774',avatar:'/a/6c7f7f1f6a045c776963556f133b1774',username:'hefish🤖',}],[805,{uid:805,url:'/u/1c3b47146a045c77686a536f19031a01',avatar:'/a/1c3b47146a045c77686a536f19031a01',username:'jiejianshiwa🤖',}],[5765,{uid:5765,url:'/u/093c7f1e6a045c72676c536f0e2b1a05',avatar:'/a/093c7f1e6a045c72676c536f0e2b1a05',username:'knva🤖',}],[3823,{uid:3823,url:'/u/6e2146016a045c746868556f3e1e6a20',avatar:'/a/6e2146016a045c746868556f3e1e6a20',username:'yelc668🤖',}],]),related:[{title:'tailscale 和 zerotier 哪个好用,功能多?',url:'/d/360b75096a045c77606a567a445d6a6a2b280405',},{title:'Openwrt 上如何设置递归静态路由',url:'/d/2f2c575e6a045c77606a567a465f676a5b2f3139',},{title:'小米 wifi7 路由器千兆都跑不满',url:'/d/313003376a045c77606a567a475c606a1c101014',},{title:'家庭路由器组网求助',url:'/d/3711025f6a045c77606a56754f5e636a3b0c3505',},{title:'EasyTier 组网是真不错',url:'/d/6a035e586a045c77606a56744051666a5d332b01',},{title:'目前好像感受到了 openwrt 作为主路由的无力感',url:'/d/373048036a045c77606a56744051616a2517642b',},{title:'路由器选择就推荐,小米还是中兴呢?或者华硕呢',url:'/d/6a3e555a6a045c77606a5674405f676a282f0920',},{title:'畅网 N100 软路由死机频繁, PVE + 爱快 + IstoreOS 配置,换硬盘后仍未解决,求助!',url:'/d/037d540e6a045c77606a56744251656a38131d3e',},{title:'两个路由器之间的电力猫应该如何配置?',url:'/d/0f784b076a045c77606a56744258656a2b711f64',},{title:'大佬们能帮我看看拓扑图吗?现在旁路无法上网,折腾两天了,头都大了。',url:'/d/3f2c713a6a045c77606a56744358656a15356b34',},{title:'求推荐带两路 SFP+口的路由器',url:'/d/620859076a045c77606a5674455f656a1b131f15',},{title:'你们的AdGuard home能去youtube客户端广告吗',url:'/d/1c7c482c6a045c77606a5674465f6a6a5b2f0319',},{title:'有什么好用的软路由系统推荐吗',url:'/d/3d3b7e1d6a045c77606a5674465b636a2902231f',},{title:'openwrt 去广告的方案',url:'/d/1f3c621a6a045c77606a56774550656a0d326304',},{title:'r2s 的内存卡(带op系统 ) 插r4s 上能否直接使用。',url:'/d/2f38780f6a045c77606a5677455b6b6a0a7a1a2a',},{title:'AdGuard现在哪里还有活动吗?',url:'/d/1d1077186a045c77606a56764e5b616a162f6736',},{title:'r2s 只能跑满300兆啊。4s 5s 哪个能跑满千啊',url:'/d/080b7a2b6a045c77606a5676415c6a6a1c20270b',},{title:'分享一下用AdguardHome和Nginx的配置,让你可以自由DIY路径',url:'/d/6d10533f6a045c77606a5676415a626a0f273467',},{title:'adguard home的doh服务终于搭建成功了',url:'/d/69707b0c6a045c77606a567641586b6a5d361b64',},{title:'AdGuard home过滤手机广告——服务端',url:'/d/2a250a046a045c77606a5671405e636a0a3a2126',},],} 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")