1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 20:47:45 +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

@ -17,4 +17,4 @@ set(SOURCES
) )
serenity_bin(WebContent) serenity_bin(WebContent)
target_link_libraries(WebContent LibCore LibIPC LibGfx LibWeb) target_link_libraries(WebContent LibCore LibIPC LibGfx LibWeb LibMain)

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