~ekez/tui-webpage

ref: cd714f325803027f7aad5cd7bd960ffe7cace260 tui-webpage/README.md -rw-r--r-- 2.6 KiB
cd714f32Zeke Medley Add openssl package dependency 2 months ago

#TUI Webpage

This is the source code for the Tangible User Interfaces (TUI) webpage for Fall Semester 2021. More information about this class can be found here.

The webpage is deployed here: https://tui.negativefour.com

#Database Schema

This webpage offers two views of submissions. One view is on a per assignment basis and one is on a per student basis. When a student would like to submit a project they associate it with an assignment.

 +-------------+              +---------------+
 | student     | -----------> | submissions   |
 +-------------+              +---------------+
submission := {
	assignment: <string>
	link: <string>
}

submissions := [ <submission> ]

We store values as stringified JSON objects.

#Authentication

Before visiting the submit form visitors must authenticate themselves with a Berkeley Google account. This is implemented with an auth0 rule which verifies that the domain of incoming emails are Berkeley ones. If that rule fails we refuse to authenticate and logout the user from auth0 so they can try again.

If we'd like it would be easy enough to further restrict this with an allow-list of student emails.

#Adding new assignments

Currently assignments are hardcoded in two places. To add a new assignment you'll need to modify those locations.

  1. assignment.js in the function getAssignmentList.
  2. submit.js in the submitHTML function.

This is less than ideal, but in all fairness the "ideal" is likely to have the assignment list hardcoded in one place so we're not that far off. A todo that tracks this being completed can be found here.

#Deployment

#Deploying to tui.negativefour.com

Commits pushed to the master branch of this repository will be deployed automatically.

To land a commit on the master branch you'll need to either get commit permissions from me or you can send me a patch at zekemedley[at]gmail.com.

#Deploying your own version

This project is a reasonably standard issue Cloudflare workers website. The authentication system is heavily based on this guide.

In order to deploy this you'll need to configure an auth0 application and then input the information from there into cloudflare workers secrets. Please refer to this section of the beforementioned tutorial for information about the secrets requirements. The secrets used there are the same as the ones used here.