Fix websocket location to /api/vX

pull/1529/head
Dessalines 2021-03-29 17:48:37 -04:00
parent 4c8f2e976e
commit 4da6e42fc1
3 changed files with 4 additions and 7 deletions

View File

@ -15,12 +15,8 @@ const HEARTBEAT_INTERVAL: Duration = Duration::from_secs(5);
/// How long before lack of client response causes a timeout /// How long before lack of client response causes a timeout
const CLIENT_TIMEOUT: Duration = Duration::from_secs(10); const CLIENT_TIMEOUT: Duration = Duration::from_secs(10);
pub fn config(cfg: &mut web::ServiceConfig) {
cfg.service(web::resource("/ws").to(chat_route));
}
/// Entry point for our route /// Entry point for our route
async fn chat_route( pub async fn chat_route(
req: HttpRequest, req: HttpRequest,
stream: web::Payload, stream: web::Payload,
context: web::Data<LemmyContext>, context: web::Data<LemmyContext>,

View File

@ -3,12 +3,14 @@ use lemmy_api::Perform;
use lemmy_api_common::{comment::*, community::*, person::*, post::*, site::*, websocket::*}; use lemmy_api_common::{comment::*, community::*, person::*, post::*, site::*, websocket::*};
use lemmy_api_crud::PerformCrud; use lemmy_api_crud::PerformCrud;
use lemmy_utils::rate_limit::RateLimit; use lemmy_utils::rate_limit::RateLimit;
use lemmy_websocket::LemmyContext; use lemmy_websocket::{routes::chat_route, LemmyContext};
use serde::Deserialize; use serde::Deserialize;
pub fn config(cfg: &mut web::ServiceConfig, rate_limit: &RateLimit) { pub fn config(cfg: &mut web::ServiceConfig, rate_limit: &RateLimit) {
cfg.service( cfg.service(
web::scope("/api/v3") web::scope("/api/v3")
// Websocket
.service(web::resource("/ws").to(chat_route))
// Site // Site
.service( .service(
web::scope("/site") web::scope("/site")

View File

@ -91,7 +91,6 @@ async fn main() -> Result<(), LemmyError> {
.data(context) .data(context)
// The routes // The routes
.configure(|cfg| api_routes::config(cfg, &rate_limiter)) .configure(|cfg| api_routes::config(cfg, &rate_limiter))
.configure(lemmy_websocket::routes::config)
.configure(lemmy_apub::routes::config) .configure(lemmy_apub::routes::config)
.configure(feeds::config) .configure(feeds::config)
.configure(|cfg| images::config(cfg, &rate_limiter)) .configure(|cfg| images::config(cfg, &rate_limiter))