File indexing completed on 2024-11-10 04:32:43
0001 /* 0002 SPDX-FileCopyrightText: 2017-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "ruqolaserverconfig.h" 0008 #include "ruqola_authentication_debug.h" 0009 #include "ruqola_debug.h" 0010 #include <QJsonArray> 0011 #include <QJsonDocument> 0012 #include <QJsonObject> 0013 #include <QRegularExpression> 0014 #include <QStringList> 0015 0016 RuqolaServerConfig::RuqolaServerConfig() = default; 0017 0018 QString RuqolaServerConfig::uniqueId() const 0019 { 0020 return mUniqueId; 0021 } 0022 0023 void RuqolaServerConfig::setUniqueId(const QString &uniqueId) 0024 { 0025 mUniqueId = uniqueId; 0026 } 0027 0028 QString RuqolaServerConfig::jitsiMeetUrl() const 0029 { 0030 return mJitsiMeetUrl; 0031 } 0032 0033 void RuqolaServerConfig::setJitsiMeetUrl(const QString &jitsiMeetUrl) 0034 { 0035 mJitsiMeetUrl = jitsiMeetUrl; 0036 } 0037 0038 QString RuqolaServerConfig::jitsiMeetPrefix() const 0039 { 0040 return mJitsiMeetPrefix; 0041 } 0042 0043 void RuqolaServerConfig::setJitsiMeetPrefix(const QString &jitsiMeetPrefix) 0044 { 0045 mJitsiMeetPrefix = jitsiMeetPrefix; 0046 } 0047 0048 QString RuqolaServerConfig::fileUploadStorageType() const 0049 { 0050 return mFileUploadStorageType; 0051 } 0052 0053 void RuqolaServerConfig::setFileUploadStorageType(const QString &type) 0054 { 0055 mFileUploadStorageType = type; 0056 } 0057 0058 void RuqolaServerConfig::setBlockDeletingMessageInMinutes(int minutes) 0059 { 0060 mBlockDeletingMessageInMinutes = minutes; 0061 } 0062 0063 void RuqolaServerConfig::setBlockEditingMessageInMinutes(int minutes) 0064 { 0065 mBlockEditingMessageInMinutes = minutes; 0066 } 0067 0068 int RuqolaServerConfig::blockEditingMessageInMinutes() const 0069 { 0070 return mBlockEditingMessageInMinutes; 0071 } 0072 0073 bool RuqolaServerConfig::needAdaptNewSubscriptionRC60() const 0074 { 0075 return mNeedAdaptNewSubscriptionRC60; 0076 } 0077 0078 bool RuqolaServerConfig::hasAtLeastVersion(int major, int minor, int patch) const 0079 { 0080 // qDebug() << " major " << major << " mServerVersionMajor " << mServerVersionMajor << " (major <= mServerVersionMajor) " << (major <= 0081 // mServerVersionMajor) << 0082 // " minor " << minor << " mServerVersionMinor " << mServerVersionMinor << " (minor <= mServerVersionMinor) " << (minor <= 0083 // mServerVersionMinor) << " patch " << patch << " mServerVersionPatch " << mServerVersionPatch << " (patch <= mServerVersionPatch) " << 0084 // (patch <= mServerVersionPatch); 0085 if (mServerVersionMajor > major) { 0086 return true; 0087 } 0088 return (major <= mServerVersionMajor) && (minor <= mServerVersionMinor) && (patch <= mServerVersionPatch); 0089 } 0090 0091 void RuqolaServerConfig::setServerVersion(const QString &version) 0092 { 0093 mServerVersionStr = version; 0094 const QStringList lst = version.split(QLatin1Char('.')); 0095 // 0.70.0-rc.1 has 4 "." 0096 if (lst.count() >= 3) { 0097 bool ok; 0098 int value = lst.at(0).toInt(&ok); 0099 if (ok) { 0100 mServerVersionMajor = value; 0101 } 0102 value = lst.at(1).toInt(&ok); 0103 if (ok) { 0104 mServerVersionMinor = value; 0105 } 0106 value = lst.at(2).toInt(&ok); 0107 if (ok) { 0108 mServerVersionPatch = value; 0109 } else { // Perhaps it has "rc"/"beta" etc. 0110 mServerVersionPatch = 0; 0111 } 0112 } else if (lst.count() == 2) { // As "4.0" 0113 bool ok; 0114 int value = lst.at(0).toInt(&ok); 0115 if (ok) { 0116 mServerVersionMajor = value; 0117 } 0118 value = lst.at(1).toInt(&ok); 0119 if (ok) { 0120 mServerVersionMinor = value; 0121 } 0122 mServerVersionPatch = 0; 0123 } 0124 adaptToServerVersion(); 0125 } 0126 0127 QString RuqolaServerConfig::serverVersion() const 0128 { 0129 return mServerVersionStr; 0130 } 0131 0132 bool RuqolaServerConfig::ruqolaHasSupportForAuthMethodType(AuthenticationManager::AuthMethodType type) const 0133 { 0134 return mRuqolaAuthMethodTypes & type; 0135 } 0136 0137 bool RuqolaServerConfig::canShowAuthMethod(AuthenticationManager::AuthMethodType type) const 0138 { 0139 const bool hasSupport = serverHasSupportForAuthMethodType(type) && ruqolaHasSupportForAuthMethodType(type); 0140 return hasSupport; 0141 } 0142 0143 void RuqolaServerConfig::addRuqolaAuthenticationSupport(AuthenticationManager::AuthMethodType type) 0144 { 0145 mRuqolaAuthMethodTypes |= type; 0146 } 0147 0148 bool RuqolaServerConfig::serverHasSupportForAuthMethodType(AuthenticationManager::AuthMethodType type) const 0149 { 0150 return mServerAuthTypes & type; 0151 } 0152 0153 void RuqolaServerConfig::addOauthService(const QString &service) 0154 { 0155 qCDebug(RUQOLA_AUTHENTICATION_LOG) << " serviceLower " << service; 0156 if (service.endsWith(QLatin1String("twitter"), Qt::CaseInsensitive)) { 0157 mServerAuthTypes |= AuthenticationManager::AuthMethodType::Twitter; 0158 } else if (service.endsWith(QLatin1String("facebook"), Qt::CaseInsensitive)) { 0159 mServerAuthTypes |= AuthenticationManager::AuthMethodType::FaceBook; 0160 } else if (service.endsWith(QLatin1String("github"), Qt::CaseInsensitive)) { 0161 mServerAuthTypes |= AuthenticationManager::AuthMethodType::GitHub; 0162 } else if (service.endsWith(QLatin1String("gitlab"), Qt::CaseInsensitive)) { 0163 mServerAuthTypes |= AuthenticationManager::AuthMethodType::GitLab; 0164 } else if (service.endsWith(QLatin1String("google"), Qt::CaseInsensitive)) { 0165 mServerAuthTypes |= AuthenticationManager::AuthMethodType::Google; 0166 } else if (service.endsWith(QLatin1String("linkedin"), Qt::CaseInsensitive)) { 0167 mServerAuthTypes |= AuthenticationManager::AuthMethodType::Linkedin; 0168 } else if (service.endsWith(QLatin1String("wordpress"), Qt::CaseInsensitive)) { 0169 mServerAuthTypes |= AuthenticationManager::AuthMethodType::Wordpress; 0170 } else if (service.endsWith(QLatin1String("apple"), Qt::CaseInsensitive)) { 0171 mServerAuthTypes |= AuthenticationManager::AuthMethodType::Apple; 0172 } else if (service.endsWith(QLatin1String("nextcloud"), Qt::CaseInsensitive)) { 0173 mServerAuthTypes |= AuthenticationManager::AuthMethodType::NextCloud; 0174 } else if (service.endsWith(QLatin1String("_oauth_proxy_host"), Qt::CaseInsensitive)) { 0175 // Hide warning as it's not a service 0176 qCDebug(RUQOLA_LOG) << "_OAuth_Proxy_host found "; 0177 } else if (service.endsWith(QLatin1String("_oauth_meteor"), Qt::CaseInsensitive)) { 0178 qCDebug(RUQOLA_LOG) << "Accounts_OAuth_Meteor found "; 0179 } else { 0180 qCDebug(RUQOLA_LOG) << "Unknown service type: " << service; 0181 } 0182 qCDebug(RUQOLA_AUTHENTICATION_LOG) << " authentication service " << mServerAuthTypes; 0183 } 0184 0185 void RuqolaServerConfig::adaptToServerVersion() 0186 { 0187 mNeedAdaptNewSubscriptionRC60 = (mServerVersionMajor >= 1) || ((mServerVersionMajor == 0) && (mServerVersionMinor >= 60)); 0188 } 0189 0190 bool RuqolaServerConfig::messageAllowConvertLongMessagesToAttachment() const 0191 { 0192 return mMessageAllowConvertLongMessagesToAttachment; 0193 } 0194 0195 void RuqolaServerConfig::setMessageAllowConvertLongMessagesToAttachment(bool newMessageAllowConvertLongMessagesToAttachment) 0196 { 0197 mMessageAllowConvertLongMessagesToAttachment = newMessageAllowConvertLongMessagesToAttachment; 0198 } 0199 0200 void RuqolaServerConfig::privateSettingsUpdated(const QJsonArray &updateArray) 0201 { 0202 if (updateArray.count() == 2) { 0203 const QString updateArrayInfo{updateArray.at(0).toString()}; 0204 if (updateArrayInfo == QLatin1String("updated")) { 0205 loadSettings(updateArray.at(1).toObject()); 0206 qDebug() << "Update settings " << *this; 0207 } else { 0208 qCWarning(RUQOLA_LOG) << "UpdateArray info unknown: " << updateArrayInfo; 0209 } 0210 } else { 0211 qCWarning(RUQOLA_LOG) << "Error in privateSettingsUpdated " << updateArray; 0212 } 0213 } 0214 0215 int RuqolaServerConfig::messageMaximumAllowedSize() const 0216 { 0217 return mMessageMaximumAllowedSize; 0218 } 0219 0220 void RuqolaServerConfig::setMessageMaximumAllowedSize(int newMessageMaximumAllowedSize) 0221 { 0222 mMessageMaximumAllowedSize = newMessageMaximumAllowedSize; 0223 } 0224 0225 const QString &RuqolaServerConfig::userNameValidation() const 0226 { 0227 return mUserNameValidation; 0228 } 0229 0230 const QString &RuqolaServerConfig::channelNameValidation() const 0231 { 0232 return mChannelNameValidation; 0233 } 0234 0235 int RuqolaServerConfig::loginExpiration() const 0236 { 0237 return mLoginExpiration; 0238 } 0239 0240 void RuqolaServerConfig::setChannelNameValidation(const QString &str) 0241 { 0242 mChannelNameValidation = str; 0243 } 0244 0245 void RuqolaServerConfig::setUserNameValidation(const QString &str) 0246 { 0247 mUserNameValidation = str; 0248 } 0249 0250 void RuqolaServerConfig::setLoginExpiration(int loginExpiration) 0251 { 0252 mLoginExpiration = loginExpiration; 0253 } 0254 0255 RuqolaServerConfig::ServerConfigFeatureTypes RuqolaServerConfig::serverConfigFeatureTypes() const 0256 { 0257 return mServerConfigFeatureTypes; 0258 } 0259 0260 void RuqolaServerConfig::setServerConfigFeatureTypes(ServerConfigFeatureTypes serverConfigFeatureTypes) 0261 { 0262 mServerConfigFeatureTypes = serverConfigFeatureTypes; 0263 } 0264 0265 void RuqolaServerConfig::setAllowRegistrationFrom(const QString ®istrationFromValue) 0266 { 0267 if (registrationFromValue == QLatin1String("Public")) { 0268 mServerConfigFeatureTypes |= ServerConfigFeatureType::RegistrationFormEnabled; 0269 } else if (registrationFromValue == QLatin1String("Disabled")) { 0270 // Nothing => disabled 0271 ; 0272 } else if (registrationFromValue == QLatin1String("Secret URL")) { 0273 qCWarning(RUQOLA_LOG) << " Registration Secret Url not implemented"; 0274 } 0275 } 0276 0277 qint64 RuqolaServerConfig::fileMaxFileSize() const 0278 { 0279 return mFileMaxFileSize; 0280 } 0281 0282 void RuqolaServerConfig::setFileMaxFileSize(qint64 fileMaxFileSize) 0283 { 0284 mFileMaxFileSize = fileMaxFileSize; 0285 } 0286 0287 int RuqolaServerConfig::blockDeletingMessageInMinutes() const 0288 { 0289 return mBlockDeletingMessageInMinutes; 0290 } 0291 0292 QString RuqolaServerConfig::autoTranslateGoogleKey() const 0293 { 0294 return mAutoTranslateGoogleKey; 0295 } 0296 0297 void RuqolaServerConfig::setAutoTranslateGoogleKey(const QString &autoTranslateGoogleKey) 0298 { 0299 mAutoTranslateGoogleKey = autoTranslateGoogleKey; 0300 } 0301 0302 int RuqolaServerConfig::serverVersionPatch() const 0303 { 0304 return mServerVersionPatch; 0305 } 0306 0307 int RuqolaServerConfig::serverVersionMinor() const 0308 { 0309 return mServerVersionMinor; 0310 } 0311 0312 int RuqolaServerConfig::serverVersionMajor() const 0313 { 0314 return mServerVersionMajor; 0315 } 0316 0317 QString RuqolaServerConfig::serverVersionStr() const 0318 { 0319 return mServerVersionStr; 0320 } 0321 0322 QString RuqolaServerConfig::siteName() const 0323 { 0324 return mSiteName; 0325 } 0326 0327 void RuqolaServerConfig::setSiteName(const QString &siteName) 0328 { 0329 mSiteName = siteName; 0330 } 0331 0332 QString RuqolaServerConfig::siteUrl() const 0333 { 0334 return mSiteUrl; 0335 } 0336 0337 void RuqolaServerConfig::setSiteUrl(const QString &siteUrl) 0338 { 0339 mSiteUrl = siteUrl; 0340 } 0341 0342 AuthenticationManager::AuthMethodTypes RuqolaServerConfig::ruqolaOauthTypes() const 0343 { 0344 return mRuqolaAuthMethodTypes; 0345 } 0346 0347 AuthenticationManager::AuthMethodTypes RuqolaServerConfig::serverAuthMethodTypes() const 0348 { 0349 return mServerAuthTypes; 0350 } 0351 0352 RuqolaServerConfig::ConfigWithDefaultValue RuqolaServerConfig::logoUrl() const 0353 { 0354 return mLogoUrl; 0355 } 0356 0357 void RuqolaServerConfig::setLogoUrl(const RuqolaServerConfig::ConfigWithDefaultValue &url) 0358 { 0359 mLogoUrl = url; 0360 } 0361 0362 RuqolaServerConfig::ConfigWithDefaultValue RuqolaServerConfig::faviconUrl() const 0363 { 0364 return mFaviconUrl; 0365 } 0366 0367 void RuqolaServerConfig::setFaviconUrl(const RuqolaServerConfig::ConfigWithDefaultValue &url) 0368 { 0369 mFaviconUrl = url; 0370 } 0371 0372 QDebug operator<<(QDebug d, const RuqolaServerConfig::ConfigWithDefaultValue &t) 0373 { 0374 d.space() << " Value " << t.url; 0375 d.space() << " Default Value " << t.defaultUrl; 0376 return d; 0377 } 0378 0379 QDebug operator<<(QDebug d, const RuqolaServerConfig &t) 0380 { 0381 d.space() << "mUniqueId " << t.uniqueId(); 0382 d.space() << "mJitsiMeetUrl " << t.jitsiMeetUrl(); 0383 d.space() << "mJitsiMeetPrefix " << t.jitsiMeetPrefix(); 0384 d.space() << "mFileUploadStorageType " << t.fileUploadStorageType(); 0385 d.space() << "mSiteUrl " << t.siteUrl(); 0386 d.space() << "mSiteName " << t.siteName(); 0387 d.space() << "mServerOauthTypes " << t.serverAuthMethodTypes(); 0388 d.space() << "mRuqolaOauthTypes " << t.ruqolaOauthTypes(); 0389 d.space() << "mBlockEditingMessageInMinutes " << t.blockEditingMessageInMinutes(); 0390 d.space() << "mNeedAdaptNewSubscriptionRC60 " << t.needAdaptNewSubscriptionRC60(); 0391 d.space() << "mServerVersionMajor " << t.serverVersionMajor() << " mServerVersionMinor " << t.serverVersionMinor() << " mServerVersionPatch " 0392 << t.serverVersionPatch(); 0393 d.space() << "mLogoUrl " << t.logoUrl(); 0394 d.space() << "mFaviconUrl " << t.faviconUrl(); 0395 d.space() << "mLoginExpiration " << t.loginExpiration(); 0396 d.space() << "mChannelNameValidation " << t.channelNameValidation(); 0397 d.space() << "mUserNameValidation " << t.userNameValidation(); 0398 d.space() << "mMessageMaximumAllowedSize " << t.messageMaximumAllowedSize(); 0399 d.space() << "mMessageAllowConvertLongMessagesToAttachment " << t.messageAllowConvertLongMessagesToAttachment(); 0400 d.space() << "mUIUseRealName " << t.useRealName(); 0401 d.space() << "mAccountsAllowInvisibleStatusOption" << t.accountsAllowInvisibleStatusOption(); 0402 d.space() << "mUserDataDownloadEnabled " << t.userDataDownloadEnabled(); 0403 d.space() << "mMediaBlackList " << t.mediaBlackList(); 0404 d.space() << "mMediaWhiteList " << t.mediaWhiteList(); 0405 d.space() << "previewEmbed " << t.previewEmbed(); 0406 d.space() << "embedCacheExpirationDays " << t.embedCacheExpirationDays(); 0407 return d; 0408 } 0409 0410 void RuqolaServerConfig::assignSettingValue(bool value, ServerConfigFeatureType type) 0411 { 0412 if (value) { 0413 mServerConfigFeatureTypes |= type; 0414 } else { 0415 mServerConfigFeatureTypes &= ~type; 0416 } 0417 } 0418 0419 RuqolaServerConfig::ConfigWithDefaultValue RuqolaServerConfig::parseConfigWithDefaultValue(const QJsonObject &o) 0420 { 0421 RuqolaServerConfig::ConfigWithDefaultValue value; 0422 value.defaultUrl = o[QLatin1String("defaultUrl")].toString(); 0423 value.url = o[QLatin1String("url")].toString(); 0424 return value; 0425 } 0426 0427 int RuqolaServerConfig::embedCacheExpirationDays() const 0428 { 0429 return mEmbedCacheExpirationDays; 0430 } 0431 0432 void RuqolaServerConfig::setEmbedCacheExpirationDays(int newEmbedCacheExpirationDays) 0433 { 0434 mEmbedCacheExpirationDays = newEmbedCacheExpirationDays; 0435 } 0436 0437 bool RuqolaServerConfig::previewEmbed() const 0438 { 0439 return mPreviewEmbed; 0440 } 0441 0442 void RuqolaServerConfig::setPreviewEmbed(bool newPreviewEmbed) 0443 { 0444 mPreviewEmbed = newPreviewEmbed; 0445 } 0446 0447 void RuqolaServerConfig::loadSettings(const QJsonObject ¤tConfObject) 0448 { 0449 // qDebug() << " currentConfObject " << currentConfObject; 0450 const QString id = currentConfObject[QLatin1String("_id")].toString(); 0451 const QVariant value = currentConfObject[QLatin1String("value")].toVariant(); 0452 static const QRegularExpression regularExpressionOAuth(QStringLiteral("^Accounts_OAuth_\\w+")); 0453 if (id == QLatin1String("uniqueID")) { 0454 setUniqueId(value.toString()); 0455 } else if (id == QLatin1String("Jitsi_Enabled")) { 0456 assignSettingValue(value.toBool(), ServerConfigFeatureType::JitsiEnabled); 0457 } else if (id == QLatin1String("Jitsi_Enable_Teams")) { 0458 assignSettingValue(value.toBool(), ServerConfigFeatureType::JitsiEnabledTeams); 0459 } else if (id == QLatin1String("Jitsi_Enable_Channels")) { 0460 assignSettingValue(value.toBool(), ServerConfigFeatureType::JitsiEnabledChannels); 0461 } else if (id == QLatin1String("Jitsi_Domain")) { 0462 setJitsiMeetUrl(value.toString()); 0463 } else if (id == QLatin1String("Jitsi_URL_Room_Prefix")) { 0464 setJitsiMeetPrefix(value.toString()); 0465 } else if (id == QLatin1String("FileUpload_Storage_Type")) { 0466 setFileUploadStorageType(value.toString()); 0467 } else if (id == QLatin1String("Message_AllowEditing")) { 0468 assignSettingValue(value.toBool(), ServerConfigFeatureType::AllowEditingMessage); 0469 } else if (id == QLatin1String("Message_AllowEditing_BlockEditInMinutes")) { 0470 setBlockEditingMessageInMinutes(value.toInt()); 0471 } else if (id == QLatin1String("Message_AllowDeleting_BlockDeleteInMinutes")) { 0472 setBlockDeletingMessageInMinutes(value.toInt()); 0473 } else if (id == QLatin1String("OTR_Enable")) { 0474 assignSettingValue(value.toBool(), ServerConfigFeatureType::OtrEnabled); 0475 } else if (id.contains(regularExpressionOAuth)) { 0476 if (value.toBool()) { 0477 addOauthService(id); 0478 } 0479 } else if (id == QLatin1String("Site_Url")) { 0480 setSiteUrl(value.toString()); 0481 } else if (id == QLatin1String("Site_Name")) { 0482 setSiteName(value.toString()); 0483 } else if (id == QLatin1String("E2E_Enable")) { 0484 assignSettingValue(value.toBool(), ServerConfigFeatureType::EncryptionEnabled); 0485 } else if (id == QLatin1String("Message_AllowPinning")) { 0486 assignSettingValue(value.toBool(), ServerConfigFeatureType::AllowMessagePinning); 0487 } else if (id == QLatin1String("Message_AllowStarring")) { 0488 assignSettingValue(value.toBool(), ServerConfigFeatureType::AllowMessageStarring); 0489 } else if (id == QLatin1String("Message_AllowDeleting")) { 0490 assignSettingValue(value.toBool(), ServerConfigFeatureType::AllowMessageDeleting); 0491 } else if (id == QLatin1String("Threads_enabled")) { 0492 assignSettingValue(value.toBool(), ServerConfigFeatureType::ThreadsEnabled); 0493 } else if (id == QLatin1String("Discussion_enabled")) { 0494 assignSettingValue(value.toBool(), ServerConfigFeatureType::DiscussionEnabled); 0495 } else if (id == QLatin1String("AutoTranslate_Enabled")) { 0496 assignSettingValue(value.toBool(), ServerConfigFeatureType::AutoTranslateEnabled); 0497 } else if (id == QLatin1String("AutoTranslate_GoogleAPIKey")) { 0498 setAutoTranslateGoogleKey(value.toString()); 0499 } else if (id == QLatin1String("FileUpload_Enabled")) { 0500 assignSettingValue(value.toBool(), ServerConfigFeatureType::UploadFileEnabled); 0501 } else if (id == QLatin1String("FileUpload_MaxFileSize")) { 0502 setFileMaxFileSize(value.toULongLong()); 0503 } else if (id == QLatin1String("Broadcasting_enabled")) { 0504 assignSettingValue(value.toBool(), ServerConfigFeatureType::BroadCastEnabled); 0505 } else if (id == QLatin1String("Message_VideoRecorderEnabled")) { 0506 assignSettingValue(value.toBool(), ServerConfigFeatureType::VideoRecorderEnabled); 0507 } else if (id == QLatin1String("Message_AudioRecorderEnabled")) { 0508 assignSettingValue(value.toBool(), ServerConfigFeatureType::AudioRecorderEnabled); 0509 } else if (id == QLatin1String("Assets_logo")) { 0510 setLogoUrl(parseConfigWithDefaultValue(value.toJsonObject())); 0511 } else if (id == QLatin1String("Assets_favicon")) { 0512 setFaviconUrl(parseConfigWithDefaultValue(value.toJsonObject())); 0513 } else if (id == QLatin1String("Accounts_AllowDeleteOwnAccount")) { 0514 assignSettingValue(value.toBool(), ServerConfigFeatureType::AllowDeleteOwnAccount); 0515 } else if (id == QLatin1String("Accounts_RegistrationForm")) { 0516 setAllowRegistrationFrom(value.toString()); 0517 } else if (id == QLatin1String("Accounts_PasswordReset")) { 0518 assignSettingValue(value.toBool(), ServerConfigFeatureType::AllowPasswordReset); 0519 } else if (id == QLatin1String("Accounts_AllowEmailChange")) { 0520 assignSettingValue(value.toBool(), ServerConfigFeatureType::AllowEmailChange); 0521 } else if (id == QLatin1String("Accounts_AllowPasswordChange")) { 0522 assignSettingValue(value.toBool(), ServerConfigFeatureType::AllowPasswordChange); 0523 } else if (id == QLatin1String("Accounts_AllowUsernameChange")) { 0524 assignSettingValue(value.toBool(), ServerConfigFeatureType::AllowUsernameChange); 0525 } else if (id == QLatin1String("Accounts_AllowUserProfileChange")) { 0526 assignSettingValue(value.toBool(), ServerConfigFeatureType::AllowUserProfileChange); 0527 } else if (id == QLatin1String("Accounts_AllowUserAvatarChange")) { 0528 assignSettingValue(value.toBool(), ServerConfigFeatureType::AllowUserAvatarChange); 0529 } else if (id == QLatin1String("LDAP_Enable")) { 0530 assignSettingValue(value.toBool(), ServerConfigFeatureType::LdapEnabled); 0531 } else if (id == QLatin1String("Accounts_LoginExpiration")) { 0532 setLoginExpiration(value.toInt()); 0533 } else if (id == QLatin1String("Accounts_TwoFactorAuthentication_Enabled")) { 0534 assignSettingValue(value.toBool(), ServerConfigFeatureType::TwoFactorAuthenticationEnabled); 0535 } else if (id == QLatin1String("Accounts_TwoFactorAuthentication_By_Email_Enabled")) { 0536 assignSettingValue(value.toBool(), ServerConfigFeatureType::TwoFactorAuthenticationByEmailEnabled); 0537 } else if (id == QLatin1String("Accounts_TwoFactorAuthentication_By_TOTP_Enabled")) { 0538 assignSettingValue(value.toBool(), ServerConfigFeatureType::TwoFactorAuthenticationByTOTPEnabled); 0539 } else if (id == QLatin1String("Accounts_TwoFactorAuthentication_Enforce_Password_Fallback")) { 0540 assignSettingValue(value.toBool(), ServerConfigFeatureType::TwoFactorAuthenticationEnforcePasswordFallback); 0541 } else if (id == QLatin1String("UTF8_Channel_Names_Validation")) { 0542 setChannelNameValidation(value.toString()); 0543 } else if (id == QLatin1String("UTF8_User_Names_Validation")) { 0544 setUserNameValidation(value.toString()); 0545 } else if (id == QLatin1String("Message_MaxAllowedSize")) { 0546 setMessageMaximumAllowedSize(value.toInt()); 0547 } else if (id == QLatin1String("Message_AllowConvertLongMessagesToAttachment")) { 0548 setMessageAllowConvertLongMessagesToAttachment(value.toBool()); 0549 } else if (id == QLatin1String("UI_Use_Real_Name")) { 0550 setUseRealName(value.toBool()); 0551 } else if (id == QLatin1String("Accounts_AllowInvisibleStatusOption")) { 0552 setAccountsAllowInvisibleStatusOption(value.toBool()); 0553 } else if (id == QLatin1String("UserData_EnableDownload")) { 0554 setUserDataDownloadEnabled(value.toBool()); 0555 } else if (id == QLatin1String("Device_Management_Enable_Login_Emails")) { 0556 setDeviceManagementEnableLoginEmails(value.toBool()); 0557 } else if (id == QLatin1String("Device_Management_Allow_Login_Email_preference")) { 0558 setDeviceManagementAllowLoginEmailpreference(value.toBool()); 0559 } else if (id == QLatin1String("Message_GroupingPeriod")) { 0560 setMessageGroupingPeriod(value.toInt()); 0561 } else if (id == QLatin1String("DirectMesssage_maxUsers")) { 0562 setDirectMessageMaximumUser(value.toInt()); 0563 } else if (id == QLatin1String("Message_QuoteChainLimit")) { 0564 setMessageQuoteChainLimit(value.toInt()); 0565 } else if (id == QLatin1String("Accounts_AllowUserStatusMessageChange")) { 0566 setAllowCustomStatusMessage(value.toBool()); 0567 } else if (id == QLatin1String("FileUpload_MediaTypeWhiteList")) { 0568 setMediaWhiteList(value.toString().split(QLatin1Char(','), Qt::SkipEmptyParts)); 0569 } else if (id == QLatin1String("FileUpload_MediaTypeBlackList")) { 0570 setMediaBlackList(value.toString().split(QLatin1Char(','), Qt::SkipEmptyParts)); 0571 } else if (id == QLatin1String("Accounts_ShowFormLogin")) { 0572 if (value.toBool()) { 0573 mServerAuthTypes |= AuthenticationManager::AuthMethodType::Password; 0574 } else { 0575 mServerAuthTypes &= ~AuthenticationManager::AuthMethodType::Password; 0576 } 0577 } else if (id == QLatin1String("AuthenticationServerMethod")) { 0578 mServerAuthTypes = static_cast<AuthenticationManager::AuthMethodTypes>(value.toInt()); 0579 } else if (id == QLatin1String("API_Embed")) { 0580 setPreviewEmbed(value.toBool()); 0581 } else if (id == QLatin1String("API_EmbedCacheExpirationDays")) { 0582 setEmbedCacheExpirationDays(value.toInt()); 0583 } else { 0584 qCDebug(RUQOLA_LOG) << "Other public settings id " << id << value; 0585 } 0586 } 0587 0588 QStringList RuqolaServerConfig::mediaBlackList() const 0589 { 0590 return mMediaBlackList; 0591 } 0592 0593 void RuqolaServerConfig::setMediaBlackList(const QStringList &newMediaBlackList) 0594 { 0595 mMediaBlackList = newMediaBlackList; 0596 } 0597 0598 QJsonObject RuqolaServerConfig::createJsonObject(const QString &identifier, const QString &value) 0599 { 0600 QJsonObject v; 0601 v[QLatin1String("_id")] = identifier; 0602 v[QLatin1String("value")] = value; 0603 return v; 0604 } 0605 0606 QJsonObject RuqolaServerConfig::createJsonObject(const QString &identifier, const RuqolaServerConfig::ConfigWithDefaultValue &value) 0607 { 0608 QJsonObject v; 0609 v[QLatin1String("_id")] = identifier; 0610 QJsonObject customUrl; 0611 customUrl[QLatin1String("defaultUrl")] = value.defaultUrl; 0612 customUrl[QLatin1String("url")] = value.url; 0613 v[QLatin1String("value")] = customUrl; 0614 return v; 0615 } 0616 0617 QJsonObject RuqolaServerConfig::createJsonObject(const QString &identifier, qint64 value) 0618 { 0619 QJsonObject v; 0620 v[QLatin1String("_id")] = identifier; 0621 v[QLatin1String("value")] = static_cast<qint64>(value); 0622 return v; 0623 } 0624 0625 QJsonObject RuqolaServerConfig::createJsonObject(const QString &identifier, bool value) 0626 { 0627 QJsonObject v; 0628 v[QLatin1String("_id")] = identifier; 0629 v[QLatin1String("value")] = value; 0630 return v; 0631 } 0632 0633 QJsonObject RuqolaServerConfig::createJsonObject(const QString &identifier, int value) 0634 { 0635 QJsonObject v; 0636 v[QLatin1String("_id")] = identifier; 0637 v[QLatin1String("value")] = value; 0638 return v; 0639 } 0640 0641 QByteArray RuqolaServerConfig::serialize(bool toBinary) 0642 { 0643 QJsonObject o; 0644 QJsonArray array; 0645 array.append(createJsonObject(QStringLiteral("uniqueID"), mUniqueId)); 0646 array.append(createJsonObject(QStringLiteral("Jitsi_Enabled"), static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::JitsiEnabled))); 0647 array.append( 0648 createJsonObject(QStringLiteral("Jitsi_Enable_Teams"), static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::JitsiEnabledTeams))); 0649 array.append(createJsonObject(QStringLiteral("Jitsi_Enable_Channels"), 0650 static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::JitsiEnabledChannels))); 0651 array.append(createJsonObject(QStringLiteral("Jitsi_Domain"), jitsiMeetUrl())); 0652 array.append(createJsonObject(QStringLiteral("Jitsi_URL_Room_Prefix"), jitsiMeetPrefix())); 0653 array.append(createJsonObject(QStringLiteral("FileUpload_Storage_Type"), fileUploadStorageType())); 0654 array.append( 0655 createJsonObject(QStringLiteral("Message_AllowEditing"), static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::AllowEditingMessage))); 0656 array.append(createJsonObject(QStringLiteral("Message_AllowEditing_BlockEditInMinutes"), blockEditingMessageInMinutes())); 0657 array.append(createJsonObject(QStringLiteral("Message_AllowDeleting_BlockDeleteInMinutes"), blockDeletingMessageInMinutes())); 0658 array.append(createJsonObject(QStringLiteral("OTR_Enable"), static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::OtrEnabled))); 0659 array.append(createJsonObject(QStringLiteral("Site_Url"), mSiteUrl)); 0660 array.append(createJsonObject(QStringLiteral("Site_Name"), siteName())); 0661 array.append(createJsonObject(QStringLiteral("E2E_Enable"), static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::EncryptionEnabled))); 0662 array.append( 0663 createJsonObject(QStringLiteral("Message_AllowPinning"), static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::AllowMessagePinning))); 0664 array.append(createJsonObject(QStringLiteral("Message_AllowStarring"), 0665 static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::AllowMessageStarring))); 0666 array.append(createJsonObject(QStringLiteral("Message_AllowDeleting"), 0667 static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::AllowMessageDeleting))); 0668 array.append(createJsonObject(QStringLiteral("Threads_enabled"), static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::ThreadsEnabled))); 0669 array.append( 0670 createJsonObject(QStringLiteral("Discussion_enabled"), static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::DiscussionEnabled))); 0671 array.append(createJsonObject(QStringLiteral("AutoTranslate_Enabled"), 0672 static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::AutoTranslateEnabled))); 0673 array.append( 0674 createJsonObject(QStringLiteral("FileUpload_Enabled"), static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::UploadFileEnabled))); 0675 array.append(createJsonObject(QStringLiteral("AutoTranslate_GoogleAPIKey"), autoTranslateGoogleKey())); 0676 array.append( 0677 createJsonObject(QStringLiteral("Broadcasting_enabled"), static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::BroadCastEnabled))); 0678 array.append(createJsonObject(QStringLiteral("Message_VideoRecorderEnabled"), 0679 static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::VideoRecorderEnabled))); 0680 array.append(createJsonObject(QStringLiteral("Message_AudioRecorderEnabled"), 0681 static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::AudioRecorderEnabled))); 0682 array.append(createJsonObject(QStringLiteral("Accounts_AllowDeleteOwnAccount"), 0683 static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::AllowDeleteOwnAccount))); 0684 array.append(createJsonObject(QStringLiteral("Accounts_PasswordReset"), 0685 static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::AllowPasswordReset))); 0686 array.append(createJsonObject(QStringLiteral("Accounts_AllowEmailChange"), 0687 static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::AllowEmailChange))); 0688 array.append(createJsonObject(QStringLiteral("Accounts_AllowPasswordChange"), 0689 static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::AllowPasswordChange))); 0690 array.append(createJsonObject(QStringLiteral("Accounts_AllowUsernameChange"), 0691 static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::AllowUsernameChange))); 0692 0693 array.append(createJsonObject(QStringLiteral("Accounts_AllowUserProfileChange"), 0694 static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::AllowUserProfileChange))); 0695 array.append(createJsonObject(QStringLiteral("Accounts_AllowUserAvatarChange"), 0696 static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::AllowUserAvatarChange))); 0697 array.append(createJsonObject(QStringLiteral("LDAP_Enable"), static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::LdapEnabled))); 0698 array.append(createJsonObject(QStringLiteral("Accounts_TwoFactorAuthentication_Enabled"), 0699 static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::TwoFactorAuthenticationEnabled))); 0700 array.append(createJsonObject(QStringLiteral("Accounts_TwoFactorAuthentication_By_Email_Enabled"), 0701 static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::TwoFactorAuthenticationByEmailEnabled))); 0702 array.append(createJsonObject(QStringLiteral("Accounts_TwoFactorAuthentication_By_TOTP_Enabled"), 0703 static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::TwoFactorAuthenticationByTOTPEnabled))); 0704 array.append(createJsonObject(QStringLiteral("Accounts_TwoFactorAuthentication_Enforce_Password_Fallback"), 0705 static_cast<bool>(serverConfigFeatureTypes() & ServerConfigFeatureType::TwoFactorAuthenticationEnforcePasswordFallback))); 0706 array.append(createJsonObject(QStringLiteral("Assets_logo"), logoUrl())); 0707 array.append(createJsonObject(QStringLiteral("Assets_favicon"), faviconUrl())); 0708 array.append(createJsonObject(QStringLiteral("Accounts_LoginExpiration"), loginExpiration())); 0709 array.append(createJsonObject(QStringLiteral("UTF8_Channel_Names_Validation"), channelNameValidation())); 0710 array.append(createJsonObject(QStringLiteral("UTF8_User_Names_Validation"), userNameValidation())); 0711 array.append(createJsonObject(QStringLiteral("Message_MaxAllowedSize"), messageMaximumAllowedSize())); 0712 array.append(createJsonObject(QStringLiteral("Message_AllowConvertLongMessagesToAttachment"), messageAllowConvertLongMessagesToAttachment())); 0713 array.append(createJsonObject(QStringLiteral("UI_Use_Real_Name"), useRealName())); 0714 array.append(createJsonObject(QStringLiteral("Accounts_AllowInvisibleStatusOption"), accountsAllowInvisibleStatusOption())); 0715 array.append(createJsonObject(QStringLiteral("UserData_EnableDownload"), userDataDownloadEnabled())); 0716 array.append(createJsonObject(QStringLiteral("Device_Management_Enable_Login_Emails"), deviceManagementEnableLoginEmails())); 0717 array.append(createJsonObject(QStringLiteral("Device_Management_Allow_Login_Email_preference"), deviceManagementAllowLoginEmailpreference())); 0718 array.append(createJsonObject(QStringLiteral("Message_GroupingPeriod"), messageGroupingPeriod())); 0719 array.append(createJsonObject(QStringLiteral("DirectMesssage_maxUsers"), directMessageMaximumUser())); 0720 array.append(createJsonObject(QStringLiteral("Message_QuoteChainLimit"), messageQuoteChainLimit())); 0721 array.append(createJsonObject(QStringLiteral("Accounts_AllowUserStatusMessageChange"), allowCustomStatusMessage())); 0722 array.append(createJsonObject(QStringLiteral("FileUpload_MediaTypeWhiteList"), mMediaWhiteList.join(QLatin1Char(',')))); 0723 array.append(createJsonObject(QStringLiteral("FileUpload_MediaTypeBlackList"), mMediaBlackList.join(QLatin1Char(',')))); 0724 array.append(createJsonObject(QStringLiteral("FileUpload_MaxFileSize"), mFileMaxFileSize)); 0725 array.append(createJsonObject(QStringLiteral("AuthenticationServerMethod"), static_cast<int>(mServerAuthTypes))); 0726 array.append(createJsonObject(QStringLiteral("API_Embed"), previewEmbed())); 0727 array.append(createJsonObject(QStringLiteral("API_EmbedCacheExpirationDays"), embedCacheExpirationDays())); 0728 0729 o[QLatin1String("result")] = array; 0730 #if 0 0731 } else if (id.contains(regExp)) { 0732 if (value.toBool()) { 0733 addOauthService(id); 0734 } 0735 } else if (id == QLatin1String("Accounts_RegistrationForm")) { 0736 setAllowRegistrationFrom(value.toString()); 0737 0738 #endif 0739 if (toBinary) { 0740 return QCborValue::fromJsonValue(o).toCbor(); 0741 } 0742 QJsonDocument d; 0743 d.setObject(o); 0744 return d.toJson(QJsonDocument::Indented); 0745 } 0746 0747 void RuqolaServerConfig::deserialize(const QJsonObject &obj) 0748 { 0749 QJsonArray configs = obj.value(QLatin1String("result")).toArray(); 0750 mServerConfigFeatureTypes = ServerConfigFeatureType::None; 0751 for (QJsonValueRef currentConfig : configs) { 0752 const QJsonObject currentConfObject = currentConfig.toObject(); 0753 loadSettings(currentConfObject); 0754 } 0755 } 0756 0757 QStringList RuqolaServerConfig::mediaWhiteList() const 0758 { 0759 return mMediaWhiteList; 0760 } 0761 0762 void RuqolaServerConfig::setMediaWhiteList(const QStringList &newMediaWhiteList) 0763 { 0764 mMediaWhiteList = newMediaWhiteList; 0765 } 0766 0767 bool RuqolaServerConfig::allowCustomStatusMessage() const 0768 { 0769 return mAllowCustomStatusMessage; 0770 } 0771 0772 void RuqolaServerConfig::setAllowCustomStatusMessage(bool newAllowCustomStatusMessage) 0773 { 0774 mAllowCustomStatusMessage = newAllowCustomStatusMessage; 0775 } 0776 0777 int RuqolaServerConfig::messageQuoteChainLimit() const 0778 { 0779 return mMessageQuoteChainLimit; 0780 } 0781 0782 void RuqolaServerConfig::setMessageQuoteChainLimit(int newMessageQuoteChainLimit) 0783 { 0784 mMessageQuoteChainLimit = newMessageQuoteChainLimit; 0785 } 0786 0787 int RuqolaServerConfig::directMessageMaximumUser() const 0788 { 0789 return mDirectMessageMaximumUser; 0790 } 0791 0792 void RuqolaServerConfig::setDirectMessageMaximumUser(int newDirectMessageMaximumUser) 0793 { 0794 mDirectMessageMaximumUser = newDirectMessageMaximumUser; 0795 } 0796 0797 int RuqolaServerConfig::messageGroupingPeriod() const 0798 { 0799 return mMessageGroupingPeriod; 0800 } 0801 0802 void RuqolaServerConfig::setMessageGroupingPeriod(int newMessageGroupingPeriod) 0803 { 0804 mMessageGroupingPeriod = newMessageGroupingPeriod; 0805 } 0806 0807 bool RuqolaServerConfig::deviceManagementAllowLoginEmailpreference() const 0808 { 0809 return mDeviceManagementAllowLoginEmailpreference; 0810 } 0811 0812 void RuqolaServerConfig::setDeviceManagementAllowLoginEmailpreference(bool newDeviceManagementAllowLoginEmailpreference) 0813 { 0814 mDeviceManagementAllowLoginEmailpreference = newDeviceManagementAllowLoginEmailpreference; 0815 } 0816 0817 bool RuqolaServerConfig::deviceManagementEnableLoginEmails() const 0818 { 0819 return mDeviceManagementEnableLoginEmails; 0820 } 0821 0822 void RuqolaServerConfig::setDeviceManagementEnableLoginEmails(bool newDeviceManagementEnableLoginEmails) 0823 { 0824 mDeviceManagementEnableLoginEmails = newDeviceManagementEnableLoginEmails; 0825 } 0826 0827 bool RuqolaServerConfig::userDataDownloadEnabled() const 0828 { 0829 return mUserDataDownloadEnabled; 0830 } 0831 0832 void RuqolaServerConfig::setUserDataDownloadEnabled(bool newUserDataDownloadEnabled) 0833 { 0834 mUserDataDownloadEnabled = newUserDataDownloadEnabled; 0835 } 0836 0837 bool RuqolaServerConfig::accountsAllowInvisibleStatusOption() const 0838 { 0839 return mAccountsAllowInvisibleStatusOption; 0840 } 0841 0842 void RuqolaServerConfig::setAccountsAllowInvisibleStatusOption(bool newAccountsAllowInvisibleStatusOption) 0843 { 0844 mAccountsAllowInvisibleStatusOption = newAccountsAllowInvisibleStatusOption; 0845 } 0846 0847 bool RuqolaServerConfig::hasEnterpriseSupport() const 0848 { 0849 return mHasEnterpriseSupport; 0850 } 0851 0852 void RuqolaServerConfig::setHasEnterpriseSupport(bool newHasEnterpriseSupport) 0853 { 0854 mHasEnterpriseSupport = newHasEnterpriseSupport; 0855 } 0856 0857 bool RuqolaServerConfig::useRealName() const 0858 { 0859 return mUIUseRealName; 0860 } 0861 0862 void RuqolaServerConfig::setUseRealName(bool newUIUseRealName) 0863 { 0864 mUIUseRealName = newUIUseRealName; 0865 } 0866 0867 void RuqolaServerConfig::parsePublicSettings(const QJsonObject &obj, bool update) 0868 { 0869 // qDebug() << " void RuqolaServerConfig::parsePublicSettings(const QJsonObject &obj)" << obj; 0870 QJsonArray configs = obj.value(QLatin1String("result")).toArray(); 0871 if (!update) { 0872 mServerConfigFeatureTypes = ServerConfigFeatureType::None; 0873 } 0874 for (QJsonValueRef currentConfig : configs) { 0875 const QJsonObject currentConfObject = currentConfig.toObject(); 0876 loadSettings(currentConfObject); 0877 } 0878 } 0879 0880 bool RuqolaServerConfig::ConfigWithDefaultValue::operator==(const RuqolaServerConfig::ConfigWithDefaultValue &other) const 0881 { 0882 return other.url == url && other.defaultUrl == defaultUrl; 0883 } 0884 0885 bool RuqolaServerConfig::operator==(const RuqolaServerConfig &other) const 0886 { 0887 return mUniqueId == other.mUniqueId && mJitsiMeetUrl == other.mJitsiMeetUrl && mJitsiMeetPrefix == other.mJitsiMeetPrefix 0888 && mFileUploadStorageType == other.mFileUploadStorageType && mSiteUrl == other.mSiteUrl && mSiteName == other.mSiteName 0889 && mServerVersionStr == other.mServerVersionStr && mAutoTranslateGoogleKey == other.mAutoTranslateGoogleKey 0890 && mChannelNameValidation == other.mChannelNameValidation && mUserNameValidation == other.mUserNameValidation 0891 && mServerAuthTypes == other.mServerAuthTypes && mRuqolaAuthMethodTypes == other.mRuqolaAuthMethodTypes 0892 && mBlockEditingMessageInMinutes == other.mBlockEditingMessageInMinutes && mBlockDeletingMessageInMinutes == other.mBlockDeletingMessageInMinutes 0893 && mServerVersionMajor == other.mServerVersionMajor && mServerVersionMinor == other.mServerVersionMinor 0894 && mServerVersionPatch == other.mServerVersionPatch && mFileMaxFileSize == other.mFileMaxFileSize 0895 && mNeedAdaptNewSubscriptionRC60 == other.mNeedAdaptNewSubscriptionRC60 0896 && mMessageAllowConvertLongMessagesToAttachment == other.mMessageAllowConvertLongMessagesToAttachment && mUIUseRealName == other.mUIUseRealName 0897 && mServerConfigFeatureTypes == other.mServerConfigFeatureTypes && mMediaWhiteList == other.mMediaWhiteList && mMediaBlackList == other.mMediaBlackList 0898 && mLogoUrl == other.mLogoUrl && mFaviconUrl == other.mFaviconUrl && mLoginExpiration == other.mLoginExpiration 0899 && mMessageMaximumAllowedSize == other.mMessageMaximumAllowedSize && mMessageGroupingPeriod == other.mMessageGroupingPeriod 0900 && mDirectMessageMaximumUser == other.mDirectMessageMaximumUser && mMessageQuoteChainLimit == other.mMessageQuoteChainLimit 0901 && mHasEnterpriseSupport == other.mHasEnterpriseSupport && mAccountsAllowInvisibleStatusOption == other.mAccountsAllowInvisibleStatusOption 0902 && mUserDataDownloadEnabled == other.mUserDataDownloadEnabled && mDeviceManagementEnableLoginEmails == other.mDeviceManagementEnableLoginEmails 0903 && mDeviceManagementAllowLoginEmailpreference == other.mDeviceManagementAllowLoginEmailpreference 0904 && mAllowCustomStatusMessage == other.mAllowCustomStatusMessage && mPreviewEmbed == other.mPreviewEmbed 0905 && mEmbedCacheExpirationDays == other.mEmbedCacheExpirationDays; 0906 } 0907 0908 void RuqolaServerConfig::loadAccountSettingsFromLocalDataBase(const QByteArray &ba) 0909 { 0910 const QJsonDocument doc = QJsonDocument::fromJson(ba); 0911 const QJsonObject newObj = doc.object(); 0912 deserialize(newObj); 0913 } 0914 0915 #include "moc_ruqolaserverconfig.cpp"