From de60936cd2ae62b2d7869f59fffff7b6958d2df0 Mon Sep 17 00:00:00 2001 From: Stuce Date: Wed, 2 Jul 2025 17:37:55 +0100 Subject: [PATCH] moved hamlet to widgetfiles --- README.md | 5 ++++- src/Foundation.hs | 16 +++++++-------- src/Handler/Group.hs | 24 ++-------------------- src/Handler/Todolist.hs | 27 +++---------------------- src/Handler/TodolistItem.hs | 30 +++------------------------- templates/edit-group.hamlet | 8 ++++++++ templates/edit-todolist-items.hamlet | 6 ++++++ templates/edit-todolist.hamlet | 8 ++++++++ templates/group.hamlet | 9 +++++++++ templates/todolist-items.hamlet | 17 ++++++++++++++++ templates/todolist.hamlet | 12 +++++++++++ 11 files changed, 80 insertions(+), 82 deletions(-) create mode 100644 templates/edit-group.hamlet create mode 100644 templates/edit-todolist-items.hamlet create mode 100644 templates/edit-todolist.hamlet create mode 100644 templates/group.hamlet create mode 100644 templates/todolist-items.hamlet create mode 100644 templates/todolist.hamlet diff --git a/README.md b/README.md index ba821ed..7958ab1 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,15 @@ # sTodo Stuce's simple todo is a web app that let's you self host a simple todolist. The goal is to provide a minimalistic and fast todo list that is self hostable. +## Usage +- can be used as is for a single user behind a vpn (for ex, wireguard) +- can be setup for multi user with a reverse proxy and an authentification provider that supports trusted sso (for ex, nginx + authelia) ## Next goals - Make multi user support - [ ] write a minimal step by step guide to install with nix, - [ ] add some css to make it look nicer - [ ] add htmx to make more agreable without making js manadatory - - [ ] make api to allow usage with native app + - [ ] make api to allow usage with native app (a way to get every list that has been modified since date $date belonging from the user in a json or similar format) ## Version 0.0.3 Simple todo list webapp. Features : diff --git a/src/Foundation.hs b/src/Foundation.hs index 39678d4..d031441 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -75,12 +75,12 @@ instance Yesod App where Nothing -> getApprootText guessApproot app req Just root -> root - -- Store session data on the client in encrypted cookies, - -- default session idle timeout is 120 minutes - makeSessionBackend :: App -> IO (Maybe SessionBackend) - makeSessionBackend app = Just <$> defaultClientSessionBackend - 120 -- timeout in minutes - (appSessionKey $ appSettings app) + -- -- Store session data on the client in encrypted cookies, + -- -- default session idle timeout is 120 minutes + -- makeSessionBackend :: App -> IO (Maybe SessionBackend) + -- makeSessionBackend app = Just <$> defaultClientSessionBackend + -- 120 -- timeout in minutes + -- (appSessionKey $ appSettings app) -- Yesod Middleware allows you to run code before and after each handler function. -- The defaultYesodMiddleware adds the response header "Vary: Accept, Accept-Language" and performs authorization checks. @@ -97,7 +97,7 @@ instance Yesod App where master <- getYesod mmsg <- getMessage - mcurrentRoute <- getCurrentRoute + -- mcurrentRoute <- getCurrentRoute -- We break up the default layout into two components: -- default-layout is the contents of the body tag, and @@ -190,7 +190,7 @@ unsafeHandler = Unsafe.fakeHandlerGetLogger appLogger -- https://github.com/yesodweb/yesod/wiki/i18n-messages-in-the-scaffolding --- TODO: complete implementation should short circuit if multi user is on but no user exist +-- TODO: complete implementation should short circuit if multi user is on but no user exist, to enforce policy safely getUserId :: HandlerFor App (Key User) getUserId = do mName <- lookupHeader "Remote-User" diff --git a/src/Handler/Group.hs b/src/Handler/Group.hs index 287cedd..16fc7c1 100644 --- a/src/Handler/Group.hs +++ b/src/Handler/Group.hs @@ -18,18 +18,7 @@ getGroupR = do groups <- getGroups userId defaultLayout $ do setTitle "Groups" - [whamlet| - Home -