Add caching to GitHub star badge to reduce API calls
Co-authored-by: cute-omega <92797441+cute-omega@users.noreply.github.com>pull/534/head
parent
7351f98f0b
commit
5dda806cb8
|
|
@ -50,6 +50,11 @@ export default {
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
|
githubStarBadgeUrl () {
|
||||||
|
// 生成每天更新一次的缓存键,减少API调用频率
|
||||||
|
const today = new Date().toISOString().split('T')[0] // YYYY-MM-DD
|
||||||
|
return `https://img.shields.io/github/stars/docmirror/dev-sidecar?logo=github&cacheSeconds=86400&t=${today}`
|
||||||
|
},
|
||||||
},
|
},
|
||||||
async created () {
|
async created () {
|
||||||
await this.doCheckRootCa()
|
await this.doCheckRootCa()
|
||||||
|
|
@ -352,11 +357,10 @@ export default {
|
||||||
如果它解决了你的问题,请不要吝啬你的star哟!点这里
|
如果它解决了你的问题,请不要吝啬你的star哟!点这里
|
||||||
<a-icon style="margin-right:10px;" type="arrow-right" theme="outlined" />
|
<a-icon style="margin-right:10px;" type="arrow-right" theme="outlined" />
|
||||||
</div>
|
</div>
|
||||||
<a @click="openExternal('https://github.com/docmirror/dev-sidecar')">
|
<a @click="openExternal('https://github.com/docmirror/dev-sidecar')"><img
|
||||||
<a-button type="primary" icon="star">
|
alt="GitHub stars"
|
||||||
Star on GitHub
|
:src="githubStarBadgeUrl"
|
||||||
</a-button>
|
></a>
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue