Skip to content

Commit 7923a69

Browse files
committed
Cleanup, use closure to return Redirect::To
1 parent 2dd5b37 commit 7923a69

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

src/main.rs

-15
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,6 @@ async fn healthz(data: web::Data<AppState>) -> HttpResponse {
274274
}
275275
}
276276

277-
async fn redirector() -> HttpResponse {
278-
HttpResponse::TemporaryRedirect().insert_header((header::LOCATION, "https://tracker.mywaifu.best")).finish()
279-
// HttpResponse::build(StatusCode::TEMPORARY_REDIRECT).append_header((header::LOCATION, "https://tracker.mywaifu.best")).finish()
280-
}
281-
282277
struct AppState {
283278
redis_connection: redis::aio::MultiplexedConnection,
284279
}
@@ -303,7 +298,6 @@ fn init_tracer(args: &Args) -> Result<sdktrace::Tracer, TraceError> {
303298
}
304299

305300
static HOMEPAGE: &'static str = "https://tracker.mywaifu.best";
306-
const HEADER: (header::HeaderName, &'static str) = (header::LOCATION, HOMEPAGE);
307301

308302
#[actix_web::main]
309303
async fn main() -> std::io::Result<()> {
@@ -329,12 +323,6 @@ async fn main() -> std::io::Result<()> {
329323
let port = args.port.unwrap_or_else(|| 6969);
330324
let host = args.host.unwrap_or_else(|| "0.0.0.0".to_string());
331325

332-
// let REDIRECT_RESPONSE = HttpResponse::build(StatusCode::TEMPORARY_REDIRECT).append_header((header::LOCATION, "https://tracker.mywaifu.best")).finish();
333-
// let REDIRECT_RESPONSE = HttpResponse::TemporaryRedirect().insert_header((header::LOCATION, "https://tracker.mywaifu.best"));
334-
// let leaked = Box::leak(*REDIRECT_RESPONSE);
335-
336-
// let myr = Redirect::to(HOMEPAGE);
337-
338326
return HttpServer::new(move || {
339327
App::new()
340328
.app_data(data.clone())
@@ -369,12 +357,9 @@ async fn main() -> std::io::Result<()> {
369357
})
370358
.service(healthz)
371359
.service(announce)
372-
// .default_service(web::to(redirector))
373360
.default_service(web::to(|| async {
374361
Redirect::to(HOMEPAGE)
375-
// myr
376362
}))
377-
// .default_service(web::to(redirector))
378363
})
379364
.bind((host, port))?
380365
.max_connection_rate(8192)

0 commit comments

Comments
 (0)