mirror of https://github.com/kiwix/libkiwix.git
Partly respecting the kiwix-serve --nosearchbar option
`--nosearchbar` option of `kiwix-serve` (despite its misleading name) was used to disable the entire taskbar. This commit accounts for the existence of that option only partially: 1. Links to books on the welcome/library page are affected - by default books are displayed in the viewer, but in a kiwix-serve instance run with --nosearchbar books are loaded in the top window. 2. The `/viewer` endpoint is enabled unconditionally, so if anyone enters the viewer URL in the address bar they will see books in the viewer.
This commit is contained in:
parent
369406fb5d
commit
2be9ac342f
|
@ -626,7 +626,9 @@ InternalServer::get_matching_if_none_match_etag(const RequestContext& r) const
|
|||
|
||||
std::unique_ptr<Response> InternalServer::build_homepage(const RequestContext& request)
|
||||
{
|
||||
return ContentResponse::build(*this, m_indexTemplateString, get_default_data(), "text/html; charset=utf-8");
|
||||
auto data = get_default_data();
|
||||
data.set("enable_viewer", m_withTaskbar ? "true" : "false");
|
||||
return ContentResponse::build(*this, m_indexTemplateString, data, "text/html; charset=utf-8");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -111,7 +111,9 @@
|
|||
downloadLink = '';
|
||||
}
|
||||
const bookName = link.split('/').pop();
|
||||
const viewerLink = `${root}/viewer#${bookName}`;
|
||||
const viewerLink = enableViewer
|
||||
? `${root}/viewer#${bookName}`
|
||||
: link;
|
||||
|
||||
const humanFriendlyZimSize = humanFriendlySize(zimSize);
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
</style>
|
||||
<script src="{{root}}/skin/isotope.pkgd.min.js?KIWIXCACHEID" defer></script>
|
||||
<script src="{{root}}/skin/iso6391To3.js?KIWIXCACHEID"></script>
|
||||
<script>const enableViewer = {{enable_viewer}};</script>
|
||||
<script type="text/javascript" src="{{root}}/skin/index.js?KIWIXCACHEID" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -184,7 +184,7 @@ R"EXPECTEDRESULT( href="/ROOT/skin/index.css?cacheid=3b470cee"
|
|||
src: url("/ROOT/skin/fonts/Roboto.ttf?cacheid=84d10248") format("truetype");
|
||||
<script src="/ROOT/skin/isotope.pkgd.min.js?cacheid=2e48d392" defer></script>
|
||||
<script src="/ROOT/skin/iso6391To3.js?cacheid=ecde2bb3"></script>
|
||||
<script type="text/javascript" src="/ROOT/skin/index.js?cacheid=2f5a81ac" defer></script>
|
||||
<script type="text/javascript" src="/ROOT/skin/index.js?cacheid=12321f62" defer></script>
|
||||
)EXPECTEDRESULT"
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue