summaryrefslogtreecommitdiff
path: root/src/api
diff options
context:
space:
mode:
authorTyler Murphy <tylermurphy534@gmail.com>2023-02-02 11:29:37 -0500
committerTyler Murphy <tylermurphy534@gmail.com>2023-02-02 11:29:37 -0500
commit18a27f62befb0c0d2e3b175f08f6088f10b25063 (patch)
tree1d8c0d00685f9374fdb3705062c08265d7e1fdb0 /src/api
parentadd caching header (diff)
downloadxssbook-18a27f62befb0c0d2e3b175f08f6088f10b25063.tar.gz
xssbook-18a27f62befb0c0d2e3b175f08f6088f10b25063.tar.bz2
xssbook-18a27f62befb0c0d2e3b175f08f6088f10b25063.zip
loading by offset on profile
Diffstat (limited to 'src/api')
-rw-r--r--src/api/mod.rs2
-rw-r--r--src/api/posts.rs3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/api/mod.rs b/src/api/mod.rs
index 9efcefc..925aa4a 100644
--- a/src/api/mod.rs
+++ b/src/api/mod.rs
@@ -16,7 +16,7 @@ pub use auth::RegistrationRequet;
pub fn router() -> Router {
let governor_conf = Box::new(
GovernorConfigBuilder::default()
- .burst_size(10)
+ .burst_size(1000)
.per_second(1)
.key_extractor(SmartIpKeyExtractor)
.finish()
diff --git a/src/api/posts.rs b/src/api/posts.rs
index 3a2e507..d85fb98 100644
--- a/src/api/posts.rs
+++ b/src/api/posts.rs
@@ -72,6 +72,7 @@ async fn page(
#[derive(Deserialize)]
struct UsersPostsRequest {
user_id: u64,
+ page: u64
}
impl Check for UsersPostsRequest {
@@ -84,7 +85,7 @@ async fn user(
AuthorizedUser(_user): AuthorizedUser,
Json(body): Json<UsersPostsRequest>,
) -> Response {
- let Ok(posts) = Post::from_user_id(body.user_id) else {
+ let Ok(posts) = Post::from_user_post_page(body.user_id, body.page) else {
return ResponseCode::InternalServerError.text("Failed to fetch posts")
};