git ssb

0+

Daan Patchwork / ssb-viewer



forked from cel / ssb-viewer

Commit 514c401ff151036c45361377130d23877d57bec1

Avoid deprecated Buffer constructor

cel committed on 6/11/2020, 5:39:00 PM
Parent: df2a2ada6eb755c0b52aad076d8abdcf12c14ad5

Files changed

index.jschanged
index.jsView
@@ -29,9 +29,9 @@
2929 var appHash = hash([fs.readFileSync(__filename)])
3030
3131 var urlIdRegex = /^(?:\/(([%&@]|%25|%26|%40)(?:[A-Za-z0-9\/+]|%2[Ff]|%2[Bb]){43}(?:=|%3[Dd])\.(?:sha256|ed25519))(?:\.([^?]*))?|(\/.*?))(?:\?(.*))?$/
3232
33-var zeros = new Buffer(24); zeros.fill(0)
33+var zeros = Buffer.alloc(24); zeros.fill(0)
3434
3535 function hash(arr) {
3636 return arr.reduce(function (hash, item) {
3737 return hash.update(String(item))
@@ -482,9 +482,9 @@
482482 if (!has) return respond(res, 404, 'Not found')
483483
484484 var unboxKey
485485 if (unbox) {
486- try { unboxKey = new Buffer(unbox, 'base64') }
486+ try { unboxKey = Buffer.from(unbox, 'base64') }
487487 catch(e) { return respond(res, 400, err.message) }
488488 if (unboxKey.length !== 32) return respond(res, 400, 'Bad blob key')
489489 }
490490

Built with git-ssb-web