Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ヘルプでアップデートを確認できるようにする #690

Merged
Merged
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/components/UpdateInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,44 @@ export default defineComponent({
const infos = ref<UpdateInfo[]>();
store.dispatch("GET_UPDATE_INFOS").then((obj) => (infos.value = obj));

const currentVersion = ref("");
window.electron.getAppInfos().then((obj) => {
currentVersion.value = obj.version;
});

const latestVersion = ref("");
fetch("https://api.github.com/repos/VOICEVOX/voicevox/releases")
.then((res) => res.json())
.then((obj) => {
obj.find((item: { prerelease: boolean }) => {
item.prerelease === false;
});
sopisoft marked this conversation as resolved.
Show resolved Hide resolved
latestVersion.value = obj[0].tag_name;
});

const html = computed(() => {
if (!infos.value) return "";

let html = "";

const isFetchingFinished = latestVersion.value.length > 0;
const isUpdateAvailable = currentVersion.value !== latestVersion.value;
sopisoft marked this conversation as resolved.
Show resolved Hide resolved

if (isFetchingFinished && isUpdateAvailable) {
html += `<h3>アップデートがあります!</h3>`;
html += `<p>現在のバージョン:` + currentVersion.value + `</p>`;
html += `<p>最新のバージョン:` + latestVersion.value + `</p>`;
html += `<h4>最新版のダウンロードページ</h4>`;
html += `<a href="https://voicevox.hiroshiba.jp/" target="_blank">https://voicevox.hiroshiba.jp/</a>`;
} else if (isFetchingFinished) {
html += `<h3>お使いの VOICEBOX は最新です!</h3>`;
} else {
html += `<h3>アップデートを確認中です…</h3>`;
}

html += `<hr />`;
html += `<h3>アップデート履歴</h3>`;

for (const info of infos.value) {
const version: string = info.version;
const descriptions: string[] = info.descriptions;
Expand Down