Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1 file). Show all
Unified · Split
| @@ -2377,15 +2377,21 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co · 2376 unmodified lines | ||
| 2377 | 2377 | // END PULL SAFEURLS FROM INTERFACE.JSON Settings |
| 2378 | 2378 | |
| 2379 | 2379 | bool isInWhitelist = false; // assume unsafe |
| 2380 | − for (const auto& str : safeURLS) { | |
| 2381 | − qCDebug(scriptengine) << whitelistPrefix << "Script URL: " << scriptOrURL << "TESTING AGAINST" << str << "RESULTS IN" | |
| 2382 | − << scriptOrURL.startsWith(str); | |
| 2383 | − if (!str.isEmpty() && scriptOrURL.startsWith(str)) { | |
| 2384 | − isInWhitelist = true; | |
| 2385 | − qCDebug(scriptengine) << whitelistPrefix << "Script approved."; | |
| 2386 | − break; // bail early since we found a match | |
| 2387 | − } | |
| 2388 | − } | |
| 2380 | + | |
| 2381 | + if(ScriptEngine::getContext() == "entity_server") { | |
| 2382 | + isInWhitelist = true; | |
| 2383 | + } else { | |
| 2384 | + for (const auto& str : safeURLS) { | |
| 2385 | + qCDebug(scriptengine) << whitelistPrefix << "Script URL: " << scriptOrURL << "TESTING AGAINST" << str << "RESULTS IN" | |
| 2386 | + << scriptOrURL.startsWith(str); | |
| 2387 | + if (!str.isEmpty() && scriptOrURL.startsWith(str)) { | |
| 2388 | + isInWhitelist = true; | |
| 2389 | + qCDebug(scriptengine) << whitelistPrefix << "Script approved."; | |
| 2390 | + break; // bail early since we found a match | |
| 2391 | + } | |
| 2392 | + } | |
| 2393 | + } | |
| 2394 | + | |
| 2389 | 2395 | if (!isInWhitelist) { |
| 2390 | 2396 | qCDebug(scriptengine) << whitelistPrefix << "(disabled entity script)" << entityID.toString() << scriptOrURL; |
| 2391 | 2397 | exception = makeError("UNSAFE_ENTITY_SCRIPTS == 0"); |