From 758fe3ef8baa68e71f766ae5499dfa6988d0d72a Mon Sep 17 00:00:00 2001 From: Vika Shleina Date: Wed, 21 Jul 2021 06:25:15 +0300 Subject: Added an internal token mechanism The internal token is a shared secret that can update and delete any posts stored in the database. It is intended for use in webmention endpoints to update posts with latest webmentions. Please keep it safe. --- src/indieauth.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/indieauth.rs') diff --git a/src/indieauth.rs b/src/indieauth.rs index 27e545d..aea7e4d 100644 --- a/src/indieauth.rs +++ b/src/indieauth.rs @@ -166,6 +166,17 @@ where .build()) } Some(value) => { + match (&req.state().internal_token) { + Some(token) => if token == &value.last().to_string().split(" ").skip(1).collect::() { + req.set_ext::(User::new( + "", // no user ID here + "https://kittybox.fireburn.ru/", + "update delete undelete media kittybox_internal:do_what_thou_wilt" + )); + return Ok(next.run(req).await) + } + None => {} + } let endpoint = &req.state().token_endpoint; let http_client = &req.state().http_client; let token = value.last().to_string(); -- cgit 1.4.1