main.cpp 872 B

1234567891011121314151617181920212223242526
  1. /*
  2. * Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibCore/EventLoop.h>
  7. #include <LibCore/LocalServer.h>
  8. #include <LibCore/System.h>
  9. #include <LibIPC/SingleServer.h>
  10. #include <LibMain/Main.h>
  11. #include <WebContent/ClientConnection.h>
  12. ErrorOr<int> serenity_main(Main::Arguments)
  13. {
  14. Core::EventLoop event_loop;
  15. TRY(Core::System::pledge("stdio recvfd sendfd accept unix rpath"));
  16. TRY(Core::System::unveil("/res", "r"));
  17. TRY(Core::System::unveil("/tmp/portal/request", "rw"));
  18. TRY(Core::System::unveil("/tmp/portal/image", "rw"));
  19. TRY(Core::System::unveil("/tmp/portal/websocket", "rw"));
  20. TRY(Core::System::unveil(nullptr, nullptr));
  21. auto client = TRY(IPC::take_over_accepted_client_from_system_server<WebContent::ClientConnection>());
  22. return event_loop.exec();
  23. }