From 1e67b110fe1aef146e7e8468b8dc93e5a807748a Mon Sep 17 00:00:00 2001 From: amass Date: Wed, 20 Nov 2024 21:10:31 +0800 Subject: [PATCH] add doc root. --- .gitea/workflows/deploy.yaml | 2 +- Server/main.cpp | 6 +++--- WebApplication/WebApplication.cpp | 4 ++-- WebApplication/WebApplication.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index dc845e2..6b9c920 100755 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -23,7 +23,7 @@ jobs: ssh-keyscan -t ed25519 -p 22022 frp-by1.wwvvww.cn >> ~/.ssh/known_hosts - name: Clone repository run: | - echo "git clone --depth 1 --branch=${GITHUB_REF##*/} ssh://git@frp-by1.wwvvww.cn:22022/${{ gitea.repository }}.git" + echo "git clone --depth 10 --branch=${GITHUB_REF##*/} ssh://git@frp-by1.wwvvww.cn:22022/${{ gitea.repository }}.git" git clone --depth 1 --branch=${GITHUB_REF##*/} ssh://git@frp-by1.wwvvww.cn:22022/${{ gitea.repository }}.git . git checkout ${GITHUB_SHA} - name: Notify-Start diff --git a/Server/main.cpp b/Server/main.cpp index 6bee08b..02864c2 100644 --- a/Server/main.cpp +++ b/Server/main.cpp @@ -70,8 +70,8 @@ int main(int argc, char const *argv[]) { BOOST_ASSERT_MSG(!application->getServer().empty(), "server.empty() == true"); auto address = boost::asio::ip::make_address(application->getServer()); - auto listener = std::make_shared(application->ioContext(), - boost::asio::ip::tcp::endpoint{address, application->getPort()}); + auto listener = + std::make_shared(application->ioContext(), boost::asio::ip::tcp::endpoint{address, application->getPort()}); listener->startAccept(); auto wechatContext = Singleton::instance(application->ioContext()); @@ -101,7 +101,7 @@ int main(int argc, char const *argv[]) { auto udpServer = std::make_shared(application->ioContext()); auto mediaServer = std::make_shared(554, false); - auto webApp = Singleton::instance(application->getWtPort()); + auto webApp = Singleton::instance(application->getWtPort(), application->getDocumentRoot()); using namespace boost::asio::ip; auto proxyAddress = make_address(application->getServer()); diff --git a/WebApplication/WebApplication.cpp b/WebApplication/WebApplication.cpp index b61d104..33a487b 100644 --- a/WebApplication/WebApplication.cpp +++ b/WebApplication/WebApplication.cpp @@ -14,11 +14,11 @@ #include #include -WebApplication::WebApplication(uint16_t port) { +WebApplication::WebApplication(uint16_t port, const std::string &documentRoot) { try { std::vector args; args.push_back("--approot=./build"); - args.push_back("--docroot=./build"); + args.push_back(std::format("--docroot={}", documentRoot)); args.push_back("--config=resources/wt_config.xml"); args.push_back(std::format("--http-listen=127.0.0.1:{}", port)); // --docroot=. --no-compression --http-listen 127.0.0.1:8855 diff --git a/WebApplication/WebApplication.h b/WebApplication/WebApplication.h index 4e9db23..7303f1f 100644 --- a/WebApplication/WebApplication.h +++ b/WebApplication/WebApplication.h @@ -31,7 +31,7 @@ public: const Wt::Auth::PasswordService &passwordService(); protected: - WebApplication(uint16_t port); + WebApplication(uint16_t port, const std::string &documentRoot); static std::unique_ptr createConnectionPool(const std::string &sqlite3); std::unique_ptr createApplication(const Wt::WEnvironment &env, bool embedded);