From 46412a6bfcf232790b9a57931d3efafcbf758511 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Geenz\" Goodman" Date: Tue, 7 Apr 2026 19:12:59 -0400 Subject: Release/26.1.1 (#5530) * Integrate Velopack installer and update framework * Add Velopack update support for macOS and VVM integration * Update Velopack version and dependencies * Improve Velopack packaging for macOS * #5346 Uninstall older non-velopack viewer (#5363) * #5335 Fix silent uninstall asking about registry * #5346 Uninstall older non-velopack viewer * Use runtime viewer exe name, handle Velopack URL * Velopack download failure diagnostic (#5520) * Velopack download failure diagnostic * Fix up velopack downloading updates. Handle updates internally then hand them off to velopack. (#5524) * More velopack changes. Should download updates properly now. * Don't include NSI files * Restore optional updates, refine viewer restart behavior. (#5527) * Add support for optional updates. * Don't restart the viewer after the update unless it was optional. * Setup UpdaterServiceSetting with velopack properly. * Refine the restart behavior a bit - readd the old "the viewer must update" UX. * If the update is still downloading, close should just reopen the downloading dialog. --------- Co-authored-by: Jonathan "Geenz" Goodman * Remove SLVersionChecker from the viewer with velopack. (#5528) * Remove SLVersionChecker updater integration * Ensure that the portable install has the correct version number. * Don't produce shortcuts with VPK - we do this with our post install. * Bump viewer version from 26.1.0 to 26.1.1 * Potential fix for uninstaller not being functional. * Fix for UpdaterServiceSetting being ignored. * Filter for release channel when generating shortcuts. * Add some more logging for icons on Windows builds. * More VPK logging. * Move velopack packaging in CI to the sign and package step. * Enable velopack downgrade and skip older updates * Move the version required checking into velopack's checks. * Potential fix for downgrade prompts. * Make sure our macOS flow mirrors Windows. * Make sure to use the dev version of the mac sign and package. * p#553 Only one of two uninstallers displayed * #5346 Don't force user to shutdown velopack build for NSIS uninstall * #5346 Ignore option for the uninstall dialog * #5346 Fix early exit crash * #5346 Properly reset version flag. * Add some autodetect logic on macOS. * p#564 Clear legacy links * p#553 Handle uninstall records * p#549 Permit testing release notes on a test build * p#564 Remake nsis to velopack update flow * p#564 Remake nsis to velopack update flow #2 * p#564 Fix incorrect value type * p#553 Clear velopack's own registry entry in favor of a custom one * #5346 Resolve duplicated window class name * Bump to 2.1.0 of sign and package. --------- Co-authored-by: Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> --- indra/newview/llvelopack.h | 59 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 indra/newview/llvelopack.h (limited to 'indra/newview/llvelopack.h') diff --git a/indra/newview/llvelopack.h b/indra/newview/llvelopack.h new file mode 100644 index 0000000000..d04d0db7dc --- /dev/null +++ b/indra/newview/llvelopack.h @@ -0,0 +1,59 @@ +/** + * @file llvelopack.h + * @brief Velopack installer and update framework integration + * + * $LicenseInfo:firstyear=2025&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2025, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLVELOPACK_H +#define LL_LLVELOPACK_H + +#if LL_VELOPACK + +#include +#include + +bool velopack_initialize(); +void velopack_check_for_updates(const std::string& required_version, const std::string& relnotes_url); +std::string velopack_get_current_version(); +bool velopack_is_update_pending(); +bool velopack_is_required_update_in_progress(); +std::string velopack_get_required_update_version(); +bool velopack_should_restart_after_update(); +void velopack_request_restart_after_update(); +void velopack_apply_pending_update(bool restart = true); +void velopack_set_update_url(const std::string& url); +void velopack_set_progress_callback(std::function callback); +void velopack_cleanup(); + +#if LL_WINDOWS +void clear_nsis_links(); +bool get_nsis_version( + int& nsis_major, + int& nsis_minor, + int& nsis_patch, + uint64_t& nsis_build); +#endif + +#endif // LL_VELOPACK +#endif +// EOF -- cgit v1.3 From 49790ad857fbbee05f786bf8c29477a6805c5b0d Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> Date: Thu, 9 Apr 2026 21:21:52 +0300 Subject: #5628 Update taskbar's link to point to velopack --- indra/newview/llstartup.cpp | 5 +- indra/newview/llvelopack.cpp | 188 ++++++++++++++++++++++++++++++++++++++++--- indra/newview/llvelopack.h | 5 +- 3 files changed, 185 insertions(+), 13 deletions(-) (limited to 'indra/newview/llvelopack.h') diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index c23b493ad0..72acb9beae 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2632,8 +2632,9 @@ void uninstall_nsis_if_required() S32 found_minor = 0; S32 found_patch = 0; U64 found_build = 0; + std::string nsis_path; - if (!get_nsis_version(found_major, found_minor, found_patch, found_build)) + if (!get_nsis_version(found_major, found_minor, found_patch, found_build, nsis_path)) { return; } @@ -2665,7 +2666,7 @@ void uninstall_nsis_if_required() // so there is no point to check build. LL_INFOS() << "Found NSIS install " << found_major << "." << found_minor << "." << found_patch << "." << found_build << LL_ENDL; - clear_nsis_links(); + clear_nsis_links(nsis_path); LLSD args; args["VERSION"] = llformat("%d.%d.%d", found_major, found_minor, found_patch); diff --git a/indra/newview/llvelopack.cpp b/indra/newview/llvelopack.cpp index 28e989c4ba..7a013dafb5 100644 --- a/indra/newview/llvelopack.cpp +++ b/indra/newview/llvelopack.cpp @@ -330,14 +330,14 @@ static std::wstring get_desktop_path() return L""; } -static bool create_shortcut(const std::wstring& shortcut_path, +static HRESULT create_shortcut(const std::wstring& shortcut_path, const std::wstring& target_path, const std::wstring& arguments, const std::wstring& description, const std::wstring& icon_path) { HRESULT hr = CoInitialize(NULL); - if (FAILED(hr)) return false; + if (FAILED(hr)) return hr; IShellLinkW* shell_link = nullptr; hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, @@ -365,7 +365,7 @@ static bool create_shortcut(const std::wstring& shortcut_path, } CoUninitialize(); - return SUCCEEDED(hr); + return hr; } static void register_protocol_handler(const std::wstring& protocol, @@ -405,9 +405,105 @@ static void register_protocol_handler(const std::wstring& protocol, } } -void clear_nsis_links() +static bool get_shortcut_target(const std::wstring& lnk_path, std::wstring& target_path_str) +{ + // Resolve the shortcut to check its target + wchar_t target_path[MAX_PATH] = { 0 }; + HRESULT hr = CoInitialize(NULL); + bool res = false; + if (SUCCEEDED(hr)) + { + IShellLinkW* psl = nullptr; + hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLinkW, (void**)&psl); + if (SUCCEEDED(hr)) + { + IPersistFile* ppf = nullptr; + hr = psl->QueryInterface(IID_IPersistFile, (void**)&ppf); + if (SUCCEEDED(hr)) + { + hr = ppf->Load(lnk_path.c_str(), STGM_READ); + if (SUCCEEDED(hr)) + { + // Resolve() in theory may retarget to a different executable, + // but we should be fine as long as folder stays the same, + // otherwise we shouldn't clear it. + hr = psl->Resolve(NULL, SLR_NO_UI | SLR_NOUPDATE | SLR_ANY_MATCH); + if (SUCCEEDED(hr)) + { + hr = psl->GetPath(target_path, MAX_PATH, nullptr, 0); + if (SUCCEEDED(hr)) + { + target_path_str = std::wstring(target_path); + res = true; + } + } + } + ppf->Release(); + } + psl->Release(); + } + CoUninitialize(); + } + return res; +} + +static bool paths_are_equal(const std::wstring& path1, const std::wstring& path2) +{ + try + { + std::error_code ec1, ec2; + std::filesystem::path p1(path1); + std::filesystem::path p2(path2); + + // Get canonical (absolute, normalized) paths + auto canonical1 = std::filesystem::canonical(p1, ec1); + auto canonical2 = std::filesystem::canonical(p2, ec2); + + // If either path doesn't exist, fall back to string comparison + if (ec1 || ec2) + { + // Normalize case for comparison + std::wstring lower1 = path1; + std::wstring lower2 = path2; + std::transform(lower1.begin(), lower1.end(), lower1.begin(), ::towlower); + std::transform(lower2.begin(), lower2.end(), lower2.begin(), ::towlower); + while (!lower1.empty() && (lower1.back() == L'\\' || lower1.back() == L'/')) + { + lower1.pop_back(); + } + while (!lower2.empty() && (lower2.back() == L'\\' || lower2.back() == L'/')) + { + lower2.pop_back(); + } + return lower1 == lower2; + } + + // Use filesystem::equivalent which handles all path variations + return std::filesystem::equivalent(canonical1, canonical2, ec1); + } + catch (const std::filesystem::filesystem_error&) + { + // Fallback to case-insensitive string comparison + std::wstring lower1 = path1; + std::wstring lower2 = path2; + std::transform(lower1.begin(), lower1.end(), lower1.begin(), ::towlower); + std::transform(lower2.begin(), lower2.end(), lower2.begin(), ::towlower); + while (!lower1.empty() && (lower1.back() == L'\\' || lower1.back() == L'/')) + { + lower1.pop_back(); + } + while (!lower2.empty() && (lower2.back() == L'\\' || lower2.back() == L'/')) + { + lower2.pop_back(); + } + return lower1 == lower2; + } +} + +void clear_nsis_links(const std::string& nsis_folder_path) { wchar_t path[MAX_PATH]; + std::wstring app_name = get_app_name(); // 1. The 'start' shortcuts set by nsis would be global, like app shortcut: // C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Second Life Viewer\Second Life Viewer.lnk @@ -415,7 +511,7 @@ void clear_nsis_links() if (SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_COMMON_PROGRAMS, NULL, 0, path))) { std::wstring start_menu_path = path; - std::wstring folder_path = start_menu_path + L"\\" + get_app_name(); + std::wstring folder_path = start_menu_path + L"\\" + app_name; std::error_code ec; std::filesystem::path dir(folder_path); @@ -431,11 +527,11 @@ void clear_nsis_links() } // 2. Desktop link, also a global one. - // C:\Users\Public\Desktop + // C:\Users\Public\Desktop\Second Life Viewer.lnk if (SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_COMMON_DESKTOPDIRECTORY, NULL, 0, path))) { std::wstring desktop_path = path; - std::wstring shortcut_path = desktop_path + L"\\" + get_app_name() + L".lnk"; + std::wstring shortcut_path = desktop_path + L"\\" + app_name + L".lnk"; if (!DeleteFileW(shortcut_path.c_str())) { DWORD error = GetLastError(); @@ -447,6 +543,70 @@ void clear_nsis_links() } } } + + // 3. Taskbar link, which is user-specific and located at: + // %AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Second Life.lnk + // Note that it can be a link to velopack already, but since + // we aren't removing, but recreating, it shouldn't be an issue. + if (SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, 0, path))) + { + std::wstring taskbar_path = path; + // Hardcoded, because this name is the default window name and isn't going to change in NSIS + taskbar_path += L"\\Microsoft\\Internet Explorer\\Quick Launch\\User Pinned\\TaskBar\\Second Life.lnk"; + + if (PathFileExistsW(taskbar_path.c_str())) + { + // First try to overwrite shortcut + std::wstring current_exe = ll_convert(gDirUtilp->getExecutablePathAndName()); + + HRESULT hr = create_shortcut(taskbar_path, current_exe, L"", app_name, current_exe); + if (FAILED(hr)) + { + LL_WARNS("Velopack") << "Failed to update taskbar shortcut, error " << std::hex << hr << LL_ENDL; + // Try deleting and if possible recreating separately. We should not leave hanging shortcuts behind. + // It is not warranted that the shortcut points to NSIS, so check the destination first. + std::wstring target_path; + if (get_shortcut_target(taskbar_path, target_path)) + { + // Strip the filename part to get just the folder path + std::filesystem::path trim_path(target_path); + if (trim_path.has_filename()) + { + target_path = trim_path.parent_path().wstring(); + } + std::wstring nsis_path_w = ll_convert(nsis_folder_path); + if (paths_are_equal(nsis_path_w, target_path)) + { + if (!DeleteFileW(taskbar_path.c_str())) + { + DWORD error = GetLastError(); + if (error != ERROR_FILE_NOT_FOUND) + { + LL_WARNS("Velopack") << "Failed to delete NSIS taskbar shortcut: " + << ll_convert_wide_to_string(taskbar_path) + << " (error: " << error << ")" << LL_ENDL; + } + } + else + { + // Deleted user created link, recreate it with new target if possible. + LL_INFOS("Velopack") << "Updating taskbar shortcut to point to current exe" << LL_ENDL; + HRESULT hr = create_shortcut(taskbar_path, current_exe, L"", app_name, current_exe); + if (FAILED(hr)) + { + LL_WARNS("Velopack") << "Failed to re-create taskbar shortcut, error: " << std::hex << hr << ", NSIS shortcut was removed" << LL_ENDL; + } + } + } + } + } + else + { + LL_INFOS("Velopack") << "Successfully updated taskbar shortcut to point to current exe" << LL_ENDL; + } + } + // else user didn't create a taskbar shortcut. + } } static void parse_version(const wchar_t* version_str, int& major, int& minor, int& patch, uint64_t& build) @@ -462,7 +622,8 @@ bool get_nsis_version( int& nsis_major, int& nsis_minor, int& nsis_patch, - uint64_t& nsis_build) + uint64_t& nsis_build, + std::string& nsis_path) { // Test for presence of NSIS viewer registration, then // attempt to read uninstall info @@ -515,12 +676,21 @@ bool get_nsis_version( } std::error_code ec; std::filesystem::path path(path_buffer); + // check if uninstaller exists if (!std::filesystem::exists(path, ec)) { return false; } - // Todo: check codesigning? + // We found a valid NSIS installation, trim the path to get the folder + wchar_t* pos = wcsstr(path_buffer, L"uninst.exe"); + if (pos) + { + // Trim uninst.exe from the path by setting null terminator before it + *pos = L'\0'; + } + // Note that it has a trailing backslash. + nsis_path = ll_convert_wide_to_string(path_buffer); return true; } diff --git a/indra/newview/llvelopack.h b/indra/newview/llvelopack.h index d04d0db7dc..449330f68d 100644 --- a/indra/newview/llvelopack.h +++ b/indra/newview/llvelopack.h @@ -46,12 +46,13 @@ void velopack_set_progress_callback(std::function callback); void velopack_cleanup(); #if LL_WINDOWS -void clear_nsis_links(); +void clear_nsis_links(const std::string& nsis_folder_path); bool get_nsis_version( int& nsis_major, int& nsis_minor, int& nsis_patch, - uint64_t& nsis_build); + uint64_t& nsis_build, + std::string& nsis_folder_path); #endif #endif // LL_VELOPACK -- cgit v1.3