[FIX] Migrated to Tensamin Transport Protocol

This commit is contained in:
Alex Emmet 2026-02-27 23:45:22 +01:00
commit a0ae378601
11 changed files with 619 additions and 1585 deletions

View file

@ -1,11 +1,10 @@
use crate::{
log,
server::{api, short_link::get_short_link, socket},
server::{api, short_link::get_short_link},
util::file_util::get_directory,
};
use actix_web::{App, HttpRequest, HttpResponse, HttpServer, Responder, http::header, web};
use actix_web_actors::ws;
use rustls::ServerConfig;
use rustls::pki_types::{CertificateDer, PrivateKeyDer};
@ -42,7 +41,6 @@ pub async fn start(port: u16) -> anyhow::Result<()> {
App::new()
.route("/api/{path:.*}", web::to(api_handler))
.route("/direct/{path:.*}", web::to(direct_handler))
.route("/ws/{path:.*}", web::get().to(ws_handler))
})
.bind_rustls_0_23(addr, config)?
.run()
@ -64,16 +62,6 @@ async fn direct_handler(req: HttpRequest) -> impl Responder {
.finish()
}
}
async fn ws_handler(
req: HttpRequest,
stream: web::Payload,
path: web::Path<String>,
) -> Result<HttpResponse, actix_web::Error> {
let path = path.into_inner();
println!("WS handler reached: {}", path);
ws::start(socket::WsSession::new(path), &req, stream)
}
async fn api_handler(req: HttpRequest, body: web::Bytes) -> HttpResponse {
let path = req.uri().path().to_string();