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

leancloud-log-middleware

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leancloud-log-middleware - npm Package Compare versions

Comparing version 1.4.1 to 1.4.2

20

index.js
var request = require('request');
var AV = require('leanengine');
var BASE_URL = (process.env.isUS === 'true') ? 'http://us-api.leancloud.cn/1.1/classes' : 'http://api.leancloud.cn/1.1/classes';
var BASE_URL = (process.env.isUS === 'true') ? 'http://us-api.leancloud.cn/1.1/classes' : 'https://api.leancloud.cn/1.1/classes';
var CLASS = process.env.LOG_SYSTEM_CLASS;

@@ -10,3 +10,2 @@

appKey: process.env.LEANCLOUD_APP_KEY,
masterKey: process.env.LEANCLOUD_APP_MASTER_KEY,
region: 'us'

@@ -18,3 +17,2 @@ });

appKey: process.env.LEANCLOUD_APP_KEY,
masterKey: process.env.LEANCLOUD_APP_MASTER_KEY
});

@@ -82,2 +80,14 @@ }

var fetchSession = function(req) {
if(req.cookies){
if(req.cookies.sessiontoken)
return req.cookies.sessiontoken;
} else if (req.headers){
if(req.headers.sessiontoken)
return req.headers.sessiontoken;
} else {
return null;
}
};
var add = function (_payload, cb) {

@@ -125,3 +135,3 @@ var url = BASE_URL + '/' + CLASS;

var Request = function (req, res, next) {
var token = req.cookies.sessiontoken || req.headers.sessiontoken;
var token = fetchSession(req);
var payload = defaultRequestPayload(req, res, next);

@@ -146,3 +156,3 @@ if (token) {

var ORIGIN_JSON_FUNCTION = res.json;
var token = req.cookies.sessiontoken || req.headers.sessiontoken;
var token = fetchSession(req);

@@ -149,0 +159,0 @@ res.json = function(_result) {

{
"name": "leancloud-log-middleware",
"version": "1.4.1",
"version": "1.4.2",
"description": "Middleware of creating Leancloud object, by configuring LOG_SYSTEM_APP_ID, LOG_SYSTEM_APP_KEY and LOG_SYSTEM_CLASS",

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

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