Skip to content

Commit

Permalink
use a function to get the proteinpaint-client version at runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
siosonel committed Oct 23, 2023
1 parent aa31eab commit 688bf17
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions client/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,21 @@ export function runproteinpaint(arg) {
})
}

runproteinpaint.getStatus = async function getStatus(outputAs = '') {
return await fetch('/healthcheck')
.then(res => res.json())
.then(res => {
const status = {
clientVersion: document.querySelector('.sja_root_holder')?.dataset.ppclientversion,
versionInfo: res.versionInfo
}
if (outputAs == 'log') console.info(status)
else if (outputAs == 'json') return JSON.stringify(status)
else return status
})
.catch(console.error)
}

// KEEP THIS ppsrc DECLARATION AT THE TOP SCOPE !!!
// need to know the script src when pp is first loaded
// the source context may be lost after the pp script is loaded
Expand Down

0 comments on commit 688bf17

Please sign in to comment.