Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Beebeeoii/lominus
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.2.0
Choose a base ref
...
head repository: Beebeeoii/lominus
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 2,350 additions and 1,817 deletions.
  1. BIN .DS_Store
  2. +20 −0 .github/pull_request_template.md
  3. +31 −0 .github/workflows/ci-pr-branches.yml
  4. +4 −1 .gitignore
  5. +2 −2 FyneApp.toml
  6. +26 −0 Makefile
  7. +55 −59 README.md
  8. BIN assets/app-icon.ico
  9. BIN assets/app-icon.png
  10. +34 −32 go.mod
  11. +601 −101 go.sum
  12. +41 −29 internal/app/app.go
  13. +28 −22 internal/app/auth/auth.go
  14. +2 −2 internal/app/dir/dir.go
  15. +41 −12 internal/app/integrations/telegram/telegram.go
  16. +2 −2 internal/app/lock/lock.go
  17. +53 −25 internal/app/pref/pref.go
  18. +11 −0 internal/constants/lominus.go
  19. +66 −0 internal/constants/ui.go
  20. +127 −180 internal/cron/cron.go
  21. +27 −10 internal/file/file.go
  22. +1 −1 internal/indexing/indexing.go
  23. +3 −17 internal/log/logs.go
  24. +0 −15 internal/lominus/lominus.go
  25. +2 −2 internal/ui/bundled.go
  26. +115 −0 internal/ui/credentials.go
  27. +110 −0 internal/ui/integrations.go
  28. +236 −0 internal/ui/preferences.go
  29. +24 −48 internal/ui/systray.go
  30. +56 −347 internal/ui/ui.go
  31. +2 −1 main.go
  32. +257 −113 pkg/api/files.go
  33. +0 −90 pkg/api/grades.go
  34. +39 −47 pkg/api/modules.go
  35. +160 −178 pkg/api/request.go
  36. +0 −75 pkg/api/response.go
  37. +0 −223 pkg/api/videos.go
  38. +27 −161 pkg/auth/auth.go
  39. +49 −0 pkg/auth/canvas.go
  40. +18 −0 pkg/constants/endpoints.go
  41. +13 −0 pkg/constants/platforms.go
  42. +3 −22 pkg/integrations/telegram/telegram.go
  43. +23 −0 pkg/interfaces/File.go
  44. +16 −0 pkg/interfaces/Folder.go
  45. +13 −0 pkg/interfaces/Module.go
  46. +12 −0 pkg/interfaces/Url.go
  47. BIN screenshots/lominus-demo.gif
  48. BIN screenshots/main-dark-1.png
  49. BIN screenshots/main-dark-2.png
  50. BIN screenshots/main-dark-3.png
  51. BIN screenshots/main-light-1.png
  52. BIN screenshots/main-light-2.png
  53. BIN screenshots/main-light-3.png
Binary file removed .DS_Store
Binary file not shown.
20 changes: 20 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!-- Please set your PR title following the [Conventional Commits guidelines](https://www.conventionalcommits.org/en/v1.0.0/#summary). -->

### 🖼️ Description
<!-- Explain the context behind this PR and what this PR seeks to accomplish. -->
<!-- Link to any existing issues/PRs this PR is related to. -->

### ✨ What's Changed?
<!-- Provide a detailed list of changes (point form) made in this PR. -->

### 🧪 How Has This Been Tested? <!-- (Remove section if not applicable) -->
<!-- Describe in detail how you tested your changes and how your PR can be tested. -->

### 📸 Screenshots <!-- (Remove section if not applicable) -->
<!-- Provide screenshots of the changes in this PR if applicable. -->

### 🏎️ Review checklist
<!-- Cross out the text using the markdown strikethrough syntax if not applicable. -->
<!-- For example: - [ ] ~~Not applicable item~~ -->
- [ ] Have you conducted thorough regression testing?
- [ ] Have you included comprehensive tests covering new features or changes?
31 changes: 31 additions & 0 deletions .github/workflows/ci-pr-branches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: CI for Pull Requests/Branches

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.22

- name: Install OS Dependencies
run: sudo apt-get install gcc libgtk-3-dev libayatana-appindicator3-dev libxxf86vm-dev

- name: Install Dependencies
run: go get -v ./...

- name: Build
run: make build

- name: Test
run: make test
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -2,4 +2,7 @@
*.csv
*.txt
*.exe
*.app
*.app
.DS_Store
fyne-cross
dev_test.go
4 changes: 2 additions & 2 deletions FyneApp.toml
Original file line number Diff line number Diff line change
@@ -4,5 +4,5 @@ Website = "https://github.com/beebeeoii/lominus"
Icon = "./assets/app-icon.png"
Name = "Lominus"
ID = "com.beebeeoii.lominus"
Version = "1.2.0"
Build = 199
Version = "2.1.0"
Build = 204
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## tidy: format code and tidy modfile
.PHONY: tidy
tidy:
go fmt ./...
go mod tidy -v

## build: build the application
.PHONY: build
build:
go build -v ./...

## test: run all tests
.PHONY: test
test:
go test -v -race -buildvcs ./...

## test/cov: run all tests and display coverage
.PHONY: test/cov
test/cov:
go test -v -race -buildvcs -coverprofile=/tmp/coverage.out ./...
go tool cover -html=/tmp/coverage.out

## run: run the application
.PHONY: run
start:
go run main.go
114 changes: 55 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
![GitHub Lominus version](https://img.shields.io/badge/Lominus-v1.2.0-blueviolet)
![GitHub all releases](https://img.shields.io/github/downloads/beebeeoii/lominus/total)
![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/beebeeoii/lominus)
[![Go Reference](https://pkg.go.dev/badge/github.com/beebeeoii/lominus.svg)](https://pkg.go.dev/github.com/beebeeoii/lominus)
<p align="center">
<img src="./assets/app-icon.png" alt="lominus-app-icon" width="196" />
</p>

<p align="center">
<img src="https://img.shields.io/badge/Lominus-v2.1.0-blueviolet" />
<img src="https://img.shields.io/github/downloads/beebeeoii/lominus/total" />
<img src="https://img.shields.io/github/go-mod/go-version/beebeeoii/lominus" />
<a href="https://pkg.go.dev/github.com/beebeeoii/lominus">
<img src="https://pkg.go.dev/badge/github.com/beebeeoii/lominus.svg" alt="Go Reference">
</a>
</p>

![image](./screenshots/lominus-demo.gif)

# Table of Contents

@@ -24,31 +34,24 @@

# About <a name="about">

Lominus is a tool written in Go to automatically sync [Luminus](https://luminus.nus.edu.sg) files onto your local storage for easy access at a fixed interval of your choice. It is designed to run on Windows, macOS and Linux operating systems.
Lominus is a tool written in Go to automatically sync [Canvas](https://canvas.nus.edu.sg/) files onto your local storage for easy access to updated files. It runs on Windows, macOS and Linux.

**No credentials, files, or any other form of information is uploaded to any servers. Everything is stored locally on your system. Credentials are only used to authenticate with [Luminus](https://luminus.nus.edu.sg).**
**No credentials, files, or any other form of information is uploaded to any servers. Everything is stored locally on your system. Credentials are only used for authentication.**

# Features <a name="features">

Lominus removes the hassle to download (or redownload) whenever files are uploaded (or updated), resulting in necessary manual cleanup and organisation of the files. And many more!
Lominus removes the hassle to download (or redownload) whenever files are uploaded (or updated). And many more!

- Keeps your Luminus files organised
- Automatic download of all files from Luminus Files
- Automatic update of files when files are reuploaded on Luminus
- Works with Canvas (New !)
- Keeps files updated and organised
- Automatic download of module files
- Automatic update of module files when files are reuploaded
- System notifications
- System-based dark/light mode
- System tray icon (Windows only)
- System tray icon
- Telegram integration
- Grades notification
- Files notification
- API

To be implemented:

- Multimedia download
- Notion integration
- Custom webhook integration

# Getting Started <a name="getting-started">

## Installation <a name="getting-started-installation">
@@ -65,8 +68,6 @@ Your anti-virus software like Windows Defender may prompt that `lominus.exe` as

This occurs because the app is unsigned amongst other reasons regarding Go executables which you may find out more [here](https://go.dev/doc/faq#virus). Signing it requires a valid certificate which is payable.

If you want to be sure (which is highly recommended), compile and build the source code manually. You may find out more under [Building](#getting-started-building)

### macOS <a name="getting-started-installation-mac">

> Tested on M1 MacBook Air 2020 macOS Monterey Version 12.1
@@ -91,7 +92,7 @@ where `[filepath]` is the path to the `.dmg` file.

### Linux <a name="getting-started-installation-linux">

> Tested on Ubuntu Focal 20.04.2 LTS
> Tested on Ubuntu Focal 20.04.2 LTS and Arch
Download and extract the tarball

@@ -107,11 +108,9 @@ sudo make install

## Building <a name="getting-started-building">

You are highly recommended to compile and the program manually.

### Prerequisites <a name="getting-started-building-prerequisites">

1. [Go](https://go.dev/dl/)
1. [Golang >= 1.18](https://go.dev/dl/)

2. `gcc`

@@ -124,10 +123,16 @@ You are highly recommended to compile and the program manually.
```

- If you are on Linux Mint, you will require `libxapp-dev` as well.

4. `libxxf86vm-dev` might help if Lominus keeps crashing on startup

### Build <a name="getting-started-building-build">

1. Ensure Go is set in you system env var
1. Ensure `GOPATH` is set in your system env

``` bash
export GOPATH=$HOME/go
```

2. Install dependencies in the directory where you cloned

@@ -138,18 +143,20 @@ You are highly recommended to compile and the program manually.
3. Install [fyne](https://developer.fyne.io/index.html)

``` bash
go get fyne.io/fyne/v2/cmd/fyne
go install fyne.io/fyne/v2/cmd/fyne@latest
```

4. Finally, build and compile
4. Ensure that your system `PATH` contains `$GOPATH/bin` before building.

``` bash
export PATH=$GOPATH/bin:$PATH
fyne package
```

## API <a name="getting-started-api">

Lominus can also be used as an API. Please visit [documentations](https://pkg.go.dev/github.com/beebeeoii/lominus) for more details.
However, do note that the documentations are lacking after v2.0.0 update due to lack of time :(. This should be fixed in due time.

### Example: Retrieving your modules <a name="getting-started-api-example">

@@ -161,33 +168,27 @@ import (
"github.com/beebeeoii/lominus/pkg/api"
"github.com/beebeeoii/lominus/pkg/auth"
"github.com/beebeeoii/lominus/pkg/constants"
)
func main() {
credentials := auth.Credentials{
Username: "nusstu\\e0123456",
Password: "p455w0rd",
}
func getCanvasModules() {
canvasToken := "your-canvas-token"
_, err := auth.RetrieveJwtToken(credentials, true)
if err != nil {
log.Fatalln(err)
}
moduleRequest, modReqErr := api.BuildModuleRequest()
modulesReq, modReqErr := api.BuildModulesRequest(canvasToken, constants.Canvas)
if modReqErr != nil {
log.Fatalln(modReqErr)
}
modules, modErr := moduleRequest.GetModules()
if modErr != nil {
log.Fatalln(modErr)
modules, modulesErr := modulesReq.GetModules()
if modulesErr != nil {
log.Fatalln(modulesErr)
}
for _, module := range modules {
log.Println(module.ModuleCode, module.Name)
}
}
```
### Sample output <a name="getting-started-api-example-output">
@@ -206,40 +207,35 @@ func main() {
## Telegram
As a major messenging platform, Telegram can be used to receive notifications for things such as new grades releases.
Telegram can be used to receive notifications for things such as new grades releases.
### Setting up
1) You need to create a bot on your own via [BotFather](https://telegram.me/BotFather). Take note of the _bot token_ sent to you by **BotFather**.
1) Retrieve your _bot token_ via [BotFather](https://telegram.me/BotFather).
2) **_Important_**: Drop the bot you have just created a message to enable it to message you.
2) Retrieve your _Telegram user ID_. The simplest way is via [UserInfoBot](https://telegram.me/userinfobot).
3) You will also need to figure out your _Telegram ID_. The simplest way to get your _Telegram ID_ is via [UserInfoBot](https://telegram.me/userinfobot).
3) Copy and paste the _bot token_ and your _Telegram user ID_ in Lominus, under the Integrations tab.
4) Copy and paste the _bot token_ and your _Telegram ID_ in Lominus, under the Integrations tab.
4) Save and you should receive a test message from your bot.
5) Click save and you should receive a test message from your bot.
> Ensure that the bot is able to message you by dropping it a message.
# Screenshots <a name="screenshots">
Click [here](./screenshots/SCREENSHOTS.md) for more screenshots
Login Info | Preferences
:-------------------------:|:-------------------------:
![image](./screenshots/ubuntu-1.png) | ![image](./screenshots/ubuntu-2.png)
![image](./screenshots/mac-1.png) | ![image](./screenshots/mac-2.png)
![image](./screenshots/win-1.png) | ![image](./screenshots/win-2.png)
| Credentials | Integrations | Preferences |
| :---------: | :----------: | :---------: |
| ![image](./screenshots/main-light-1.png) | ![image](./screenshots/main-light-2.png) | ![image](./screenshots/main-light-3.png) |
| ![image](./screenshots/main-dark-1.png) | ![image](./screenshots/main-dark-2.png) | ![image](./screenshots/main-dark-3.png) |
# Contributing <a name="contributing">
Lominus is far from perfect. All contributions, regardless large or small, are highly encouraged as this would help to make Lominus better. Please submit an [issue](https://github.com/beebeeoii/lominus/issues) or fork this repo and submit a [pull request](https://github.com/beebeeoii/lominus/pulls) if necessary.
# FAQ
1. I am unable to verify my Luminus login credentials.
- Please ensure that you have trusted the SSL Certificate used by Luminus, **especially on Unix systems**.
1. Will my annotated lecture notes be overwritten if there exists a newer version uploaded by the Professor?
2. Will my annotated lecture notes be overwritten if there exists a newer version uploaded by the Professor?
- Your annotated file will be renamed to `[Edit1] XXX.XXX` and the newer version will be downloaded.
- Your annotated file will be renamed to `[v1] XXX.XXX` and the newer version will be downloaded.
Binary file modified assets/app-icon.ico
Binary file not shown.
Binary file modified assets/app-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading