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

apostrophe-snippets

Package Overview
Dependencies
Maintainers
8
Versions
202
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apostrophe-snippets - npm Package Compare versions

Comparing version 0.0.10 to 0.0.11

46

index.js

@@ -97,2 +97,3 @@ var async = require('async');

self._app = options.app;
self._searchable = options.searchable || true;
self._options = options;

@@ -987,2 +988,14 @@ self._dirs = (options.dirs || []).concat([ __dirname ]);

// The default properties for snippets are already covered by the
// default properties for pages in general. Extend this to add more
// search texts representing metadata relating to
// this type of snippet. Always call the superclass version. Example:
// texts.push({ weight: 20, text: snippet.address })
//
// The default search engine is very simplistic. Searches that match
// something weighted 11 or higher appear before everything else.
self.addSearchTexts = function(snippet, texts) {
};
// Add a listener so we can contribute our own metadata to the set of lines used

@@ -999,2 +1012,35 @@ // for the diffs between versions. Pass an inline function so that self.addDiffLines

self._apos.addListener('index', function(snippet, lines) {
if (snippet.type === self._instance) {
self.addSearchTexts(snippet, lines);
}
});
self._apos.addListener('searchResult', function(req, res, page, context) {
// Not all types are searchable on all sites, snippets usually
// have this shut off because they have no permalinks
if (!self._searchable) {
return;
}
console.log('searchable for ' + self._instance);
// Don't mess with a result another listener already accepted
if (context.accepted) {
return;
}
if (self._instance === page.type) {
// Set the accepted flag so the pages module doesn't 404 the search result.
// Now we can asynchronously work on it
context.accepted = true;
// The result belongs to us now, let's figure out what to do with it.
return self.findBestPage(req, page, function(err, bestPage) {
if (!bestPage) {
res.statusCode = 404;
return res.send('Not Found');
}
var url = self.permalink(page, bestPage);
return res.redirect(url);
});
}
});
// Add the .url property to snippets so they can be clicked through

@@ -1001,0 +1047,0 @@ self.addUrls = function(req, snippets, callback) {

2

package.json
{
"name": "apostrophe-snippets",
"version": "0.0.10",
"version": "0.0.11",
"description": "Reusable content snippets for the Apostrophe content management system. The blog and events modules are built on this foundation, which is also useful in and of itself.",

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

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