106 lines
2.4 KiB
Markdown
106 lines
2.4 KiB
Markdown
# IPLeiria Auto Attendance Script
|
|
|
|
This project automates the process of navigating to the IPLeiria GISEM platform and marking your attendence using the `chromedp` library.
|
|
|
|
## Prerequisites
|
|
|
|
- Go 1.23.2 or later
|
|
- A Chromium browser installed
|
|
|
|
## Installation
|
|
|
|
1. Clone the repository:
|
|
|
|
```sh
|
|
git clone https://github.com/FernandoJVideira/gisem-presencas.git
|
|
cd gisem-presencas
|
|
```
|
|
|
|
2. Install dependencies:
|
|
|
|
```sh
|
|
go mod tidy
|
|
```
|
|
|
|
3. Add your credentials to the `utils.go` file.
|
|
|
|
4. (Optional) If you are using Chromium instead of Chrome you need to add this line to the `main.go` file:
|
|
|
|
```go
|
|
chromedp.ExecPath("path/to/chromium-browser"), // Specify the path to Chromium executable
|
|
```
|
|
|
|
So the result would be (in `main.go`):
|
|
|
|
```go
|
|
opts := append(chromedp.DefaultExecAllocatorOptions[:],
|
|
chromedp.ExecPath("path/to/chromium-browser"), // Specify the path to Chromium executable
|
|
chromedp.Flag("headless", headless), // Disable headless mode
|
|
chromedp.Flag("disable-gpu", headless), // Enable GPU
|
|
chromedp.Flag("start-maximized", !headless), // Start maximized
|
|
)
|
|
|
|
## Usage
|
|
|
|
To run the project without building it, execute the following command:
|
|
|
|
```sh
|
|
go run .
|
|
```
|
|
|
|
## Building the Project
|
|
|
|
### For your current OS
|
|
|
|
```sh
|
|
go build -o gisem_presencas
|
|
```
|
|
|
|
### Cross-platform builds
|
|
|
|
#### For Windows
|
|
```sh
|
|
GOOS=windows GOARCH=amd64 go build -o gisem_presencas.exe
|
|
```
|
|
|
|
#### For macOS
|
|
```sh
|
|
GOOS=darwin GOARCH=amd64 go build -o gisem_presencas_mac
|
|
```
|
|
|
|
#### For Linux
|
|
```sh
|
|
GOOS=linux GOARCH=amd64 go build -o gisem_presencas_linux
|
|
```
|
|
|
|
And run it like:
|
|
|
|
```sh
|
|
./gisem_presencas -w value
|
|
```
|
|
|
|
On Windows:
|
|
```sh
|
|
gisem_presencas.exe -w value
|
|
```
|
|
|
|
## Flags
|
|
|
|
- `-w` or `-wait`: Time to wait in between refreshes (default is 10 seconds).
|
|
- `-l` or `-log`: Send the output to a file.
|
|
- `-m` or `-maxtime`: Sets a maxmium time for the program to try set Attendance (default is -1 (forever)).
|
|
- `-r` or `-replace`: Forces the program into replacing the existing saved credentials.
|
|
- `-v` or `-verbose`: Shows addicional info.
|
|
|
|
## Project Structure
|
|
|
|
- `main.go`: The main entry point of the application.
|
|
- `utils.go`: Contains utility functions such as flag parsing and the welcome message.
|
|
- `go.mod`: Go module dependencies.
|
|
- `go.sum`: Go module dependency checksums.
|
|
- `README.md`: Project documentation.
|
|
|
|
## License
|
|
|
|
This project is licensed under the MIT License.
|