add workflow

This commit is contained in:
Simplxs 2024-05-07 19:27:42 +08:00
parent ea42c03794
commit de279a6b7a
No known key found for this signature in database
GPG Key ID: E23537FF14DD6507
8 changed files with 92 additions and 7 deletions

50
.github/workflows/build.yml vendored Normal file
View File

@ -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

3
.gitignore vendored
View File

@ -1,2 +1,3 @@
.vscode .vscode
build build
install

View File

@ -21,7 +21,7 @@ set(CMAKE_CXX_STANDARD 17)
file(GLOB SOURCE_FILES "./src/*.cpp" "./src/*.asm") file(GLOB SOURCE_FILES "./src/*.cpp" "./src/*.asm")
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES}) add_library(SignerServer SHARED ${SOURCE_FILES})
if(MSVC) if(MSVC)
target_link_options(SignerServer PRIVATE target_link_options(SignerServer PRIVATE

33
CMakePresets.json Normal file
View File

@ -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"
}
]
}

View File

@ -1,15 +1,13 @@
#include "sign.h"
#include "server.h" #include "server.h"
#include "../include/rapidjson/document.h" #include "../include/rapidjson/document.h"
#include "../include/rapidjson/writer.h" #include "../include/rapidjson/writer.h"
#include <thread> #include <thread>
Sign sign;
Server::Server(int port) 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 try
{ {

View File

@ -1,3 +1,4 @@
#include "sign.h"
#include "../include/cpp-httplib/httplib.h" #include "../include/cpp-httplib/httplib.h"
class Server class Server
@ -7,4 +8,5 @@ public:
private: private:
httplib::Server svr; httplib::Server svr;
Sign sign;
}; };

View File

@ -19,8 +19,8 @@
#include <Windows.h> #include <Windows.h>
#include <psapi.h> #include <psapi.h>
#elif defined(_MAC_PLATFORM_) || defined(_LINUX_PLATFORM_) #elif defined(_MAC_PLATFORM_) || defined(_LINUX_PLATFORM_)
#include <cstring>
#include "proc_maps.h" #include "proc_maps.h"
#include <cstring>
#endif #endif
// 签名函数定义 // 签名函数定义
@ -53,7 +53,8 @@ std::map<std::string, uint64_t> addrMap = {
{"3.2.7-23361", 0x4C93C57}}; {"3.2.7-23361", 0x4C93C57}};
#endif #endif
#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 ExtraOffsets = 511;
int TokenOffsets = 255; int TokenOffsets = 255;