Skip to content

Commit

Permalink
Bump to 0.7.205. Added commit parser with href function. Improved Set…
Browse files Browse the repository at this point in the history
…tings.vue
  • Loading branch information
DIDIRUS4 committed Jun 22, 2024
1 parent 5af5024 commit fe6247b
Show file tree
Hide file tree
Showing 5 changed files with 215 additions and 269 deletions.
2 changes: 1 addition & 1 deletion theseus_gui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "theseus_gui",
"private": true,
"version": "0.7.2",
"patch_version": "04 • Beta",
"patch_version": "05 • Beta",
"development_build": true,
"type": "module",
"scripts": {
Expand Down
61 changes: 54 additions & 7 deletions theseus_gui/src/helpers/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,64 @@ import { downloadBuild, getOS } from '@/helpers/utils.js'
export const blockDownload = ref(true)
export const buildInstalling = ref(false)
export const updateAvailable = ref(false)
export const latestMasterCommitTruncatedSha = ref('')
export const latestMasterCommitLink = ref('')
export const latestBetaCommitTruncatedSha = ref('')
export const latestBetaCommitLink = ref('')
export const hrefAstralium = 'https://www.astralium.su/get/ar'
// export const hrefGithubLatest = 'https://github.com/DIDIRUS4/AstralRinth/releases/latest'
const os = ref('')
const apiUrl = `https://api.github.com/repos/DIDIRUS4/AstralRinth/releases/latest`
const failedPattern = `Failed to fetch remote AR releases:`
const releaseLink = `https://api.github.com/repos/DIDIRUS4/AstralRinth/releases/latest`
const branchesLink = `https://api.github.com/repos/DIDIRUS4/AstralRinth/branches`
const failedFetchRelease = `Failed to fetch remote releases:`
const failedFetchCommit = `Failed to fetch remote commits:`
const v = `v`
const localVersion = `${v}${version}${patch_version}`
const macExtension = `.dmg`
const windowsExtension = `.msi`
const linuxExtension = `.deb`
const blacklistDevBuilds = `DEV_BUILD`

export async function forceRefreshRemote(disableElementId, autoUpdate) {
fetch(apiUrl)
export async function forceRefreshRemote(disableElementId, installUpdate) {
fetch(branchesLink)
.then(async (response) => {
if (response.ok) {
response.json().then((data) => {
const branches = data.map((branch) => branch)
branches.forEach(branch => {
fetch(branch.commit.url)
.then(async (data) => {
if (data.ok) {
data.json().then((data) => {
const truncatedSha = data.sha.slice(0, 7)
const commitLink = data.html_url
if (branch.name.toLowerCase() == "master".toLowerCase()) {
latestMasterCommitTruncatedSha.value = truncatedSha
latestMasterCommitLink.value = commitLink
} else if (branch.name.toLowerCase() == "beta".toLowerCase()) {
latestBetaCommitTruncatedSha.value = truncatedSha
latestBetaCommitLink.value = commitLink
}
})
} else {
throw new Error(data.status)
}
})
});
})
} else {
throw new Error(response.status)
}

})
.catch((error) => {
latestBetaCommitTruncatedSha.value = error.message
latestMasterCommitTruncatedSha.value = error.message
latestBetaCommitLink.value = undefined
latestMasterCommitLink.value = undefined
console.error(failedFetchCommit, error)
})

fetch(releaseLink)
.then((response) => {
if (!response.ok) {
throw new Error(`Failed to fetch releases. Status: ${response.status}`)
Expand Down Expand Up @@ -53,8 +97,11 @@ export async function forceRefreshRemote(disableElementId, autoUpdate) {
}
console.log('Update available state is', updateAvailable.value)
console.log('Remote version is', remoteVersion)
console.log('Latest commit on remote is', latestMasterCommitTruncatedSha.value)
console.log('Direct link to latest commit on remote is', latestMasterCommitLink.value)
console.log('Operating System is', os.value)
if (autoUpdate) {

if (installUpdate) {
buildInstalling.value = true;
let downloadUrl = undefined
let fileName = undefined
Expand Down Expand Up @@ -98,7 +145,7 @@ export async function forceRefreshRemote(disableElementId, autoUpdate) {
}
})
.catch((error) => {
console.error(failedPattern, error)
console.error(failedFetchRelease, error)
if (!disableElementId) {
const errorData = document.getElementById('releaseData')
if (errorData) {
Expand Down
4 changes: 3 additions & 1 deletion theseus_gui/src/languages/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@
"Remote": "Remote latest version is",
"Local": "Local installed version is",
"DownloadButton": "Download via github",
"DevelopmentBuild": "You are using an assembly for development, an unexpected error may occur!"
"DevelopmentBuild": "You are using an assembly for development, an unexpected error may occur!",
"LatestMasterCommit": "Latest master commit on remote is",
"LatestBetaCommit": "Latest beta commit on remote is"
},
"RunningAppBar": {
"GetSupport": "Support",
Expand Down
6 changes: 4 additions & 2 deletions theseus_gui/src/languages/ru_ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,12 @@
"Display": "Изображение",
"LatestAvailable": "Последние релизы доступны на",
"OurGithub": "нашем Github",
"Remote": "Последняя версия на удаленном репозитории",
"Remote": "Последняя версия на удаленном сервере",
"Local": "Локальная установленная версия",
"DownloadButton": "Скачать через Github",
"DevelopmentBuild": "Вы используете сборку для разработки, может возникнуть непредвиденная ошибка!"
"DevelopmentBuild": "Вы используете сборку для разработки, может возникнуть непредвиденная ошибка!",
"LatestMasterCommit": "Последний master коммит на удаленном сервере",
"LatestBetaCommit": "Последний beta коммит на удаленном сервере"
},
"RunningAppBar": {
"GetSupport": "Поддержка",
Expand Down
Loading

0 comments on commit fe6247b

Please sign in to comment.