Commit Graph

95 Commits (88e1bfc146179184284f79f2222aef0e9f13e846)

Author SHA1 Message Date
Aravinth Manivannan 88e1bfc146
feat: setup zola to deploy website 2022-03-09 10:42:53 +05:30
Aravinth Manivannan 53cb808083
feat: demo user banner on login and register pages 2022-03-08 08:43:46 +05:30
Aravinth Manivannan 2db966c04a
feat: gist index view 2022-02-28 12:18:49 +05:30
Aravinth Manivannan edca78906e
feat: gist preview
SUMMARY
    crate::data::Data::gist_preview fetches gist metadata from DB and
    retrieves contents of all the files(see notes #1) stored in the
    repository

NOTES
    1) Data::gist_preview uses Data::read_file under the hood, which
       currently reads subdirectories up to level 1 depth. Decision has
       to be made regarding what to do with level 2 and below
       subdirectories. TODO
2022-02-28 10:38:13 +05:30
Aravinth Manivannan 5791e829fd
feat: utility method to parse gist public ID from repo path 2022-02-28 10:36:00 +05:30
Aravinth Manivannan 375bdc1e6c
chore: use references to GistID whenever possible 2022-02-28 10:34:26 +05:30
Aravinth Manivannan 3a1666f23c
chore: gist creation test 2022-02-28 09:02:06 +05:30
Aravinth Manivannan b698884b49
feat: gist creation form 2022-02-27 20:41:45 +05:30
Aravinth Manivannan ff01303bea
feat: readme: add docker img badge 2022-02-27 20:17:24 +05:30
Aravinth Manivannan 92f48b7bfb
feat: add new gist form gets error handling and rendering with
user-provided values on error
2022-02-27 20:14:53 +05:30
Aravinth Manivannan 7fdf815a14
chore: clippy lints 2022-02-27 18:54:13 +05:30
Aravinth Manivannan 55f7b3c3a1
fix: non-authenticated requests to pages endpoint redirected to registration, now redirects to login page 2022-02-27 18:53:51 +05:30
Aravinth Manivannan 1c21596e29
feat: CI: build and publish docker image 2022-02-26 21:10:36 +05:30
Aravinth Manivannan bfb7185801
feat: package docker img 2022-02-26 20:04:45 +05:30
Aravinth Manivannan 20d34867cf
feat: add more tests 2022-02-23 21:01:15 +05:30
Aravinth Manivannan 9e15e04ca5
feat: new gist page and extractors to handle new gist form payload
SUMMARY
    REST API for gist creation uses JSON for payload format, which
    supports array. Form doesn't so gist file field names(filename and
    content) follow {KNOWN_PREFIX}{index} semantics, which can be parsed
    while processing request.
2022-02-23 20:34:24 +05:30
Aravinth Manivannan f5a22a2916
fix: add validation to check for empty file array during gist creation 2022-02-23 20:32:32 +05:30
Aravinth Manivannan 0ba7559425
feat: view gist route and helper method to construct route from parts 2022-02-23 19:43:58 +05:30
Aravinth Manivannan 5ae12f98b3
fix: remove placeholder home route and save profile link in auth_ctx 2022-02-23 19:42:29 +05:30
Aravinth Manivannan 68fc93b33f
fix: login-register template name clash 2022-02-23 19:40:29 +05:30
Aravinth Manivannan 56ff863042
feat: add tests for HTML signout route 2022-02-23 19:40:05 +05:30
Aravinth Manivannan 371e56ab47
fix: set authentication session cookie and load middleware 2022-02-23 19:39:06 +05:30
Aravinth Manivannan 28b501810e
feat: separate navigation bars for logged and unauthenticated users
SUMMARY
    Authenticated and unauthenticated users have different requirements.
    Links to profile and settings are irrelevant for unauthenticated
    users. So separate navigation bars.

USAGE
    crate::pages::auth_ctx
	Authenticated user context should be supplied on every
	authenticated route template render. Authenticated navigation
	bar depends on "loggedin_user" to render profile link.

    AUTH_NAV("auth_nav")
	Should only be used in authenticated routes. Depends on
	"loggedin_user" authenticated user context, which can't be
	supplied in unauthenticated routes.

NOTES
    Currently, there's (template)code
    duplication, when inheritance for "include" templates are
    implemented in Tera crate, navigation bars implementations should be
    refactored to avoid duplication.
2022-02-23 12:17:48 +05:30
Aravinth Manivannan 3d040ede86
feat: gist routes and methods to generate profile route from component 2022-02-23 12:07:41 +05:30
Aravinth Manivannan 1f4053f361
feat: load embedded templates 2022-02-23 09:55:06 +05:30
Aravinth Manivannan 551a48d0c5
feat: embed templates in binary 2022-02-23 09:54:22 +05:30
Aravinth Manivannan d0dbfd9729
chore: reorganize templates 2022-02-23 09:52:56 +05:30
Aravinth Manivannan 8dd20a4f52
feat: register templates fills form on err 2022-02-23 08:10:43 +05:30
Aravinth Manivannan 78d24af48c
feat: convert empty emails to None in register form handler
SUMMARY
    Browsers send empty strings for empty fields in form submissions.
    Email is optional in registration process but empty field fails
    validation for email and results in 400 bad request. Converting
    empty strings to None fixes this.
2022-02-23 08:08:02 +05:30
Aravinth Manivannan fdbd62a0a6
feat: add error styling 2022-02-23 08:07:37 +05:30
Aravinth Manivannan 3b6a5938d7
feat: login form submission 2022-02-22 22:03:03 +05:30
Aravinth Manivannan dba0834eff
feat: register form submission 2022-02-22 21:57:13 +05:30
Aravinth Manivannan 2a8df0ebb8
feat: register template renders errors 2022-02-22 21:44:57 +05:30
Aravinth Manivannan 5c9a96dfab
feat: add tests for login template 2022-02-22 21:44:23 +05:30
Aravinth Manivannan 2919611e00
feat: login template renders errors 2022-02-22 10:12:05 +05:30
Aravinth Manivannan 3d684ff53f
feat: error component 2022-02-22 10:09:53 +05:30
Aravinth Manivannan 8901191549
feat: empty homepage placeholder 2022-02-22 10:07:52 +05:30
Aravinth Manivannan f03c052471
feat: implement HTML PageError
SUMMARY
    crate::errors::ServiceError is for JSON APIs.
    crate::page::errors::PageError is implemented for HTML pages. It
    takes a template and ServiceError instance to render given template
    with error message.

    If a user submits a form, which errors out, the user should be
    presented the same form, values filled but with error message
    included.

DESCRIPTION
    PageError::reason is human readable and friendly message
    explain what had happened.

    PageError::title is the name of the status code: HTTP "200: is "200
    OK"

    crate::page::errors::CtxError: trait all templates that can error
    should implement. It accepts an error and appends it to the
    templates context before rendering it.
2022-02-22 10:05:03 +05:30
Aravinth Manivannan 9fdd467fe9
feat: implement GetLoginRoute for crate::pages::route::Pages 2022-02-21 23:42:13 +05:30
Aravinth Manivannan 037b7f1b97
feat: HTTP signout route 2022-02-21 23:41:56 +05:30
Aravinth Manivannan 58fbe892b3
chore: separate API logout route 2022-02-21 23:38:02 +05:30
Aravinth Manivannan 34e8d8851f
feat: login and register HTML pages 2022-02-21 02:22:01 +05:30
Aravinth Manivannan 2cf064d565
feat: setup embedding static files in binary 2022-02-21 02:19:56 +05:30
Aravinth Manivannan 9dd7f2e1c7
chore: rm errors.rs from coverage report and cleanup protected_routes_work 2022-02-21 02:18:44 +05:30
Aravinth Manivannan 6d2b071308
feat: add basic styling 2022-02-21 02:16:00 +05:30
Aravinth Manivannan 9249dc3567
feat: setup cache busting for static assets 2022-02-21 02:15:38 +05:30
Aravinth Manivannan fc40706ca9
feat: get admin_email in settings and validate admin_email and source_code
SUMMARY
    New field is added to settings to receive email of the admin of the
    instance. source_code is a link to the repository of the source code
    of a GitPad instance, set_source_code is defined to build a HTTP
    link to the exact commit from which the instance binary was built.

NOTE
    Current Settings::set_source_code assumes the provided HTTP link to
    point to a forge belonging to the GitHub-family(GitHub, Gitea and
    GitLab), provisions must be made to accommodate other forges as
    well.
2022-02-21 00:42:53 +05:30
Aravinth Manivannan b7fe7ea5d5
chore: rename gists to gitpad 2022-02-20 19:21:28 +05:30
Aravinth Manivannan 604d887164
feat: REST endpoint to delete comment by ID
DESCRIPTION
    Each comment is uniquely identified by database assigned, serially
    incremented ID. Access controlled REST endpoint is added to delete
    comment by ID.

ERRORS RETURNED
    - Gist doesn't exist: 404 GistNotFound
    - Gist is private and requesting user is not owner or is not visible
      to user: 404 GistNotFound
    - Gist exists and is visible to requesting user but comment doesn't
      exist: 404 CommentNotFound
    - Gist exists and is visible to requesting user is not comment owner
      : 401 UnauthorizedOperation
2022-02-20 01:04:13 +05:30
Aravinth Manivannan 3af7c7c0f8
feat: add delete request test util 2022-02-20 01:04:01 +05:30