Commit graph

40 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
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
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 a6dc6804aa
Pass LocalUser to PostQuery etc, instead of separate params (#2413) 2022-08-19 10:27:39 -04:00
Nutomic 8a4d9cc1ba
Use typed-builder crate for queries (#2379)
* Use typed-builder crate for PrivateMessageQuery

* derive builder for all queries

* remove unnecessary clones

* fix tests
2022-08-04 15:30:17 -04:00
Dessalines 9c3efe32e7
First pass at adding comment trees. (#2362)
* First pass at adding comment trees.

- Extracted comment replies into its own table.
- Added ltree column to comment
- Added parent_id param to GetComments to fetch a tree branch
- No paging / limiting yet

* Adding child_count to comment_aggregates.

* Adding parent comment update counts

* Fix unit tests.

* Comment tree paging mostly done.

* Fix clippy

* Fix drone tests wrong postgres version.

* Fix unit tests.

* Add back in delete in unit test.

* Add postgres upgrade script.

* Fixing some PR comments.

* Move update ltree into Comment::create

* Updating based on comments.

* Fix send soft fail.
2022-07-30 05:55:59 +02:00
Dessalines 3b86e15399
Remove listing type community. Fixes #2361 (#2377)
* Remove listing type community. Fixes #2361

* Have ListingType::All be the default
2022-07-29 10:57:39 +00:00
Nutomic b7a2677b4d
Be more explicit about returning deleted actors or not (#2335)
* Be more explicit about returning deleted actors or not

* simplify db queries
2022-07-05 17:40:44 -04:00
Dessalines 40609549d8
Increase RSS fetch limit to 20. Fixes #2319 (#2327) 2022-06-22 12:30:09 +00: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 3053e14be7
Derive default for api request structs, move type enums (#2245)
* Derive default for api request structs, move type enums

* Simplify api by using enum types directly, instead of string

* Add default and clone for most api structs
2022-05-06 20:55:07 +00:00
Nutomic 3aa3d75a1e
Add cargo feature for building lemmy_api_common with mininum deps (#2243) 2022-05-03 17:44:13 +00:00
Dessalines 4cf0da7b60 Clippy fixes. 2022-03-30 10:58:03 -04:00
Nutomic 660efd1549
Correctly read local SiteView (#2122) 2022-03-08 12:52:33 +00:00
Dessalines ffd2ba5d90
Fix community rss. Fixes #2116 (#2119)
Co-authored-by: Nutomic <me@nutomic.com>
2022-03-07 21:49:02 +00:00
Nutomic 4a23ee4d8b
Dont make webfinger request when viewing community/user profile (fixes #1896) (#2049) 2022-01-27 16:39:22 +00:00
Dessalines a212f6b780
Fixing liking comment on blocked person. Fixes #2033 (#2042) 2022-01-19 14:17:18 +00:00
Dessalines 1410c5659c
Upgrading deps (#1995) 2021-12-14 13:30:37 +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
Felix Ableitner e88106cef4 Use once_cell instead of lazy_static 2021-11-22 19:58:31 +01:00
Felix Ableitner f24999027e Merge crates db_schema and db_queries 2021-10-20 12:28:08 +02:00
Nutomic f4c783cba5
Fix clippy warnings added in nightly (#1833) 2021-10-12 12:46:26 -04:00
Dessalines 8708ad1b44 Moving settings and secrets to context. 2021-09-27 11:25:26 +02:00
Felix Ableitner cf214ff583 Move jwt secret from config to database (fixes #1728) 2021-09-27 11:25:09 +02:00
Dessalines 9840f5c1c1
Upgrading deps, running clippy fix on nightly 1.55.0 (#1638)
* Upgrading deps, running clippy fix on nightly 1.55.0

* Running clippy --fix

* Trying to fix transform

* Trying to fix another transform

* Upgrading http-signature-normalization-actix

* Fix app_data

* Fix pictrs uploading

* Fix unwrap
2021-07-06 13:26:46 +00:00
Dessalines f54209c451
Running clippy --fix (#1647) 2021-07-05 16:07:26 +00:00
Dessalines 880c51687a Merge branch 'main' into feature/mark_post_as_read 2021-04-26 10:44:19 -04:00
Dessalines 5b2be6f9df Add show_read_posts filter. Fixes #1561 2021-04-24 18:26:50 -04:00
Dessalines f8cd6fd445 Making more fields optional in the API.
- Fixes #1569
2021-04-23 02:30:13 -04:00
Nutomic efee2062dd
Mark accounts as bot nutomic (#1565)
* Mark account as bot. Fixes #1357

* Fix clippy

* Federate bot status using actor `type` field

* fix clippy

Co-authored-by: Dessalines <tyhou13@gmx.com>
2021-04-21 17:41:14 -04:00
Felix Ableitner 249fcc5066 Split api crate into api_structs and api 2021-03-25 20:19:40 +01:00
Dessalines 05b485b678 Merge branch 'Mart-Bogdan-1462-jwt-revocation-on-pwd-change' into jwt_revocation_dess 2021-03-19 00:31:49 -04:00
Dessalines c3efb9f7cf Strictly typing DB id fields. Fixes #1498 2021-03-18 16:25:21 -04:00
Dessalines 8ee624a542 Some changes
- Changing claim name to local_user_id to facilitate logout.
- Changing AddAdmin back to using person_id
2021-03-15 14:02:27 -04:00
Dessalines ddf4a667b1 ~80% done 2021-03-10 17:33:55 -05:00
Dessalines a1c7584875 Remove extra category_id s . Fixes #1429 2021-03-03 23:44:07 -05: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 3bdd78f341 Rename lemmy_structs to lemmy_api_structs 2021-03-01 14:08:41 +01:00
Dessalines 37ad9e9a09 Change RSS feeds to use lemmy URL for the rss link. Fixes #1378 2021-02-10 15:43:03 -05:00
Felix Ableitner 999d9f4d6c Move routes into separate crate to speed up compilation 2021-02-09 19:34:36 +01:00
Renamed from src/routes/feeds.rs (Browse further)