Skip to content

guilhas07/bio-drive

Repository files navigation

BioDrive

Description

Bio Drive is a website that hosts NEBIST's repository.

It provides digital access to several study materials to the Biological Engineering students from Instituto Superior Técnico, thus contributing to their academic success.


How does it work:

Every week, a workflow defined here .github/workflows/update.yml is triggered. This workflow runs the script ./src/files/generateFiles.js (see Section for more details) so as to generate/update the files containing all the NEBIST Google Drive file's metadata. These files are what make all the website functionality, e.g., directory navigation, and file download, work.

Our server implements Fenix authentication as described in the Fenix API documentation. After a user successfully authenticates, the server generates a JWT (JSON Web Token) and securely sends it to the client as an HTTP-only cookie. This cookie is used to maintain the user's authenticated state. When a subsequent request is made, the server reads and validates the JWT to verify the user's identity and ensure the session is still valid.


Generate Files Functionality:

As mentioned earlier this file retrieves the NEBIST Google Drive file metadata to generate two JSON files. It does so by using a Google Drive API Secret.

After that, it queries the Google Drive API starting by the two root folders (the archive and new drive) with the IDS defined in the variable ROOT_IDS.


Development

To test the website locally:

  1. Start by cloning this repo
git clone https://github.com/guilhas07/bio-drive.git
  1. Install Node 22

  2. Copy the file example.env to a file called .env. Here you will replace the following keys:

FENIX_API='YOUR_FENIX_CLIENT_KEY'
FENIX_SECRET='YOUR_FENIX_SECRET_KEY'
REDIRECT_URI='YOUR_REDIRECT_URI'

by your newly created keys. Before creating your fake application so you can have the keys, by following https://fenixedu.org/dev/tutorials/use-fenixedu-api-in-your-application/ check the expected format:

FENIX_API='5790153********'
FENIX_SECRET='qlXJR0***********************************************************************************'
REDIRECT_URI='http://localhost:3000/login/redirect'

Warning

The REDIRECT_URI should be the same!

  1. To run the server you first need to install the required packages. If you already installed Node, you can simply run the command:
npm i
  1. Now start the server in dev mode, which means the server will restart every time you make changes:
npm run dev

And you should be able to access the website at http://localhost:3000.

Test the GoogleDrive JSON file generation locally:

  1. Follow the steps 1-4 in the previous Section.
  2. Run the script:
npm run update

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published