Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
c1a93bc
Updated gitignore
n-mattos Aug 19, 2025
e0f70b3
Change json database into sqlite
n-mattos Aug 19, 2025
d0ec237
Added prisma migration
n-mattos Aug 19, 2025
855cc2e
Does not store entire user profile anymore, now only stores an access…
n-mattos Aug 19, 2025
f0c52f9
Removed unused database functions
n-mattos Aug 19, 2025
d8c3cdc
Added transform, insert, and query functions using SQLite and Prisma
n-mattos Aug 19, 2025
7f508ac
Removed unused types
n-mattos Aug 19, 2025
9682763
Added functions for fetching data from the 42Api using fast42
n-mattos Aug 19, 2025
69b72a1
Installed fast42
n-mattos Aug 19, 2025
bb2a313
Added variables to limit fetching during development
n-mattos Aug 19, 2025
b1f8913
Added functions to synchronize the database with Intra
n-mattos Aug 19, 2025
6625713
IDs will now be stored in the SQLite database
n-mattos Aug 19, 2025
128873b
Now saves the SyncTimestamp in the SQLite database, instead of a file…
n-mattos Aug 19, 2025
80bcc29
Adjusted msUntilNextPull according to the new database
n-mattos Aug 22, 2025
e15ba5a
Added comment
n-mattos Aug 22, 2025
fe86578
Added new database using SQLite, replacing JSON.
n-mattos Sep 1, 2025
83c7a8b
Added front-end to match the new database. Also fixed the database in…
n-mattos Sep 1, 2025
87f34ad
Increased readability
n-mattos Sep 1, 2025
9497b8d
Gave the site an updated (Codam Inspired) look
n-mattos Sep 1, 2025
bc9be27
Added a short site description at the top of the page
n-mattos Sep 2, 2025
29b1d8d
Removed unnecessary variable
n-mattos Sep 2, 2025
b67e471
Added an option to hide empty projects
n-mattos Sep 2, 2025
dcfa45f
Removed dev filter (forced to only fetch campus 14)
n-mattos Sep 2, 2025
73f9191
Retries syncing multiple times before throwing an error. + Filter gho…
n-mattos Sep 2, 2025
41fceab
Project Users now fully sync one page of project users and its depend…
n-mattos Sep 4, 2025
69dabfb
Function namechange, not a callback function
n-mattos Sep 4, 2025
1ebc956
Filters project users to only process updated ones.
n-mattos Sep 4, 2025
9c95fdf
Trailing whitespace
n-mattos Sep 4, 2025
5d0afcf
Store which campuses contain which projects. This allows the site to …
n-mattos Sep 5, 2025
61545f2
Fixed syntax error on getting primary campus
n-mattos Sep 5, 2025
0293251
syntax error
n-mattos Sep 5, 2025
3c3b91d
Removed clickable project title, functionality isnt currently there, …
n-mattos Sep 5, 2025
f2d698c
Display all project names in lowercase
n-mattos Sep 5, 2025
a5c4481
Now displays which piscine the user participated in, and reimplemente…
n-mattos Sep 5, 2025
85c7724
Fixed 'token expired' case
n-mattos Sep 5, 2025
c638108
Updated site description after having removed project links
n-mattos Sep 5, 2025
cb96aa6
Use the authPath environment variable for redirection in authenticate()
n-mattos Sep 8, 2025
1564463
Use authPath variable, and added comments for code clarity.
n-mattos Sep 8, 2025
0884519
Removed redundant database functions
n-mattos Sep 8, 2025
b129c35
Updated displayProject type to reflect the additions made to the disp…
n-mattos Sep 8, 2025
a91eb12
Made the site more appealing to look at, and changed the colour schem…
n-mattos Sep 8, 2025
9308ad1
Missing import for 'log' function
n-mattos Sep 18, 2025
a49b5ee
wrong module
n-mattos Sep 18, 2025
62960b7
Removed datadog key, since it wont be used anymore
n-mattos Sep 18, 2025
ee768b5
status/pull isnt used anymore, as there is only one pull timing, whic…
n-mattos Sep 18, 2025
db0e84f
Updated README to match the new changes better
n-mattos Sep 18, 2025
6cc825e
changed a comment to be more accurate
n-mattos Sep 18, 2025
b729697
sql files aren't necessary anymore. The database is described in ./pr…
n-mattos Sep 18, 2025
f4247dc
Clarified why campusID==1 was hidden
n-mattos Sep 18, 2025
49b5c9c
Returns out of sync if fast42 couldnt be initialized. Retries the nex…
n-mattos Sep 18, 2025
8d4019c
Made a mistake in the previous commit. Now handles initialization of …
n-mattos Sep 18, 2025
5d50a06
Clarify why staff logins get a prefix in the database
n-mattos Sep 18, 2025
3ce1b50
Changed displayProject type to DisplayProject
n-mattos Sep 18, 2025
6f7703b
Removed unused functions from wrapper.ts. Then moved the remaining fu…
n-mattos Sep 18, 2025
a18136a
Changed the way lastUpdate is displayed. If there was no lastupdate, …
n-mattos Sep 18, 2025
4ab1bda
campus to project relation removed, project difficulty added.
n-mattos Sep 18, 2025
aedacd1
Adjusted prisma schema according to previous commit
n-mattos Sep 18, 2025
bdc7f56
Past migration doesn't need to be pushed (it's a very outdated databa…
n-mattos Sep 18, 2025
c4dc419
Removed image caching proxy
n-mattos Sep 18, 2025
c3954d6
Filter Ghost Campus out of dropdown in the error page
n-mattos Sep 18, 2025
f535d00
Removed label in while loop
n-mattos Sep 18, 2025
c23ff59
Removed source from the footer
n-mattos Sep 18, 2025
5955514
Filter projectuser fetching on 42 cursus and piscine
n-mattos Sep 18, 2025
b3ba78c
Add slug back for project links. Moved Ghost campus to id 42
n-mattos Sep 18, 2025
44a60b6
Fix regarding slug
n-mattos Sep 18, 2025
bd9a4f4
Increase fetch timeout to 60s
n-mattos Sep 18, 2025
0838127
Added slug into DisplayProject interface
n-mattos Sep 18, 2025
374ca26
Changed sync. New order: projects->projectuser->user->campus. And onl…
n-mattos Sep 22, 2025
93f3319
Removed 'go-to'
n-mattos Sep 22, 2025
f3ada19
Added anonymization, by clearing the database of anonymized users aft…
n-mattos Sep 22, 2025
c9ac5c3
Stores user info at authentication, to prevent constant api calls fro…
n-mattos Sep 22, 2025
ef13ce4
Fixed new authentication
n-mattos Sep 22, 2025
ddf17b6
Replaced all space indentations with tabs, and added some ;
n-mattos Sep 22, 2025
727332f
Added semicolons
n-mattos Sep 22, 2025
f486fa0
More semicolons
n-mattos Sep 22, 2025
d6b5056
Removed unused functions, and added comments to new ones
n-mattos Sep 22, 2025
c7b9b4e
Added staff check for login
n-mattos Sep 22, 2025
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
/node_modules/
/token*.json
/env/.env
/database*/
database/*.db
/test.ts
/sessions/
*.swp
/prisma/*.db
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"semi": false,
"semi": true,
"singleQuote": true,
"bracketSameLine": true,
"printWidth": 180,
Expand Down
23 changes: 5 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ This website is meant to help students to find peers that are working on the sam

Also see `./src/env.ts` for more configuration

## Changing listed projects
- The projects shown on the front page are listed in `./env/projectIDs.json`. Should the curriculum change, you can edit that file. Remember to restart the server and wait for the server to pull all the data from the intra api.
- A list of all the projects and their corresponding ID in the 42 network (as of march 2022) can be found in `./env/allProjectIDs.json`

## Updating the secrets / API tokens
```shell
cd find-peers
Expand All @@ -25,26 +21,13 @@ docker compose up -d
docker logs --tail 10000 -f find-peers
```

## Monitoring
At the (unauthenticated) route `/status/pull` you can see a summary of the pull status of every campus
It contains the key `hoursAgo` for every campus, which is the amount of hours since the last successful pull (syncing the 42 DB of the users' completed projects) of that campus
This value should not be higher than 2 * the pull timeout (currently 24 hours)

## Configuration files
| File path | Description | Managed by server |
|----------------------------------------------|---------------------------------------------------------------------------------------|-------------------|
| `./env/projectIDs.json` | List of all the projects and their corresponding ID to be displayed on the front page | no |
| `./env/allProjectIDs.json` | List of all projects in the 42 network (as of march 2022) | no |
| `./env/.env-example` | Example file for api tokens, rename to `.env` to activate | no |
| `./env/campusIDs.json` | List of all campuses and their corresponding ID that are fetched from the 42 API | no |
| `./database/` | All database files, mount this when running in a docker container | yes |
| `./database/sessions/` | All session files currently active | yes |
| `./database/users.json` | Userdata associated with session | yes |
| `./database/<campus_name>/lastpull.txt` | Unix timestamp when the project users of that campus were last successfully updated | yes |
| `./database/<campus_name>/projectUsers.json` | Status of users for each project | yes |

## Running
The 'database' of this project is a folder called 'database' at the root of the project.
The database of this project is in a folder called 'prisma' at the root of the project.

### Docker and Docker-compose
This is in production
Expand All @@ -61,5 +44,9 @@ docker logs --tail 10000 -f find-peers
- Install Nodejs >= 18.x
- Install dependencies\
`npm install`
- Generate the Prisma client\
`npx prisma generate`
- Run Prisma migration\
`npx prisma migrate dev`
- Start development server\
`npm run dev`
3 changes: 0 additions & 3 deletions env/.env-example
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,3 @@ SYNC_SECRET=

# Rate limiter, you can find this number on in the line "Your application has a secondly rate limit set at " on the application page
SYNC_MAX_REQUESTS_PER_SECOND=

# DataDog API key, used for logging metrics
DD_API_KEY=
Loading