mirror of
https://github.com/Troplo/Colubrina.git
synced 2024-11-23 03:36:42 +11:00
Update index.js
This commit is contained in:
parent
4936f0851f
commit
9f3ff615bf
1 changed files with 25 additions and 20 deletions
11
cli/index.js
11
cli/index.js
|
@ -12,26 +12,31 @@ const { execSync } = require('child_process');
|
||||||
console.log("Troplo/Colubrina CLI")
|
console.log("Troplo/Colubrina CLI")
|
||||||
console.log("Colubrina version", require("../frontend/package.json").version)
|
console.log("Colubrina version", require("../frontend/package.json").version)
|
||||||
async function checkForUpdates() {
|
async function checkForUpdates() {
|
||||||
|
if (!process.argv.includes("--skip-update")) {
|
||||||
await axios
|
await axios
|
||||||
.get("https://services.troplo.com/api/v1/state", {
|
.get("https://services.troplo.com/api/v1/state", {
|
||||||
headers: {
|
headers: {
|
||||||
"X-Troplo-Project": "colubrina"
|
"X-Troplo-Project": "colubrina"
|
||||||
},
|
},
|
||||||
timeout: 800
|
timeout: 1000
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (require("frontend/package.json").version !== res.data.latestVersion) {
|
if (require("../frontend/package.json").version !== res.data.latestVersion) {
|
||||||
console.log("A new version of Colubrina is available!")
|
console.log("A new version of Colubrina is available!")
|
||||||
console.log("Latest version:", res.data.latestVersion)
|
console.log("Latest version:", res.data.latestVersion)
|
||||||
} else {
|
} else {
|
||||||
console.log("Colubrina is up to date.")
|
console.log("Colubrina is up to date.")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch((e) => {
|
||||||
|
console.log(e)
|
||||||
console.log(
|
console.log(
|
||||||
"Failed to check for updates, ensure you are connected to the internet, and services.troplo.com is whitelisted behind any potential firewalls."
|
"Failed to check for updates, ensure you are connected to the internet, and services.troplo.com is whitelisted behind any potential firewalls."
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
console.log("Skipping update check")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let state = {
|
let state = {
|
||||||
db: {
|
db: {
|
||||||
|
|
Loading…
Reference in a new issue