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

WebContent: Port to LibMain :^)

This commit is contained in:
Andreas Kling 2021-11-23 10:31:08 +01:00
parent 69a7ffa174
commit 32e05f9b14
2 changed files with 11 additions and 27 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -7,35 +7,19 @@
#include <LibCore/EventLoop.h>
#include <LibCore/LocalServer.h>
#include <LibIPC/ClientConnection.h>
#include <LibMain/Main.h>
#include <LibSystem/Wrappers.h>
#include <WebContent/ClientConnection.h>
int main(int, char**)
ErrorOr<int> serenity_main(Main::Arguments)
{
Core::EventLoop event_loop;
if (pledge("stdio recvfd sendfd accept unix rpath", nullptr) < 0) {
perror("pledge");
return 1;
}
if (unveil("/res", "r") < 0) {
perror("unveil");
return 1;
}
if (unveil("/tmp/portal/request", "rw") < 0) {
perror("unveil");
return 1;
}
if (unveil("/tmp/portal/image", "rw") < 0) {
perror("unveil");
return 1;
}
if (unveil("/tmp/portal/websocket", "rw") < 0) {
perror("unveil");
return 1;
}
if (unveil(nullptr, nullptr) < 0) {
perror("unveil");
return 1;
}
TRY(System::pledge("stdio recvfd sendfd accept unix rpath", nullptr));
TRY(System::unveil("/res", "r"));
TRY(System::unveil("/tmp/portal/request", "rw"));
TRY(System::unveil("/tmp/portal/image", "rw"));
TRY(System::unveil("/tmp/portal/websocket", "rw"));
TRY(System::unveil(nullptr, nullptr));
auto socket = Core::LocalSocket::take_over_accepted_socket_from_system_server();
VERIFY(socket);