Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 4 files). Show all
Unified · Split
| @@ -84,6 +84,11 @@ · 83 unmodified lines | ||
| 84 | 84 | #include "../../midi/src/Midi.h" // FIXME why won't a simpler include work? |
| 85 | 85 | #include "MIDIEvent.h" |
| 86 | 86 | |
| 87 | +#include "SettingHandle.h" | |
| 88 | +// #include "SettingManager.h" | |
| 89 | +// #include "SettingInterface.h" | |
| 90 | +// #include "SettingHelpers.h" | |
| 91 | + | |
| 87 | 92 | const QString ScriptEngine::_SETTINGS_ENABLE_EXTENDED_EXCEPTIONS { |
| 88 | 93 | "com.highfidelity.experimental.enableExtendedJSExceptions" |
| 89 | 94 | }; |
| @@ -2362,10 +2367,30 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co · 2272 unmodified lines | ||
| 2362 | 2367 | QList<QString> safeURLS = { "https://FAKEURL.t43wt4g4g44FAKE" }; |
| 2363 | 2368 | safeURLS += qEnvironmentVariable("EXTRA_WHITELIST").split(QRegExp("\\s*,\\s*"), QString::SkipEmptyParts); |
| 2364 | 2369 | |
| 2370 | + // PULL SAFEURLS FROM INTERFACE.JSON Settings | |
| 2371 | + | |
| 2372 | + QVariant raw = Setting::Handle<QVariant>("private/settingsSafeURLS").get(); | |
| 2373 | + // qDebug() << "raw value" << raw; | |
| 2374 | + // qDebug() << "raw value as list" << raw.toList(); | |
| 2375 | + QStringList settingsSafeURLS = raw.toString().split(QRegExp("[\r\n]+")); | |
| 2376 | + safeURLS += settingsSafeURLS; | |
| 2377 | + | |
| 2378 | + // QVariantList settingsSafeURLS = Setting::Handle<QVariantList>("private/settingsSafeURLS").get(); | |
| 2379 | + // qCDebug(scriptengine) << "ESWsafeURLS" << safeURLS; | |
| 2380 | + | |
| 2381 | + // for (QVariantList::iterator surl = settingsSafeURLS.begin(); surl != settingsSafeURLS.end(); surl++) | |
| 2382 | + // { | |
| 2383 | + // safeURLS += (*surl).toString(); | |
| 2384 | + // } | |
| 2385 | + | |
| 2386 | + // for (const auto& s : settingsSafeURLS) safeURLS << s.toString(); | |
| 2387 | + | |
| 2388 | + // END PULL SAFEURLS FROM INTERFACE.JSON Settings | |
| 2389 | + | |
| 2365 | 2390 | bool isInWhitelist = false; // assume unsafe |
| 2366 | 2391 | for (const auto& str : safeURLS) { |
| 2367 | 2392 | // qDebug() << "CHECKING" << entityID.toString() << scriptOrURL << "AGAINST" << str; |
| 2368 | − qDebug() << "SCRIPTOURL STARTSWITH" << scriptOrURL << "TESTING AGAINST" << str << "RESULTS IN" | |
| 2393 | + qCDebug(scriptengine) << "SCRIPT URL STARTSWITH" << scriptOrURL << "TESTING AGAINST" << str << "RESULTS IN" | |
| 2369 | 2394 | << scriptOrURL.startsWith(str); |
| 2370 | 2395 | if (scriptOrURL.startsWith(str)) { |
| 2371 | 2396 | isInWhitelist = true; |
| @@ -2373,7 +2398,7 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co · 1 unmodified line | ||
| 2373 | 2398 | } |
| 2374 | 2399 | } |
| 2375 | 2400 | if (!isInWhitelist) { |
| 2376 | − qDebug() << "(disabled entity script)" << entityID.toString() << scriptOrURL; | |
| 2401 | + qCDebug(scriptengine) << "(disabled entity script)" << entityID.toString() << scriptOrURL; | |
| 2377 | 2402 | exception = makeError("UNSAFE_ENTITY_SCRIPTS == 0"); |
| 2378 | 2403 | } else { |
| 2379 | 2404 | QTimer timeout; |