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

cabal-cli

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cabal-cli - npm Package Compare versions

Comparing version 6.0.2 to 6.2.0

lol

9

cli.js

@@ -13,2 +13,4 @@ #!/usr/bin/env node

var ram = require('random-access-memory')
var level = require('level')
var memdb = require('memdb')

@@ -162,3 +164,5 @@ var args = minimist(process.argv.slice(2))

var storage = args.temp ? ram : archivesdir + key
return Cabal(storage, key, {maxFeeds: maxFeeds})
if (!args.temp) try { mkdirp.sync(path.join(archivesdir, key, 'views')) } catch (e) {}
var db = args.temp ? memdb() : level(path.join(archivesdir, key, 'views'))
return Cabal(storage, key, {db: db, maxFeeds: maxFeeds})
}

@@ -276,3 +280,4 @@

console.log(`Publishing message to channel - ${channel || 'default'}: ${message}`)
var cabal = Cabal(archivesdir + key, key, {maxFeeds: maxFeeds})
var db = args.temp ? memdb() : level(path.join(archivesdir, key, 'views'))
var cabal = Cabal(archivesdir + key, key, {db: db, maxFeeds: maxFeeds})
cabal.ready(() => {

@@ -279,0 +284,0 @@ cabal.publish({

function Commander (view, cabal) {
if (!(this instanceof Commander)) return new Commander(view, cabal)
this.cabal = cabal
this.channel = 'default'
this.channel = '~status'
this.view = view

@@ -148,2 +148,4 @@ this.pattern = (/^\/(\w*)\s*(.*)/)

self.view.writeLine(`${cmd} is not a command, type /help for commands`)
} else if (self.channel === "~status") {
self.view.writeLine(line)
} else {

@@ -150,0 +152,0 @@ line = line.trim()

@@ -12,4 +12,7 @@ var Cabal = require('cabal-core')

var emojiPattern = emojiRegex()
var util = require("./util")
var markdown = require('./markdown-shim')
var statusMessages = ['welcome to cabal', 'for more info visit https://github.com/cabal-club/cabal']
statusMessages = statusMessages.map(util.wrapStatusMsg)

@@ -195,4 +198,4 @@ const HEADER_ROWS = 6

cabal.client = {
channel: 'default',
channels: [],
channel: '~status',
channels: ['~status'],
messages: [],

@@ -202,2 +205,4 @@ user: { local: true, online: true, key: '' },

}
this.commander.commands.help.call()
self.state.cabal.client = cabal.client

@@ -208,4 +213,4 @@

if (err) return
cabal.client.channels = channels
self.loadChannel('default')
cabal.client.channels = cabal.client.channels.concat(channels)
self.loadChannel(cabal.client.channel)
self.bus.emit('render')

@@ -316,5 +321,7 @@

// use to write anything else to the screen, e.g. info messages or emotes
// use to write anything else to the screen, e.g. info iessages or emotes
NeatScreen.prototype.writeLine = function (line) {
this.state.cabal.client.messages.push(`${chalk.dim(line)}`)
var msg = `${chalk.dim(line)}`
this.state.cabal.client.messages.push(msg)
statusMessages.push(util.wrapStatusMsg(msg))
this.bus.emit('render')

@@ -346,3 +353,7 @@ }

// MISSING: mention beeps
if (channel === '~status') {
self.state.cabal.client.messages = statusMessages.map(self.formatMessage)
self.neat.render()
return
}

@@ -407,13 +418,28 @@ var pending = 0

var highlight = false
if (!msg.value.type) { msg.type = 'chat/text' }
/*
msg = {
key: ''
value: {
timestamp: ''
type: ''
content: {
text: ''
}
}
}
*/
if (!msg.value.type) { msg.value.type = 'chat/text' }
if (msg.value.content && msg.value.timestamp) {
var author
if (self.state.cabal.client.users && self.state.cabal.client.users[msg.key]) author = self.state.cabal.client.users[msg.key].name || self.state.cabal.client.users[msg.key].key.slice(0, 8)
if (self.state && self.state.cabal.client.users && self.state.cabal.client.users[msg.key]) author = self.state.cabal.client.users[msg.key].name || self.state.cabal.client.users[msg.key].key.slice(0, 8)
else author = msg.key.slice(0, 8)
let localNick = self.state.cabal.client.user.name
var localNick = ''
if (self.state) {
localNick = self.state.cabal.client.user.name
}
// emojis.break the cli: replace them with a cabal symbol
var msgtxt = msg.value.content.text.replace(emojiPattern, '➤')
if (msgtxt.indexOf(localNick) > -1 && author !== localNick) { highlight = true }
if (msgtxt.indexOf(localNick) > -1 && author !== localNick) { highlight = false }
var color = keyToColour(msg.key)
var color = keyToColour(msg.key) || colours[5]

@@ -420,0 +446,0 @@ var timestamp = `${chalk.dim(formatTime(msg.value.timestamp))}`

{
"name": "cabal-cli",
"version": "6.0.2",
"version": "6.2.0",
"description": "p2p chat",

@@ -10,3 +10,3 @@ "main": "index.js",

"dependencies": {
"cabal-core": "^5.1.0",
"cabal-core": "^5.1.1",
"chalk": "^2.4.1",

@@ -19,2 +19,4 @@ "collect-stream": "^1.2.1",

"js-yaml": "^3.12.0",
"level": "^5.0.1",
"memdb": "^1.3.1",
"minimist": "^1.2.0",

@@ -21,0 +23,0 @@ "mkdirp": "^0.5.1",

@@ -1,2 +0,2 @@

function logResult (err, result) {
function log (err, result) {
if (err) { console.error('hyperdb failed with', err) }

@@ -81,2 +81,16 @@ if (arguments.length >= 2) { console.log(result) }

module.exports = {log: logResult, wrapAnsi: wrapAnsi, strlenAnsi: strlenAnsi, centerText, rightAlignText}
function wrapStatusMsg (m) {
return {
key: 'status',
value: {
timestamp: Date.now(),
type: 'chat/text',
content: {
text: m
}
}
}
}
module.exports = { log, wrapAnsi, strlenAnsi, centerText, rightAlignText, wrapStatusMsg }
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