processing / p5.js-web-editor

The p5.js Editor is a website for creating p5.js sketches, with a focus on making coding accessible and inclusive for artists, designers, educators, beginners, and anyone else! You can create, share, or remix p5.js sketches without needing to download or configure anything.
https://editor.p5js.org
GNU Lesser General Public License v2.1
1.37k stars 1.32k forks source link

Evaluate redundant redirects between client and server #2992

Closed lindapaiste closed 3 months ago

lindapaiste commented 8 months ago

Increasing Access

It is confusing to work with code where redirections can be be initiated from multiple places.

Feature enhancement details

Ref: https://github.com/processing/p5.js-web-editor/pull/2987#issuecomment-1925915203

We should look through the https://github.com/processing/p5.js-web-editor/blob/develop/client/routes.jsx file and see which redirects are not actually needed because they are already handled by the server in https://github.com/processing/p5.js-web-editor/blob/develop/server/routes/server.routes.js.

Specifically, we should check over our usages of userIsNotAuthenticated, userIsAuthenticated, userIsAuthorized, and createRedirectWithUsername. I have a hunch that we can actually delete all four of those functions. Let's make a list of all routes which use some form of redirection and whether each route's redirect logic duplicates what is already implemented on the server.

lindapaiste commented 8 months ago

Logged-out only:

Logged-in only:

Logged-in only, redirects to URL with username:

Only for current user:

Viewable to anyone:

lindapaiste commented 8 months ago

Proposed changes to server:

Proposed changes to client:

adityagarg06 commented 8 months ago

@lindapaiste can you assign this issue to me

Keshav-0907 commented 8 months ago

@lindapaiste can i work on this issue

PiyushChandra17 commented 4 months ago

@raclim I would like to work on this issue. Can you please assign me this issue? Thanks!