New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

corsica-martell

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

corsica-martell - npm Package Compare versions

Comparing version 0.1.0 to 1.0.0

53

index.js
/* Description:
* Loads content from Sean Martell's Mozilla logo page.
* Loads content from Mozilla Etherpads.
*

@@ -11,3 +11,2 @@ * Dependencies:

var Promise = require('es6-promise').Promise;
var cheerio = require('cheerio');

@@ -20,35 +19,29 @@ var nunjucks = require('nunjucks');

nunjucks.configure(__dirname);
var etherpad_re = RegExp('^https?://etherpad.mozilla.org/(.*)$');
var allImages = corsica.http('http://blog.seanmartell.com/brands/')
.then(function(data) {
var $ = cheerio.load(data);
var imageNodes = $('.masonry-post');
var imageData = [];
imageNodes.each(function(i, node) {
imageData.push({
title: $(node).find('p').text(),
url: $(node).find('img').attr('src') + '?utm_source=corsica',
});
});
return imageData;
});
corsica.on('content', function(msg) {
if (!('url' in msg)) {
return msg;
}
corsica.on('martell', function(content) {
allImages.then(function(images) {
var r = Math.floor(Math.random() * images.length);
var img = images[r];
console.log('sending', img);
corsica.sendMessage('content', {
// console.log('sending', {
type: 'html',
screen: content.screen,
content: nunjucks.render('template.html', img),
var match = msg.url.match(etherpad_re);
if (!match) {
return msg;
}
var title = match[1];
var htmlUrl = 'https://etherpad.mozilla.org/ep/pad/export/' + title + '/latest?format=html'
return corsica.http(htmlUrl)
.then(function(page) {
var body = cheerio.load(page)('body').html();
msg.url = undefined;
msg.type = 'html';
msg.content = nunjucks.render('template.html', {
body: body,
title: title,
});
})
.catch(function(err) {
console.error('AHHHH', err);
return msg;
});
return content;
});
};
{
"name": "corsica-martell",
"version": "0.1.0",
"description": "Grab logos from Sean Martell's site.",
"version": "1.0.0",
"description": "Show Etherpads on Corsica.",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/mythmon/corsica-martell.git"
"url": "https://github.com/mythmon/corsica-etherpad.git"
},

@@ -16,5 +16,5 @@ "keywords": [

"bugs": {
"url": "https://github.com/mythmon/corsica-martell/issues"
"url": "https://github.com/mythmon/corsica-etherpad/issues"
},
"homepage": "https://github.com/mythmon/corsica-martell",
"homepage": "https://github.com/mythmon/corsica-etherpad",
"dependencies": {

@@ -21,0 +21,0 @@ "cheerio": "^0.17.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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