Applications, Cluster node management and minor fixes
This commit is contained in:
@@ -76,6 +76,9 @@ impl AccountApiHandler for Server {
|
||||
Permission::SysLogCreate,
|
||||
Permission::SysLogDestroy,
|
||||
Permission::SysLogUpdate,
|
||||
Permission::SysClusterNodeCreate,
|
||||
Permission::SysClusterNodeUpdate,
|
||||
Permission::SysClusterNodeDestroy,
|
||||
] {
|
||||
permissions.clear(p.to_id() as usize);
|
||||
}
|
||||
|
||||
@@ -596,17 +596,28 @@ impl ParseHttp for Server {
|
||||
|
||||
return Ok(HtmlResponse::new(page.to_string()).into_http_response());
|
||||
}
|
||||
_ => {
|
||||
let path = req.uri().path();
|
||||
let resource = self
|
||||
external => {
|
||||
if path.next().is_none() {
|
||||
return Ok(HttpResponse::redirect(format!("/{external}/")));
|
||||
} else if let Some(resource) = self
|
||||
.inner
|
||||
.data
|
||||
.applications
|
||||
.get(path.strip_prefix('/').unwrap_or(path))
|
||||
.await?;
|
||||
|
||||
if !resource.is_empty() {
|
||||
return Ok(resource.into_http_response());
|
||||
.serve(
|
||||
external,
|
||||
req.uri()
|
||||
.path()
|
||||
.get(external.len() + 2..)
|
||||
.unwrap_or_default(),
|
||||
)
|
||||
.await?
|
||||
{
|
||||
let response = resource.resource.into_http_response();
|
||||
return Ok(if !resource.no_cache {
|
||||
response.with_immutable_cache()
|
||||
} else {
|
||||
response.with_no_cache()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user