Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Noticeboard Parser #1

Open
wants to merge 74 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 60 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
49f0c86
feat: project init
Bikram-ghuku Oct 1, 2024
c282eee
feat: added basic endpoints
Bikram-ghuku Oct 1, 2024
185c2a9
feat: added request maker
Bikram-ghuku Oct 2, 2024
7c827c8
feat: added more parameters to decode
Bikram-ghuku Oct 2, 2024
933c83b
fix: response parameters to decode
Bikram-ghuku Oct 2, 2024
cb5403f
feat: made client reuseable
Bikram-ghuku Oct 2, 2024
9708e6e
feat: added cron, get notices, initialse client functions
Bikram-ghuku Oct 2, 2024
60f762a
feat: added last message checker
Bikram-ghuku Oct 2, 2024
f90d849
fix: writing file error
Bikram-ghuku Oct 2, 2024
2cd1498
feat: updated gitignore
Bikram-ghuku Oct 2, 2024
bf1e4cc
feat: added field correction and printer message
Bikram-ghuku Oct 2, 2024
40f76d6
feat: increment refresh timer
Bikram-ghuku Oct 2, 2024
4889afb
feat: update logger message
Bikram-ghuku Oct 2, 2024
43e55b4
fix: latest single msg -> latest all message
Bikram-ghuku Oct 2, 2024
f62faeb
refactor: naming
Bikram-ghuku Oct 2, 2024
13df9c3
Initial commit
Bikram-ghuku Oct 2, 2024
08cd0f2
feat: add to docs template
Bikram-ghuku Oct 2, 2024
da36e8f
feat: remove workflow
Bikram-ghuku Oct 2, 2024
a824448
feat: update docs
Bikram-ghuku Oct 2, 2024
682dede
feat: added example env file
Bikram-ghuku Oct 2, 2024
5c2ea5e
feat: made repeat after time a env var
Bikram-ghuku Oct 2, 2024
b869d91
refactor: message
Bikram-ghuku Oct 2, 2024
3bb2808
feat: handle attachements
Bikram-ghuku Oct 2, 2024
6968777
feat: require only sso token
Bikram-ghuku Oct 2, 2024
80d85e4
feat: added modules
Bikram-ghuku Oct 2, 2024
89dd649
feat: added erp login
Bikram-ghuku Oct 2, 2024
e81f446
feat: add to new package
Bikram-ghuku Oct 2, 2024
b864d08
feat: added erp creds
Bikram-ghuku Oct 2, 2024
9954ae1
feat: add otp
Bikram-ghuku Oct 2, 2024
b0a0377
feat: add empty security question checker
Bikram-ghuku Oct 3, 2024
5c80e07
feat: remove login scripts
Bikram-ghuku Oct 3, 2024
54473d7
feat: add project files
Bikram-ghuku Oct 4, 2024
ec6ab4b
fix: merge conflicts
Bikram-ghuku Oct 4, 2024
d2b3419
docs(readme): update links
Bikram-ghuku Oct 4, 2024
4f14154
docs(readme): update information
Bikram-ghuku Oct 4, 2024
1ace229
docs(readme): update project details
Bikram-ghuku Oct 4, 2024
1532dc2
docs(readme): update stats links
Bikram-ghuku Oct 4, 2024
6288ddb
docs(readme): update logo link
Bikram-ghuku Oct 4, 2024
6c95658
feat: added basic erp login
Bikram-ghuku Oct 5, 2024
2e7592c
feat: remove unwanted code
Bikram-ghuku Oct 5, 2024
ec329d7
feat: update pkg name
Bikram-ghuku Oct 5, 2024
230f21b
feat: added erplogin to cron
Bikram-ghuku Oct 5, 2024
114e120
feat: continue session without relogin
Bikram-ghuku Oct 5, 2024
b278866
feat: added gmail libraries
Bikram-ghuku Oct 5, 2024
5069a7e
feat: update gitignore
Bikram-ghuku Oct 5, 2024
e4b0781
feat: added automated otp fetching
Bikram-ghuku Oct 5, 2024
6a7c4f0
feat: confidential file
Bikram-ghuku Oct 5, 2024
6fdb456
feat: automatic security question handler
Bikram-ghuku Oct 5, 2024
0db5535
feat: automatic security question handler
Bikram-ghuku Oct 5, 2024
9b47023
feat: read if already present
Bikram-ghuku Oct 5, 2024
a55d9c0
feat: added logs
Bikram-ghuku Oct 5, 2024
be61f44
docs(README): add installation instructions
Bikram-ghuku Oct 6, 2024
1926cba
feat: init ntfy
Bikram-ghuku Oct 6, 2024
7321db3
feat: add ntfy
Bikram-ghuku Oct 6, 2024
6737d87
docs(README): update run instruction
Bikram-ghuku Oct 6, 2024
53e19ec
feat: add ntfy post
Bikram-ghuku Oct 6, 2024
561a385
feat: restructure files
Bikram-ghuku Oct 6, 2024
9746d9c
feat: add docker compose
Bikram-ghuku Oct 9, 2024
9cf4ded
feat: capitalise env vars
Bikram-ghuku Oct 9, 2024
fd106ae
feat: multimodule go
Bikram-ghuku Oct 9, 2024
5846d16
feat: use erp login package go
Bikram-ghuku Oct 14, 2024
68711b5
feat: add new login script
Bikram-ghuku Oct 14, 2024
7a495ee
feat: update .env.example
Bikram-ghuku Oct 14, 2024
cf165cd
feat: update docker compose
Bikram-ghuku Oct 14, 2024
751a3b7
docs(README): update instructions
Bikram-ghuku Oct 14, 2024
626b101
feat: update workflow
Bikram-ghuku Oct 15, 2024
31bcf2a
fix: remove dockerignore
Bikram-ghuku Oct 15, 2024
9c245c4
fix: remove metaploy, update dockerfile
Bikram-ghuku Oct 19, 2024
486207e
refactor: error messages
Bikram-ghuku Oct 19, 2024
835e518
feat: add monitoring service
Bikram-ghuku Dec 6, 2024
501a4ac
feat: monitoring service run always
Bikram-ghuku Dec 6, 2024
a4e2e3b
feat: add monitoring service to go work
Bikram-ghuku Dec 6, 2024
f183115
feat: add delimiters
Bikram-ghuku Dec 6, 2024
4d40667
feat: allow docker daemon connection
Bikram-ghuku Dec 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ROLL_NO=
PASSWORD=
NTFY_ADDR=
REPEAT=120
MFINS_CONFIG=
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
.DS_Store
.vscode
node-modules/
.env
lastmsg.json
client_secret.json
.token
security_question.json
120 changes: 63 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@
<br />
<!-- UPDATE -->
<div align="center">
<a href="https://github.com/metakgp/PROJECT_NAME">
<img width="140" alt="image" src="https://raw.githubusercontent.com/metakgp/design/main/logos/logo.jpg">
<a href="https://github.com/metakgp/mfins">
<img width="140" alt="image" src="https://raw.githubusercontent.com/metakgp/design/main/logos/black-large.jpg">
</a>

<h3 align="center">PROJECT_NAME</h3>
<h3 align="center">MFINS</h3>

<p align="center">
<!-- UPDATE -->
<i>Project one liner slogan goes here</i>
<i>My Freakin' Internal Noticeboard Scrapper</i>
<br />
<a href="https://UPDATE.metakgp.org">Website</a>
·
<a href="https://github.com/proffapt/PROJECT_NAME/issues">Request Feature / Report Bug</a>
<a href="https://github.com/metakgp/mfins/issues">Request Feature / Report Bug</a>
</p>
</div>

Expand All @@ -56,26 +56,19 @@
## About The Project
<!-- UPDATE -->
<div align="center">
<a href="https://github.com/metakgp/PROJECT_NAME">
<a href="https://github.com/metakgp/mfins">
<img width="80%" alt="image" src="https://user-images.githubusercontent.com/86282911/206632547-a3b34b47-e7ae-4186-a1e6-ecda7ddb38e6.png">
</a>
</div>

_Detailed explaination of the project goes here_

This a microservice designed to send notceboard messages for the internal noticeboard to Naarad (NTFY). It uses the SSO token and jsessionid to access the noticeboard present in the erp. It checks for a new message every 2 minutes.
<p align="right">(<a href="#top">back to top</a>)</p>

<div id="supports"></div>

### Supports:
<!-- UPDATE -->
1. Shells
* `bash`
* `zsh`
2. OS(s)
* any `*nix`[`GNU+Linux` and `Unix`]
<!-- ### Supports: -->

<p align="right">(<a href="#top">back to top</a>)</p>
<!-- <p align="right">(<a href="#top">back to top</a>)</p> -->

## Getting Started

Expand All @@ -84,10 +77,7 @@ To set up a local instance of the application, follow the steps below.
### Prerequisites
The following dependencies are required to be installed for the project to function properly:
<!-- UPDATE -->
* npm
```sh
npm install npm@latest -g
```
* [golang](https://go.dev/doc/install)

<p align="right">(<a href="#top">back to top</a>)</p>

Expand All @@ -97,16 +87,32 @@ _Now that the environment has been set up and configured to properly compile and
<!-- UPDATE -->
1. Clone the repository
```sh
git clone https://github.com/metakgp/PROJECT_NAME.git
git clone https://github.com/metakgp/mfins.git
```
2. Make the script executable
2. Change directory to the folder
```sh
cd ./PROJECT_NAME
chmod +x ./PROJECT_NAME
cd ./mfins
```
3. Execute the script
3. Copy the `.env.example` to `.env` file
```shell
cp .env.example .env
```
4. Fill the .env files with your erp credentials

5. Create `lastmsg.json` and add `{}` in it
```sh
touch lastmsg.json && echo {} > lastmsg.json
```
6. Create `security_question.json` and add `{}` to it
```sh
touch security_question.json && echo {} > security_question.json
```

7. Create a google OAuth client secret and client id and add it to `client_secret.json`

8. Execute the script
```sh
./PROJECT_NAME
go run .
```

<p align="right">(<a href="#top">back to top</a>)</p>
Expand All @@ -118,7 +124,7 @@ _Now that the environment has been set up and configured to properly compile and
Use this space to show useful examples of how this project can be used. Additional screenshots, code examples and demos work well in this space.

<div align="center">
<a href="https://github.com/metakgp/PROJECT_NAME">
<a href="https://github.com/metakgp/mfins">
<img width="80%" alt="image" src="https://user-images.githubusercontent.com/86282911/206632640-40dc440e-5ef3-4893-be48-618f2bd85f37.png">
</a>
</div>
Expand All @@ -128,40 +134,40 @@ Use this space to show useful examples of how this project can be used. Addition
## Contact

<p>
📫 Metakgp -
<a href="https://slack.metakgp.org">
<img align="center" alt="Metakgp's slack invite" width="22px" src="https://raw.githubusercontent.com/edent/SuperTinyIcons/master/images/svg/slack.svg" />
</a>
<a href="mailto:[email protected]">
<img align="center" alt="Metakgp's email " width="22px" src="https://raw.githubusercontent.com/edent/SuperTinyIcons/master/images/svg/gmail.svg" />
</a>
<a href="https://www.facebook.com/metakgp">
<img align="center" alt="metakgp's Facebook" width="22px" src="https://raw.githubusercontent.com/edent/SuperTinyIcons/master/images/svg/facebook.svg" />
</a>
<a href="https://www.linkedin.com/company/metakgp-org/">
<img align="center" alt="metakgp's LinkedIn" width="22px" src="https://raw.githubusercontent.com/edent/SuperTinyIcons/master/images/svg/linkedin.svg" />
</a>
<a href="https://twitter.com/metakgp">
<img align="center" alt="metakgp's Twitter " width="22px" src="https://raw.githubusercontent.com/edent/SuperTinyIcons/master/images/svg/twitter.svg" />
</a>
<a href="https://www.instagram.com/metakgp_/">
<img align="center" alt="metakgp's Instagram" width="22px" src="https://raw.githubusercontent.com/edent/SuperTinyIcons/master/images/svg/instagram.svg" />
</a>
📫 Metakgp -
<a href="https://slack.metakgp.org">
<img align="center" alt="Metakgp's slack invite" width="22px" src="https://raw.githubusercontent.com/edent/SuperTinyIcons/master/images/svg/slack.svg" />
</a>
<a href="mailto:[email protected]">
<img align="center" alt="Metakgp's email " width="22px" src="https://raw.githubusercontent.com/edent/SuperTinyIcons/master/images/svg/gmail.svg" />
</a>
<a href="https://www.facebook.com/metakgp">
<img align="center" alt="metakgp's Facebook" width="22px" src="https://raw.githubusercontent.com/edent/SuperTinyIcons/master/images/svg/facebook.svg" />
</a>
<a href="https://www.linkedin.com/company/metakgp-org/">
<img align="center" alt="metakgp's LinkedIn" width="22px" src="https://raw.githubusercontent.com/edent/SuperTinyIcons/master/images/svg/linkedin.svg" />
</a>
<a href="https://twitter.com/metakgp">
<img align="center" alt="metakgp's Twitter " width="22px" src="https://raw.githubusercontent.com/edent/SuperTinyIcons/master/images/svg/twitter.svg" />
</a>
<a href="https://www.instagram.com/metakgp_/">
<img align="center" alt="metakgp's Instagram" width="22px" src="https://raw.githubusercontent.com/edent/SuperTinyIcons/master/images/svg/instagram.svg" />
</a>
</p>

### Maintainer(s)

The currently active maintainer(s) of this project.

<!-- UPDATE -->
- [NAME](https://github.com/GITHUB_USERNAME)
- [Bikram Ghuku](https://github.com/bikram-ghuku)

### Creator(s)

Honoring the original creator(s) and ideator(s) of this project.

<!-- UPDATE -->
- [NAME](https://github.com/GITHUB_USERNAME)
- [Arpit Bhardwaj](https://github.com/proffapt)

<p align="right">(<a href="#top">back to top</a>)</p>

Expand All @@ -176,16 +182,16 @@ Honoring the original creator(s) and ideator(s) of this project.

<!-- MARKDOWN LINKS & IMAGES -->

[contributors-shield]: https://img.shields.io/github/contributors/metakgp/PROJECT_NAME.svg?style=for-the-badge
[contributors-url]: https://github.com/metakgp/PROJECT_NAME/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/metakgp/PROJECT_NAME.svg?style=for-the-badge
[contributors-shield]: https://img.shields.io/github/contributors/metakgp/mfins.svg?style=for-the-badge
[contributors-url]: https://github.com/metakgp/mfins/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/metakgp/mfins.svg?style=for-the-badge
[forks-url]: https://github.com/metakgp/PROJECT_NAME/network/members
[stars-shield]: https://img.shields.io/github/stars/metakgp/PROJECT_NAME.svg?style=for-the-badge
[stars-url]: https://github.com/metakgp/PROJECT_NAME/stargazers
[issues-shield]: https://img.shields.io/github/issues/metakgp/PROJECT_NAME.svg?style=for-the-badge
[issues-url]: https://github.com/metakgp/PROJECT_NAME/issues
[license-shield]: https://img.shields.io/github/license/metakgp/PROJECT_NAME.svg?style=for-the-badge
[license-url]: https://github.com/metakgp/PROJECT_NAME/blob/master/LICENSE
[stars-shield]: https://img.shields.io/github/stars/metakgp/mfins.svg?style=for-the-badge
[stars-url]: https://github.com/metakgp/mfins/stargazers
[issues-shield]: https://img.shields.io/github/issues/metakgp/mfins.svg?style=for-the-badge
[issues-url]: https://github.com/metakgp/mfins/issues
[license-shield]: https://img.shields.io/github/license/metakgp/mfins.svg?style=for-the-badge
[license-url]: https://github.com/metakgp/mfins/blob/master/LICENSE
[wiki-shield]: https://custom-icon-badges.demolab.com/badge/metakgp_wiki-grey?logo=metakgp_logo&style=for-the-badge
[wiki-url]: https://wiki.metakgp.org
[slack-url]: https://slack.metakgp.org
20 changes: 20 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
services:
mfins:
build:
context: ./mfins
dockerfile: Dockerfile
image: metakgp/mfins
container_name: mfins
volumes:
- $MFINS_CONFIG/.env:/app/.env
- $MFINS_CONFIG/client_secret.json:/app/client_secret.json
- $MFINS_CONFIG/security_question.json:/app/security_question.json
- $MFINS_CONFIG/lastmsg.json:/app/lastmsg.json
- $MFINS_CONFIG/.token:/app/.token

mfins_doctor:
build:
context: ./mfins-doctor
dockerfile: Dockerfile
image: metakgp/mfins-doctor
container_name: mfins-doctor
3 changes: 3 additions & 0 deletions go.work
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
go 1.23.1

use ./mfins
22 changes: 22 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
cel.dev/expr v0.16.0/go.mod h1:TRSuuV7DlVCE/uwv5QbAiW/v8l5O8C4eEPHeu7gf7Sg=
cloud.google.com/go v0.115.1 h1:Jo0SM9cQnSkYfp44+v+NQXHpcHqlnRJk2qxh6yvxxxQ=
cloud.google.com/go v0.115.1/go.mod h1:DuujITeaufu3gL68/lOFIirVNJwQeyf5UXyi+Wbgknc=
cloud.google.com/go/longrunning v0.5.6/go.mod h1:vUaDrWYOMKRuhiv6JBnn49YxCPz2Ayn9GqyjaBT8/mA=
cloud.google.com/go/translate v1.10.3/go.mod h1:GW0vC1qvPtd3pgtypCv4k4U8B7EdgK9/QEF2aJEUovs=
github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cncf/xds/go v0.0.0-20240723142845-024c85f92f20/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8=
github.com/envoyproxy/go-control-plane v0.13.0/go.mod h1:GRaKG3dwvFoTg4nj7aXdZnvMg4d7nvT/wl9WgVXn3Q8=
github.com/envoyproxy/protoc-gen-validate v1.1.0/go.mod h1:sXRDRVmzEbkM7CVcM06s9shE/m23dg3wzjl0UWqJ2q4=
github.com/golang/glog v1.2.2/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/go-pkcs11 v0.3.0/go.mod h1:6eQoGcuNJpa7jnd5pMGdkSaQpNDYvPlXWMcjXXThLlY=
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0/go.mod h1:B9yO6b04uB80CzjedvewuqDhxJxi11s7/GtiGa8bAjI=
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8=
golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=
google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:hL97c3SYopEHblzpxRL4lSs523++l8DYxGM1FQiYmb4=
google.golang.org/genproto/googleapis/bytestream v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:q0eWNnCW04EJlyrmLT+ZHsjuoUiZ36/eAEdCCezZoco=
Empty file added mfins-doctor/Dockerfile
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ayein?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was Initialising the monitoring service :)

Empty file.
3 changes: 3 additions & 0 deletions mfins-doctor/go.mod
Bikram-ghuku marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/metakgp/mfins/mfins-doctor

go 1.23.1
Empty file added mfins/.dockerignore
Bikram-ghuku marked this conversation as resolved.
Show resolved Hide resolved
Empty file.
27 changes: 27 additions & 0 deletions mfins/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM golang:1.23.1 AS builder

WORKDIR /src

COPY go.mod go.sum ./

RUN go mod download

COPY . .

RUN CGO_ENABLED=1 GOOS=linux go build -o ./build --tags "fts5" -a -ldflags '-linkmode external -extldflags "-static"' .

FROM alpine:latest AS app

RUN apk --no-cache add tzdata ca-certificates bash

ENV TZ="Asia/Kolkata"

WORKDIR /app

COPY metaploy/ ./

RUN chmod +x ./postinstall.sh

COPY --from=builder /src/build .

CMD ["./postinstall.sh", "./build"]
10 changes: 10 additions & 0 deletions mfins/erplogin/endpoints.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package erplogin

const (
PING_URL = "iitkgp.ac.in"
HOMEPAGE_URL = "https://erp.iitkgp.ac.in/IIT_ERP3/"
WELCOMEPAGE_URL = "https://erp.iitkgp.ac.in/IIT_ERP3/welcome.jsp"
LOGIN_URL = "https://erp.iitkgp.ac.in/SSOAdministration/auth.htm"
SECRET_QUESTION_URL = "https://erp.iitkgp.ac.in/SSOAdministration/getSecurityQues.htm"
OTP_URL = "https://erp.iitkgp.ac.in/SSOAdministration/getEmilOTP.htm" // blame ERP for the typo
)
Loading