Commit Graph

96 Commits

Author SHA1 Message Date
Henry 36d46a8576 fix denied list in sqlite 2021-03-22 13:02:39 +01:00
Henry 8c48b4a2b8 web/handlers 2021-03-22 13:02:37 +01:00
Henry b9bcbb42ec alias JSON endpoint and testing 2021-03-16 08:49:58 +01:00
Henry 50e4ebbaca aliases: add overview and revoke handlers 2021-03-16 08:49:47 +01:00
Henry 117cad48a7 rename admindb to roomdb 2021-03-10 16:44:46 +01:00
Henry b95c8de8be add room v1 "invite" until we have ssb-uri finalized 2021-03-10 09:35:54 +01:00
Henry fd21dfc60a Various fixes
* fix accept and consumed view
* Apply suggestions from Alex' code review
* define admin.Databases options struct
* structify database parameters of web/handlers
2021-03-10 09:34:36 +01:00
Henry 98468e93a5 Invite endpoints
* Add revoke and created templates
* Render invite accept with domain
* Flesh out accept page
2021-03-10 09:33:55 +01:00
Henry 91dd6017e0 add user.FromContext middleware
A helper package so that handler and render code isnt directly tied to
the authentication package.

Also reduces db lookup overhead to one request to sqlite per request for
the user lookup.
2021-03-10 09:33:27 +01:00
Henry 97554069b5 re-use pagination code 2021-03-10 09:33:27 +01:00
Henry c7bcef4339 invite form testing 2021-03-10 09:33:15 +01:00
Andre Staltz 96b6e097dc
display description notice on the landing page 2021-02-25 18:00:57 +02:00
Andre Staltz 62d31f08b9
implement new template func "urlToNotice" 2021-02-25 17:18:51 +02:00
Henry d22996c24d rm news 2021-02-25 11:22:15 +01:00
Henry 2b79354d20 fix typo 2021-02-25 11:14:39 +01:00
Henry 99e56dbcbf re-use edit template for new translation 2021-02-25 11:13:48 +01:00
Henry 1ec3e8b064 list, set and get pinned notices 2021-02-25 10:07:47 +01:00
Henry e5a07fd8bc (Pinned)Notices
Notices are pages that admins can fill with their content to describe
and customize the room.

Pinned notices are common notices that each room has. Like a description
and privacy policy.

* update models
* simple crud test for basic notices
* edit and save notices as admin
2021-02-25 10:07:44 +01:00
Andre Staltz eaf4a4447c
new route "menu" that is accessible on mobile only 2021-02-24 12:08:21 +02:00
Andre Staltz 622b01a854
highlight active menu item with current_page_is 2021-02-23 18:41:02 +02:00
Henry 67597d9f8a turn template evaluation error fatal
this shouldn't just be logged and discarded as "not logged in"
2021-02-22 16:29:05 +01:00
Henry 73471b5ff6 update http/render 2021-02-22 16:20:26 +01:00
Henry f0e61e7189 add back dev build tag for local file access without embedding 2021-02-22 15:51:55 +01:00
Henry 534691b639 change template paths for embed.FS 2021-02-22 14:49:11 +01:00
Henry dd575aa0c7 use embed package of go1.16 for embedding assets (fixes #20) 2021-02-22 14:48:45 +01:00
Henry 56daccbb4b fix session lifetime 2021-02-17 12:22:05 +01:00
Henry f1f4e9dcb9 add CSRF protection
updates #14
2021-02-17 12:22:05 +01:00
Henry a528002361 cleanup internal sqlite error 2021-02-15 17:21:06 +01:00
Henry 58f795d5e6 route with query params instead of named routers
Since we don't use the web/router through and through to setup handler
functions, accessing the named route varaibles doesn't work inside those
handler functions.

Since I dont find it acceptable to juggle two concepts here I switch the
url generation to classical get query paramters (route?varA=xyz&varB=2).
2021-02-15 14:43:55 +01:00
Henry 6416d1c215 allow list interface 2021-02-15 14:43:32 +01:00
Henry 99c2e95aa3 setup logging in http handlers (fixes #10)
in a http.Handler you can now do the following to log events:

logger := logging.FromContext(req.Context())
level.Info(logger).Log("event", "happend", ...)
2021-02-11 16:43:37 +01:00
Henry 431e917fd2 eliminate global state in handlers/http_test.go 2021-02-11 15:34:03 +01:00
Henry beea19f93e seperate room state from muxrpc handler
There is a new roomstate package now with a Manager which is shared between muxrpc and the http
handler(s).

Also adds a list of peers in the room to admin dashboard.
2021-02-11 15:30:51 +01:00
Henry fec92d428c change name to go-ssb-room
It has been brought to my attention that "gossb" reads like "gossip..?"
to the untrained eye. That's just confusing.

Also the project hosts a single room so the plural was just wrong.
2021-02-09 17:38:51 +01:00
Henry 34aa8dd2c4 fix web/handlers tests
used the route name in palce of the url
2021-02-09 17:35:17 +01:00
Henry 31cbf00c93 use new auth.SetErrorHandler option 2021-02-09 13:40:57 +01:00
Henry 0a44d19b4b add missing license headers 2021-02-09 12:53:33 +01:00
Henry 743de1d1f6 add simple authenticated navigation
{{is_logged_in}} returns a *admindb.User value or nil depending on their
state. This can be used to build conditional rendering.
2021-02-09 12:39:57 +01:00
Henry ef4a2f3f22 sqlite and auth setup 2021-02-08 17:47:42 +01:00
Henry 01ed66d6df basic auth middleware setup 2021-02-08 13:02:45 +01:00
Henry 025a5be7ad add embedded assets server 2021-02-04 17:46:51 +01:00
Henry 2d38db1bc7 embedded templates 2021-02-04 17:25:39 +01:00
Henry e9013a0c6b change import path
this is part of the NGI work and should be clearly indicated as such
2021-02-04 16:54:30 +01:00
Henry f741065836 add i18n support
TODO: default files once embedded assets are there
2021-02-04 16:52:55 +01:00
Henry 98ca4f8408 examples for the news/ section 2021-02-04 12:00:12 +01:00
Henry fdf11f9a23 start http and html skelleton 2021-02-04 11:36:02 +01:00