Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cabal-core

Package Overview
Dependencies
Maintainers
4
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cabal-core - npm Package Compare versions

Comparing version 11.2.0 to 11.2.1

9

index.js

@@ -55,4 +55,4 @@ var kappa = require('kappa-core')

this.maxFeeds = opts.maxFeeds
this.modKeys = []
this.adminKeys = []
this.modKeys = opts.modKeys || []
this.adminKeys = opts.adminKeys || []

@@ -63,6 +63,3 @@ if (!key) this.key = generateKeyHex()

if (!key.startsWith('cabal://')) key = 'cabal://' + key
const uri = new URL(key)
this.key = sanitizeKey(key)
this.modKeys = uri.searchParams.getAll('mod')
this.adminKeys = uri.searchParams.getAll('admin')
}

@@ -98,3 +95,3 @@ if (!isHypercoreKey(this.key)) throw new Error('invalid cabal key')

sublevel(this.db, USERS, { valueEncoding: json })))
this.kcore.use('moderation', createModerationView(
this.kcore.use('moderation', 2, createModerationView(
this,

@@ -101,0 +98,0 @@ sublevel(this.db, MODERATION_AUTH, { valueEncoding: json }),

{
"name": "cabal-core",
"version": "11.2.0",
"version": "11.2.1",
"description": " p2p db functions for chat ",

@@ -5,0 +5,0 @@ "main": "index.js",

var mauth = require('materialized-group-auth')
var Writable = require('readable-stream').Writable
var sub = require('subleveldown')

@@ -53,3 +54,3 @@ var EventEmitter = require('events').EventEmitter

if (flags.includes('admin') && row.key === undefined &&
cabal.adminKeys.includes(row.id) && row.id !== key) {
!cabal.adminKeys.includes(row.id) && row.id !== key) {
batch.push({

@@ -68,3 +69,3 @@ type: 'remove',

if (flags.includes('mod') && row.key === undefined &&
cabal.modKeys.includes(row.id) && row.id !== key) {
!cabal.modKeys.includes(row.id) && row.id !== key) {
batch.push({

@@ -155,3 +156,2 @@ type: 'remove',

}
var r = auth.list(opts)
var out = through.obj(function (row, enc, next) {

@@ -162,3 +162,6 @@ row.channel = row.group

})
pump(r, out)
this.ready(function () {
var r = auth.list(opts)
pump(r, out)
})
var ro = readonly(out)

@@ -194,2 +197,57 @@ if (cb) collect(ro, cb)

},
},
// view lifecycle
storeState: function (state, cb) {
state = state.toString('base64')
authDb.put('state', state, cb)
},
fetchState: function (cb) {
authDb.get('state', function (err, state) {
if (err && err.notFound) cb()
else if (err) cb(err)
else cb(null, Buffer.from(state, 'base64'))
})
},
clearIndex: function (cb) {
var batch = []
var maxSize = 5000
let pending = 2
infoDb.open(function () {
pump(infoDb.createKeyStream(), new Writable({
objectMode: true,
write: function (key, enc, next) {
batch.push({ type: 'del', key })
if (batch.length >= maxSize) {
infoDb.batch(batch, next)
} else next()
},
final: function (next) {
if (batch.length > 0) infoDb.batch(batch, next)
else next()
}
}), ondone)
})
authDb.open(function () {
pump(authDb.createKeyStream(), new Writable({
objectMode: true,
write: function (key, enc, next) {
batch.push({ type: 'del', key })
if (batch.length >= maxSize) {
authDb.batch(batch, next)
} else next()
},
final: function (next) {
if (batch.length > 0) authDb.batch(batch, next)
else next()
}
}), ondone)
})
function ondone (err) {
if (--pending) return
if (err) cb(err)
else cb()
}
}

@@ -196,0 +254,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc