No longer send the script source of shortcuts via the topic. Don't scripts into the log that are binary blobs

This commit is contained in:
Alexander Bock
2024-08-14 14:38:46 +02:00
parent 1cef84ca74
commit ab4023b9fd
2 changed files with 3 additions and 4 deletions

View File

@@ -58,7 +58,6 @@ std::vector<nlohmann::json> ShortcutTopic::shortcutsJson() const {
const nlohmann::json shortcutJson = {
{ "identifier", action.identifier },
{ "name", action.name },
{ "script", action.command },
{ "synchronization", static_cast<bool>(!action.isLocal) },
{ "documentation", action.documentation },
{ "guiPath", action.guiPath },
@@ -121,7 +120,6 @@ nlohmann::json ShortcutTopic::shortcutJson(const std::string& identifier) const
json.push_back({
{ "identifier", action.identifier },
{ "name", action.name },
{ "script", action.command },
{ "synchronization", static_cast<bool>(!action.isLocal) },
{ "documentation", action.documentation },
{ "guiPath", action.guiPath },

View File

@@ -170,8 +170,9 @@ bool ScriptEngine::runScript(const std::string& script, const ScriptCallback& ca
ghoul_assert(!script.empty(), "Script must not be empty");
if (_logScripts) {
// Write command to log before it's executed
if (_logScripts && script[0] != '\x1b') {
// \x1b = A byte in the beginning that Lua uses to represent whether a string is
// an ASCII or a binary blob. We don't want to print binary blobs into the log
writeLog(script);
}