Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: minimal theme and inline editing #93

Merged
merged 5 commits into from
Jul 17, 2024

Conversation

kimlimjustin
Copy link
Contributor

Added the first theme for the public page, a minimal theme.

@kimlimjustin kimlimjustin marked this pull request as ready for review July 13, 2024 17:59
@kimlimjustin
Copy link
Contributor Author

Pushed a commit that supports the inline editing feature directly on the public page with the following algorithm:

  1. When a user is logging in, we pass the user to a worker page to save its csrfToken and also a variable justLoggedIn, telling that the user is logging in, to the cookies.
  2. The user will be redirected to Rauthy's default authorization URL to handle the logging-in process.
  3. After the user is logged in and redirected to the account page, a quick condition checker will run to check if the user just logged in via the justLoggedin cookie value. If that's true, we'll fetch a token for the user and the user will be redirected to the public page's pubpage-auth-callback page together with token and cookies as the queries.
  4. Through the pubpage-auth-callback page, the cookies and token will be saved locally in the pubpage's cookies.
  5. Whenever the pubpage is loaded, a quick checker will be run to confirm whether it's the author (aka who has the correct token) who is visiting the page. If it's true, then the content will be displayed in contentEditable format, giving the user the ability to edit the content directly.
  6. The users can save their change by clicking the submit button that will trigger a POST request to the /account/update endpoint.

Technical-wise, I've modified the account/update page to enable token-powered post request. Some essential changes in the backend were also made so that everything worked correctly.

@kimlimjustin kimlimjustin changed the title feat: minimal theme feat: minimal theme and inline editing Jul 14, 2024
@zicklag
Copy link
Collaborator

zicklag commented Jul 17, 2024

Note: I'm about to force push to this branch a rebased version with a couple of my own commits on top. The commit hash before force pushing ( for recovery purposes if necessary is eeeb0c9 ).

@zicklag
Copy link
Collaborator

zicklag commented Jul 17, 2024

OK, this doesn't fix inline editing for custom domains yet I don't think, but it gets things basically up and running, and even if there are edge cases where inline editing doesn't work, it will always display the profile contents.

Known edge cases:

  • Might not work when using custom domain
  • Won't work when loggin in with 3rd party provider
  • Won't work without re-logging-in if we restart/update the weird server.

I'm just going to merge this now to unblock things and we can fix the remaining issues in separate PRs.

@zicklag zicklag merged commit f3f2eea into commune-os:main Jul 17, 2024
2 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jul 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants