
Product
Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
ctrl-content-manager
Advanced tools
An abstraction around contentful.
Yarn is recommended for installation.
$ yarn add ctrl-content-manager
But you can still use npm:
$ npm install --save ctrl-content-manager
const _ = require('lodash')
const CtrlContentManager = require('ctrl-content-manager')
const cm = new CtrlContentManager({
accessTokens: {
production: 'contentful_production_token'
, preview: 'contentful_preview_token'
}
, fetchInterval: 60 * 60 * 1000
, isProduction: process.env.NODE_ENV === 'production'
, space: 'contentful_space_id'
, parsing: {
keyed: {
tags: 'title'
, authors: 'name'
}
, singles: [
'globalElements'
, 'blogPostElements'
]
}
})
cm.startFetchInterval()
// Psuedo blog server code
http.get('/blog/?slug', (request, reply) {
// Get URL Slug.
const slug = request.params.slug
// Lookup the blog post by slug.
const blogPost = cm.find('blogPosts', {slug})
// If that post doesn't exist, show a 404 page with 3 random post suggestions.
if (!blogPost) {
return reply('404-template', {
suggestedBlogs: _.sampleSize(cm.get('blogPosts'), 3)
})
}
// Otherwise
// Get generic blog post elements. (E.g., nav buttons, colors, section titles)
const blogPostElements = cm.get('blogPostElements')
// Get the page title suffix. (E.g., ' - My Blog')
const titleSuffix = cm.get('globalElements.titleSuffix')
// Get tags that aren't already tagged on this post.
const otherTags = _.omit(cm.get('tags'), _.map(blogPost.tags, 'title'))
// Get authors that aren't this post's author.
const otherAuthors = _.omit(cm.get('authors'), blogPost.author.name)
// Render and serve the blog post.
return reply('blog-post-template', {
blogPost
, blogPostElements
, titleSuffix
, otherTags
, otherAuthors
})
})
Full documentation to come soon!
Copyright (c) 2016 Martin Experiments LLC
FAQs
An abstraction around contentful.
The npm package ctrl-content-manager receives a total of 0 weekly downloads. As such, ctrl-content-manager popularity was classified as not popular.
We found that ctrl-content-manager demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.