Skip to content

Commit

Permalink
fix: autoclose node
Browse files Browse the repository at this point in the history
  • Loading branch information
geolffreym committed Sep 18, 2022
1 parent 8a11de4 commit 00572a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions src/main/core/ipfs/node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ const KILL_TIMEOUT = 15 * 1000
const DEFAULT_SWARM_TCP = 4010
const DEFAULT_SWARM_WS = 4011
const resolveIpfsPaths = () => require('go-ipfs').path()
.replace('app.asar', 'app.asar.unpacked');
.replace('app.asar', 'app.asar.unpacked')

const forceKill = async (isInstance) => {
log.info('Forcing stop')
await isInstance.stop()
log.warn('Cleaning bad repo')
await removeFiles(ROOT_IPFS_DIR)
};
}

const initIpfsNode = async (isInstance) => {
// Check if running time dir exists
Expand All @@ -44,7 +44,7 @@ const initIpfsNode = async (isInstance) => {
const ipfsFactory = async (conf = {}) => {
const keyFile = key.readFromStorage() || {}
const node = 'node' in keyFile && keyFile.node ? keyFile.node : null

// Link to current local node
if (node) {
log.info('Using provided node on port:', node)
Expand Down Expand Up @@ -111,7 +111,6 @@ const ipfsFactory = async (conf = {}) => {
return false
}


const ipfsApi = isInstance?.api
const id = ipfsApi.peerId
log.info(`Started ${isInstance.started}`)
Expand Down
7 changes: 3 additions & 4 deletions src/render/core/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@

// import { Key as key } from '@main/bridge'


export default {
streaming: ['hls'],
gateways: () => {
// const keyFile = key.readFromStorage() || {}
// const node = 'node' in keyFile && keyFile.node ? keyFile.node : null
const port = '9090'//null ? '8080' : '9090'
const port = '9090'// null ? '8080' : '9090'

return [
// 'https://vps1.phillm.net',
Expand All @@ -30,15 +29,15 @@ export default {
spanish: 'es',
english: 'en'
},
get revHash() {
get revHash () {
const v = Object.values(this.hash)
const k = Object.keys(this.hash)
return v.reduce((o, i, index) => {
o[i] = k[index]
return o
}, {})
},
get available() {
get available () {
return Object.keys(this.hash)
}
},
Expand Down

0 comments on commit 00572a2

Please sign in to comment.