fix for windows

This commit is contained in:
einhornimmond 2025-10-25 15:28:21 +02:00
parent 04af2ebec9
commit 181c1d28fc
6 changed files with 14 additions and 6 deletions

View File

@ -13,6 +13,7 @@
"@sinclair/typemap": "^0.10.1",
"@types/bun": "^1.2.17",
"@types/uuid": "^8.3.4",
"adm-zip": "^0.5.16",
"async-mutex": "^0.5.0",
"dotenv": "^10.0.0",
"elysia": "1.3.8",
@ -285,6 +286,8 @@
"acorn": ["acorn@8.15.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg=="],
"adm-zip": ["adm-zip@0.5.16", "", {}, "sha512-TGw5yVi4saajsSEgz25grObGHEUaDrniwvA2qwSC060KfqGPdglhvPMA2lPIoxs3PQIItj2iag35fONcQqgUaQ=="],
"agent-base": ["agent-base@7.1.4", "", {}, "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ=="],
"anser": ["anser@1.4.10", "", {}, "sha512-hCv9AqTQ8ycjpSd3upOJd7vFwW1JaoYQ7tpham03GJ1ca8/65rqn0RpaWpItOAd6ylW9wAw6luXYPJIyPFVOww=="],

View File

@ -26,6 +26,7 @@
"@sinclair/typemap": "^0.10.1",
"@types/bun": "^1.2.17",
"@types/uuid": "^8.3.4",
"adm-zip": "^0.5.16",
"async-mutex": "^0.5.0",
"dotenv": "^10.0.0",
"elysia": "1.3.8",

View File

@ -1,7 +1,6 @@
import { execSync } from 'node:child_process'
import fs from 'node:fs'
import path from 'node:path'
import { gunzipSync } from 'node:zlib'
import { getLogger } from 'log4js'
import { exportCommunities } from '../client/GradidoNode/communities'
import { GradidoNodeProcess } from '../client/GradidoNode/GradidoNodeProcess'
@ -15,6 +14,7 @@ import {
import { checkFileExist, checkPathExist } from '../utils/filesystem'
import { isPortOpen } from '../utils/network'
import { AppContextClients } from './appContext'
import AdmZip from 'adm-zip'
const logger = getLogger(`${LOG4JS_BASE_CATEGORY}.bootstrap.initGradidoNode`)
@ -58,7 +58,6 @@ async function exportHederaAddressbooks(
async function ensureGradidoNodeRuntimeAvailable(runtimeFileName: string): Promise<void> {
const runtimeFolder = path.dirname(runtimeFileName)
checkPathExist(runtimeFolder, true)
logger.debug(`GradidoNode Runtime: ${runtimeFileName}`)
if (!checkFileExist(runtimeFileName)) {
const runtimeArchiveFilename = createGradidoNodeRuntimeArchiveFilename()
const downloadUrl = new URL(
@ -71,7 +70,8 @@ async function ensureGradidoNodeRuntimeAvailable(runtimeFileName: string): Promi
}
const compressedBuffer = await archive.arrayBuffer()
if (process.platform === 'win32') {
fs.writeFileSync(runtimeFileName, gunzipSync(Buffer.from(compressedBuffer)))
const zip = new AdmZip(Buffer.from(compressedBuffer))
zip.extractAllTo(runtimeFolder, true)
} else {
const archivePath = path.join(runtimeFolder, runtimeArchiveFilename)
logger.debug(`GradidoNode Runtime Archive: ${archivePath}`)

View File

@ -52,6 +52,7 @@ export class GradidoNodeProcess {
env: {
CLIENTS_HIERO_NETWORKTYPE: CONFIG.HIERO_HEDERA_NETWORK,
SERVER_JSON_RPC_PORT: CONFIG.DLT_NODE_SERVER_PORT.toString(),
USERPROFILE: CONFIG.DLT_GRADIDO_NODE_SERVER_HOME_FOLDER,
HOME: CONFIG.DLT_GRADIDO_NODE_SERVER_HOME_FOLDER,
},
onExit(proc, exitCode, signalCode, error) {

View File

@ -27,10 +27,13 @@ export const homeCommunityGraphqlQuery = gql`
export const setHomeCommunityTopicId = gql`
mutation ($uuid: String!, $hieroTopicId: String){
updateHomeCommunity(uuid: $uuid, hieroTopicId: $hieroTopicId) {
...Community_common
uuid
name
hieroTopicId
foreign
creationDate
}
}
${communityFragment}
`
export const getReachableCommunities = gql`

View File

@ -9,7 +9,7 @@ export function checkFileExist(filePath: string): boolean {
fs.accessSync(filePath, fs.constants.R_OK | fs.constants.W_OK)
return true
} catch (err) {
logger.debug(`file ${filePath} does not exist: ${err}`)
// logger.debug(`file ${filePath} does not exist: ${err}`)
return false
}
}