refactor(settings): do not read address from old settings
This commit is contained in:
parent
1995423cb8
commit
06b7fe1691
2 changed files with 40 additions and 49 deletions
|
|
@ -471,6 +471,17 @@ void Config::readSectionOptions(ConfigReadContext &s)
|
||||||
addOption("", kOptionClipboardSharing, Settings::value(Settings::Server::EnableClipboard).toBool());
|
addOption("", kOptionClipboardSharing, Settings::value(Settings::Server::EnableClipboard).toBool());
|
||||||
addOption("", kOptionClipboardSharingSize, Settings::value(Settings::Server::ClipboardSize).toUInt() * 1024);
|
addOption("", kOptionClipboardSharingSize, Settings::value(Settings::Server::ClipboardSize).toUInt() * 1024);
|
||||||
|
|
||||||
|
if (const auto address = Settings::value(Settings::Core::Interface).toString(); !address.isEmpty()) {
|
||||||
|
m_deskflowAddress = NetworkAddress(address.toStdString(), Settings::value(Settings::Core::Port).toInt());
|
||||||
|
} else {
|
||||||
|
m_deskflowAddress = NetworkAddress(Settings::value(Settings::Core::Port).toInt());
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
m_deskflowAddress.resolve();
|
||||||
|
} catch (SocketAddressException &e) {
|
||||||
|
throw ServerConfigReadException(s, std::string("invalid address argument ") + e.what());
|
||||||
|
}
|
||||||
|
|
||||||
std::string line;
|
std::string line;
|
||||||
while (s.readLine(line)) {
|
while (s.readLine(line)) {
|
||||||
// check for end of section
|
// check for end of section
|
||||||
|
|
@ -491,28 +502,9 @@ void Config::readSectionOptions(ConfigReadContext &s)
|
||||||
++i;
|
++i;
|
||||||
s.parseNameWithArgs("value", line, ",;\n", i, value, valueArgs);
|
s.parseNameWithArgs("value", line, ",;\n", i, value, valueArgs);
|
||||||
|
|
||||||
bool handled = true;
|
|
||||||
|
|
||||||
if (m_oldNames.contains(name))
|
if (m_oldNames.contains(name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (name == "address") {
|
|
||||||
try {
|
|
||||||
m_deskflowAddress = NetworkAddress(value, kDefaultPort);
|
|
||||||
m_deskflowAddress.resolve();
|
|
||||||
} catch (SocketAddressException &e) {
|
|
||||||
throw ServerConfigReadException(s, std::string("invalid address argument ") + e.what());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
handled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (handled) {
|
|
||||||
// make sure handled options aren't followed by more values
|
|
||||||
if (i < line.size() && (line[i] == ',' || line[i] == ';')) {
|
|
||||||
throw ServerConfigReadException(s, std::string("too many arguments for: ").append(name));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// make filter rule
|
// make filter rule
|
||||||
InputFilter::Rule rule(parseCondition(s, name, nameArgs));
|
InputFilter::Rule rule(parseCondition(s, name, nameArgs));
|
||||||
|
|
||||||
|
|
@ -549,8 +541,6 @@ void Config::readSectionOptions(ConfigReadContext &s)
|
||||||
// add rule
|
// add rule
|
||||||
m_inputFilter.addFilterRule(rule);
|
m_inputFilter.addFilterRule(rule);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
throw ServerConfigReadException(s, "unexpected end of options section");
|
throw ServerConfigReadException(s, "unexpected end of options section");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -432,7 +432,8 @@ private:
|
||||||
QStringLiteral("relativeMouseMoves"),
|
QStringLiteral("relativeMouseMoves"),
|
||||||
QStringLiteral("win32KeepForeground"),
|
QStringLiteral("win32KeepForeground"),
|
||||||
QStringLiteral("disableLockToScreen"),
|
QStringLiteral("disableLockToScreen"),
|
||||||
QStringLiteral("defaultLockToScreenState")
|
QStringLiteral("defaultLockToScreenState"),
|
||||||
|
QStringLiteral("address")
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue