-
Notifications
You must be signed in to change notification settings - Fork 0
Companion version visibility on front page
At companion.ac.uk:/var/www/companion.ac.uk/
there is a script set_version.sh
which calls the GitHub API to obtain the latest release version for the sii-companion/companion repository, and stores it in dist/version.txt
. The script takes as its first argument a GitHub PAT token which is used to authenticate this API call.
A JQuery AJAX call is made in dist/index.html
to get the dist/version.txt
file and append the contents to the corresponding div. Note that dist/legacy_version.txt
is just statically set to v1.0.2 (the last tagged version number from legacy)
There is a cron job set to run once per hour which calls set_version.sh .token
, where .token
is the PAT token stored in the same directory. To edit this cron job (e.g. to change frequency), users with sudo can run the following when SSH'd into the companion.ac.uk
server
sudo crontab -u www-data -e
If the .token
has expired, the placeholder on the front page will just display null. This leads us onto...
Unfortunately, the PAT generated by GitHub has a maximum expiration time of 1 year and so will need to be regenerated every so often.
- Login to github.com
- Navigate to Settings > Developer Settings > Personal access tokens > Fine-grained tokens
- If this is your first time, follow this guide, where Read-only access to public repositories (default) is fine. Otherwise, select the expired token and click Regenerate token
- Make sure to copy the token contents at creation/regeneration time and paste into
companion.ac.uk:/var/www/companion.ac.uk/.token