-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
优化 FetchInfo.vue 和改用 Lsposed Module 仓库获取版本信息 (#49)
* 优化FetchInfo.vue和改用Lsposed Module仓库获取版本 改用 Lsposed Module 仓库获取版本信息 - 防止一些网络问题。 - 防止出现 GitHub API 速率问题。 - 切换到 Lsposed Module仓库以修复描述的 Markdown 未被渲染问题。 优化 FetchInfo.vue - 添加错误处理 - 将大部分操作移至 FetchInfo.vue 不至于让还没有获取到更新或者获取出错的位置很丑 * 为 FetchInfo.vue 添加 i18n 支持
- Loading branch information
Showing
4 changed files
with
111 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,49 @@ | ||
<template></template> | ||
|
||
<template> | ||
<div id="update_log"> | ||
<p v-if="loading">{{ i18n.loading_tips }}</p> | ||
<div v-if="releases"> | ||
<p>{{ i18n.version + release.name }}</p> | ||
<p>{{ i18n.update_date + release.publishedAt }}</p> | ||
<p v-html="release.descriptionHTML"></p> | ||
</div> | ||
<div v-if="error"> | ||
<p>{{ i18n.error_log }}</p> | ||
<br /> | ||
<pre>{{ error }}</pre> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
mounted() { | ||
const githubApiUrl1 = 'https://api.github.com/repos/saraSakuHj/HyperCeiler/releases/latest'; | ||
const githubApiUrl2 = 'https://api.github.com/repos/saraSakuHj/Cemiuiler/releases/latest'; | ||
fetch(githubApiUrl1) | ||
.then(response => response.json()) | ||
.then(data => { | ||
handleResponse(data); | ||
}) | ||
.catch(error => { | ||
console.error('Error fetching data from', githubApiUrl1, 'Error:', error); | ||
// If the first request fails, try the second one | ||
setTimeout(() => { | ||
fetch(githubApiUrl2) | ||
.then(response => response.json()) | ||
.then(data => { | ||
handleResponse(data); | ||
}) | ||
.catch(error => { | ||
console.error('Error fetching data from', githubApiUrl2, 'Error:', error); | ||
}); | ||
}, 500); | ||
}); | ||
function handleResponse(data) { | ||
if (document.getElementById("info")) { | ||
const body = data.body.replace(/\r\n/g, '<br/>'); | ||
document.getElementById('info').innerHTML = body; | ||
} | ||
document.getElementById('version').innerHTML = data.name; | ||
document.getElementById('date').innerHTML = data.published_at; | ||
document.getElementById('hidden').innerHTML = ''; | ||
} | ||
} | ||
} | ||
props: { | ||
i18n: Object, | ||
}, | ||
data() { | ||
return { | ||
error: false, | ||
loading: true, | ||
releases: false, | ||
release: {}, // 一个玄学问题,解决ts(2568)低级警告(强迫症去世) | ||
}; | ||
}, | ||
async mounted() { | ||
try { | ||
const response = await fetch("https://modules.lsposed.org/module/com.sevtinge.hyperceiler.json"); | ||
const data = await response.json(); | ||
this.loading = false; | ||
this.releases = true; | ||
this.release = data.releases[0]; | ||
} catch (error) { | ||
this.loading = false; | ||
this.error = error.message; | ||
} | ||
}, | ||
}; | ||
</script> | ||
|
||
|
||
<style scoped> | ||
pre { | ||
white-space: pre-wrap; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,62 @@ | ||
# 下载 | ||
|
||
- [GitHub Releases 下载](https://github.com/ReChronoRain/HyperCeiler/releases) | ||
- [GitHub Releases 下载](https://github.com/ReChronoRain/HyperCeiler/releases) | ||
|
||
- [直链下载](https://api.sevtinge.cc/update.php) | ||
- [直链下载](https://api.sevtinge.cc/update.php) | ||
|
||
- [Alist 网盘下载](https://alist.heinu.cc/cemiuiler) | ||
- [Alist 网盘下载](https://alist.heinu.cc/cemiuiler) | ||
|
||
> 以上下载方式均可以下载最新版 Alist网盘/Github Releases 可以下载历史版本 | ||
> 以上下载方式均可以下载最新版 Alist 网盘/Github Releases 可以下载历史版本 | ||
## 安全提醒 | ||
|
||
::: danger 警告 | ||
**非官方发布的安装包可能存在恶意代码,请务必在官方进行下载!** | ||
::: | ||
|
||
**HyperCeiler官方更新的位置** | ||
**HyperCeiler 官方更新的位置** | ||
|
||
**Telegram:** | ||
|
||
- [HyperCeiler | Release & Notice ](https://t.me/cemiuiler_release) | ||
- [HyperCeiler | Release & Notice](https://t.me/cemiuiler_release) | ||
|
||
- [Sevtinge's bug workshop](https://t.me/sevtinge_mod) | ||
- [Sevtinge's bug workshop](https://t.me/sevtinge_mod) | ||
|
||
**BiliBili:** | ||
|
||
- [绀漓丨Sevtinge](https://space.bilibili.com/526912874) | ||
- [绀漓丨 Sevtinge](https://space.bilibili.com/526912874) | ||
|
||
>PS: | ||
> PS: | ||
![bilibili](/images/bilibili.png) | ||
![bilibili](/images/bilibili.png) | ||
|
||
**X (Twitter):** | ||
|
||
- [绀漓丨Sevtinge](https://x.com/CN_Sevtinge) | ||
- [绀漓丨 Sevtinge](https://x.com/CN_Sevtinge) | ||
|
||
**GitHub:** | ||
**GitHub:** | ||
|
||
- [HyperCeiler](https://github.com/ReChronoRain/HyperCeiler) | ||
- [HyperCeiler](https://github.com/ReChronoRain/HyperCeiler) | ||
|
||
**lsposed仓库:** | ||
**lsposed 仓库:** | ||
|
||
- [HyperCeiler](https://modules.lsposed.org/module/com.sevtinge.hyperceiler) | ||
- [HyperCeiler](https://modules.lsposed.org/module/com.sevtinge.hyperceiler) | ||
|
||
## 意见反馈&交流群: | ||
## 意见反馈&交流群 | ||
|
||
[点击查看](/Support.html) | ||
|
||
## 更新日志 | ||
|
||
<span id="hidden">更新日志由 GitHub 提供,如果持续无法加载,请更换网络环境</span> | ||
|
||
版本号: <span id="version">加载中...</span> | ||
|
||
更新日期: <span id="date">加载中...</span> (UTC) | ||
|
||
<p id="info">加载中...</p> | ||
<FetchInfo :i18n="i18n"/> | ||
|
||
<script setup> | ||
import FetchInfo from '/.vitepress/components/FetchInfo.vue' | ||
import FetchInfo from '/.vitepress/components/FetchInfo.vue'; | ||
|
||
const i18n = { | ||
loading_tips: "正在获取更新日志,请稍后... 更新日志由 Lsposed 提供!如果持续无法加载,请尝试更换网络环境", | ||
version: "版本号:", | ||
update_date: "更新日期:", | ||
error_log: "无法获取更新日志!", | ||
} | ||
</script> | ||
<FetchInfo/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters