4 Commits

Author SHA1 Message Date
57fc689784 fix load.js 2024-07-02 19:42:35 +08:00
2c39499736 fix linux 2024-07-02 19:31:11 +08:00
52d2fa4851 fix bug(fxxk microsoft) 2024-07-02 19:28:03 +08:00
d120834ac1 fix release 2024-07-02 16:52:25 +08:00
8 changed files with 119 additions and 129 deletions

View File

@ -26,9 +26,9 @@ jobs:
- name: Zip Artifact - name: Zip Artifact
run: | run: |
zip -r SignerServer-windows-x64.zip SignerServer-windows-latest-x64.zip zip -r SignerServer-windows-x64.zip SignerServer-windows-latest-x64.zip/*
zip -r SignerServer-ubuntu-x64.zip SignerServer-ubuntu-latest-x64.zip zip -r SignerServer-ubuntu-x64.zip SignerServer-ubuntu-latest-x64.zip/*
zip -r SignerServer-ubuntu-arm64.zip SignerServer-ubuntu-latest-arm64.zip zip -r SignerServer-ubuntu-arm64.zip SignerServer-ubuntu-latest-arm64.zip/*
- name: Create Release Draft and Upload Artifacts - name: Create Release Draft and Upload Artifacts
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2

View File

@ -1,4 +1,4 @@
# v2.0.0 # SignerServer
QQ Version: Windows 9.9.11-24815 / Linux 3.2.9-24815 QQ Version: Windows 9.9.11-24815 / Linux 3.2.9-24815

12
load.js
View File

@ -3,16 +3,18 @@ const os = require('node:os');
const exePath = path.dirname(process.execPath); const exePath = path.dirname(process.execPath);
let QQWrapper, appid, qua; let QQWrapper, version, appid, qua;
if (os.platform() === "win32") { if (os.platform() === "win32") {
const versionConfig = require(path.join(exePath, "resources/app/versions/config.json")); const versionConfig = require(path.join(exePath, "resources/app/versions/config.json"));
QQWrapper = require(path.join(exePath, "resources/app/versions", versionConfig.curVersion, "wrapper.node")); version = versionConfig.curVersion;
QQWrapper = require(path.join(exePath, "resources/app/versions", version, "wrapper.node"));
appid = "537226655"; // 9.9.12-25234 appid = "537226655"; // 9.9.12-25234
qua = `V1_WIN_NQ_${versionConfig.curVersion.replace("-", "_")}_GW_B`; qua = `V1_WIN_NQ_${version.replace("-", "_")}_GW_B`;
} else { } else {
const qqPkgInfo = require(path.join(exePath, "resources/app/package.json")); const qqPkgInfo = require(path.join(exePath, "resources/app/package.json"));
QQWrapper = require(path.join(exePath, "resources/app/wrapper.node")); QQWrapper = require(path.join(exePath, "resources/app/wrapper.node"));
version = qqPkgInfo.version;
appid = "537226441"; appid = "537226441";
qua = qqPkgInfo.qua; qua = qqPkgInfo.qua;
} }
@ -43,7 +45,7 @@ engine.initWithDeskTopConfig({
base_path_prefix: "", base_path_prefix: "",
platform_type: 3, platform_type: 3,
app_type: 4, app_type: 4,
app_version: qqPkgInfo.version, app_version: version,
os_version: os.release(), os_version: os.release(),
use_xlog: true, use_xlog: true,
qua: qua, qua: qua,
@ -59,6 +61,6 @@ loginService.initConfig({
appid: appid, appid: appid,
platVer: os.release(), platVer: os.release(),
commonPath: dataPathGlobal, commonPath: dataPathGlobal,
clientVer: qqPkgInfo.version, clientVer: version,
hostName: os.hostname() hostName: os.hostname()
}); });

View File

@ -2,27 +2,28 @@
#include "../include/rapidjson/document.h" #include "../include/rapidjson/document.h"
#include <filesystem>
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
Server *server = nullptr;
void init() void init()
{
try
{ {
#if defined(_WIN_PLATFORM_) #if defined(_WIN_PLATFORM_)
std::string version = "9.9.12-25300"; std::string version = "9.9.12-25300";
try try
{ {
std::ifstream versionConfig("resources\\app\\versions\\config.json"); TCHAR pathm[MAX_PATH];
GetModuleFileName(NULL, pathm, MAX_PATH);
std::filesystem::path path = pathm;
path = path.parent_path().append("resources\\app\\versions\\config.json");
std::ifstream versionConfig(path.wstring());
if (versionConfig.is_open()) if (versionConfig.is_open())
{ {
std::string versionConfigStr; std::stringstream versionConfigStream;
versionConfig >> versionConfigStr; versionConfigStream << versionConfig.rdbuf();
versionConfig.close(); versionConfig.close();
rapidjson::Document doc; rapidjson::Document doc;
doc.Parse(versionConfigStr.c_str(), versionConfigStr.size()); doc.Parse(versionConfigStream.str().c_str(), versionConfigStream.str().size());
if (doc.HasMember("curVersion") && doc["curVersion"].IsString()) if (doc.HasMember("curVersion") && doc["curVersion"].IsString())
version = doc["curVersion"].GetString(); version = doc["curVersion"].GetString();
} }
@ -40,11 +41,11 @@ void init()
std::ifstream versionConfig("/opt/QQ/resources/app/package.json"); std::ifstream versionConfig("/opt/QQ/resources/app/package.json");
if (versionConfig.is_open()) if (versionConfig.is_open())
{ {
std::string versionConfigStr; std::stringstream versionConfigStrBuf;
versionConfig >> versionConfigStr; versionConfigStrBuf << versionConfig.rdbuf();
versionConfig.close(); versionConfig.close();
rapidjson::Document doc; rapidjson::Document doc;
doc.Parse(versionConfigStr.c_str(), versionConfigStr.size()); doc.Parse(versionConfigStrBuf.str().c_str(), versionConfigStrBuf.str().size());
if (doc.HasMember("version") && doc["version"].IsString()) if (doc.HasMember("version") && doc["version"].IsString())
version = doc["version"].GetString(); version = doc["version"].GetString();
} }
@ -70,12 +71,12 @@ void init()
} }
else else
{ {
std::string config; std::stringstream configStream;
configFile >> config; configStream << configFile.rdbuf();
configFile.close(); configFile.close();
try try
{ {
doc.Parse(config.c_str(), config.size()); doc.Parse(configStream.str().c_str(), configStream.str().size());
} }
catch (const std::exception &e) catch (const std::exception &e)
{ {
@ -91,21 +92,21 @@ void init()
if (doc.HasMember("version") && doc["version"].IsString()) if (doc.HasMember("version") && doc["version"].IsString())
version = doc["version"].GetString(); version = doc["version"].GetString();
printf("Start Init server\n"); std::thread sign_init([version, ip, port]
server = new Server(); {
server->Init();
printf("Start Init sign\n"); printf("Start Init sign\n");
std::thread([=] { // Cannot use '&' capture!!!!! will cause crash
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
{ {
try try
{ {
if (Sign::Init(version)) if (Sign::Init(version))
{ {
if (!server->Run(ip, port)) printf("Start Init server\n");
Server server;
server.Init();
if (!server.Run(ip, port))
printf("Server run failed\n"); printf("Server run failed\n");
break; return;
} }
} }
catch (const std::exception &e) catch (const std::exception &e)
@ -113,23 +114,12 @@ void init()
printf("Init failed: %s\n", e.what()); printf("Init failed: %s\n", e.what());
} }
std::this_thread::sleep_for(std::chrono::seconds(1)); std::this_thread::sleep_for(std::chrono::seconds(1));
} } });
}) sign_init.detach();
.detach();
}
catch (const std::exception &e)
{
printf("Init failed: %s\n", e.what());
}
} }
void uninit() void uninit()
{ {
if (server != nullptr)
{
delete server;
server = nullptr;
}
} }
#if defined(_WIN_PLATFORM_) #if defined(_WIN_PLATFORM_)

View File

@ -21,7 +21,6 @@ std::shared_ptr<void> (*nodeInitializeOncePerProcess)(
int __stdcall fakeWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) int __stdcall fakeWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{ {
MessageBoxA(NULL, "Init", "fakeWinMain", MB_OK);
checkRunAsNode(nullptr); checkRunAsNode(nullptr);
return oriWinMain(hInstance, hPrevInstance, lpCmdLine, nShowCmd); return oriWinMain(hInstance, hPrevInstance, lpCmdLine, nShowCmd);
} }
@ -43,11 +42,7 @@ bool RunAsNode::RunNode()
[](auto &a) [](auto &a)
{ return std::wstring_convert<std::codecvt_utf8<wchar_t>>().to_bytes(a); }); { return std::wstring_convert<std::codecvt_utf8<wchar_t>>().to_bytes(a); });
MessageBoxA(NULL, "pre nodeInitializeOncePerProcess", "fakeWinMain", MB_OK);
std::for_each(argv.begin(), argv.end(), [](const std::string &arg)
{ MessageBoxA(NULL, arg.c_str(), "fakeWinMain", MB_OK); });
nodeInitializeOncePerProcess(argv, (1 << 6) | (1 << 7)); nodeInitializeOncePerProcess(argv, (1 << 6) | (1 << 7));
MessageBoxA(NULL, "post nodeInitializeOncePerProcess", "fakeWinMain", MB_OK);
return true; return true;
} }

View File

@ -2,8 +2,6 @@
#include "../include/rapidjson/document.h" #include "../include/rapidjson/document.h"
#include "../include/rapidjson/writer.h" #include "../include/rapidjson/writer.h"
#include <thread>
std::string Server::GetSign(const std::string_view &cmd, const std::string_view &src, const int seq) std::string Server::GetSign(const std::string_view &cmd, const std::string_view &src, const int seq)
{ {
auto [signDataHex, extraDataHex, tokenDataHex] = Sign::Call(cmd, src, seq); auto [signDataHex, extraDataHex, tokenDataHex] = Sign::Call(cmd, src, seq);

View File

@ -1,4 +1,5 @@
#pragma once #pragma once
#define _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR
#include "sign.h" #include "sign.h"
#include "../include/cpp-httplib/httplib.h" #include "../include/cpp-httplib/httplib.h"

View File

@ -5,6 +5,9 @@ for /f "tokens=2*" %%a in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\M
set "RetString=%%b" set "RetString=%%b"
goto :boot goto :boot
) )
echo QQ installation not found
pause
exit
:boot :boot
for %%a in ("!RetString!") do ( for %%a in ("!RetString!") do (
@ -37,6 +40,7 @@ goto launch
:restart :restart
powershell Start-Process -FilePath cmd.exe -ArgumentList """/c pushd %~dp0 && %~s0 %*""" -Verb RunAs powershell Start-Process -FilePath cmd.exe -ArgumentList """/c pushd %~dp0 && %~s0 %*""" -Verb RunAs
exit
:launch :launch
set "QQPath=!pathWithoutUninstall!QQ.exe" set "QQPath=!pathWithoutUninstall!QQ.exe"