Skip to content

Commit

Permalink
feat(all): update notifs
Browse files Browse the repository at this point in the history
  • Loading branch information
SpikeHD committed Feb 1, 2024
1 parent 007a63c commit 84fce55
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion backend/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn _relative_to_seconds(rel: impl AsRef<str>) -> u64 {

pub fn version_string() -> String {
format!(
"Procchi v{}.{}.{}, by {}",
r#"{{ "name": "Procchi", "version": "{}.{}.{}", "author": "{}" }}"#,
env!("CARGO_PKG_VERSION_MAJOR"),
env!("CARGO_PKG_VERSION_MINOR"),
env!("CARGO_PKG_VERSION_PATCH"),
Expand Down
12 changes: 10 additions & 2 deletions frontend/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,16 @@ export function App() {
;(async () => {
// Get version and alert it
const res = await fetch('/api/version_info')
const data = await res.text()
window.dispatchEvent(ProcchiAlert(data))
const data = await res.json()
window.dispatchEvent(ProcchiAlert(`${data.name} v${data.version} by ${data.author}`))

// Also check for updates
const updateRes = await fetch('https://api.github.com/repos/SpikeHD/procchi/releases/latest')
const updateData = await updateRes.json()

if (updateData.tag_name !== `v${data.version}`) {
window.dispatchEvent(ProcchiAlert(`A new version of Procchi (${updateData.tag_name}) is available!`))
}
})()
}, [])

Expand Down

0 comments on commit 84fce55

Please sign in to comment.