tweak
This commit is contained in:
parent
ab5f97d05f
commit
13a8f5dc8a
2 changed files with 10 additions and 7 deletions
12
src/lib.rs
12
src/lib.rs
|
|
@ -31,8 +31,8 @@ pub struct BlogdorTheAggregator {
|
||||||
endpoint: String,
|
endpoint: String,
|
||||||
channel_id: u32,
|
channel_id: u32,
|
||||||
email: String,
|
email: String,
|
||||||
password: String, // sent *to zulip* in POSTs *from us*
|
zulip_token: String, // sent *to zulip* in POSTs *from us*
|
||||||
token: String, // checked against incoming POSTs *from zulip*
|
blogdor_token: String, // sent *from zulip* in POSTs *to us*
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, PartialEq, Eq)]
|
#[derive(Debug, Default, Clone, PartialEq, Eq)]
|
||||||
|
|
@ -85,8 +85,8 @@ impl BlogdorTheAggregator {
|
||||||
endpoint,
|
endpoint,
|
||||||
channel_id,
|
channel_id,
|
||||||
email,
|
email,
|
||||||
password,
|
zulip_token: password,
|
||||||
token,
|
blogdor_token: token,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -95,7 +95,7 @@ impl BlogdorTheAggregator {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn spawn_http(&self) {
|
pub async fn spawn_http(&self) {
|
||||||
let state = ServerState::new(self.db.clone(), &self.email, &self.token);
|
let state = ServerState::new(self.db.clone(), &self.email, &self.blogdor_token);
|
||||||
server::spawn_server(state, self.cancel.clone()).await;
|
server::spawn_server(state, self.cancel.clone()).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -161,7 +161,7 @@ impl BlogdorTheAggregator {
|
||||||
match self
|
match self
|
||||||
.client
|
.client
|
||||||
.post(&self.endpoint)
|
.post(&self.endpoint)
|
||||||
.basic_auth(&self.email, Some(&self.password))
|
.basic_auth(&self.email, Some(&self.zulip_token))
|
||||||
.body(msg)
|
.body(msg)
|
||||||
.header("Content-Type", "application/x-www-form-urlencoded")
|
.header("Content-Type", "application/x-www-form-urlencoded")
|
||||||
.send()
|
.send()
|
||||||
|
|
|
||||||
|
|
@ -65,10 +65,13 @@ async fn handle_add_feed(
|
||||||
} = request;
|
} = request;
|
||||||
if state.email == bot_email && state.token == token {
|
if state.email == bot_email && state.token == token {
|
||||||
tracing::debug!("gonna do a thing with {message:?}");
|
tracing::debug!("gonna do a thing with {message:?}");
|
||||||
|
// things
|
||||||
|
|
||||||
|
(StatusCode::IM_A_TEAPOT, "nee-ope")
|
||||||
} else {
|
} else {
|
||||||
tracing::debug!("psych");
|
tracing::debug!("psych");
|
||||||
}
|
|
||||||
(StatusCode::IM_A_TEAPOT, "nee-ope")
|
(StatusCode::IM_A_TEAPOT, "nee-ope")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn graceful_shutdown(cancel: CancellationToken) {
|
async fn graceful_shutdown(cancel: CancellationToken) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue