diff --git a/docs/.vuepress/public/js/get_data.js b/docs/.vuepress/public/js/get_data.js index 8b137891..6dad8992 100644 --- a/docs/.vuepress/public/js/get_data.js +++ b/docs/.vuepress/public/js/get_data.js @@ -1 +1,27 @@ +function updatePageData() { + fetch("https://api.liteyuki.icu/count") + .then(res => res.json()) + .then(data => { + let total = document.getElementById("total"); + if(total !== null) { + total.innerText = data.register; + } + }) + .catch(err => console.error(err)); + + fetch("https://api.liteyuki.icu/online") + .then(res => res.json()) + .then(data => { + let online = document.getElementById("online"); + if(online !== null) { + online.innerText = data.online; + } + }) + .catch(err => console.error(err)); +} + +updatePageData(); +setInterval(() => { + updatePageData(); +}, 1000); \ No newline at end of file diff --git a/docs/README.md b/docs/README.md index 07671dff..26aeb091 100644 --- a/docs/README.md +++ b/docs/README.md @@ -80,31 +80,4 @@ highlights: - title: 使用 python main.py 启动项目。 copyright: © 2021-2024 SnowyKami All Rights Reserved ---- - \ No newline at end of file +--- \ No newline at end of file