Commit graph

31 commits

Author SHA1 Message Date
Nutomic 6f3bf4634b
Various pedantic clippy fixes (#2568)
* Various pedantic clippy fixes

* more clippy pedantic fixes

* try to fix ci

* add fix clippy script, use rust 1.65

* fix clippy
2022-11-19 04:33:54 +00:00
Nutomic 63c237d6df
Use enum_delegate crate (#2554) 2022-11-16 22:51:05 +00:00
Dessalines 235cc8b228
Moving settings to Database. (#2492)
* 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.

* Fixing federation tests.

* Trying to fix check features 1.

* Addressing PR comments.

* Adding check_apub to all verify functions.
2022-10-27 09:24:07 +00:00
Dessalines 8bfeb4b627
Fix a few form options for diesel. Fixes #2287 (#2376)
* Fix a few form options for diesel. Fixes #2287

* Adding TODO comment.
2022-07-29 15:04:21 +02: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
Nutomic 166ec196b0
Rework error handling (fixes #1714) (#2135) 2022-03-16 20:11:49 +00:00
Dessalines 16271b0a4c
Empty post bodies (#2050)
* Cleaning optional post bodies. Fixes #2039

* Only trim once.

* Using .map() instead.

* Revert "Using .map() instead."

This reverts commit a2f4907209.
2022-01-21 13:38:01 +00:00
Dessalines 19ccaf767c
Cleaning optional post bodies. Fixes #2039 (#2043)
* Cleaning optional post bodies. Fixes #2039

* Only trim once.

* Using .map() instead.
2022-01-20 14:04:54 +00:00
Riley 35cbae61bc
Don't drop error context when adding a message to errors (#1958)
* Respond directly with LemmyError

Instrument Perform implementations for more precise traces
Use ApiError to format JSON errors when messages are present
Keep SpanTrace output in LemmyError Display impl

* Hide SpanTrace debug output from LemmyError

* Don't log when entering spans, only when leaving

* Update actix-web

* Update actix-rt

* Add newline after error info in LemmyError Display impl

* Propogate span information to blocking operations

* Instrument apub functions

* Use skip_all for more instrument attributes, don't skip 'self' in some api actions

* Make message a static string

* Send proper JSON over websocket

* Add 'message' to LemmyError display if present

* Use a quieter root span builder, don't pretty-print logs

* Keep passwords and emails out of logs

* Re-enable logging Login

* Instrument feeds

* Emit our own errors

* Move error log after status code recording

* Make Sensitive generic over the inner type

* Remove line that logged secrets
2021-12-06 09:54:47 -05:00
Dessalines 451818749b
Fix min title char count for post titles. Fixes #1854 (#1940)
* Fix min title char count for post titles. Fixes #1854

* Adding more newline checks for actors.

* Adding helper function
2021-11-23 15:52:58 +00:00
Felix Ableitner e88106cef4 Use once_cell instead of lazy_static 2021-11-22 19:58:31 +01:00
Dessalines b18ea3e0cc
Renaming to slur_filter. Fixes #1773 (#1801)
* Renaming to slur_filter. Fixes #1773

* Fixing config

* Updating doku for slur filter.

* Updating doku for slur filter again.

* Remove comment.
2021-10-28 20:47:25 +00:00
Nutomic 8067244765
Dont swallow API errors (fixes #1834) (#1837)
Dont swallow API errors (fixes #1834)
2021-10-13 15:50:21 -04:00
Dessalines 8708ad1b44 Moving settings and secrets to context. 2021-09-27 11:25:26 +02:00
Nutomic 3b37ea6c8b
Dont append ? to url when cleaning it (#1716) 2021-08-21 09:36:33 -04:00
Dessalines 7b8cbbba85
Simplify config using macros (#1686)
Co-authored-by: Felix Ableitner <me@nutomic.com>
2021-08-04 21:13:51 +00:00
Dessalines 6ffa291ec9
Actor name length config dess (#1672)
* Make length of user/community name configurable (fixes #1306)

* use single config value, fix migrations, increase displayname length

* remove debug statements

* add helper method for setting actor_name_max_length

* move function

* Fixing some defaults

Co-authored-by: Felix Ableitner <me@nutomic.com>
2021-07-22 21:53:44 -04:00
Dessalines f54209c451
Running clippy --fix (#1647) 2021-07-05 16:07:26 +00:00
Felix Ableitner f289374e70 Remove tracking params from post url (fixes #768) 2021-06-18 20:38:34 +02:00
Pavel Balashov 7008848f9c
Add additional slurs configuration option. Closes #1464. (#1612)
* Actualize a comment about config initialization

* Add additional slurs functionality.

It is possible to additional regex for slurs filtering.
It can be done through `additional_slurs` option in config file.
2021-05-26 13:39:38 +00:00
Nutomic 96488684e6
Better slur regex 2021-04-27 12:32:56 +00:00
Dessalines c864dfadf6
Fixing regex. Fixes #1593 (#1594)
* Fixing regex. Fixes #1593

* Fixing test
2021-04-26 18:18:12 +00:00
Dessalines 5fff927dc4
Adding matrix id validation check. Fixes #1520 (#1538) 2021-04-07 11:38:00 +00:00
Dessalines 799ab94af3 Don't allow zero-space char in display name. Fixes #1317 2021-04-01 14:09:53 -04:00
Dessalines bf7558830f Changing preferred to display name. Fixes #1211 2021-04-01 13:57:45 -04:00
Dessalines c3efb9f7cf Strictly typing DB id fields. Fixes #1498 2021-03-18 16:25:21 -04:00
Felix Ableitner 7f56281c26 Forbid usage of unwrap 2021-03-01 19:24:34 +01:00
Dessalines 462c4a2954
Rewrite settings implementation. Fixes #1270 (#1433)
* A first attempt at using deser-hjson. Fixes #1270

* Trying to fix tests, try 1

* Trying to fix tests, try 2

* A few fixes to deser_hjson

- Removing unwrap_or_defaults, using impl functions.
- Reorganized settings

* Make clippy happy

* hjson list strings must be quoted.

* Adding support for env vars.

* Moving to structs and defaults file.

* Moving settings default and struct.
2021-03-01 17:24:11 +00:00
Felix Ableitner 8096765f0e Fix clippy error upper_case_acronyms 2021-02-22 19:04:32 +01:00
Dessalines 2e5ccaf7fe Fixing display name limit. Fixes #1421 2021-02-10 10:27:48 -05:00
Felix Ableitner 3b64c58198 Move most code into crates/ subfolder 2021-01-20 16:21:27 +01:00
Renamed from lemmy_utils/src/utils.rs (Browse further)