Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions ydb/core/viewer/viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ class TViewer : public TActorBootstrapped<TViewer>, public IViewer {

bool ReplyWithFile(NMon::TEvHttpInfo::TPtr& ev, const TString& name) {
if (name == "/api/viewer.yaml") {
Cerr << "CompileTime is " << GetCompileTime() << Endl;
Send(ev->Sender, new NMon::TEvHttpInfoRes(GetHTTPOKYAML(ev->Get(), Dump(GetSwaggerYaml()), GetCompileTime()), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
return true;
}
Expand All @@ -322,6 +321,9 @@ class TViewer : public TActorBootstrapped<TViewer>, public IViewer {
type = mimetypeByExt(filename.c_str());
} else {
filename = name;
if (filename.StartsWith("/")) {
filename.erase(0, 1);
}
if (NResource::FindExact(filename, &blob)) {
type = mimetypeByExt(filename.c_str());
}
Expand Down Expand Up @@ -420,31 +422,27 @@ class TViewer : public TActorBootstrapped<TViewer>, public IViewer {
return;
}
}
if (path.StartsWith("counters/hosts")) {
if (path.StartsWith("/counters/hosts")) {
ctx.ExecutorThread.RegisterActor(new TCountersHostsList(this, ev));
return;
}
if (path.StartsWith("healthcheck")) {
ctx.ExecutorThread.RegisterActor(new TJsonHealthCheck(this, ev));
return;
}
// TODO: check path validity
// TODO: cache
if (msg->Request.GetPathInfo().StartsWith('/')) {
if (path.StartsWith("/viewer")) {
path.erase(0, 7);
}
if (IsMatchesWildcard(path, "monitoring*/static/js/*")
|| IsMatchesWildcard(path, "monitoring*/static/css/*")
|| IsMatchesWildcard(path, "monitoring*/static/media/*")
|| IsMatchesWildcard(path, "monitoring*/static/assets/fonts/*")
|| IsMatchesWildcard(path, "monitoring*/static/favicon.png")) {
if (IsMatchesWildcard(path, "/monitoring*/static/js/*")
|| IsMatchesWildcard(path, "/monitoring*/static/css/*")
|| IsMatchesWildcard(path, "/monitoring*/static/media/*")
|| IsMatchesWildcard(path, "/monitoring*/static/assets/fonts/*")
|| IsMatchesWildcard(path, "/monitoring*/static/favicon.png")) {
auto resPos = path.find("/static/");
if (resPos != TString::npos) {
path = "monitoring" + path.substr(resPos);
path = "/monitoring" + path.substr(resPos);
}
} else if (path.StartsWith("monitoring") && path != "monitoring/index.html") {
path = "monitoring/index.html";
} else if (path.StartsWith("/monitoring") && path != "/monitoring/index.html") {
path = "/monitoring/index.html";
}
if (path.EndsWith('/')) {
path += "index.html";
Expand Down