diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..89df2c8 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,50 @@ +# https://docs.github.com/en/actions/learn-github-actions/contexts + +--- + name: SignerServer + on: + push: + branches: + - main + pull_request: + workflow_dispatch: + + jobs: + ubuntu: + name: run on ${{ matrix.os }}(${{ matrix.arch }}) + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + arch: [x64] + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup cmake + uses: lukka/get-cmake@latest + + - name: Build And Test + uses: lukka/run-cmake@v10 + with: + # This is the default path to the CMakeLists.txt along side the + # CMakePresets.json. Change if you need have CMakeLists.txt and CMakePresets.json + # located elsewhere. + cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt' + + # This is the name of the CMakePresets.json's configuration to use to generate + # the project files. This configuration leverages the vcpkg.cmake toolchain file to + # run vcpkg and install all dependencies specified in vcpkg.json. + configurePreset: 'ninja-${{ matrix.arch }}' + + # This is the name of the CMakePresets.json's configuration to build the project. + buildPreset: 'ninja-${{ matrix.arch }}-release' + + - name: Upload build + uses: actions/upload-artifact@v4 + with: + name: SignerServer-${{ matrix.os }}-${{ matrix.arch }} + path: | + build/ninja-${{ matrix.arch }}/lib/libSignerServer.so + load.js + start.sh diff --git a/.gitignore b/.gitignore index 6a8bc10..0b85d77 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .vscode -build \ No newline at end of file +build +install \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 7449c22..42b1657 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_CXX_STANDARD 17) file(GLOB SOURCE_FILES "./src/*.cpp" "./src/*.asm") -add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES}) +add_library(SignerServer SHARED ${SOURCE_FILES}) if(MSVC) target_link_options(SignerServer PRIVATE diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..2f78711 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,33 @@ +{ + "version": 2, + "configurePresets": [ + { + "name": "ninja-x64", + "displayName": "Configure ninja-x64", + "description": "Configure ninja-x64", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build/${presetName}", + "cacheVariables": { + "CMAKE_INSTALL_PREFIX": "${sourceDir}/install/${presetName}" + } + } + ], + "buildPresets": [ + { + "name": "ninja-x64-debug", + "description": "Build ninja-x64 Debug", + "displayName": "Build ninja-x64 Debug", + "configurePreset": "ninja-x64", + "configuration": "Debug", + "targets": "all" + }, + { + "name": "ninja-x64-release", + "description": "Build ninja-x64 Release", + "displayName": "Build ninja-x64 Release", + "configurePreset": "ninja-x64", + "configuration": "Release", + "targets": "all" + } + ] +} \ No newline at end of file diff --git a/src/server.cpp b/src/server.cpp index 8400efc..52a1460 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -1,15 +1,13 @@ -#include "sign.h" #include "server.h" #include "../include/rapidjson/document.h" #include "../include/rapidjson/writer.h" #include -Sign sign; Server::Server(int port) { - svr.Post("/sign", [](const httplib::Request &req, httplib::Response &res) + svr.Post("/sign", [this](const httplib::Request &req, httplib::Response &res) { try { diff --git a/src/server.h b/src/server.h index f356916..bc064ca 100644 --- a/src/server.h +++ b/src/server.h @@ -1,3 +1,4 @@ +#include "sign.h" #include "../include/cpp-httplib/httplib.h" class Server @@ -7,4 +8,5 @@ public: private: httplib::Server svr; + Sign sign; }; \ No newline at end of file diff --git a/src/sign.cpp b/src/sign.cpp index c09fb23..1909981 100644 --- a/src/sign.cpp +++ b/src/sign.cpp @@ -19,8 +19,8 @@ #include #include #elif defined(_MAC_PLATFORM_) || defined(_LINUX_PLATFORM_) -#include #include "proc_maps.h" +#include #endif // 签名函数定义 @@ -53,7 +53,8 @@ std::map addrMap = { {"3.2.7-23361", 0x4C93C57}}; #endif #endif -int SignOffsets = 562; // 562 in 3.1.2-12912 + +int SignOffsets = 562; // 562 before 3.1.2-13107, 767 in others int ExtraOffsets = 511; int TokenOffsets = 255; diff --git a/signserver.sh b/start.sh similarity index 100% rename from signserver.sh rename to start.sh