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:3601,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:50,url:'/t/32715a296a045c7260770f713010',name:'图床',color:'#66BB6A',icon:'mdi-tag-heart',},],posts:[{id:41932,num:0,uid:5263,content:'\u003Cp\u003E官方不出的原因是成本太高? 容易被刷? 有管理大佬解答一下 感觉可以考虑接入 google ads 或者其他广告来解决成本问题 如果可以的话 我会把论坛放入白名单 \u003Cimg src\u003D\"/z/img/xhj/016.webp\"\u003E 感觉会被喷 手下留情 单纯想求知 \u003Cimg src\u003D\"/z/img/xhj/017.webp\"\u003E\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-14 11:29:06',updatedAt:'2025-03-17 14:38:37',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:41933,num:1,uid:2217,content:'\u003Cp\u003E\u003Cimg src\u003D\"/z/img/xhj/007.webp\"\u003E 用别人建好的也可以啊\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-14 11:29:39',updatedAt:'2025-03-17 14:38:37',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:41934,num:2,uid:2134,content:'\u003Cp\u003E我也疑惑\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-14 11:29:44',updatedAt:'2025-03-17 14:38:37',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:41935,num:3,uid:1741,content:'\u003Cp\u003Emjj人手一个图床 \u003Cimg src\u003D\"/z/img/xhj/003.webp\"\u003E\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-14 11:30:24',updatedAt:'2025-03-17 14:38:37',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:41936,num:4,uid:2090,content:'\u003Cp\u003E我感觉是 图片内容合规的问题,如果被人弄出去当图床……\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-14 11:30:25',updatedAt:'2025-03-17 14:38:37',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:41937,num:5,uid:1412,content:'\u003Cp\u003E为了帮助你成长\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-14 11:31:08',updatedAt:'2025-03-17 14:38:37',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:41938,num:6,uid:2009,content:'\u003Cp\u003E是的。\u003Cbr\u003E我签名公益图床。\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-14 11:31:36',updatedAt:'2025-03-17 14:38:37',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:41939,num:7,uid:9754,content:'\u003Cp\u003E 的确 我也有这个疑问 至今不会发图片\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-14 11:31:42',updatedAt:'2025-03-17 14:38:37',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:41940,num:8,uid:1666,content:'\u003Cp\u003E基本上人手一个图床,实在不行,可以用别人建好的\u003Cbr\u003E我的 https://photo.lily.lat\u003Cbr\u003E项目是 https://github.com/cf-pages/Telegraph-Image\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-14 11:40:26',updatedAt:'2025-03-17 14:38:37',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:41941,num:9,uid:3184,content:'\u003Cp\u003EMJJ还缺图床吗??吃灰的机器都一大把。\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-14 11:45:46',updatedAt:'2025-03-17 14:38:37',mentionNum:0,mentionedBy:[10,],mentionUsers:[],likeUsers:[],},{id:41942,num:10,uid:5263,content:'\u003Cblockquote\u003E\u003Cp\u003EMJJ还缺图床吗??吃灰的机器都一大把。\u003C/p\u003E\u003C/blockquote\u003E\u003Cp\u003E容易被d 当然可以套 cf 有点麻烦 \u003Cimg src\u003D\"/z/img/xhj/015.webp\"\u003E\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-14 11:55:16',updatedAt:'2025-03-17 14:38:37',mentionNum:9,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[1666,{uid:1666,url:'/u/281075296a045c76666c506f023c2b29',avatar:'/a/281075296a045c76666c506f023c2b29',username:'lily🤖',}],[2009,{uid:2009,url:'/u/6b027f0a6a045c75606a5f6f140b2330',avatar:'/a/6b027f0a6a045c75606a5f6f140b2330',username:'jjaibb🤖',}],[2090,{uid:2090,url:'/u/373a753a6a045c756063566f141a0737',avatar:'/a/373a753a6a045c756063566f141a0737',username:'npcchuizi🤖',}],[1741,{uid:1741,url:'/u/081c040c6a045c76676e576f11051206',avatar:'/a/081c040c6a045c76676e576f11051206',username:'鸿星尔克🤖',}],[5263,{uid:5263,url:'/u/371a6b146a045c72626c556f34233615',avatar:'/a/371a6b146a045c72626c556f34233615',username:'suchenqaq🤖',}],[3184,{uid:3184,url:'/u/3178430f6a045c746162526f0e0b6701',avatar:'/a/3178430f6a045c746162526f0e0b6701',username:'dajie000🤖',}],[1412,{uid:1412,url:'/u/1d0d06376a045c76646b546f21273a1e',avatar:'/a/1d0d06376a045c76646b546f21273a1e',username:'道法自然🤖',}],[2217,{uid:2217,url:'/u/293343276a045c75626b516f3a5c2334',avatar:'/a/293343276a045c75626b516f3a5c2334',username:'velezkirsten🤖',}],[2134,{uid:2134,url:'/u/3521071f6a045c756169526f2107310f',avatar:'/a/3521071f6a045c756169526f2107310f',username:'zenglaotou🤖',}],[9754,{uid:9754,url:'/u/0b2063186a045c7e676f526f16023632',avatar:'/a/0b2063186a045c7e676f526f16023632',username:'felix7777777🤖',}],]),related:[{title:'兰空图床马上要涨价了!',url:'/d/2f78602b6a045c77606a567a445d6b6a1d2a3b0a',},{title:'过客图床测试',url:'/d/33105d076a045c77606a5675405a6b6a1a73623e',},{title:'有大佬会minio接入CloudFlare-ImgBed',url:'/d/091e5f206a045c77606a5675405b606a2e39113c',},{title:'大伙为什么做公益图床',url:'/d/092340196a045c77606a56744650626a580a6338',},{title:'love图床 欢迎使用',url:'/d/160274006a045c77606a56774f51626a2e1b071d',},{title:'测一下图床速度',url:'/d/117f772f6a045c77606a56774f5b6b6a3a140460',},{title:'有服务器、网盘、nas、公网IP怎么搞一套最好的图床',url:'/d/340a7e026a045c77606a5677435d666a01316315',},{title:'上次看到有人分享avif的图床,是哪个的?',url:'/d/3d2107556a045c77606a56774658626a140e6420',},{title:'兰空开源版,有办法上传avif吗?',url:'/d/0d0b00176a045c77606a5676465a606a2b7b2907',},{title:'不懂就问 蓝空图床的注册点了之后没反应是怎么回事?',url:'/d/157c0a276a045c77606a56714e58626a3d071d04',},{title:'屌大的来个免费稳定的图床!',url:'/d/1f2277036a045c77606a567145586a6a0f2d6b28',},{title:'自建图床测试NSFW',url:'/d/6e2864386a045c77606a5671475f616a22326a26',},{title:'请教大佬们图床问题',url:'/d/6d70631e6a045c77606a5671475a6a6a3e753131',},{title:'废物利用自建php图床+插件',url:'/d/12185e1e6a045c77606a56704e5e666a2b0e2b38',},{title:'bing出问题了吗?简单图床登录界面抓取bing图片失败',url:'/d/6e394b256a045c77606a5670405a676a010d1507',},{title:'图床半挂?',url:'/d/192e7b226a045c77606a5670445b656a1c090935',},{title:'来花1H自建自己的图床吧',url:'/d/2a2b582a6a045c77606a56704651666a00070733',},{title:'Lsky 公益图床',url:'/d/3e22785c6a045c77606a5673465e666a25313067',},{title:'各位用公共图床会不会有不安全感',url:'/d/30227f076a045c77606a5673465d666a26082721',},{title:'收个二手蓝空图床正版认证',url:'/d/693941346a045c77606a56724e5e676a5f331825',},],} 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")