Tired of always re-logging in to moodle? Extend your moodle session lifetime!
Apparently moodle has an API method to extend the lifetime of a session. If you just call this API regularly your session will never expire.
This repo features a server that does exactly that.
As a convenience feature it also features a browser extension that sends the sessions to server for continuous extension
In case of firefox, download extension from releases page and install it into your browser. The extension provided in the releases is signed by Mozilla, so you can install it easily.
In case of chromium-based browsers, you can install it from Chrome Web Store. Alternatively, you can enable the so-called "developer mode" and load the corresponding file from the releases.
Navigate to your moodle page & log in. The extension should capture the moodle session cookie and send it to the server. A notification should appear notifying you whether the session was extended successfully or not:
Note that the extension published in releases and chrome web store only works with the Innopolis University moodle instance. Making it work with other moodle instances will require both a custom extension build and specially-deployed server (see below).
There are two cases for when you want to run a custom server:
- innopolis university moodle, but your own server (because you don't want to send all your sessions to me or smth)
- another moodle instance and your own server (my server only works with innopolis moodle)
To run a custom server against innopolis university moodle you would need:
- deploy the docker container with the server software (build it with the provided
Dockerfile
, usedocker-compose.yaml
or get it fromghcr.io/dcnick3/moodle-session-ext:ref-cefae23f6dc152f5b32eb558ab547985ae7daa98
) - make sure it's HTTP API on port
8080
is exposed publicly as an HTTPS server. You would need to use a reverse proxy like traefik or nginx for this.
Then you can just point the extension to your own server by putting its https URL to settings.
To run it against another moodle instance you would need to take some additional steps.
First of all, you would need to build your own web extensions. To do this:
- Change all the instances of
https://moodle.innopolis.university
to your own moodle instance URL inwebextension/source/mv2/manifest.json
, webextension/source/mv3/manifest.jsonand
webextension/source/background.js`. - Put your own server URL into
webextension/source/options-storage.js
- Build your own web extension by running
yarn prepublish
inwebextension
directory
After this you will have firefox.zip
and chrome.zip
files that you can load into the corresponding browser families. Firefox allows only temporary loads (so-called debug add-ons), you would need to sign it with mozilla if you want to keep it permamently loaded (choose the unlisted option).
As for the server, you would also need to change the moodle URL here by editing config.prod.yml
and build your own docker image with the provided Dockerfile
. You can probably also get away with replacing the config by starting FROM ghcr.io/dcnick3/moodle-session-ext:ref-cefae23f6dc152f5b32eb558ab547985ae7daa98
.
Otherwise, the steps are the same: get it running somewhere and make sure there's a public HTTPS endpoint the server is available at. As an added bonus, as you have built your own extension, you don't need to change the server URL in the extension settings.