mirror of
https://github.com/kiwix/kiwix-tools.git
synced 2026-04-28 03:30:03 +00:00
Merge pull request #763 from vighnesh-sawant/standard-port-enhancment
Some checks failed
CI / Windows (push) Has been cancelled
CI / Linux (linux-x86_64, jammy, /x86_64-linux-gnu, linux-x86_64-dyn) (push) Has been cancelled
CI / Linux (linux-x86_64, jammy, /x86_64-linux-gnu, linux-x86_64-static) (push) Has been cancelled
Packages / build-deb (ubuntu-jammy) (push) Has been cancelled
Packages / build-deb (ubuntu-noble) (push) Has been cancelled
Some checks failed
CI / Windows (push) Has been cancelled
CI / Linux (linux-x86_64, jammy, /x86_64-linux-gnu, linux-x86_64-dyn) (push) Has been cancelled
CI / Linux (linux-x86_64, jammy, /x86_64-linux-gnu, linux-x86_64-static) (push) Has been cancelled
Packages / build-deb (ubuntu-jammy) (push) Has been cancelled
Packages / build-deb (ubuntu-noble) (push) Has been cancelled
Improve message when server is running on standard port
This commit is contained in:
commit
d61eafe6a2
1 changed files with 4 additions and 16 deletions
|
|
@ -104,16 +104,6 @@ std::string loadCustomTemplate (std::string customIndexPath) {
|
|||
return indexTemplateString;
|
||||
}
|
||||
|
||||
inline std::string normalizeRootUrl(std::string rootUrl)
|
||||
{
|
||||
while ( !rootUrl.empty() && rootUrl.back() == '/' )
|
||||
rootUrl.pop_back();
|
||||
|
||||
while ( !rootUrl.empty() && rootUrl.front() == '/' )
|
||||
rootUrl = rootUrl.substr(1);
|
||||
return rootUrl.empty() ? rootUrl : "/" + rootUrl;
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
volatile sig_atomic_t waiting = false;
|
||||
volatile sig_atomic_t libraryMustBeReloaded = false;
|
||||
|
|
@ -393,13 +383,11 @@ int main(int argc, char** argv)
|
|||
if (! server.start()) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
std::string prefix = "http://";
|
||||
kiwix::IpAddress addresses = server.getAddress();
|
||||
std::string suffix = ":" + std::to_string(server.getPort()) + normalizeRootUrl(rootLocation);
|
||||
|
||||
std::cout << "The Kiwix server is running and can be accessed in the local network at: " << std::endl;
|
||||
if(!addresses.addr.empty()) std::cout << " - " << prefix << addresses.addr << suffix << std::endl;
|
||||
if(!addresses.addr6.empty()) std::cout << " - " << prefix << "[" << addresses.addr6 << "]" << suffix << std::endl;
|
||||
for (const auto& url : server.getServerAccessUrls()) {
|
||||
std::cout << " - " << url << std::endl;
|
||||
}
|
||||
|
||||
/* Run endless (until PPID dies) */
|
||||
waiting = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue