diff --git a/README.md b/README.md index 4a71d57..b36ac82 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,23 @@ done: --- +## Keeping the app up to date + +Once in a while you'll be sent an updated version with fixes or improvements. +Updating is one step: + +1. Double-click **`update.command`** in the `ocr-grade` folder. +2. A Terminal window opens, downloads the newest version, and tells you when it's + done. Close it when it says so — that's it. +3. The first time, your Mac may say the file is from an "unidentified developer." + If so: **right-click `update.command` → Open → Open**. You only do that once. + +Your login, your Mistral key, and anything you've already downloaded are kept — the +update only replaces the app itself. Afterwards, start the app as usual by +double-clicking `start.command`. + +--- + ## Privacy Each student's name and ID are blacked out on your computer **before** any page is sent diff --git a/update.command b/update.command new file mode 100755 index 0000000..b36e694 --- /dev/null +++ b/update.command @@ -0,0 +1,45 @@ +#!/bin/bash +# Double-click this file to update the Exam Transcriber to the newest version. +# +# It downloads the latest version and installs it over this folder. Your saved +# settings (the .env file with your key and password) and anything already in +# your Downloads folder are left completely untouched. +# +# The whole script is wrapped in { } so it is fully loaded before it runs — that +# way it can safely replace itself with the newer copy. +{ + cd "$(dirname "$0")" || exit 1 + + echo "Updating the Exam Transcriber…" + echo "(This just needs an internet connection and takes a few seconds.)" + echo "" + + TMP="$(mktemp -d)" + ZIP="$TMP/latest.zip" + + # Download the latest version straight from GitHub. 'curl' is built into macOS + # (it is the same tool the setup used to install uv) — no extra software needed. + if ! curl -LsSf "https://codeload.github.com/briacSck/ocr-grade/zip/refs/heads/main" -o "$ZIP"; then + echo "Could not download the update. Please check your internet connection and try again." + rm -rf "$TMP" + echo "Press any key to close." ; read -n 1 -s -r ; exit 1 + fi + + if ! unzip -q "$ZIP" -d "$TMP"; then + echo "The downloaded update looked damaged. Please try again in a minute." + rm -rf "$TMP" + echo "Press any key to close." ; read -n 1 -s -r ; exit 1 + fi + + # Copy the new files over this folder. The download contains only the app + # itself, so your .env settings and your scans/transcripts are never replaced. + cp -R "$TMP"/ocr-grade-main/. . + rm -rf "$TMP" + + echo "" + echo "Done — you are now on the latest version." + echo "Close this window, then start the app as usual by double-clicking start.command." + echo "" + echo "Press any key to close." ; read -n 1 -s -r + exit 0 +}