mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-12 01:10:42 +00:00
ConfigServer: Add methods to list groups and keys
Applications that make use of LibConfig anyway have now a way of listing the groups and keys without resorting to using Core::ConfigFile directly.
This commit is contained in:
parent
2266b4acdb
commit
116d89eec6
Notes:
sideshowbarker
2024-07-18 01:01:32 +09:00
Author: https://github.com/faxe1008 Commit: https://github.com/SerenityOS/serenity/commit/116d89eec64 Pull-request: https://github.com/SerenityOS/serenity/pull/10937 Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/cqundefine ✅
3 changed files with 21 additions and 0 deletions
|
@ -135,6 +135,22 @@ void ClientConnection::sync_dirty_domains_to_disk()
|
|||
}
|
||||
}
|
||||
|
||||
Messages::ConfigServer::ListConfigKeysResponse ClientConnection::list_config_keys(String const& domain, String const& group)
|
||||
{
|
||||
if (!validate_access(domain, group, ""))
|
||||
return Vector<String> {};
|
||||
auto& config = ensure_domain_config(domain);
|
||||
return { config.keys(group) };
|
||||
}
|
||||
|
||||
Messages::ConfigServer::ListConfigGroupsResponse ClientConnection::list_config_groups(String const& domain)
|
||||
{
|
||||
if (!validate_access(domain, "", ""))
|
||||
return Vector<String> {};
|
||||
auto& config = ensure_domain_config(domain);
|
||||
return { config.groups() };
|
||||
}
|
||||
|
||||
Messages::ConfigServer::ReadStringValueResponse ClientConnection::read_string_value(String const& domain, String const& group, String const& key)
|
||||
{
|
||||
if (!validate_access(domain, group, key))
|
||||
|
|
|
@ -27,6 +27,8 @@ private:
|
|||
|
||||
virtual void pledge_domains(Vector<String> const&) override;
|
||||
virtual void monitor_domain(String const&) override;
|
||||
virtual Messages::ConfigServer::ListConfigGroupsResponse list_config_groups([[maybe_unused]] String const& domain) override;
|
||||
virtual Messages::ConfigServer::ListConfigKeysResponse list_config_keys([[maybe_unused]] String const& domain, [[maybe_unused]] String const& group) override;
|
||||
virtual Messages::ConfigServer::ReadStringValueResponse read_string_value([[maybe_unused]] String const& domain, [[maybe_unused]] String const& group, [[maybe_unused]] String const& key) override;
|
||||
virtual Messages::ConfigServer::ReadI32ValueResponse read_i32_value([[maybe_unused]] String const& domain, [[maybe_unused]] String const& group, [[maybe_unused]] String const& key) override;
|
||||
virtual Messages::ConfigServer::ReadBoolValueResponse read_bool_value([[maybe_unused]] String const& domain, [[maybe_unused]] String const& group, [[maybe_unused]] String const& key) override;
|
||||
|
|
|
@ -4,6 +4,9 @@ endpoint ConfigServer
|
|||
|
||||
monitor_domain(String domain) =|
|
||||
|
||||
list_config_groups(String domain) => (Vector<String> groups)
|
||||
list_config_keys(String domain, String group) => (Vector<String> keys)
|
||||
|
||||
read_string_value(String domain, String group, String key) => (Optional<String> value)
|
||||
read_i32_value(String domain, String group, String key) => (Optional<i32> value)
|
||||
read_bool_value(String domain, String group, String key) => (Optional<bool> value)
|
||||
|
|
Loading…
Reference in a new issue