mirror of https://codeberg.org/pzp/zooboard.git
cosmetic refactor
This commit is contained in:
parent
8076007d63
commit
fc65557783
12
main.js
12
main.js
|
@ -5,18 +5,18 @@ const p = require('node:util').promisify
|
||||||
const Keypair = require('ppppp-keypair')
|
const Keypair = require('ppppp-keypair')
|
||||||
const awaitable = require('pull-awaitable')
|
const awaitable = require('pull-awaitable')
|
||||||
|
|
||||||
// WARNING monkey patch! --------------------------------------
|
// WARNING monkey patch! -------------------------------------------------------
|
||||||
const na = require('sodium-native')
|
const na = require('sodium-native')
|
||||||
na.sodium_malloc = function sodium_malloc_monkey_patched(n) {
|
na.sodium_malloc = function sodium_malloc_monkey_patched(n) {
|
||||||
return Buffer.alloc(n)
|
return Buffer.alloc(n)
|
||||||
}
|
}
|
||||||
na.sodium_free = function sodium_free_monkey_patched() {}
|
na.sodium_free = function sodium_free_monkey_patched() {}
|
||||||
// Electron > 20.3.8 breaks a napi method that `sodium_malloc`
|
// Electron > 20.3.8 breaks a napi method that `sodium_malloc` depends on to
|
||||||
// depends on to create external buffers. (see v8 memory cage)
|
// create external buffers. (see v8 memory cage)
|
||||||
//
|
//
|
||||||
// This crashes electron when called by various libraries, so
|
// This crashes electron when called by various libraries, so we monkey-patch
|
||||||
// we monkey-patch this particular function.
|
// this particular function.
|
||||||
// ------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
process.env.ZOOBOARD_DATA ??= Path.join(app.getPath('appData'), 'zooboard')
|
process.env.ZOOBOARD_DATA ??= Path.join(app.getPath('appData'), 'zooboard')
|
||||||
app.setPath('userData', process.env.ZOOBOARD_DATA)
|
app.setPath('userData', process.env.ZOOBOARD_DATA)
|
||||||
|
|
Loading…
Reference in New Issue