Skip to content

Commit

Permalink
fix dash path (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibigbug authored Oct 4, 2023
1 parent 3d199c3 commit 931f16c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion clash_lib/src/app/api/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::path::PathBuf;
use std::{net::SocketAddr, sync::Arc};

use axum::{response::Redirect, routing::get, Router};
Expand Down Expand Up @@ -39,6 +40,7 @@ pub fn get_api_runner(
statistics_manager: Arc<StatisticsManager>,
cache_store: ThreadSafeCacheFile,
router: ThreadSafeRouter,
cwd: String,
) -> Option<Runner> {
if let Some(bind_addr) = controller_cfg.external_controller {
let app_state = Arc::new(AppState {
Expand Down Expand Up @@ -92,7 +94,7 @@ pub fn get_api_runner(
if let Some(external_ui) = controller_cfg.external_ui {
app = app
.route("/ui", get(|| async { Redirect::to("/ui/") }))
.nest_service("/ui/", ServeDir::new(external_ui));
.nest_service("/ui/", ServeDir::new(PathBuf::from(cwd).join(external_ui)));
}

axum::Server::bind(&addr)
Expand Down
2 changes: 1 addition & 1 deletion clash_lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use config::def::LogLevel;
use proxy::tun::get_tun_runner;
use state::Storage;
use std::io;
use std::path::PathBuf;
use tokio::task::JoinHandle;

use std::sync::Arc;
Expand Down Expand Up @@ -246,6 +245,7 @@ async fn start_async(opts: Options) -> Result<(), Error> {
statistics_manager,
cache_store,
router,
cwd.to_string_lossy().to_string(),
);
if let Some(r) = api_runner {
runners.push(r);
Expand Down

0 comments on commit 931f16c

Please sign in to comment.