Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

Implementing get routes #15

Open
wants to merge 55 commits into
base: Unautenticated_With_JS
Choose a base branch
from

Conversation

CSDUMMI
Copy link
Owner

@CSDUMMI CSDUMMI commented Feb 25, 2020

This is not supposed to be merged yet.
But having these Requests open makes it more easily possible for us to keep
an eye on those Branches, that we still work on and review the code.
It also makes the goal of a branch clear.
My goal here is to implement the GET Routes underlying the
UI.
In the end, this is supposed to make it easy to test (by hand)
the different functionalities of the site.

I want to ( and have partly already done so) implement:

GET / -> index.html  with messages : List[{ "title" : str, "hash" : to use in /read }]
GET /login -> login.html 
GET /readings -> readings-index.html with readings :  List[{ "title" : str, "hash" : to use in /read }]
GET /writings -> writings-index.html with writings :  List[{ "title" : str, "hash" : to use in /write }]
GET /elections -> elections.html with elections : List[{ "title" : str, "hash" : to use in /vote}]
GET /read/<hash of message> -> read.html with reading : Message
GET /write/<hash of unfinished message if writing on a draft> -> write.html with writing : Draft Message
GET /vote/<hash of the open election> -> vote.html with Election 

I am using Jinja2 Templates.
This means that in Unautenticated_With_JS we will have
to use that Template Engine to present, for example:
The title of a post and a link to the /read/ of the post in / and /.
Message, Draft Message and Election are directly from the Database
and by current plans, unencrypted (at least for Message and Draft Message).

Explanation to the format:
Before the -> is the valid HTTP Header.
After it the HTML Template File it links to and after with the
Jinja2 Variables and their Type.

Login returns the login.html page,
while /readings returns the readings-index.html with a readings template 
variable containing the unencrypted messages.
If the user is logged in, returns feed
sorted by most recent uploads as
dict of "title" and "hash".
So you can use /read/<hash> to get to reading that upload.
Added try catch error handleing..
and used try … catch … else.
Added errors.
that can easily be transformed using dict operations.
This is used to enable a debug mode, where instead of numeric error 
codes, strings are used.
And raising exceptions if the error is unknown.
objects.
Moved output/home.html -> output/index.html and output/home.css -> output/static/index.css
@CSDUMMI CSDUMMI added this to the Alpha phase milestone Feb 25, 2020
GET /write/<writing hash>
Implemented.
Handling TypError in GET /vote.
…ded in {{}} or {%%} and {{}} does automatic XSS protection on the server.

This will have to be automized, improved and the XSS prevention moved into the browser.
@CSDUMMI CSDUMMI added critical Any and all changes to critical parts of the codebase, like elections. enhancement New feature or request labels Feb 26, 2020
from POST /write, which means once you saved your message once, you'll be redirected to that messsages id: /write/<hash>
0. Proposing the vote
1. Collection options
2. Voting

And implemented first route for the first step of the process, GET and POST /voting/propose.
… in the dictionary could also be arguments of themself. Also, don't write more comment than code.
…rgument, although it was a keyword argument.
… data structure in MongoDB in /voting/option/<vote_id>
…he Patches module. Also created a function to set a Patch directory to readonly.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
critical Any and all changes to critical parts of the codebase, like elections. enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant