
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
gengojs-accept
Advanced tools
Express, Koa, Hapi locale parser that powers gengo.js.
This module parses the accept-language header from Express, Koa, or Hapi and returns the appropriate locale.
See the beautifully generated documenation at GitHub.
$ npm i --save gengojs-accept
import express from 'express';
import accept from 'gengojs-accept/express';
let app = express();
app.use(accept());
app.use('/', function(req, res, next){
console.log(req.getLocale());
});
// ...
import Hapi from 'hapi';
import accept from 'gengojs-accept/hapi';
let server = new Hapi.Server();
server.connection({
port:3000
})
server.register(accept(), function(error){
if(error) console.log(error);
});
server.route({
method: 'GET',
path: '/',
handler: function (request, reply) {
console.log(request.accept.getLocale());
reply();
}
});
// ...
Note: I have not tested Koa's v1.0.0 API but in theory it should work. Please report any bugs if encountered or create a pull request to add tests.
import Koa from 'koa';
import accept from 'gengojs-accept/koa';
let app = new Koa();
app.use(accept());
app.use('/', function (self, next){
console.log(self.accept.getLocale());
// or
console.log(self.request.accept.getLocale());
// or
console.log(self.response.accept.getLocale());
});
// ...
import accept from 'gengojs-accept';
// pass the request object from express or hapi
// or the 'ctx'/'self' context from koa;
let currentLocale = accept(req || ctx, options).getLocale();
{
"check": true,
"default": "en-US",
"supported": [
"en-US"
],
"keys": {
"cookie": "locale",
"query": "locale"
},
"detect": {
"header": true,
"cookie": false,
"query": false,
"url": false,
"domain": false,
"subdomain": false
}
}
FAQs
Express, Koa, and Hapi locale parser.
The npm package gengojs-accept receives a total of 5 weekly downloads. As such, gengojs-accept popularity was classified as not popular.
We found that gengojs-accept 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.