diff options
| author | Jonathan "Geenz" Goodman <geenz@lindenlab.com> | 2026-09-22 17:35:03 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-22 17:35:03 -0400 |
| commit | f3fba78d9185a2385cc6c5226b7a87fddff826dd (patch) | |
| tree | 4d04ad5876c69ec0b3203dec69c711161fa7f934 /indra/newview/llpreviewscript.cpp | |
| parent | cc5d3dd3cd653971fff16cf2bc1d380edd5ea7f2 (diff) | |
| parent | 125dfba5f94191fc99d1c511d190d6a9f2d9d2f1 (diff) | |
Merge pull request #6357 from secondlife/pepper/chat-merge-26.5
Merge `release/26.5` into `project/chat-modernization`
Diffstat (limited to 'indra/newview/llpreviewscript.cpp')
| -rw-r--r-- | indra/newview/llpreviewscript.cpp | 57 |
1 files changed, 40 insertions, 17 deletions
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 10bacf53b7..cee1180fa7 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -40,7 +40,6 @@ #include "llinventorymodel.h" #include "llkeyboard.h" #include "lllineeditor.h" -#include "llmd5.h" #include "llhelp.h" #include "llnotificationsutil.h" #include "llresmgr.h" @@ -86,6 +85,8 @@ #include <regex> const std::string HELP_LSL_PORTAL_TOPIC = "LSL_Portal"; +const std::string HELP_LUA_PORTAL_URL = "https://wiki.secondlife.com/wiki/Lua_Alpha"; +const std::string HELP_LUA_LIBRARY_URL = "https://luau.org/library"; const std::string DEFAULT_SCRIPT_NAME = "New Script"; // *TODO:Translate? const std::string DEFAULT_SCRIPT_DESC = "(No Description)"; // *TODO:Translate? @@ -94,6 +95,36 @@ const std::string DEFAULT_SCRIPT_DESC = "(No Description)"; // *TODO:Translate? const S32 MAX_HISTORY_COUNT = 10; const F32 LIVE_HELP_REFRESH_TIME = 1.f; +static bool is_luau_library_symbol(const std::string& symbol) +{ + return symbol.rfind("bit32.", 0) == 0 + || symbol.rfind("buffer.", 0) == 0 + || symbol.rfind("coroutine.", 0) == 0 + || symbol.rfind("debug.", 0) == 0 + || symbol.rfind("math.", 0) == 0 + || symbol.rfind("os.", 0) == 0 + || symbol.rfind("string.", 0) == 0 + || symbol.rfind("table.", 0) == 0 + || symbol.rfind("utf8.", 0) == 0; +} + +static std::string build_script_help_url(bool luau_language, const std::string& help_string) +{ + if (!luau_language || help_string.rfind("ll.", 0) == 0) + { + LLUIString url_string = gSavedSettings.getString("LSLHelpURL"); + std::string page = help_string; + if (luau_language) + { + page.erase(2, 1); // Lua's ll.GetOwner maps to LSL's llGetOwner. + } + url_string.setArg("[LSL_STRING]", page.empty() ? HELP_LSL_PORTAL_TOPIC : page); + return url_string.getString(); + } + + return is_luau_library_symbol(help_string) ? HELP_LUA_LIBRARY_URL : HELP_LUA_PORTAL_URL; +} + static bool have_script_upload_cap(LLUUID& object_id) { LLViewerObject* object = gObjectList.findObject(object_id); @@ -210,6 +241,7 @@ LLFloaterScriptSearch::LLFloaterScriptSearch(LLScriptEdCore* editor_core) mEditorCore(editor_core) { buildFromFile("floater_script_search.xml"); + setCanMinimize(false); sInstance = this; @@ -867,13 +899,9 @@ void LLScriptEdCore::setHelpPage(const std::string& help_string) LLComboBox* history_combo = help_floater->getChild<LLComboBox>("history_combo"); if (!history_combo) return; - LLUIString url_string = gSavedSettings.getString("LSLHelpURL"); - - url_string.setArg("[LSL_STRING]", help_string.empty() ? HELP_LSL_PORTAL_TOPIC : help_string); - addHelpItemToHistory(help_string); - web_browser->navigateTo(url_string); + web_browser->navigateTo(build_script_help_url(mEditor->getIsLuauLanguage(), help_string)); } @@ -1008,6 +1036,10 @@ void LLScriptEdCore::onBtnDynamicHelp() mLiveHelpHistorySize = 0; } + const bool luau_language = mEditor->getIsLuauLanguage(); + live_help_floater->setTitle(luau_language ? "LUA REFERENCE" : "LSL REFERENCE"); + live_help_floater->setHelpTopic(luau_language ? "Lua_Alpha" : "lsl_reference"); + bool visible = true; bool take_focus = true; live_help_floater->setVisible(visible); @@ -1081,9 +1113,7 @@ void LLScriptEdCore::onHelpComboCommit(LLUICtrl* ctrl, void* userdata) corep->addHelpItemToHistory(help_string); LLMediaCtrl* web_browser = live_help_floater->getChild<LLMediaCtrl>("lsl_guide_html"); - LLUIString url_string = gSavedSettings.getString("LSLHelpURL"); - url_string.setArg("[LSL_STRING]", help_string); - web_browser->navigateTo(url_string); + web_browser->navigateTo(build_script_help_url(corep->mEditor->getIsLuauLanguage(), help_string)); } } @@ -1613,14 +1643,7 @@ std::string LLScriptEdContainer::getUniqueHash() const // Take script inventory item id (within the object inventory) // to consideration so that it's possible to edit multiple scripts // in the same object inventory simultaneously (STORM-781). - std::string script_id = mObjectUUID.asString() + "_" + mItemUUID.asString(); - - // Use MD5 sum to make the file name shorter and not exceed maximum path length. - char script_id_hash_str[33]; /* Flawfinder: ignore */ - LLMD5 script_id_hash((const U8*)script_id.c_str()); - script_id_hash.hex_digest(script_id_hash_str); - - return std::string(script_id_hash_str); + return LLScriptEditorWSServer::buildScriptSubscriptionId(mObjectUUID, mItemUUID); } std::string LLScriptEdContainer::getErrorLogFileName(const std::string& script_path) |
