Fix websocket location to /api/vX

This commit is contained in:
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
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
async fn chat_route(
pub async fn chat_route(
req: HttpRequest,
stream: web::Payload,
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_crud::PerformCrud;
use lemmy_utils::rate_limit::RateLimit;
use lemmy_websocket::LemmyContext;
use lemmy_websocket::{routes::chat_route, LemmyContext};
use serde::Deserialize;
pub fn config(cfg: &mut web::ServiceConfig, rate_limit: &RateLimit) {
cfg.service(
web::scope("/api/v3")
// Websocket
.service(web::resource("/ws").to(chat_route))
// Site
.service(
web::scope("/site")

View file

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