1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:37:46 +00:00

LaunchServer+LibDesktop: Add ability to allow URL without handler

This lets clients say they want to be able to open a specific URL
without specifying which handler to use.
This commit is contained in:
Andreas Kling 2021-01-03 12:03:13 +01:00
parent 43c2b66b18
commit 70c59dcbf8
5 changed files with 48 additions and 18 deletions

View file

@ -78,6 +78,16 @@ static LaunchServerConnection& connection()
return connection;
}
bool Launcher::add_allowed_url(const URL& url)
{
auto response = connection().send_sync<Messages::LaunchServer::AddAllowedURL>(url);
if (!response) {
dbgln("Launcher::add_allowed_url: Failed");
return false;
}
return true;
}
bool Launcher::add_allowed_handler_with_any_url(const String& handler)
{
auto response = connection().send_sync<Messages::LaunchServer::AddAllowedHandlerWithAnyURL>(handler);
@ -98,11 +108,11 @@ bool Launcher::add_allowed_handler_with_only_specific_urls(const String& handler
return true;
}
bool Launcher::seal_allowed_handler_list()
bool Launcher::seal_allowlist()
{
auto response = connection().send_sync<Messages::LaunchServer::SealAllowedHandlersList>();
auto response = connection().send_sync<Messages::LaunchServer::SealAllowlist>();
if (!response) {
dbgln("Launcher::seal_allowed_handler_list: Failed");
dbgln("Launcher::seal_allowlist: Failed");
return false;
}
return true;

View file

@ -51,9 +51,10 @@ public:
static NonnullRefPtr<Details> from_details_str(const String&);
};
[[nodiscard]] static bool add_allowed_url(const URL&);
[[nodiscard]] static bool add_allowed_handler_with_any_url(const String& handler);
[[nodiscard]] static bool add_allowed_handler_with_only_specific_urls(const String& handler, const Vector<URL>&);
[[nodiscard]] static bool seal_allowed_handler_list();
[[nodiscard]] static bool seal_allowlist();
static bool open(const URL&, const String& handler_name = {});
static bool open(const URL&, const Details& details);
static Vector<String> get_handlers_for_url(const URL&);