Commit graph

94 commits

Author SHA1 Message Date
Nutomic dc327652a5
Add db table for login tokens which allows for invalidation (#3818)
* wip

* stuff

* fmt

* fmt 2

* fmt 3

* fix default feature

* use Authorization header

* store ip and user agent for each login

* add list_logins endpoint

* serde(skip) for token

* fix api tests

* A few suggestions for login_token (#3991)

* A few suggestions.

* Fixing SQL format.

* review

* review

* rename cookie

---------

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
2023-10-09 12:46:12 +02:00
Nutomic 22608ae983
Rework the way 2FA is enabled/disabled (fixes #3309) (#3959)
* Rework the way 2FA is enabled/disabled (fixes #3309)

* postgres format

* change algo to sha1 for better compat

* review comments

* review

* clippy

---------

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
2023-09-20 10:49:54 -04:00
Lukas Trombach 28324ad2c8
Sitemap (#3808)
* generate sitemap.xml file

* set up endpoint for sitemap

* Update sitemap generation

- remove sitemap generation from scheduled tasks
- add posts query for sitemap
- create sitemap module in API crate

* remove priority and change freq from sitemap

* add configuration option for number of posts for sitemap

* fix default config

* rate limit sitemap endpoint

* update sitemap query

* update sitemap generation

- remove config value for query limit
- adjust sitemap generation to query changes
- tidy up error handling

* refactor sitemap generation loop

* remove `limit` argument

* refactor `generate_urlset` and add unit test

* change query to only fetch local posts of past 24h

* fix outdated comment and log

* cargo fmt
2023-08-22 10:30:15 -04:00
Nutomic 37998b3398
Rewrite some API handlers to remove Perform trait (#3735)
* Rewrite some API handlers to remove Perform trait

* Convert CreateComment

* ci
2023-07-28 10:39:38 -04:00
Dominic Mazzoni fcc010b5dc
Fix concatenation of audio captcha wav files (#3350)
* Fix concatenation of audio captcha wav files

* Log errors rather than crashing

* Return Result from captcha_as_wav_base64

* Change to return LemmyError

* Check for wav write error, format

* Remove unused import

* Rewrite to avoid clippy warnings
2023-06-30 12:36:38 +02:00
TKilFree 2aef6a5a33
feat: re-added captcha checks (#3289) 2023-06-27 06:38:53 -04:00
Dessalines 1f1c0ad17a
Revert "feat: re-added captcha checks (#3249)" (#3288)
This reverts commit 8a086c8240.
2023-06-23 07:02:05 -04:00
TKilFree 8a086c8240
feat: re-added captcha checks (#3249) 2023-06-23 11:47:12 +02:00
Nutomic 3565ad984a
Remove chatserver (#2919)
* Remove chatserver

* fix clippy

* Remove captchas (fixes #2922)

* fix prettier

* fix api_common build

* cargo fmt
2023-06-06 12:27:22 -04:00
Nutomic 3a526b0b7d
Remove unused dependencies (#2795) 2023-04-05 16:29:08 -04:00
Felix Ableitner c6c52ab9cc Add SendActivity trait so that api crates compile in parallel with lemmy_apub 2022-12-02 10:46:49 +01:00
Felix Ableitner 030afbc2e7 Merge websocket crate into api_common 2022-12-02 10:46:49 +01:00
Nutomic d39bc14c43
Add some more clippy lints (#2586)
* Add some more clippy lints

* restore config

* no allow dirty

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
2022-11-24 16:38:00 +00:00
Nutomic df7809fbbb
Specify dependencies and metadata for entire workspace (#2565)
* Specify dependencies and metadata for entire workspace (fixes #2474)

* building api_common shouldnt depend on diesel

* remove drone task

* try with quotes

* fix clippy

* more clippy
2022-11-17 15:23:01 +00:00
Nutomic 63c237d6df
Use enum_delegate crate (#2554) 2022-11-16 22:51:05 +00:00
Dessalines 5d837780f5
Add diesel_async, get rid of blocking function (#2510)
* Moving settings to Database.

- Moves many settings into the database. Fixes #2285
- Adds a local_site and instance table. Fixes #2365 . Fixes #2368
- Separates SQL update an insert forms, to avoid runtime errors.
- Adds TypedBuilder to all the SQL forms, instead of default.

* Fix weird clippy issue.

* Removing extra lines.

* Some fixes from suggestions.

* Fixing apub tests.

* Using instance creation helper function.

* Move forms to their own line.

* Trying to fix local_site_data, still broken.

* Testing out async

* Testing out async 2

* Fixing federation tests.

* Trying to fix check features 1.

* Starting on adding diesel async. 1/4th done.

* Added async to views and schema.

* Adding some more async

* Compiling now.

* Added diesel async. Fixes #2465

* Running clippy --fix

* Trying to fix cargo test on drone.

* Trying new muslrust.

* Trying a custom dns

* Trying a custom dns 2

* Trying a custom dns 3

* Trying a custom dns 4

* Trying a custom dns 5

* Trying a custom dns 6

* Trying a custom dns 7

* Addressing PR comments.

* Adding check_apub to all verify functions.

* Reverting back drone.

* Fixing merge

* Fix docker images.

* Adding missing discussion_languages.

* Trying to fix federation tests.

* Fix site setup user creation.

* Fix clippy

* Fix clippy 2

* Test api faster

* Try to fix 1

* Try to fix 2

* What are these lines about

* Trying to fix 3

* Moving federation test back to top.

* Remove logging cat.
2022-11-09 10:05:00 +00:00
Nutomic b0c3185663
Make verify apub url function async (#2514)
* Make verify apub url function async

* cleanup

* use dep from crates.io

* dont use unwrap
2022-10-28 09:38:22 -04:00
Nutomic 290acf6acc
Use compat mode when signing outgoing activities (fixes #1984) (#2473) 2022-10-03 13:46:42 -04:00
Dessalines c9f1407429
Diesel 2.0.0 upgrade (#2452)
* Initial commit to bump diesel to 2.0.0-rc.0 and see what happens

* Add chrono feature from diesel

* db_schema crate is close to building?

* Upgrade diesel-derive-newtype

* Mostly modifying references to connections to be mutable ones; also used
new way to do migrations as suggested by the migration guide; a lot more
compiles now, though I can't figure out this tricky ToSql issue at the
moment

* Running clippy --fix

* Trying to fix drone clippy 1

* Fix clippy

* Upgrade clux-musl

* Trying to fix drone clippy 2

* Trying to fix drone clippy 3

* Trying to fix drone clippy 5

* Adding diesel table aliases, removing sql view hack. Fixes #2101

Co-authored-by: Steven Chu <stevenc1@gmail.com>
Co-authored-by: Nutomic <me@nutomic.com>
2022-09-26 14:09:32 +00:00
Nutomic 587a0de8f7
Specify minimum Rust version 1.57 (fixes #2333) (#2334)
* Specify minimum Rust version 1.57 (fixes #2333)

* use latest rust for clippy

* use rust 1.60 for clippy

* no add component

* use official rust docker

* comments
2022-06-28 17:44:55 -04:00
Nutomic fcaf7a084c
Upgrade activitypub_federation to 0.2.0, add setting federation.debug (#2300) 2022-06-08 11:45:39 -04:00
Nutomic a2a594b763
Extract Activitypub logic into separate library (#2288)
* Create example for apub lib

* some rewriting of apub lib

* Add LocalInstance struct for apub lib to avoid using Lemmy Settings

* Move ActorType trait to lemmy_apub, because its not needed in library

* Use reqwest_retry instead of custom impl, dont specify timeout on every send()

* Some improvements to example

* Moved inbox handling to library

* bug fixes

* Move context and serde helpers into library

* wip: example changes

* Add lemmy_utils feature to build only LemmyError

* Rename to activitypub_federation

* Remove lemmy_utils dep from activitypub_federation using generic error type

* Finish activitypub example

* Cleanup and fix tests

* Reorganize library files

* Remove ApubObject.to_tombstone()

* Extract activitypub library into separate git repository
2022-06-02 16:33:41 +02:00
Dessalines 1bd57ee5ca Version 0.16.5 2022-05-30 18:32:31 -04:00
Dessalines 69106589ba Fix publish 2022-05-26 16:10:36 -04:00
Felix Ableitner 426e1b1e51 Update image crate 2022-05-17 13:48:47 -04:00
Nutomic 3aa3d75a1e
Add cargo feature for building lemmy_api_common with mininum deps (#2243) 2022-05-03 17:44:13 +00:00
Nutomic 2e01e8e42c
Remove unused dependencies (#2239) 2022-04-27 17:56:05 +02:00
Dessalines c232564fda Version 0.16.3 2022-04-08 10:20:31 -04:00
Dessalines 4878848955 Version 0.16.3-rc.1 2022-04-08 09:17:00 -04:00
Nutomic c7f5337099
Run cargo upgrade (#2176)
* Run cargo upgrade and cargo update

* Fixing validation (#2179)

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
2022-04-01 18:37:51 +00:00
Dessalines d5a213760d Version 0.16.2 2022-03-29 12:56:21 -04:00
Dessalines 7bb8069224 Version 0.16.2-rc.3 2022-03-29 11:54:13 -04:00
Dessalines a11b5b107d Version 0.16.2-rc.2 2022-03-26 21:37:12 -04:00
Dessalines c681bb79b1 Version 0.16.2-rc.1 2022-03-24 18:25:21 -04:00
Dessalines 514e2301b5 Version 0.16.1 2022-03-15 17:23:16 -04:00
Dessalines 9fd6a48e3c Version 0.16.1-rc.1 2022-03-15 16:52:37 -04:00
Dessalines 05f20da51f Version 0.16.0 2022-03-08 13:45:01 -05:00
Dessalines 82dec1911f Version 0.16.0-rc.4 2022-03-08 08:57:57 -05:00
Dessalines 15ff832c4a Version 0.16.0-rc.3 2022-03-07 18:59:29 -05:00
Dessalines aef2abb962 Version 0.16.0-rc.2 2022-03-03 14:40:09 -05:00
Rob Ede b06f3eb32e
Update actix-* dependencies to stable v4. 2022-03-02 18:00:52 +00:00
Dessalines 1b5037e92d Version 0.16.0-rc.1 2022-03-02 12:41:11 -05:00
Nutomic 5a8c894359
Upgrade to Rust 2021 edition (#2093)
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
2022-02-14 15:34:54 +00:00
Dessalines f53902ecff Version 0.15.1 2022-01-12 09:45:29 -05:00
Dessalines bccb4f068d Version 0.15.0 2022-01-12 08:46:35 -05:00
Dessalines a24676e629 Version 0.15.0-rc.7 2022-01-09 11:09:03 -05:00
Riley 41b90bb162
Add console-subscriber (#2003)
* Add console-subscriber

* Add larg event buffer capacity

* Add console port to lemmy prod container

* Expose pict-rs console port

* Update pictrs
2022-01-07 09:53:45 -05:00
Rob Ede f6c13cf313
Updated actix-web dependency to 4.0.0-beta.18 2021-12-30 18:37:59 +00:00
Dessalines c883a49a40
First pass at invite-only migration. (#1949)
* First pass at invite-only migration.

* Implement email verification (fixes #219)

* remove unwrap

* Adding views and functionality to registration application. #209

* Add private instance site column, and back end checks.

* Adding some message fields to LoginResponse

* Adding private instance to site setup.

* A few additions:

- Add a DeleteAccount response.
- RegistrationApplicationView now has the safe LocalUserSettings.
- Adding VerifyEmail to websocket API, added a proper response type.

* Adding and reorganizing some email helpers.

* A few fixes for private sites:

- Added a check_registration_application function.
- Only send a verification email if its been changed.
- VerifyEmail now returns LoginResponse.
- Deleting the old tokens after a successful email verify.
- If port is missing on email config, display a better error message.

* Version 0.15.0-rc.3

* Adding published to email_verification table.

* Adding fixes from comments.

* Version 0.15.0-rc.4

* Adding modlog private site check.

* Version 0.15.0-rc.6

Co-authored-by: Felix Ableitner <me@nutomic.com>
2021-12-15 14:49:59 -05:00
Dessalines 1410c5659c
Upgrading deps (#1995) 2021-12-14 13:30:37 +00:00