Skip to content

Commit

Permalink
feat: add support for bee 1.13 (#328)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cafe137 committed Mar 28, 2023
1 parent 13ce2d1 commit 2ff1b9f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
8 changes: 7 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { existsSync, readFileSync, writeFileSync } from 'fs'
import { getPath } from './path'
import { dump, FAILSAFE_SCHEMA, load } from 'js-yaml'
import PACKAGE_JSON from '../package.json'
import { getPath } from './path'

export const SUPPORTED_LEVELS = ['critical', 'error', 'warn', 'info', 'verbose', 'debug'] as const
export type SupportedLevels = typeof SUPPORTED_LEVELS[number]
Expand Down Expand Up @@ -34,6 +34,12 @@ export function writeConfigYaml(newValues: Record<string, unknown>) {
writeFileSync(getPath('config.yaml'), dump(data))
}

export function deleteKeyFromConfigYaml(key: string) {
const data = readConfigYaml()
delete data[key]
writeFileSync(getPath('config.yaml'), dump(data))
}

export function getDesktopVersionFromFile(): string | undefined {
try {
const desktopFile = readFileSync(getPath(DESKTOP_VERSION_FILE))
Expand Down
2 changes: 1 addition & 1 deletion src/downloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export async function runDownloader(force = false): Promise<void> {
}
await ensureDir(paths.data)
await ensureAsset(
`https://github.com/ethersphere/bee/releases/download/v1.12.0/bee-${platformString}-${archString}${suffixString}`,
`https://github.com/ethersphere/bee/releases/download/v1.13.0/bee-${platformString}-${archString}${suffixString}`,
`bee${suffixString}`,
{ chmod: process.platform !== 'win32', force },
)
Expand Down
3 changes: 1 addition & 2 deletions src/launcher.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { spawn } from 'child_process'
import * as FileStreamRotator from 'file-stream-rotator'
import { mkdirSync, writeFileSync } from 'fs'
import { platform } from 'os'
import { v4 } from 'uuid'
import { rebuildElectronTray } from './electron'
import { BeeManager } from './lifecycle'
import { logger } from './logger'
import { checkPath, getLogPath, getPath } from './path'
import * as FileStreamRotator from 'file-stream-rotator'

export function runKeepAliveLoop() {
setInterval(() => {
Expand All @@ -31,7 +31,6 @@ debug-api-enable: true
swap-enable: false
mainnet: true
full-node: false
chain-enable: false
cors-allowed-origins: '*'
use-postage-snapshot: true
resolver-options: https://cloudflare-eth.com
Expand Down
6 changes: 5 additions & 1 deletion src/migration.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { configYamlExists, readConfigYaml, writeConfigYaml } from './config'
import { configYamlExists, deleteKeyFromConfigYaml, readConfigYaml, writeConfigYaml } from './config'

export function runMigrations() {
if (!configYamlExists()) {
Expand All @@ -21,4 +21,8 @@ export function runMigrations() {
if (config['swap-endpoint'] && !config['blockchain-rpc-endpoint']) {
writeConfigYaml({ 'blockchain-rpc-endpoint': config['swap-endpoint'] })
}

if (config['chain-enable'] !== undefined) {
deleteKeyFromConfigYaml('chain-enable')
}
}

0 comments on commit 2ff1b9f

Please sign in to comment.