feat: reorganize with remote
This commit is contained in:
parent
a74e5753fa
commit
dc7b8cbadd
28 changed files with 622 additions and 3024 deletions
24
remote/noisebell-common/src/lib.rs
Normal file
24
remote/noisebell-common/src/lib.rs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
use axum::http::HeaderMap;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub fn validate_bearer(headers: &HeaderMap, expected: &str) -> bool {
|
||||
headers
|
||||
.get("authorization")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.map(|v| v.strip_prefix("Bearer ").unwrap_or("") == expected)
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct WebhookPayload {
|
||||
pub status: String,
|
||||
pub timestamp: u64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct HistoryEntry {
|
||||
pub id: i64,
|
||||
pub status: String,
|
||||
pub timestamp: u64,
|
||||
pub recorded_at: u64,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue