Last active 1 day ago

Fredrik's Avatar Fredrik revised this gist 1 month ago. Go to revision

1 file changed, 31 insertions

immich_version_checker.sh(file created)

@@ -0,0 +1,31 @@
1 + #!/bin/bash
2 +
3 + set -euo pipefail
4 +
5 + API_URL="http://localhost:2283/api/server/version-check"
6 + # API Key med bare les på server.versionCheck
7 + # Account Settings -> API Keys -> + New API Key -> velg
8 + API_KEY="696969696969696969696969"
9 + GITHUB_URL="https://api.github.com/repos/immich-app/immich/releases/latest"
10 +
11 + get_local_version() {
12 + curl -fsS -H "x-api-key: $API_KEY" "$API_URL" | jq -r '.releaseVersion'
13 + }
14 +
15 + get_latest_version() {
16 + curl -fsS "$GITHUB_URL" jq -r '.tag_name'
17 + }
18 +
19 + LOCAL=$(get_local_version)
20 + LATEST=$(get_latest_version)
21 +
22 + printf "Local : %s\n" "$LOCAL"
23 + printf "Latest: %s\n" "$LATEST"
24 +
25 + if [[ "$LOCAL" != "$LATEST" ]]; then
26 + echo "New version available!!"
27 + exit 1
28 + else
29 + echo "Up to date"
30 + exit 0
31 + fi
Newer Older