mirror of
https://github.com/overte-org/overte.git
synced 2025-04-15 08:26:36 +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() {
|
function getWhitelistAsText() {
|
||||||
var whitelist = Settings.getValue("private/settingsSafeURLS");
|
var whitelist = Settings.getValue("private/settingsSafeURLS");
|
||||||
return whitelist;
|
var arrayWhitelist = whitelist.split(",");
|
||||||
|
var whitelistText = arrayWhitelist.join("\n");
|
||||||
|
return whitelistText;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setWhiteListAsText(whitelistText) {
|
function setWhiteListAsText(whitelistText) {
|
||||||
console.info('SETTINGCURRENTVALUE: ', Settings.getValue('private/settingsSafeURLS'), whitelistText.text)
|
|
||||||
Settings.setValue("private/settingsSafeURLS", whitelistText.text);
|
Settings.setValue("private/settingsSafeURLS", whitelistText.text);
|
||||||
console.info('SETVALUE: ', Settings.getValue('private/settingsSafeURLS'), whitelistText.text)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
|
@ -2370,7 +2370,7 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co
|
||||||
// PULL SAFEURLS FROM INTERFACE.JSON Settings
|
// PULL SAFEURLS FROM INTERFACE.JSON Settings
|
||||||
|
|
||||||
QVariant raw = Setting::Handle<QVariant>("private/settingsSafeURLS").get();
|
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;
|
safeURLS += settingsSafeURLS;
|
||||||
|
|
||||||
// END PULL SAFEURLS FROM INTERFACE.JSON Settings
|
// END PULL SAFEURLS FROM INTERFACE.JSON Settings
|
||||||
|
@ -2378,10 +2378,11 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co
|
||||||
bool isInWhitelist = false; // assume unsafe
|
bool isInWhitelist = false; // assume unsafe
|
||||||
for (const auto& str : safeURLS) {
|
for (const auto& str : safeURLS) {
|
||||||
// qDebug() << "CHECKING" << entityID.toString() << scriptOrURL << "AGAINST" << str;
|
// 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);
|
<< scriptOrURL.startsWith(str);
|
||||||
if (scriptOrURL.startsWith(str)) {
|
if (scriptOrURL.startsWith(str)) {
|
||||||
isInWhitelist = true;
|
isInWhitelist = true;
|
||||||
|
qCDebug(scriptengine) << "Script approved.";
|
||||||
break; // bail early since we found a match
|
break; // bail early since we found a match
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue