mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:07:35 +00:00
Ladybird: Remove Qt dependency from RequestServer
This requires two parts: Core::System::current_executable_path(), and passing the serenity-resource-root as an argument to the process.
This commit is contained in:
parent
bb831a27dd
commit
a1e5a6ac40
6 changed files with 17 additions and 29 deletions
|
@ -11,15 +11,14 @@ set(REQUESTSERVER_SOURCES
|
|||
${REQUESTSERVER_SOURCE_DIR}/HttpsRequest.cpp
|
||||
${REQUESTSERVER_SOURCE_DIR}/HttpsProtocol.cpp
|
||||
${REQUESTSERVER_SOURCE_DIR}/Protocol.cpp
|
||||
../Utilities.cpp
|
||||
main.cpp
|
||||
)
|
||||
|
||||
qt_add_executable(RequestServer ${REQUESTSERVER_SOURCES})
|
||||
add_executable(RequestServer ${REQUESTSERVER_SOURCES})
|
||||
|
||||
target_include_directories(RequestServer PRIVATE ${SERENITY_SOURCE_DIR}/Userland/Services/)
|
||||
target_include_directories(RequestServer PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/..)
|
||||
target_link_libraries(RequestServer PRIVATE Qt::Core LibCore LibMain LibCrypto LibFileSystem LibGemini LibHTTP LibIPC LibMain LibTLS LibWebView)
|
||||
target_link_libraries(RequestServer PRIVATE LibCore LibMain LibCrypto LibFileSystem LibGemini LibHTTP LibIPC LibMain LibTLS LibWebView)
|
||||
if (ANDROID)
|
||||
link_android_libs(RequestServer)
|
||||
endif()
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "../Utilities.h"
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
|
@ -16,17 +15,16 @@
|
|||
#include <LibIPC/SingleServer.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <LibTLS/Certificate.h>
|
||||
#include <QCoreApplication>
|
||||
#include <RequestServer/ConnectionFromClient.h>
|
||||
#include <RequestServer/GeminiProtocol.h>
|
||||
#include <RequestServer/HttpProtocol.h>
|
||||
#include <RequestServer/HttpsProtocol.h>
|
||||
|
||||
ErrorOr<String> find_certificates()
|
||||
ErrorOr<String> find_certificates(StringView serenity_resource_root)
|
||||
{
|
||||
auto cert_path = TRY(String::formatted("{}/res/ladybird/cacert.pem", s_serenity_resource_root));
|
||||
auto cert_path = TRY(String::formatted("{}/res/ladybird/cacert.pem", serenity_resource_root));
|
||||
if (!FileSystem::exists(cert_path)) {
|
||||
auto app_dir = ak_deprecated_string_from_qstring(QCoreApplication::applicationDirPath());
|
||||
auto app_dir = LexicalPath::dirname(TRY(Core::System::current_executable_path()).to_deprecated_string());
|
||||
|
||||
cert_path = TRY(String::formatted("{}/cacert.pem", LexicalPath(app_dir).parent()));
|
||||
if (!FileSystem::exists(cert_path))
|
||||
|
@ -37,19 +35,18 @@ ErrorOr<String> find_certificates()
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
QCoreApplication application(arguments.argc, arguments.argv);
|
||||
platform_init();
|
||||
|
||||
// Ensure the certificates are read out here.
|
||||
DefaultRootCACertificates::set_default_certificate_path(TRY(find_certificates()));
|
||||
[[maybe_unused]] auto& certs = DefaultRootCACertificates::the();
|
||||
|
||||
int fd_passing_socket { -1 };
|
||||
StringView serenity_resource_root;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(fd_passing_socket, "File descriptor of the fd passing socket", "fd-passing-socket", 'c', "fd-passing-socket");
|
||||
args_parser.add_option(serenity_resource_root, "Absolute path to directory for serenity resources", "serenity-resource-root", 'r', "serenity-resource-root");
|
||||
args_parser.parse(arguments);
|
||||
|
||||
// Ensure the certificates are read out here.
|
||||
DefaultRootCACertificates::set_default_certificate_path(TRY(find_certificates(serenity_resource_root)));
|
||||
[[maybe_unused]] auto& certs = DefaultRootCACertificates::the();
|
||||
|
||||
Core::EventLoop event_loop;
|
||||
|
||||
[[maybe_unused]] auto gemini = make<RequestServer::GeminiProtocol>();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue