mirror of https://github.com/mastodon/flodgatt
Merge pull request #1 from tootsuite/setup-housekeeping
Initial setup/housekeeping
This commit is contained in:
commit
36c2734c86
|
@ -1 +0,0 @@
|
|||
max_width = 120
|
|
@ -2,5 +2,5 @@ use crate::AppState;
|
|||
use actix_web::{HttpRequest, Responder};
|
||||
|
||||
pub fn index(_req: HttpRequest<AppState>) -> impl Responder {
|
||||
"OMG! It works!"
|
||||
"placeholder response from direct::index"
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@ use crate::AppState;
|
|||
use actix_web::{HttpRequest, Responder};
|
||||
|
||||
pub fn index(_req: HttpRequest<AppState>) -> impl Responder {
|
||||
"OMG! It works!"
|
||||
"placeholder response from hashtag::index"
|
||||
}
|
||||
|
||||
pub fn local(_req: HttpRequest<AppState>) -> impl Responder {
|
||||
"OMG! It works!"
|
||||
"placeholder response from hashtag::local"
|
||||
}
|
||||
|
|
|
@ -2,5 +2,5 @@ use crate::AppState;
|
|||
use actix_web::{HttpRequest, Responder};
|
||||
|
||||
pub fn index(_req: HttpRequest<AppState>) -> impl Responder {
|
||||
"OMG! It works!"
|
||||
"placeholder response from list::index"
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@ use crate::AppState;
|
|||
use actix_web::{HttpRequest, Responder};
|
||||
|
||||
pub fn index(_req: HttpRequest<AppState>) -> impl Responder {
|
||||
"OMG! It works!"
|
||||
"placeholder response from public::index"
|
||||
}
|
||||
|
||||
pub fn local(_req: HttpRequest<AppState>) -> impl Responder {
|
||||
"OMG! It works!"
|
||||
"placeholder response from public::local"
|
||||
}
|
||||
|
|
|
@ -2,5 +2,5 @@ use crate::AppState;
|
|||
use actix_web::{HttpRequest, Responder};
|
||||
|
||||
pub fn index(_req: HttpRequest<AppState>) -> impl Responder {
|
||||
"OMG! It works!"
|
||||
"placeholder response from user::index"
|
||||
}
|
||||
|
|
|
@ -15,18 +15,26 @@ impl Actor for WebsocketActor {
|
|||
/// Handler for ws::Message message
|
||||
impl StreamHandler<ws::Message, ws::ProtocolError> for WebsocketActor {
|
||||
fn started(&mut self, ctx: &mut Self::Context) {
|
||||
ctx.run_interval(Duration::from_secs(HEARTBEAT_INTERVAL_SECONDS), |_, inner_ctx| {
|
||||
inner_ctx.ping("");
|
||||
});
|
||||
ctx.run_interval(
|
||||
Duration::from_secs(HEARTBEAT_INTERVAL_SECONDS),
|
||||
|_, inner_ctx| {
|
||||
inner_ctx.ping("Ping from StreamHandler");
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// This appears to be an echo server based on the actix_web documentation
|
||||
// We won't actually need echo functionality in the final server
|
||||
fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) {
|
||||
debug!("Message {:?}", msg);
|
||||
|
||||
let red = ctx.state().redis.send(Command(RespValue::SimpleString("GET".into())));
|
||||
let red = ctx
|
||||
.state()
|
||||
.redis
|
||||
.send(Command(RespValue::SimpleString("GET".into())));
|
||||
|
||||
match msg {
|
||||
ws::Message::Pong(msg) => debug!("{}", msg),
|
||||
ws::Message::Pong(msg) => debug!("matched: {}", msg),
|
||||
ws::Message::Text(text) => ctx.text(text),
|
||||
_ => (),
|
||||
}
|
||||
|
|
|
@ -91,6 +91,10 @@ fn cors_middleware() -> Cors {
|
|||
Cors::build()
|
||||
.allowed_origin("*")
|
||||
.allowed_methods(vec!["GET", "OPTIONS"])
|
||||
.allowed_headers(vec![header::AUTHORIZATION, header::ACCEPT, header::CACHE_CONTROL])
|
||||
.allowed_headers(vec![
|
||||
header::AUTHORIZATION,
|
||||
header::ACCEPT,
|
||||
header::CACHE_CONTROL,
|
||||
])
|
||||
.finish()
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
pub mod auth;
|
||||
pub mod auth;
|
||||
|
|
Loading…
Reference in New Issue