2020-06-17 12:31:42 -03:00
|
|
|
/*
|
2022-09-08 06:55:12 -03:00
|
|
|
* Copyright (c) 2020-2022, Andreas Kling <kling@serenityos.org>
|
2020-06-17 12:31:42 -03:00
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-06-17 12:31:42 -03:00
|
|
|
*/
|
|
|
|
|
|
2022-09-16 10:01:47 -03:00
|
|
|
#include "ImageCodecPluginSerenity.h"
|
2020-06-17 12:31:42 -03:00
|
|
|
#include <LibCore/EventLoop.h>
|
|
|
|
|
#include <LibCore/LocalServer.h>
|
2021-11-23 06:59:50 -03:00
|
|
|
#include <LibCore/System.h>
|
2021-12-06 14:11:05 -03:00
|
|
|
#include <LibIPC/SingleServer.h>
|
2021-11-23 06:31:08 -03:00
|
|
|
#include <LibMain/Main.h>
|
2022-04-30 07:06:30 -03:00
|
|
|
#include <LibWeb/Loader/ResourceLoader.h>
|
2022-09-07 15:30:31 -03:00
|
|
|
#include <LibWeb/Platform/EventLoopPlugin.h>
|
2022-09-21 15:33:57 -03:00
|
|
|
#include <LibWeb/Platform/EventLoopPluginSerenity.h>
|
|
|
|
|
#include <LibWeb/Platform/FontPluginSerenity.h>
|
2022-04-30 06:26:21 -03:00
|
|
|
#include <LibWeb/WebSockets/WebSocket.h>
|
2022-04-30 07:06:30 -03:00
|
|
|
#include <LibWebView/RequestServerAdapter.h>
|
2022-04-30 06:26:21 -03:00
|
|
|
#include <LibWebView/WebSocketClientAdapter.h>
|
2022-02-25 07:18:30 -03:00
|
|
|
#include <WebContent/ConnectionFromClient.h>
|
2020-06-17 12:31:42 -03:00
|
|
|
|
2021-11-23 06:31:08 -03:00
|
|
|
ErrorOr<int> serenity_main(Main::Arguments)
|
2020-06-17 12:31:42 -03:00
|
|
|
{
|
|
|
|
|
Core::EventLoop event_loop;
|
2021-12-29 15:10:12 -03:00
|
|
|
TRY(Core::System::pledge("stdio recvfd sendfd accept unix rpath"));
|
2021-11-23 06:59:50 -03:00
|
|
|
TRY(Core::System::unveil("/res", "r"));
|
2022-01-20 14:27:56 -03:00
|
|
|
TRY(Core::System::unveil("/etc/timezone", "r"));
|
2022-07-24 10:11:06 -03:00
|
|
|
TRY(Core::System::unveil("/tmp/user/%uid/portal/request", "rw"));
|
2022-07-24 10:29:26 -03:00
|
|
|
TRY(Core::System::unveil("/tmp/user/%uid/portal/image", "rw"));
|
2022-07-24 08:16:18 -03:00
|
|
|
TRY(Core::System::unveil("/tmp/user/%uid/portal/websocket", "rw"));
|
2021-11-23 06:59:50 -03:00
|
|
|
TRY(Core::System::unveil(nullptr, nullptr));
|
2020-06-17 12:31:42 -03:00
|
|
|
|
2022-09-21 15:33:57 -03:00
|
|
|
Web::Platform::EventLoopPlugin::install(*new Web::Platform::EventLoopPluginSerenity);
|
2022-09-16 10:01:47 -03:00
|
|
|
Web::Platform::ImageCodecPlugin::install(*new WebContent::ImageCodecPluginSerenity);
|
2022-09-21 15:33:57 -03:00
|
|
|
Web::Platform::FontPlugin::install(*new Web::Platform::FontPluginSerenity);
|
2022-09-07 15:30:31 -03:00
|
|
|
|
2022-04-30 06:26:21 -03:00
|
|
|
Web::WebSockets::WebSocketClientManager::initialize(TRY(WebView::WebSocketClientManagerAdapter::try_create()));
|
2022-04-30 07:06:30 -03:00
|
|
|
Web::ResourceLoader::initialize(TRY(WebView::RequestServerAdapter::try_create()));
|
2022-04-30 06:21:21 -03:00
|
|
|
|
2022-02-25 07:18:30 -03:00
|
|
|
auto client = TRY(IPC::take_over_accepted_client_from_system_server<WebContent::ConnectionFromClient>());
|
2020-06-17 12:31:42 -03:00
|
|
|
return event_loop.exec();
|
|
|
|
|
}
|