From 56e337b23c298b1ccddfc94298570705ebc69cb5 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 6 Dec 2019 20:57:48 -0800 Subject: [PATCH 1/3] Upping rate limit for register and community creation to 3/hour. - Fixes #353 --- ansible/templates/env | 2 +- docker/dev/.env | 2 +- docker/prod/.env | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ansible/templates/env b/ansible/templates/env index 8b45ef77..22e9beda 100644 --- a/ansible/templates/env +++ b/ansible/templates/env @@ -6,7 +6,7 @@ RATE_LIMIT_MESSAGE=30 RATE_LIMIT_MESSAGE_PER_SECOND=60 RATE_LIMIT_POST=3 RATE_LIMIT_POST_PER_SECOND=600 -RATE_LIMIT_REGISTER=1 +RATE_LIMIT_REGISTER=3 RATE_LIMIT_REGISTER_PER_SECOND=3600 SMTP_SERVER={{ smtp_server }} SMTP_LOGIN={{ smtp_login }} diff --git a/docker/dev/.env b/docker/dev/.env index fb43451d..014ce5c3 100644 --- a/docker/dev/.env +++ b/docker/dev/.env @@ -7,7 +7,7 @@ RATE_LIMIT_MESSAGE=30 RATE_LIMIT_MESSAGE_PER_SECOND=60 RATE_LIMIT_POST=6 RATE_LIMIT_POST_PER_SECOND=600 -RATE_LIMIT_REGISTER=1 +RATE_LIMIT_REGISTER=3 RATE_LIMIT_REGISTER_PER_SECOND=3600 # Optional email fields diff --git a/docker/prod/.env b/docker/prod/.env index fb43451d..014ce5c3 100644 --- a/docker/prod/.env +++ b/docker/prod/.env @@ -7,7 +7,7 @@ RATE_LIMIT_MESSAGE=30 RATE_LIMIT_MESSAGE_PER_SECOND=60 RATE_LIMIT_POST=6 RATE_LIMIT_POST_PER_SECOND=600 -RATE_LIMIT_REGISTER=1 +RATE_LIMIT_REGISTER=3 RATE_LIMIT_REGISTER_PER_SECOND=3600 # Optional email fields From b736ab3a6a95d92a55dda4aba8714704520be3ab Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 6 Dec 2019 21:09:59 -0800 Subject: [PATCH 2/3] Adding API docs for RSS feeds. - Fixes #348 --- docs/api.md | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/docs/api.md b/docs/api.md index f31fb60d..16383d53 100644 --- a/docs/api.md +++ b/docs/api.md @@ -1,11 +1,11 @@ -# Lemmy WebSocket API +# Lemmy API *Note: this may lag behind the actual API endpoints [here](../server/src/api).* - [Data types](#data-types) - [Basic usage](#basic-usage) - * [Endpoint](#endpoint) + * [WebSocket Endpoint](#websocket-endpoint) * [Testing with Websocat](#testing-with-websocat) * [Testing with the WebSocket JavaScript API](#testing-with-the-websocket-javascript-api) - [Rate limits](#rate-limits) @@ -125,6 +125,10 @@ + [Create Comment Like](#create-comment-like) - [Request](#request-35) - [Response](#response-35) + * [RSS / Atom feeds](#rss--atom-feeds) + + [All](#all) + + [Community](#community-1) + + [User](#user) @@ -140,7 +144,7 @@ Request and response strings are in [JSON format](https://www.json.org). -### Endpoint +### WebSocket Endpoint Connect to ws://***host***/api/v1/ws to get started. @@ -1010,3 +1014,18 @@ Mods and admins can remove a comment, creators can delete it. comment: CommentView } ``` + +### RSS / Atom feeds + +#### All + +`/feeds/all.xml?sort=Hot` + +#### Community + +`/feeds/c/community-name.xml?sort=Hot` + +#### User + +`/feeds/u/user-name.xml?sort=Hot` + From 81c99119651d1221be0f2ccbf54e3c9ef9f3efe5 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 6 Dec 2019 22:43:20 -0800 Subject: [PATCH 3/3] Show removed posts in users history. - Fixes #354 --- server/src/db/post_view.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/server/src/db/post_view.rs b/server/src/db/post_view.rs index 51dea027..e4e3c16d 100644 --- a/server/src/db/post_view.rs +++ b/server/src/db/post_view.rs @@ -95,8 +95,15 @@ impl PostView { let mut query = post_view.into_boxed(); + // If its for a specific user, show the removed / deleted if let Some(for_creator_id) = for_creator_id { query = query.filter(creator_id.eq(for_creator_id)); + } else { + query = query + .filter(removed.eq(false)) + .filter(deleted.eq(false)) + .filter(community_removed.eq(false)) + .filter(community_deleted.eq(false)); }; if let Some(search_term) = search_term { @@ -161,13 +168,7 @@ impl PostView { .then_order_by(score.desc()), }; - query = query - .limit(limit) - .offset(offset) - .filter(removed.eq(false)) - .filter(deleted.eq(false)) - .filter(community_removed.eq(false)) - .filter(community_deleted.eq(false)); + query = query.limit(limit).offset(offset); query.load::(conn) }