MCPcopy Create free account
hub / github.com/YACReader/yacreader / printServerInfo

Function printServerInfo

YACReaderLibraryServer/main.cpp:481–509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

479}
480
481void printServerInfo(YACReaderHttpServer *httpServer)
482{
483 auto addresses = getIpAddresses();
484 if (addresses.isEmpty()) {
485 QLOG_WARN() << "Running, but no global network interfaces were detected";
486 return;
487 }
488
489 QLOG_INFO() << "Running on" << addresses.first() + ":" + httpServer->getPort().toLocal8Bit() << "\n";
490
491 qrcodegen::QrCode code = qrcodegen::QrCode::encodeText(
492 (addresses.first() + ":" + httpServer->getPort()).toLocal8Bit(),
493 qrcodegen::QrCode::Ecc::LOW);
494 int border = 4;
495 for (int y = -border; y < code.getSize() + border; y += 2) {
496 QString QRCodeString;
497 for (int x = -border - 1; x < code.getSize() + border + 1; x++) {
498 QRCodeString.append((code.getModule(x, y) && code.getModule(x, y + 1))
499 ? " "
500 : code.getModule(x, y + 1) ? "\u2580"
501 : code.getModule(x, y) ? "\u2584"
502 : "\u2588");
503 }
504 QLOG_INFO() << QRCodeString;
505 }
506 if (addresses.length() > 1) {
507 QLOG_INFO() << addresses.length() - 1 << "more network interfaces detected";
508 }
509}

Callers 1

startFunction · 0.85

Calls 3

getIpAddressesFunction · 0.85
isEmptyMethod · 0.80
getPortMethod · 0.80

Tested by

no test coverage detected