/* * Copyright (c) 2026, Tim Flynn * * SPDX-License-Identifier: BSD-2-Clause */ #include #include #include #include #include #include namespace WebView { void VersionUI::register_interfaces() { register_interface("loadVersionInfo"sv, [this](auto const&) { load_version_info(); }); } void VersionUI::load_version_info() { static auto& browser_name = *new String(String::from_utf8_without_validation({ BROWSER_NAME, __builtin_strlen(BROWSER_NAME) })); static auto& browser_version = *new String(String::from_utf8_without_validation({ BROWSER_VERSION, __builtin_strlen(BROWSER_VERSION) })); static auto& arch = *new String(String::from_utf8_without_validation({ CPU_STRING, __builtin_strlen(CPU_STRING) })); static auto& platform_name = *new String(String::from_utf8_without_validation({ OS_STRING, __builtin_strlen(OS_STRING) })); static auto& command_line = *new String(MUST(String::join(' ', Application::the().command_line_arguments().strings))); static auto& executable_path = *new String(MUST(String::from_byte_string(MUST(Core::System::current_executable_path())))); JsonObject version_info; version_info.set("browserName"_string, browser_name); version_info.set("browserVersion"_string, browser_version); version_info.set("arch"_string, arch); version_info.set("platformName"_string, platform_name); version_info.set("commandLine"_string, command_line); version_info.set("executablePath"_string, executable_path); async_send_message("renderVersionInfo"sv, version_info); } }