Commit Graph

96 Commits

Author SHA1 Message Date
boreq ab664aafc3 Add a JSON endpoint for generating invites
When running in open mode invites can be freely generated by accessing
/create-invite. This displays an HTML page which creates and displays an
invite to the user.

This commit adds an additional way of creating invites in open mode. A
POST request can be sent to the same /create-invite endpoint with the
Accept header set to application/json. This returns a JSON response
which contains an invite url.

The purpose of this change is to make automatic invite generation easier
in SSB clients.
2022-12-13 19:15:11 +01:00
boreq 0692aa27b9 Add a way to list notices as JSON
Previously notices could only be displayed as HTML. This commit makes it
possible to request a list of notices as JSON. This can be used to
programmatically display a description of a room server in SSB clients.

The behaviour is governed by a query parameter. To list notices as JSON
set a query parameter "encoding" to "JSON" when listing notices (for
example https://example.com/notice/list?encoding=json). This parameter
was chosen instead of using the "Accept" header as similar behaviour is
already exhibited by other endpoints (namely the invite mechanism).
2022-11-08 16:16:54 +01:00
decentral1se 00a1452cfc
Migrate to ssbc urls (#336)
* fix: ssbc urls

Closes https://github.com/ssbc/go-ssb-room/issues/332

* fix: go-ssb-refs API changes

* test: go-ssb-refs API changes

Co-authored-by: decentral1se <cellarspoon@riseup.net>
Co-authored-by: André Staltz <andre@staltz.com>
2022-11-07 11:18:13 +02:00
Henry a249fd8bee fix SPDX headers and add reuse API badge 2021-10-08 14:39:31 +02:00
Henry 4d3610e2fb prepare v2 release 2021-05-31 14:51:05 +02:00
Henry 3e53570638 dependency updates
* use LICENSEd version of nocomment
* use forked kitlog
* cleanup of various dependencies
2021-05-25 12:40:00 +02:00
Henry 81c05a663d Support open invites (fixes #102) 2021-05-17 10:16:26 +02:00
Henry 385b98a3a1 add privacy mode and role tests (fixes #185)
* denied/remove
* denied/add
* invites/revoke
* members/remove
* notices/edit
* notices/add

also:
* add members.CheckAction helper
* fix muxrpc abort bug and update to v2.0.5
* strictly use SeeOther not 307 (fixes #149)
2021-05-14 14:27:01 +02:00
Henry be35f154b7 add tests for new password features
* reset link creation
* own password change
* setPasswordWithToken
* also: move member handler funcs to own file
2021-05-13 07:39:19 +02:00
Henry 4558b208ee implement password update flow with reset tokens (fixes #98)
also update AuthFallback database

* re-write fallback auth to use alias or ssbid
* replace Create() with SetPassword() which does an upsert
* Add reset tokens to sqlite
* add test for SetPassword with reset token
2021-05-13 07:39:14 +02:00
Henry 5bfb5316f8 minor fixes
remove unsed about page and fix some typos
2021-05-11 10:17:02 +02:00
Henry 653d0926f7 add password change form 2021-05-11 10:16:35 +02:00
User Cryptix fc5d3e440e add json response for invite facade (fixes #188) 2021-04-23 08:55:50 +02:00
cblgh 2c9fdcb98e update HTML UI to reflect role access restrictions
* disable ui if user is unelevated
* disable revoke button if unelevated and not own invite
* improve styling of disabled elements
* remove revoke if alias not made my current user
2021-04-23 08:33:20 +02:00
cblgh 16985bba8d rewrite list_languages function to use html/template 2021-04-20 11:49:24 +02:00
cblgh c6077337d1 use more robust identifier for test 2021-04-20 10:36:40 +02:00
Alexander Cobleigh a5f7701437 Apply suggestions from code review
Co-authored-by: Henry <111202+cryptix@users.noreply.github.com>

use eh.Handle
2021-04-20 10:36:34 +02:00
cblgh 7759e8f898 add de translation, use []TagTranslation, and sort
to make sure the list of languages is sorted, we now use a slice of
TagTranslation{Tag: string, Translation: string} structs, sorted
by `TagTranslation.Tag`.
2021-04-20 09:22:53 +02:00
cblgh b9fe27b0ca fix inconsistent cookies, set csrf cookie path
while working on the /set-language route, i noticed that i was getting a
csrf error for all /admin views when setting the language, while it
worked well on non-admin routes.

the issue, it turned out, was that we needed to configure gorilla's csrf
feature to set all cookies on the same route. when unconfigured, the
set cookies will only be set for the path they are being set at.

see more in the gorilla.csrf documentation (in particular the csrf.Path
option): https://pkg.go.dev/github.com/gorilla/csrf?utm_source=godoc#Path
2021-04-20 09:22:53 +02:00
cblgh c97b7d44c3 add default language admin ui functionality 2021-04-20 09:22:49 +02:00
cblgh ee185e5f43 don't render language picker if we have less than 2 translations 2021-04-20 09:12:15 +02:00
cblgh 93f84e04b0 redirect with 303 See Other 2021-04-20 09:12:15 +02:00
cblgh f535aa8f9c set & use language cookie 2021-04-20 09:12:13 +02:00
cblgh 9863c6b166 add template func for listing languages 2021-04-20 09:11:41 +02:00
Henry a78c039cc7 reuse urlTo in urlToNotice 2021-04-19 15:00:35 +02:00
Henry 3323a85226 refactor urlTo to use domain information for all links 2021-04-19 15:00:29 +02:00
Andre Staltz bb25283b4c
style the alias page and add JS redirect 2021-04-19 10:07:26 +03:00
Henry 04fb06dcaa add member_is_admin and member_has_role template helpers 2021-04-16 09:40:19 +02:00
Andre Staltz 6b082c45f7
more content and member links on the dashboard 2021-04-15 16:24:57 +03:00
Henry 8ff4adf160 various fixes
* fix test compilation
* fix aliases on member page
* add tests for aliases on member.GetByID and ByFeed
* fix admin tests
* use webassert helper for flash messages
* fix flashes
2021-04-12 14:10:42 +02:00
Henry dbf0fe5801 show login error above form 2021-04-12 14:09:09 +02:00
Henry cec7bc0e44 add flash message helper 2021-04-12 14:09:09 +02:00
Henry da62b1eecc add recovery helper to help with panics in handlers 2021-04-12 14:09:09 +02:00
Henry 81bd94344e web/handlers: revamp error localization
fixes #66
2021-04-12 14:09:07 +02:00
Andre Staltz aee9b7ad69
support /login?ssb-http-auth=1 2021-04-09 13:44:12 +03:00
cblgh 35d1d27c5f deny invite consumption for banned keys 2021-04-07 12:58:03 +02:00
cblgh 1b366dcf9f wip fix tests after new roomdb.RoomConfig interface added 2021-04-06 17:21:41 +02:00
cblgh faae7c0324 get started with privacy modes, parse -mode flag 2021-04-06 16:52:51 +02:00
Andre Staltz 08c8b0cced
style the join (claim invite) pages 2021-03-30 18:04:07 +03:00
Henry d1d108b9b7 Add support for invite consumption via JSON 2021-03-29 15:53:30 +02:00
Henry 921626b829 move NetworkInfo to network package
... and implement MultiserverAddress() there.
2021-03-29 12:29:01 +02:00
Andre Staltz c6397c50d3
support multiserverAddress in start-http-auth URI 2021-03-29 12:34:38 +03:00
Andre Staltz 09fcd573b4 style all the sign-in pages 2021-03-26 18:16:26 +01:00
Henry 7a03e5b479 unify login pages 2021-03-26 13:45:21 +01:00
Henry 3b092885fb cleanup 2021-03-26 13:45:21 +01:00
Henry 4325e0fb3d various fixes
* fill in sid and sc
* fix logout
* cascade member removal
* fix links
* trim suffix from signature
* fix /sse/login link
* fix sse links and filenames
* fix logout
* fix typos
* fix test compilation
* fix bridge test
* correct alias url test
* add some comments
* fix potentiall "can't send" deadlock on bridge

some documentation and license headers
2021-03-26 13:45:17 +01:00
Henry 396961e5e8 implement bridge between muxrcp and http 2021-03-26 13:36:48 +01:00
Henry a180c74c38 begin sign-in with ssb
* sketch session store
* use session store and unify authentication handling
* sketch muxrpc handlers
2021-03-26 13:36:42 +01:00
Henry dde6549f02 rename package web/user to web/members 2021-03-22 15:26:11 +01:00
Henry a0be3e998b various fixes 2021-03-22 13:02:39 +01:00