This commit is contained in:
Frostebite 2024-01-30 14:52:40 +00:00
parent f8d0a490b9
commit eb0a426d67
6 changed files with 26 additions and 18 deletions

BIN
dist/index.js generated vendored

Binary file not shown.

BIN
dist/index.js.map generated vendored

Binary file not shown.

BIN
dist/licenses.txt generated vendored

Binary file not shown.

View File

@ -44,6 +44,7 @@
"nanoid": "^3.3.1",
"reflect-metadata": "^0.1.13",
"semver": "^7.5.2",
"ts-md5": "^1.3.1",
"unity-changeset": "^2.0.0",
"uuid": "^9.0.0",
"yaml": "^2.2.2"

View File

@ -3,7 +3,7 @@ import fs from 'node:fs';
import path from 'node:path';
import CloudRunner from '../cloud-runner';
import CloudRunnerOptions from '../options/cloud-runner-options';
const md5 = require('md5');
import * as md5 from 'ts-md5';
export class RemoteClientLogger {
private static get LogFilePath() {
@ -51,22 +51,24 @@ export class RemoteClientLogger {
return;
}
CloudRunnerLogger.log(`Log file exist`);
await new Promise((resolve) => setTimeout(resolve, 1));
let hashedLogs = fs.readFileSync(RemoteClientLogger.LogFilePath).toString();
hashedLogs = md5(hashedLogs);
for (let index = 0; index < 3; index++) {
CloudRunnerLogger.log(`LOGHASH: ${hashedLogs}`);
const logs = fs.readFileSync(RemoteClientLogger.LogFilePath).toString();
CloudRunnerLogger.log(`LOGS: ${Buffer.from(logs).toString('base64')}`);
CloudRunnerLogger.log(
`Game CI's "Cloud Runner System" will cancel the log when it has successfully received the log data to verify all logs have been received.`,
);
// wait for 15 seconds to allow the log to be sent
await new Promise((resolve) => setTimeout(resolve, 15000));
}
// let hashedLogs = fs.readFileSync(RemoteClientLogger.LogFilePath).toString();
//
// hashedLogs = md5(hashedLogs);
//
// for (let index = 0; index < 3; index++) {
// CloudRunnerLogger.log(`LOGHASH: ${hashedLogs}`);
// const logs = fs.readFileSync(RemoteClientLogger.LogFilePath).toString();
// CloudRunnerLogger.log(`LOGS: ${Buffer.from(logs).toString('base64')}`);
// CloudRunnerLogger.log(
// `Game CI's "Cloud Runner System" will cancel the log when it has successfully received the log data to verify all logs have been received.`,
// );
//
// // wait for 15 seconds to allow the log to be sent
// await new Promise((resolve) => setTimeout(resolve, 15000));
// }
}
public static HandleLog(message: string): boolean {
if (message.includes('LOGHASH: ')) {
@ -77,7 +79,7 @@ export class RemoteClientLogger {
}
RemoteClientLogger.value += message;
const hashedValue = md5(RemoteClientLogger.value);
const hashedValue = md5.Md5.hashStr(RemoteClientLogger.value);
if (RemoteClientLogger.md5 === hashedValue) {
CloudRunnerLogger.log(`LOG COMPLETE`);
@ -96,7 +98,7 @@ export class RemoteClientLogger {
}
}
public static HandleLogFull(message: string): boolean {
const hashedValue = md5(message);
const hashedValue = md5.Md5.hashStr(message);
if (RemoteClientLogger.md5 === hashedValue) {
CloudRunnerLogger.log(`LOG COMPLETE`);

View File

@ -6031,6 +6031,11 @@ ts-jest@^27.1.3:
semver "7.x"
yargs-parser "20.x"
ts-md5@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/ts-md5/-/ts-md5-1.3.1.tgz#f5b860c0d5241dd9bb4e909dd73991166403f511"
integrity sha512-DiwiXfwvcTeZ5wCE0z+2A9EseZsztaiZtGrtSaY5JOD7ekPnR/GoIVD5gXZAlK9Na9Kvpo9Waz5rW64WKAWApg==
ts-node@10.8.1:
version "10.8.1"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.8.1.tgz#ea2bd3459011b52699d7e88daa55a45a1af4f066"