Skip to content

Commit d3b9e36

Browse files
committed
serve console index at /settings/*
1 parent 4b133fa commit d3b9e36

File tree

1 file changed

+33
-15
lines changed

1 file changed

+33
-15
lines changed

nexus/src/external_api/console_api.rs

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -558,22 +558,8 @@ pub async fn session_me(
558558
apictx.external_latencies.instrument_dropshot_handler(&rqctx, handler).await
559559
}
560560

561-
// Dropshot does not have route match ranking and does not allow overlapping
562-
// route definitions, so we cannot have a catchall `/*` route for console pages
563-
// and then also define, e.g., `/api/blah/blah` and give the latter priority
564-
// because it's a more specific match. So for now we simply give the console
565-
// catchall route a prefix to avoid overlap. Long-term, if a route prefix is
566-
// part of the solution, we would probably prefer it to be on the API endpoints,
567-
// not on the console pages. Conveniently, all the console page routes start
568-
// with /orgs already.
569-
#[endpoint {
570-
method = GET,
571-
path = "/orgs/{path:.*}",
572-
unpublished = true,
573-
}]
574-
pub async fn console_page(
561+
async fn console_page_inner(
575562
rqctx: Arc<RequestContext<Arc<ServerContext>>>,
576-
_path_params: Path<RestPathParam>,
577563
) -> Result<Response<Body>, HttpError> {
578564
let opctx = OpContext::for_external_api(&rqctx).await;
579565

@@ -599,6 +585,38 @@ pub async fn console_page(
599585
.body("".into())?)
600586
}
601587

588+
// Dropshot does not have route match ranking and does not allow overlapping
589+
// route definitions, so we cannot have a catchall `/*` route for console pages
590+
// and then also define, e.g., `/api/blah/blah` and give the latter priority
591+
// because it's a more specific match. So for now we simply give the console
592+
// catchall route a prefix to avoid overlap. Long-term, if a route prefix is
593+
// part of the solution, we would probably prefer it to be on the API endpoints,
594+
// not on the console pages. Conveniently, all the console page routes start
595+
// with /orgs already.
596+
#[endpoint {
597+
method = GET,
598+
path = "/orgs/{path:.*}",
599+
unpublished = true,
600+
}]
601+
pub async fn console_page(
602+
rqctx: Arc<RequestContext<Arc<ServerContext>>>,
603+
_path_params: Path<RestPathParam>,
604+
) -> Result<Response<Body>, HttpError> {
605+
console_page_inner(rqctx).await
606+
}
607+
608+
#[endpoint {
609+
method = GET,
610+
path = "/settings/{path:.*}",
611+
unpublished = true,
612+
}]
613+
pub async fn console_settings_page(
614+
rqctx: Arc<RequestContext<Arc<ServerContext>>>,
615+
_path_params: Path<RestPathParam>,
616+
) -> Result<Response<Body>, HttpError> {
617+
console_page_inner(rqctx).await
618+
}
619+
602620
/// Fetch a static asset from `<static_dir>/assets`. 404 on virtually all
603621
/// errors. No auth. NO SENSITIVE FILES.
604622
#[endpoint {

0 commit comments

Comments
 (0)