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:6782,currentPage:1,targetPage:1,total:31,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:83300,num:0,uid:4088,content:'之前觉得旁路由有些多余,现在准备抛弃主路由了\u003Cbr\u003E目前使用 N4120 ,内存 8GB 作为主路由,这个配置应该也不算差\u003Cbr\u003E部署了太多的东西,经常会断流几秒钟,一断流就会影响到家里的所有设备\u003Cbr\u003E目前的想法是买一个 mac mini m4 32GB 作为旁路由和本地大模型服务器\u003Cbr\u003E1 、部署 ollama 32b 这个规格的大模型,并且部署 open webui 这类的交互界面\u003Cbr\u003E2 、虚拟机安装 openwrt 作为旁路由\u003Cbr\u003E3 、使用 docker 部署 home assistant 、adguard home 这类软件\u003Cbr\u003E4 、部署一个 nas ,但是目前没想好方案,是用虚拟机部署 truenas 这类还是轻量级的 filebrowser 这种\u003Cbr\u003E5 、安装 frpc 方便出门在外能访问家里的大模型(这个好像开销不大)\u003Cbr\u003E有没有大佬实操过,这些东西 32g 内存能跑起来吗?',ipRegion:'',updatedByUid:0,createdAt:'2025-03-27 03:52:41',updatedAt:'2025-03-29 12:04:36',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:83301,num:1,uid:3651,content:'1.本地部署 32b 大模型是刚需吗?\u003Cbr\u003E如果不是,买 api 或者用免费的在线服务可能更好。\u003Cbr\u003E\u003Cbr\u003E2.喜欢折腾的话,推荐主传统硬路由+旁软路由的方案。\u003Cbr\u003E主硬路由保证家人/智能家居不断网,软路由作为旁路由接自己折腾的服务,比如 3 提到的。\u003Cbr\u003E\u003Cbr\u003E3.略。\u003Cbr\u003E\u003Cbr\u003E4.买品牌 NAS 做存储。\u003Cbr\u003E好处是外观好看、系统好用、现在有补贴价格比自组也贵不到哪去、有保修、有免费的远程技术支持。\u003Cbr\u003E软路由上需要访问 NAS 的程序远程挂载存储访问就行。\u003Cbr\u003E存储和折腾分离,这样折腾的机器崩了也不影响存储的数据。\u003Cbr\u003E\u003Cbr\u003E5.同 1 。\u003Cbr\u003E\u003Cbr\u003E以上只是个人意见,实际还是按照自己的喜好来。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-27 04:21:51',updatedAt:'2025-03-29 12:04:36',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:83302,num:2,uid:12663,content:'主路由用 tplink 的我对你的帖子看看都费劲,好费脑子呀。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-27 05:42:31',updatedAt:'2025-03-29 12:04:36',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:83303,num:3,uid:948,content:'😂确实,当动手力水平配不上雄心的时候,容易发生混乱的情况',ipRegion:'',updatedByUid:0,createdAt:'2025-03-27 06:04:38',updatedAt:'2025-03-29 12:04:36',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:83304,num:4,uid:4088,content:'我主要是想着如果我想的这些可以 all in boom 的话,用 mac mini 是非常有性价比的方案,大模型也不是刚需,我合计了一下,如果买个群晖,入门级的 2000-3000 ,不如再加 3000 买个 32g 的 mac mini ,甚至不用 3000 ,国补+教育 32+256 只需要 5200 ,还能顺带部署大模型,和做旁路由,简直性价比高到炸了(当然前提是这么多要能跑起来)',ipRegion:'',updatedByUid:0,createdAt:'2025-03-27 06:04:54',updatedAt:'2025-03-29 12:04:36',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:83305,num:5,uid:1043,content:'路由就去做路由该做的事,',ipRegion:'',updatedByUid:0,createdAt:'2025-03-27 06:07:07',updatedAt:'2025-03-29 12:04:36',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:83306,num:6,uid:4088,content:'主要是跑了太多 docker ,理论上在掌控之中,但是理论就理论在没有理论,然后就想换设备,既然都换设备了为何不整个 nas 呢,既然整 nas 了,为什么非要整品牌 nas 呢?直接 all in boom 吧,既然都 all in boom 了,为什么不部署一个大模型呢?然后开始找机子,发现没有合适的,然后看了看手中的 macbook ,直接上京东看 mac mini😂',ipRegion:'',updatedByUid:0,createdAt:'2025-03-27 06:17:24',updatedAt:'2025-03-29 12:04:36',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:83307,num:7,uid:4667,content:'路由当好路由就行了,我用的 n3050 完全没问题,其他扔虚拟机 linux 里面就行',ipRegion:'',updatedByUid:0,createdAt:'2025-03-27 08:10:30',updatedAt:'2025-03-29 12:04:36',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:83308,num:8,uid:311,content:'坚持简洁至上\u003Cbr\u003E内存 8G 的主路由,只保留梯子和路由功能即可,任何乱七八糟的软件都不用安装,最大程度保证可靠性,最多加一个 adguard home ,然后设置每天凌晨重启一下',ipRegion:'',updatedByUid:0,createdAt:'2025-03-27 08:20:15',updatedAt:'2025-03-29 12:04:36',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:83309,num:9,uid:2720,content:'\u003Cimg src\u003D\"https://i.imgur.com/AbiuawX.png\"\u003E\u003Cbr\u003E路由机只跑 openwrt+clash 网关+wg/ddns 用 lxc 容器 很稳',ipRegion:'',updatedByUid:0,createdAt:'2025-03-27 08:29:07',updatedAt:'2025-03-29 12:04:36',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:83310,num:10,uid:533,content:'为啥非要 mac mini 这并不是个好的服务器 各种服务公网访问开端口 nginx 反代',ipRegion:'',updatedByUid:0,createdAt:'2025-03-27 08:54:31',updatedAt:'2025-03-29 12:04:36',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:83311,num:11,uid:10710,content:'我目前是主路由加支持 docker 的 nas 作为常在线的服务,mac 有需要才开机',ipRegion:'',updatedByUid:0,createdAt:'2025-03-27 09:11:14',updatedAt:'2025-03-29 12:04:36',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:83312,num:12,uid:12007,content:'赞同楼上两位,我是 r5s 跑 openwrt ,启用了 openclash 翻墙、adguardhome 做 dns 和禁用广告、kms 来激活内网 windows 和 office 、ddns 到 cloudflare 解析、vpn 和 tailscale 都是用来回内网,剩下服务类的都在 nas 上 docker 部署。平时非常稳定,我可能想起来的时候会手工重启一次,通常两次想起来间隔都在 2 个月多吧。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-27 09:14:36',updatedAt:'2025-03-29 12:04:36',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:83313,num:13,uid:15143,content:'主路由不要装太多东西,让它干该干的事情,我目前是一台 n100 8g 的 PVE ,装了 op 、黑群、两个 Adg lxc 容器,其余项目全跑在一台 64g 5500u 的 unraid 上,从未出现过断流等情况,另外用 mac 做服务器感觉太奢侈🤣',ipRegion:'',updatedByUid:0,createdAt:'2025-03-27 09:18:45',updatedAt:'2025-03-29 12:04:36',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:83314,num:14,uid:342,content:'我已经把 openwrt 优化掉了,现在是硬路由+mac mini 网关+n100 nas/服务器',ipRegion:'',updatedByUid:0,createdAt:'2025-03-27 09:29:18',updatedAt:'2025-03-29 12:04:36',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:83315,num:15,uid:2443,content:'跑本地模型必要性需要考虑。我用的 M3 Max 96GB+mlx ,性能肯定比 32gb+ollama 好太多吧。实测别说 32b ,70b 的回答质量效果,尤其是速度比起 api 那是差太多了。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-27 09:34:56',updatedAt:'2025-03-29 12:04:36',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:83316,num:16,uid:15144,content:'说说我的方案\u003Cbr\u003EN100 主路由 openwrt 只跑 homeproxy + msd_lite + nginx 这三个基本服务,然后新建一个 lxc 容器,配置为 rootless ,我选择的是 fedora\u003Cbr\u003E然后容器里面安装 podman ,通过 systemd + podman 来部署其他服务,比如 homeassistant mqtt z2m (这些都是用的 macvlan 模式)\u003Cbr\u003E然后还有一**立的 i5-10400 装了 unraid 的 nas ,用于家庭影音和跑 PT 上传',ipRegion:'',updatedByUid:0,createdAt:'2025-03-27 09:41:35',updatedAt:'2025-03-29 12:04:36',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:83317,num:17,uid:649,content:'有没有想过不是 openwrt 的问题,而是你跑的其他太多容器和应用的问题呢? \u003Cbr\u003E\u003Cbr\u003E路由就该单纯做路由,甚至有条件的话存储和应用也应该分开,我这样做 openwrt 就没出过问题,当主路由跑起来稳定延迟低。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-27 09:47:51',updatedAt:'2025-03-29 12:04:36',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:83318,num:18,uid:2716,content:'请问左侧显示 IP 是怎么做到的',ipRegion:'',updatedByUid:0,createdAt:'2025-03-27 09:48:06',updatedAt:'2025-03-29 12:04:36',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:83319,num:19,uid:6471,content:'我之前用 N1 刷了 openwrt 跑旁路由,又一个 N1 刷电视盒子,在电视上看 ytb 。\u003Cbr\u003E由于我手动指定节点,如果节点挂了的话,我还要登录去切换节点。我不在家家人就不会弄。\u003Cbr\u003E\u003Cbr\u003E后来换了新电脑后,旧电脑就放家里了,再搭个 HDMI 连电视看,节点挂了随时换,就把俩 N1 都拆了',ipRegion:'',updatedByUid:0,createdAt:'2025-03-27 09:49:25',updatedAt:'2025-03-29 12:04:36',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[948,{uid:948,url:'/u/291142256a045c77696e5e6f1f036410',avatar:'/a/291142256a045c77696e5e6f1f036410',username:'szdosar🤖',}],[533,{uid:533,url:'/u/113159026a045c776569556f13392114',avatar:'/a/113159026a045c776569556f13392114',username:'YsHaNg🤖',}],[15143,{uid:15143,url:'/u/287f59236a045d72616e556f1b51262e',avatar:'/a/287f59236a045d72616e556f1b51262e',username:'Yespeter🤖',}],[12663,{uid:12663,url:'/u/697b685b6a045d75666c556f1a5b170e',avatar:'/a/697b685b6a045d75666c556f1a5b170e',username:'aqx🤖',}],[2443,{uid:2443,url:'/u/6e39562a6a045c75646e556f1d112103',avatar:'/a/6e39562a6a045c75646e556f1d112103',username:'youthfire🤖',}],[10710,{uid:10710,url:'/u/2d7d65076a045d77676b566f46073c06',avatar:'/a/2d7d65076a045d77676b566f46073c06',username:'conn457567🤖',}],[342,{uid:342,url:'/u/683e550f6a045c77636e546f2e312128',avatar:'/a/683e550f6a045c77636e546f2e312128',username:'SakuraYuki🤖',}],[649,{uid:649,url:'/u/172c572c6a045c77666e5f6f450f251f',avatar:'/a/172c572c6a045c77666e5f6f450f251f',username:'Greenm🤖',}],[4088,{uid:4088,url:'/u/0f2b051e6a045c7360625e6f022c3a0a',avatar:'/a/0f2b051e6a045c7360625e6f022c3a0a',username:'dengj3355🤖',}],[1043,{uid:1043,url:'/u/0a2c42186a045c76606e556f313e1e3f',avatar:'/a/0a2c42186a045c76606e556f313e1e3f',username:'datocp🤖',}],[2716,{uid:2716,url:'/u/147906386a045c75676b506f163e0321',avatar:'/a/147906386a045c75676b506f163e0321',username:'lnbiuc🤖',}],[3651,{uid:3651,url:'/u/2f2b68036a045c74666f576f3f2f0903',avatar:'/a/2f2b68036a045c74666f576f3f2f0903',username:'Vneix🤖',}],[15144,{uid:15144,url:'/u/6e3b04286a045d72616e526f2d1f0311',avatar:'/a/6e3b04286a045d72616e526f2d1f0311',username:'vergilgao🤖',}],[2720,{uid:2720,url:'/u/00307b3e6a045c756768566f3108190f',avatar:'/a/00307b3e6a045c756768566f3108190f',username:'chenbin36255🤖',}],[311,{uid:311,url:'/u/6b71655f6a045c77636b576f1f22190d',avatar:'/a/6b71655f6a045c77636b576f1f22190d',username:'totoro625🤖',}],[6471,{uid:6471,url:'/u/6d3f421f6a045c71646d576f1c1d1f33',avatar:'/a/6d3f421f6a045c71646d576f1c1d1f33',username:'magic3584🤖',}],[12007,{uid:12007,url:'/u/29035f396a045d75606a516f1823121e',avatar:'/a/29035f396a045d75606a516f1823121e',username:'likelylee🤖',}],[4667,{uid:4667,url:'/u/2800443c6a045c73666c516f03591d74',avatar:'/a/2800443c6a045c73666c516f03591d74',username:'brcefy🤖',}],]),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:'路由器选择就推荐,小米还是中兴呢?或者华硕呢',url:'/d/6a3e555a6a045c77606a5674405f676a282f0920',},{title:'畅网 N100 软路由死机频繁, PVE + 爱快 + IstoreOS 配置,换硬盘后仍未解决,求助!',url:'/d/037d540e6a045c77606a56744251656a38131d3e',},{title:'城中村租房 OpenWrt 抢共享带宽问题求助',url:'/d/6b3b512b6a045c77606a5674425d626a2e731038',},{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")