Skip to content

Simple script that clocks the user in/out of the Moodle platform.

Notifications You must be signed in to change notification settings

U-L-M-S/moodle-auto-clock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

moodle-auto-clock

grafik

It's a simple script that clocks the user in/out of the Moodle platform. Using Web Scraping. Moodle doesn't provide an API.

What am I going to learn in this README ?

You are NOT going to learn how to setup or create your our server. You will learn how to setup the docker container and your mobile phone so it can automatically connect to the docker container.

Requirements

  • Moodle Account
  • Bot Gmail / Your own Email (NO needed but recommended)
  • Docker
  • mobile phone (Android OR Iphone)

Server

Windows:

Docker install guide

Linux:

First let's install Docker and configure it.

sudo apt update && sudo apt install docker.io

Now, lets start and enable docker automatically everytime when we reboot the server.

sudo systemctl start docker && sudo systemctl enable docker

Once you are done just clone this repository.

git clone https://github.com/U-L-M-S/moodle-auto-clock.git

Next change the credentials.json wiht your credentials

{
    "username": "[email protected]",
    "password": "moodle_pswd_for_login",
    "bot_mail": "[email protected]",
    "bot_pswd": "bot_gmail_pswd_to_send_email",
    "user_mail": "[email protected]"
}

You can use your credentials of your own email and send the email (in case of errors) to youself or create a bot and send the errors via the bot to your email. In each case you will need a gmail app password.

Now you need to configure the docker compose. just go to the project folder cd moodle-auto-clock and run this command:

docker compose build

In this way a docker image will be created with the name moodle-auto-clock_image.

SSH

you can simple run

ssh user@server "docker run --rm -e ACTION=starten moodle-auto-clock_image"

you can use starten (it will clock you in) or beenden (it will clock you out) as variable valuer on ACTION. But our goal here is to make it happen automatically.


Phone

Iphone

On your Shortcuts go to automation and select the trigger. It can be the time or place.

Then select the action run ssh command, input your informations (hostname, username, password) and in the area of scripting insert this command docker run --rm -e ACTION=starten moodle-auto-clock_image.

Android

Unfortunately, there is no built-in feature for Android, so we need to use an app. If I am mistaken, please correct me (Coffmann).

Installation

There are many apps available. Example apps:

But for these instructions, we will use the free app "MacroDroid"

  • Download and install MacroDroid from an app store of your choice:

Usage

  1. Launch MacroDroid and navigate through the introductory screens.
  2. On the Tile Screen or Main Menu, locate and tap the "Create Macro" tab.
  3. Name the macro as you prefer.
  4. Tap the small plus (+) icon in the upper right corner of the red tile labeled "Trigger".
  5. Configure the trigger parameters according to your preferences (e.g., Time, Geofence, Shaking).
  6. Once you've set the trigger, return to the Macro Creation Screen and tap the plus (+) symbol on the blue tile labeled "Actions".
  7. In the Actions menu, select "Applications", then choose "Shell Script" from the dropdown menu.
  8. Enable the "Helper App" feature and switch the access type to "No Root Access".
  9. Now, insert the command docker run --rm -e ACTION=starten moodle-auto-clock_image, then press "OK".
  10. OPTIONAL: Customize constraints using the plus (+) symbol within the green tile labeled "Constraints".
  11. Press the "Back" arrow in the top-left corner, then click "Save" in the pop-up message. You're done!

To view all your saved macros, navigate to the "Macros" tab at the bottom of the Main Menu.

About

Simple script that clocks the user in/out of the Moodle platform.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published