Truly independent web browser
LibWebView: Add the AppImage install method to update checks
Jelle Raaijmakers8f6241704930
diff --git a/Libraries/LibWebView/UpdateCheck.cpp b/Libraries/LibWebView/UpdateCheck.cppindex c72fd92818b..b63c8b7fe49 100644--- a/Libraries/LibWebView/UpdateCheck.cpp+++ b/Libraries/LibWebView/UpdateCheck.cpp@@ -131,6 +131,8 @@ Optional<InstallMethod> parse_package_format(StringView contents)return InstallMethod::DEB;if (format == "RPM"sv)return InstallMethod::RPM;+ if (format == "AppImage"sv)+ return InstallMethod::AppImage;return {};}@@ -238,6 +240,7 @@ static Optional<StringView> architecture_name(InstallMethod install_method, Archreturn architecture == Architecture::AArch64 ? "arm64"sv : "amd64"sv;case InstallMethod::RPM:case InstallMethod::Flatpak:+ case InstallMethod::AppImage:return architecture == Architecture::AArch64 ? "aarch64"sv : "x86_64"sv;case InstallMethod::Source:return {};@@ -312,6 +315,12 @@ static bool release_installs_on(JsonObject const& release, SystemDescription conauto flatpak = repositories->get_object("flatpak"sv);return flatpak.has_value() && contains_string(flatpak->get_array("architectures"sv), *architecture);}+ case InstallMethod::AppImage:+ return architecture.has_value() && has_download([&](JsonObject const& download) {+ auto name = download.get_string("name"sv);+ return download.get_string("platform"sv) == "Linux"sv && download.get_string("architecture"sv) == *architecture+ && name.has_value() && name->bytes_as_string_view().ends_with(".AppImage"sv);+ });case InstallMethod::Source:return has_download([](JsonObject const& download) { return download.get_string("platform"sv) == "source"sv; });}@@ -387,6 +396,8 @@ static StringView install_method_name(InstallMethod install_method)return "rpm"sv;case InstallMethod::Flatpak:return "flatpak"sv;+ case InstallMethod::AppImage:+ return "appimage"sv;case InstallMethod::Source:return "source"sv;}diff --git a/Libraries/LibWebView/UpdateCheck.h b/Libraries/LibWebView/UpdateCheck.hindex 8b73bd4f1ba..a20a7ecf308 100644--- a/Libraries/LibWebView/UpdateCheck.h+++ b/Libraries/LibWebView/UpdateCheck.h@@ -26,6 +26,7 @@ enum class InstallMethod : u8 {DEB,RPM,Flatpak,+ AppImage,Source,};diff --git a/Tests/LibWebView/TestUpdateCheck.cpp b/Tests/LibWebView/TestUpdateCheck.cppindex 6e9e1bb979c..a835c101468 100644--- a/Tests/LibWebView/TestUpdateCheck.cpp+++ b/Tests/LibWebView/TestUpdateCheck.cpp@@ -18,7 +18,8 @@ static constexpr auto RELEASES = R"~~~({"version": "2026.47.0","published": "2026-11-20T12:00:00Z","downloads": [- { "platform": "source", "name": "ladybird-2026.47.0-source.tar.xz" }+ { "platform": "source", "name": "ladybird-2026.47.0-source.tar.xz" },+ { "platform": "Linux", "architecture": "x86_64", "name": "ladybird-2026.47.0-Linux-x86_64.tar.xz" }],"repositories": {"apt": {@@ -33,7 +34,8 @@ static constexpr auto RELEASES = R"~~~({"published": "2026-11-10T12:00:00Z","downloads": [{ "platform": "source", "name": "ladybird-2026.46.10-source.tar.xz" },- { "platform": "macOS", "architecture": "arm64", "name": "ladybird-2026.46.10-macOS-arm64.dmg", "minimum_macos_version": "15.0" }+ { "platform": "macOS", "architecture": "arm64", "name": "ladybird-2026.46.10-macOS-arm64.dmg", "minimum_macos_version": "15.0" },+ { "platform": "Linux", "architecture": "x86_64", "name": "ladybird-2026.46.10-Linux-x86_64.AppImage" }],"repositories": {"apt": {@@ -52,7 +54,8 @@ static constexpr auto RELEASES = R"~~~({{"version": "2026.46.9","downloads": [- { "platform": "macOS", "architecture": "arm64", "name": "ladybird-2026.46.9-macOS-arm64.dmg", "minimum_macos_version": "14.4" }+ { "platform": "macOS", "architecture": "arm64", "name": "ladybird-2026.46.9-macOS-arm64.dmg", "minimum_macos_version": "14.4" },+ { "platform": "Linux", "architecture": "aarch64", "name": "ladybird-2026.46.9-Linux-aarch64.AppImage" }],"repositories": {"apt": {@@ -145,6 +148,7 @@ TEST_CASE(a_package_names_its_format){EXPECT(WebView::parse_package_format("DEB\n"sv) == InstallMethod::DEB);EXPECT(WebView::parse_package_format("RPM"sv) == InstallMethod::RPM);+ EXPECT(WebView::parse_package_format("AppImage\n"sv) == InstallMethod::AppImage);EXPECT(!WebView::parse_package_format("Flatpak\n"sv).has_value());EXPECT(!WebView::parse_package_format(""sv).has_value());}@@ -169,6 +173,13 @@ TEST_CASE(flatpaks_and_builds_from_source_ignore_the_distribution)EXPECT_EQ(newest_for(linux_system(InstallMethod::Source, Architecture::Other)), "2026.47.0"sv);}+TEST_CASE(an_appimage_takes_the_newest_appimage_of_its_architecture)+{+ EXPECT_EQ(newest_for(linux_system(InstallMethod::AppImage, Architecture::X86_64)), "2026.46.10"sv);+ EXPECT_EQ(newest_for(linux_system(InstallMethod::AppImage, Architecture::AArch64)), "2026.46.9"sv);+ EXPECT(!newest_for(linux_system(InstallMethod::AppImage, Architecture::Other)).has_value());+}+TEST_CASE(a_release_counts_once_it_was_published_before_the_given_time){auto system = linux_system(InstallMethod::DEB, Architecture::X86_64, "ubuntu"sv, "26.04"sv);