/*! \brief Read settings. */ void RemoteControl::readSettings(QSettings *settings) { if (!settings) return; settings->beginGroup("remote_control"); // Get port number; restart server if running if (settings->contains("port")) setPort(settings->value("port").toInt()); // Get list of allowed hosts if (settings->contains("allowed_hosts")) setHosts(settings->value("allowed_hosts").toStringList()); settings->endGroup(); }
int HotlinkCtrl::config(const XmlNode *pNode) { if (setSuffixes(pNode->getChildValue("suffixes")) <= 0) { LS_ERROR(ConfigCtx::getCurConfigCtx(), "no suffix is configured, disable hotlink protection."); return LS_FAIL; } setDirectAccess(ConfigCtx::getCurConfigCtx()->getLongValue(pNode, "allowDirectAccess", 0, 1, 0)); const char *pRedirect = pNode->getChildValue("redirectUri"); if (pRedirect) setRedirect(pRedirect); int self = ConfigCtx::getCurConfigCtx()->getLongValue(pNode, "onlySelf", 0, 1, 0); if (!self) { char achBuf[4096]; const char *pValue = pNode->getChildValue("allowedHosts"); if (pValue) { ConfigCtx::getCurConfigCtx()->expandDomainNames(pValue, achBuf, 4096, ','); pValue = achBuf; } int ret = setHosts(pValue); int ret2 = setRegex(pNode->getChildValue("matchedHosts")); if ((ret <= 0) && (ret2 < 0)) { LS_WARN(ConfigCtx::getCurConfigCtx(), "no valid host is configured, only self" " reference is allowed."); self = 1; } } setOnlySelf(self); return 0; }