Save domain in different localstorage key.

This commit is contained in:
John Preston 2019-07-15 10:30:38 +02:00
parent c22aeb8b40
commit 7c6ede0908
4 changed files with 20 additions and 9 deletions

View file

@ -384,8 +384,8 @@ struct Data {
int32 CallPacketTimeoutMs = 10000;
int32 WebFileDcId = cTestMode() ? 2 : 4;
QString TxtDomainString = cTestMode()
? qsl("testapv2.stel.com")
: qsl("apv2.stel.com");
? qsl("tapv3.stel.com")
: qsl("apv3.stel.com");
bool PhoneCallsEnabled = true;
bool BlockedMode = false;
int32 CaptionLengthMax = 1024;

View file

@ -137,7 +137,7 @@ void ConfigLoader::addSpecialEndpoint(
const std::string &ip,
int port,
bytes::const_span secret) {
auto endpoint = SpecialEndpoint {
const auto endpoint = SpecialEndpoint {
dcId,
ip,
port,
@ -198,7 +198,7 @@ void ConfigLoader::sendSpecialRequest() {
void ConfigLoader::specialConfigLoaded(const MTPConfig &result) {
Expects(result.type() == mtpc_config);
auto &data = result.c_config();
const auto &data = result.c_config();
if (data.vdc_options().v.empty()) {
LOG(("MTP Error: config with empty dc_options received!"));
return;

View file

@ -477,18 +477,22 @@ void SpecialConfigRequest::handleResponse(const QByteArray &bytes) {
}
Assert(_simpleConfig.type() == mtpc_help_configSimple);
const auto &config = _simpleConfig.c_help_configSimple();
const auto now = base::unixtime::now();
const auto now = base::unixtime::http_now();
if (now > config.vexpires().v) {
LOG(("Config Error: Bad date frame for simple config: %1-%2, our time is %3.").arg(config.vdate().v).arg(config.vexpires().v).arg(now));
LOG(("Config Error: "
"Bad date frame for simple config: %1-%2, our time is %3."
).arg(config.vdate().v
).arg(config.vexpires().v
).arg(now));
return;
}
if (config.vrules().v.empty()) {
LOG(("Config Error: Empty simple config received."));
return;
}
for (auto &rule : config.vrules().v) {
for (const auto &rule : config.vrules().v) {
Assert(rule.type() == mtpc_accessPointRule);
auto &data = rule.c_accessPointRule();
const auto &data = rule.c_accessPointRule();
const auto phoneRules = qs(data.vphone_prefix_rules());
if (!CheckPhoneByPrefixesRules(_phone, phoneRules)) {
continue;

View file

@ -603,7 +603,7 @@ enum {
dbiStickersFavedLimit = 0x50,
dbiSuggestStickersByEmoji = 0x51,
dbiSuggestEmoji = 0x52,
dbiTxtDomainString = 0x53,
dbiTxtDomainStringOld = 0x53,
dbiThemeKey = 0x54,
dbiTileBackground = 0x55,
dbiCacheSettingsOld = 0x56,
@ -613,6 +613,7 @@ enum {
dbiLanguagesKey = 0x5a,
dbiCallSettings = 0x5b,
dbiCacheSettings = 0x5c,
dbiTxtDomainString = 0x5d,
dbiEncryptedWithSalt = 333,
dbiEncrypted = 444,
@ -1226,6 +1227,12 @@ bool _readSetting(quint32 blockId, QDataStream &stream, int version, ReadSetting
Global::RefWorkMode().set(newMode());
} break;
case dbiTxtDomainStringOld: {
QString v;
stream >> v;
if (!_checkStreamStatus(stream)) return false;
} break;
case dbiTxtDomainString: {
QString v;
stream >> v;