Commit Graph

235 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
decentral1se 641069a8f1
Merge pull request #351 from boreq/list-notices-as-json
Add a way to list notices as JSON
2022-11-09 10:28:36 +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 d169aaf137
test: hibp api changes 2022-11-07 21:14:26 +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
decentral1se 18062a2305 feat: member can also invite by SSB-ID
Closes https://github.com/ssb-ngi-pointer/go-ssb-room/issues/283
2022-08-22 12:07:25 +03:00
Benjamin Steinwender 6f5edbaa43
Fix alias generation (#294)
* added test
* fix missing domain
2022-01-18 10:31:01 +02:00
boreq 5687fd5fa1 Fix alias not being displayed on the invites page
Reading the template of the invites page it was the intention of the
author to display the aliases instead of user refs if they are
available. The code loading the invites wasn't properly loading the
aliases of the useres who created them though always leading to this
data not being populated. This fix populates the aliases when listing
invites.

Additionally turned the invite author field into a link. This requires
some extra styling.

Fixes #245.
2021-11-23 09:22:14 -03:00
Andre Staltz 747f5123f3 remove unnecessary code in withssb.go 2021-11-23 09:20:08 -03:00
Andre Staltz 3c6831d39a refactor common util StringifySSBURI 2021-11-23 09:20:08 -03:00
Andre Staltz 2d722f2098 unbreak TestInviteShowAcceptForm 2021-11-23 09:20:08 -03:00
Andre Staltz 8c9413d55d android intent uri does not require package field 2021-11-23 09:20:08 -03:00
Andre Staltz 642022cb0a fix support for SSB URIs on Android Chrome 2021-11-23 09:20:08 -03:00
Henry a249fd8bee fix SPDX headers and add reuse API badge 2021-10-08 14:39:31 +02:00
Tim Nordenfur 5d3ccc7184 combined Invites.Count and Invites.CountActive 2021-06-12 23:43:04 +02:00
Tim Nordenfur 922fa34302 Exclude revoked invites in dashboard invite count 2021-06-10 17:02:16 +02:00
Henry d147d0642a
fix rendering non-members on the dashboard (#238)
* fix rendering non-members on the dashboard

fixes #236

* remove alias or feedref code from template

doing this in the template was hard to read and inefficient.

also: rename OnlineMembers to OnlineUsers since it is a misnomer.
There are other connected peers in a room in certain privacy modes.
2021-06-01 14:23:42 +02:00
Henry 580830be76 went a bit too far with search+replace 2021-05-31 14:53:53 +02:00
Henry 4d3610e2fb prepare v2 release 2021-05-31 14:51:05 +02:00
Henry f83bf65bb9 don't block dasboard rendering for too long
updates #210
2021-05-31 07:38:52 +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 7c356fa407 change []byte password to string 2021-05-13 07:39:19 +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
Henry 5385ef65bb add middleware to check roles
fixes #176
2021-05-10 13:52:45 +02:00
Henry 691f0e75b9 add test for notice creation role check
updates #176
2021-05-10 13:52:45 +02:00
Henry e72f1a3787 cleanup redirect mess for denied removal
updates #205
2021-05-10 13:51:29 +02:00
Henry 3651432b42 use errHandler in admin tests 2021-04-26 09:29:22 +02:00
cblgh cae80e385e make alias mockdb return alias entry 2021-04-26 09:29:22 +02:00
cblgh f0b4c7a534 test that alias resolving is turned off for restricted rooms 2021-04-26 09:29:22 +02:00
cblgh ab06233f28 test invite creation under community & restricted for admin, mod & member
Update web/handlers/admin/setup_test.go

Co-authored-by: Henry <111202+cryptix@users.noreply.github.com>
2021-04-26 09:29:17 +02:00
cblgh 80686dec26 cherrypick: ts.User is now pointer 2021-04-23 13:25:13 +02:00
Henry 57c1375e54 fix missing context 2021-04-23 11:25:35 +02:00
Henry e6ca0ed74b remove unused argument 2021-04-23 08:56:01 +02:00
User Cryptix fc5d3e440e add json response for invite facade (fixes #188) 2021-04-23 08:55:50 +02:00
Andre Staltz 3beb656b9c change join-room to claim-http-invite 2021-04-23 08:54:29 +02:00
cblgh cec5f93fb6 tests for restricted UI behavior
* add tests for privacy mode settings
* test privacy mode settings for member role
* test default language settings
* test denied keys interface for each role
* test adding new member interface depending on role
* test member details depending on role
* test invite button is disabled pending on user role
2021-04-23 08:34:27 +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
Andre Staltz 34eef5fb9b
rename address field in alias JSON resolver 2021-04-21 19:46:45 +03: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 0574c9a235 test language picking 2021-04-20 09:22:53 +02:00
cblgh 1c5c0b9867 make tests more robust when validating specific csrf token 2021-04-20 09:22:53 +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