2021-11-24 19:47:39 +03:00
|
|
|
/*
|
2022-04-21 17:12:09 +03:00
|
|
|
* Copyright (c) 2021-2022, Sam Atkins <atkinssj@serenityos.org>
|
2021-11-24 19:47:39 +03:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
2023-04-17 20:32:51 +03:00
|
|
|
#include "AutoplaySettingsWidget.h"
|
2021-11-24 19:47:39 +03:00
|
|
|
#include "BrowserSettingsWidget.h"
|
2022-01-31 23:41:36 +03:00
|
|
|
#include "ContentFilterSettingsWidget.h"
|
2021-11-24 19:47:39 +03:00
|
|
|
#include <LibConfig/Client.h>
|
2022-04-21 17:34:53 +03:00
|
|
|
#include <LibCore/ArgsParser.h>
|
2021-11-24 19:47:39 +03:00
|
|
|
#include <LibCore/System.h>
|
|
|
|
#include <LibGUI/Application.h>
|
|
|
|
#include <LibGUI/Icon.h>
|
|
|
|
#include <LibGUI/SettingsWindow.h>
|
|
|
|
#include <LibMain/Main.h>
|
|
|
|
|
|
|
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|
|
|
{
|
2022-01-31 23:41:36 +03:00
|
|
|
TRY(Core::System::pledge("stdio rpath wpath cpath recvfd sendfd unix"));
|
2023-05-05 07:24:53 +03:00
|
|
|
auto app = TRY(GUI::Application::create(arguments));
|
2022-02-11 19:33:09 +03:00
|
|
|
Config::pledge_domain("Browser");
|
2021-11-24 19:47:39 +03:00
|
|
|
|
2022-04-21 17:34:53 +03:00
|
|
|
StringView selected_tab;
|
|
|
|
Core::ArgsParser args_parser;
|
|
|
|
args_parser.add_option(selected_tab, "Tab, one of 'browser' or 'content-filtering'", "open-tab", 't', "tab");
|
|
|
|
args_parser.parse(arguments);
|
|
|
|
|
2021-11-24 19:47:39 +03:00
|
|
|
TRY(Core::System::unveil("/res", "r"));
|
2021-11-25 15:26:54 +03:00
|
|
|
TRY(Core::System::unveil("/home", "r"));
|
2023-04-17 20:32:51 +03:00
|
|
|
TRY(Core::System::unveil("/home/anon/.config/BrowserAutoplayAllowlist.txt", "rwc"));
|
2022-01-31 23:41:36 +03:00
|
|
|
TRY(Core::System::unveil("/home/anon/.config/BrowserContentFilters.txt", "rwc"));
|
2021-11-24 19:47:39 +03:00
|
|
|
TRY(Core::System::unveil(nullptr, nullptr));
|
|
|
|
|
2022-07-11 20:32:29 +03:00
|
|
|
auto app_icon = GUI::Icon::default_icon("app-browser"sv);
|
2021-11-24 19:47:39 +03:00
|
|
|
|
2021-11-28 10:34:04 +03:00
|
|
|
auto window = TRY(GUI::SettingsWindow::create("Browser Settings", GUI::SettingsWindow::ShowDefaultsButton::Yes));
|
2021-11-24 19:47:39 +03:00
|
|
|
window->set_icon(app_icon.bitmap_for_size(16));
|
2023-04-17 08:59:38 +03:00
|
|
|
|
2023-08-08 05:26:17 +03:00
|
|
|
(void)TRY(window->add_tab(TRY(BrowserSettingsWidget::create()), "Browser"_string, "browser"sv));
|
2023-08-07 12:12:38 +03:00
|
|
|
(void)TRY(window->add_tab(TRY(ContentFilterSettingsWidget::create()), "Content Filtering"_string, "content-filtering"sv));
|
|
|
|
(void)TRY(window->add_tab(TRY(AutoplaySettingsWidget::create()), "Autoplay"_string, "autoplay"sv));
|
2022-04-21 17:34:53 +03:00
|
|
|
window->set_active_tab(selected_tab);
|
2021-11-24 19:47:39 +03:00
|
|
|
|
|
|
|
window->show();
|
|
|
|
return app->exec();
|
|
|
|
}
|