mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-24 04:32:15 -04:00
Do not allow values higher than 65535 as port number
This commit is contained in:
parent
ea1a1379cd
commit
8c962f151d
@ -26,6 +26,13 @@ LocalKiwixServer::LocalKiwixServer(QWidget *parent) :
|
|||||||
connect(ui->KiwixServerButton, SIGNAL(clicked()), this, SLOT(runOrStopServer()));
|
connect(ui->KiwixServerButton, SIGNAL(clicked()), this, SLOT(runOrStopServer()));
|
||||||
connect(ui->OpenInBrowserButton, SIGNAL(clicked()), this, SLOT(openInBrowser()));
|
connect(ui->OpenInBrowserButton, SIGNAL(clicked()), this, SLOT(openInBrowser()));
|
||||||
connect(ui->closeButton, &QPushButton::clicked, this, &LocalKiwixServer::close);
|
connect(ui->closeButton, &QPushButton::clicked, this, &LocalKiwixServer::close);
|
||||||
|
connect(ui->PortChooser, &QLineEdit::textChanged, ui->PortChooser, [=](const QString &text){
|
||||||
|
if(text.toInt() > 65535) {
|
||||||
|
QString validText = text;
|
||||||
|
validText.chop(1);
|
||||||
|
ui->PortChooser->setText(validText);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const auto interfacesMap = kiwix::getNetworkInterfaces();
|
const auto interfacesMap = kiwix::getNetworkInterfaces();
|
||||||
QVector<QString> interfaces;
|
QVector<QString> interfaces;
|
||||||
@ -72,9 +79,6 @@ void LocalKiwixServer::runOrStopServer()
|
|||||||
{
|
{
|
||||||
if (!m_active) {
|
if (!m_active) {
|
||||||
m_port = ui->PortChooser->text().toInt();
|
m_port = ui->PortChooser->text().toInt();
|
||||||
if (m_port > 65535) {
|
|
||||||
m_port = 65535;
|
|
||||||
}
|
|
||||||
mp_server->setPort(m_port);
|
mp_server->setPort(m_port);
|
||||||
m_ipAddress = ui->IpChooser->currentText();
|
m_ipAddress = ui->IpChooser->currentText();
|
||||||
auto settingsManager = KiwixApp::instance()->getSettingsManager();
|
auto settingsManager = KiwixApp::instance()->getSettingsManager();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user