mirror of
https://github.com/overte-org/overte.git
synced 2025-04-13 17:32:11 +02:00
Merge pull request #5 from kasenvr/feature/whitelist-qml-cpp-ui
scriptengine pulls from inferface.json correctly, removed extra debug…
This commit is contained in:
commit
858b056803
2 changed files with 6 additions and 5 deletions
|
@ -24,13 +24,13 @@ Rectangle {
|
|||
|
||||
function getWhitelistAsText() {
|
||||
var whitelist = Settings.getValue("private/settingsSafeURLS");
|
||||
return whitelist;
|
||||
var arrayWhitelist = whitelist.split(",");
|
||||
var whitelistText = arrayWhitelist.join("\n");
|
||||
return whitelistText;
|
||||
}
|
||||
|
||||
function setWhiteListAsText(whitelistText) {
|
||||
console.info('SETTINGCURRENTVALUE: ', Settings.getValue('private/settingsSafeURLS'), whitelistText.text)
|
||||
Settings.setValue("private/settingsSafeURLS", whitelistText.text);
|
||||
console.info('SETVALUE: ', Settings.getValue('private/settingsSafeURLS'), whitelistText.text)
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
|
|
|
@ -2370,7 +2370,7 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co
|
|||
// PULL SAFEURLS FROM INTERFACE.JSON Settings
|
||||
|
||||
QVariant raw = Setting::Handle<QVariant>("private/settingsSafeURLS").get();
|
||||
QStringList settingsSafeURLS = raw.toString().split(QRegExp("[\r\n]+"));
|
||||
QStringList settingsSafeURLS = raw.toString().split(QRegExp("\\s*[,\r\n]+\\s*"));
|
||||
safeURLS += settingsSafeURLS;
|
||||
|
||||
// END PULL SAFEURLS FROM INTERFACE.JSON Settings
|
||||
|
@ -2378,10 +2378,11 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co
|
|||
bool isInWhitelist = false; // assume unsafe
|
||||
for (const auto& str : safeURLS) {
|
||||
// qDebug() << "CHECKING" << entityID.toString() << scriptOrURL << "AGAINST" << str;
|
||||
qCDebug(scriptengine) << "SCRIPT URL STARTSWITH" << scriptOrURL << "TESTING AGAINST" << str << "RESULTS IN"
|
||||
qCDebug(scriptengine) << "Script URL: " << scriptOrURL << "TESTING AGAINST" << str << "RESULTS IN"
|
||||
<< scriptOrURL.startsWith(str);
|
||||
if (scriptOrURL.startsWith(str)) {
|
||||
isInWhitelist = true;
|
||||
qCDebug(scriptengine) << "Script approved.";
|
||||
break; // bail early since we found a match
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue