Commit Graph

21 Commits

Author SHA1 Message Date
Simon Ser
9df9880301 Add disable-inactive-user config option
This can be used to automatically disable users if they don't
actively use the bouncer for a while.
2023-01-26 19:42:29 +01:00
Simon Ser
57f5ee8d6f Add user downstream interaction time 2023-01-26 19:42:29 +01:00
Simon Ser
d7d9d45b45 Add a flag to disable users
Add a new flag to disable users. This can be useful to temporarily
deactivate an account without erasing data.

The user goroutine is kept alive for simplicity's sake. Most of the
infrastructure assumes that each user always has a running goroutine.
A disabled user's goroutine is responsible for sending back an error
to downstream connections, and listening for potential events to
re-enable the account.
2023-01-26 18:33:55 +01:00
Simon Ser
5a9dced249 database: store user creation date
This is useful to figure out which users were created recently.
2023-01-26 17:12:58 +01:00
Simon Ser
2abe231eef database/sqlite: introduce sqliteTime type
This implements sql.Scanner and sql/driver.Valuer, so that we can
load/store time values into SQLite with the format we want, and
properly handle NULL (which the go-sqlite3 package doesn't do
correctly).
2023-01-26 14:38:28 +01:00
rj1
be185fba33 Implement TLS fingerprint pinning
Closes: https://todo.sr.ht/~emersion/soju/56
2022-12-16 17:44:14 +01:00
zsrv
926dcb37ac Make the auto-away functionality configurable 2022-09-26 19:52:07 +02:00
Łukasz Margiela
d605d64d1d Add build tag for modernc/sqlite driver 2022-09-26 19:31:43 +02:00
Simon Ser
a9949c2e95 database/sqlite: make optional
SQLite requires cgo, for some use cases this is undesirable.
2022-09-11 13:57:00 +02:00
Simon Ser
ce19f76673 database/postgres: fix inverted networkID check in ListWebPushSubscriptions
Same as 02844ca9df ("database/postgres: fix inverted networkID
check in StoreWebPushSubscription").
2022-07-27 09:48:52 +02:00
Simon Ser
02844ca9df database/postgres: fix inverted networkID check in StoreWebPushSubscription
Presented without comment.
2022-07-25 19:32:09 +02:00
Simon Ser
8849669d61 database/postgres: set max open conns
Open at most 25 connections. Should fix errors such as
"pq: sorry, too many clients already".
2022-07-25 19:00:14 +02:00
Simon Ser
d0868722cd database/postgres: make WebPushSubscription.user NOT NULL
Also see 6734464b72 ("database/postgres: fix inverted network and
user in StoreWebPushSubscription").
2022-07-25 18:55:22 +02:00
Simon Ser
6734464b72 database/postgres: fix inverted network and user in StoreWebPushSubscription 2022-07-25 18:49:21 +02:00
gildarts
48960a2992 database: upgrade bcrypt cost as needed
Closes: https://todo.sr.ht/~emersion/soju/136
2022-07-12 18:52:49 +02:00
Simon Ser
dc0a847240 Add per-user default nickname
The soju username is immutable. Add a separate nickname setting so
that users can change their nickname for all networks.

References: https://todo.sr.ht/~emersion/soju/110
2022-07-08 18:01:05 +02:00
Simon Ser
27b8547572 database/sqlite: add migration for WebPushSubscription.user
This should be enough to fixup the user column for subscriptions
with a network specified.
2022-06-16 19:46:59 +02:00
Simon Ser
f0db261fc0 database: add missing user column to WebPushSubscription table
Some WebPushSubscription entries aren't tried to a network, in
which case the "network" column is NULL. But then all users share
the same row. Oops.

Fortunately network-less subscriptions aren't used for anything
yet, they're just stored. So the impact should be minimal.
2022-06-16 19:33:39 +02:00
Simon Ser
3863b8cb6b Add webpush extension
References: https://github.com/ircv3/ircv3-specifications/pull/471
Co-authored-by: delthas <delthas@dille.cc>
2022-06-14 16:16:12 +02:00
Simon Ser
fe40c51ff0 database: add User.{Check,Set}Password 2022-06-08 13:27:33 +02:00
Simon Ser
3a7dee8128 Introduce a database package 2022-05-09 15:08:04 +02:00