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

thinkjs

Package Overview
Dependencies
Maintainers
1
Versions
240
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

thinkjs - npm Package Compare versions

Comparing version 0.4.2 to 0.4.4

4

lib/Conf/config.js

@@ -12,3 +12,3 @@ /**

url_resource_on: true, //是否监听静态资源类请求
url_resource_suffix: 'js,css,png,jpg,jpeg,gif,ico,cur,swf,map,svg,ttf,woff,eot'.split(","), //监听的静态资源后缀
url_resource_reg: /^(resource\/|favicon\.ico)/, //判断是否是静态资源的正则
post_json_content_type: ["application/json"], //post数据为json时的content-type

@@ -48,3 +48,3 @@ url_route_on: true, //开启自定义路由功能

session_id: "thinkjs", //session id
session_type: "", //session存储类型, 空为内存,还可以为File, Db
session_type: "File", //session存储类型, 空为内存,还可以为File, Db
session_options: {}, //session的一些选项

@@ -51,0 +51,0 @@ session_cookie_sign: "", //session对应的cookie使用签名,如果使用这里填密钥

@@ -18,15 +18,12 @@ var path = require("path");

};
var extname = path.extname(this.http.pathname);
if (!extname) {
return false;
var pathname = this.http.pathname;
if (pathname.indexOf('/') === 0) {
pathname = pathname.substr(1);
};
extname = extname.toLowerCase();
if (extname.substr(0, 1) === '.') {
extname = extname.substr(1);
};
//如果不在配置列表里,则不为静态资源请求
if (this.options.url_resource_suffix.indexOf(extname) === -1) {
var reg = C('url_resource_reg');
//通过正则判断是否是静态资源请求
if (!reg.test(pathname)) {
return false;
};
var file = RESOURCE_PATH + "/" + this.http.pathname;
var file = RESOURCE_PATH + "/" + pathname;
var res = this.http.res;

@@ -45,2 +42,3 @@ if (fs.existsSync(file)) {

}
//返回一个pendding promise, 不让后续执行
return getDefer().promise;

@@ -47,0 +45,0 @@ }

@@ -210,6 +210,6 @@ /**

write: function(data){
ws.send(JSON.stringify(data));
ws && ws.send(JSON.stringify(data));
},
end: function(){
ws.close();
ws && ws.close();
}

@@ -216,0 +216,0 @@ }));

@@ -35,5 +35,5 @@ var url = require("url");

var self = this;
self.parsePathName();
return tag("path_info", this.http).then(function(){
return self.resourceCheck();
return self.resourceCheck().then(function(){
self.parsePathName();
return tag("path_info", self.http);
}).then(function(){

@@ -40,0 +40,0 @@ return self.routeCheck();

@@ -37,3 +37,3 @@ var crypto = require('crypto');

module.exports = Class(function(){
var data = {};
var session_data = {};
return {

@@ -44,3 +44,6 @@ cookie: null,

//session_cookie是未签名的cookie
this.cookie = this.http.session_cookie;
this.cookie = http.session_cookie;
if (!(this.cookie in session_data)) {
session_data[this.cookie] = {};
};
},

@@ -53,3 +56,4 @@ /**

get: function(name){
return getPromise();
var value = session_data[this.cookie][name] || "";
return getPromise(value);
},

@@ -62,3 +66,9 @@ /**

set: function(name, value){
return true;
if (isObject(name)) {
for(var key in name){
session_data[this.cookie][key] = name[key];
}
}else {
session_data[this.cookie][name] = value;
}
},

@@ -69,4 +79,8 @@ /**

*/
rm: function(){
rm: function(name){
if (name) {
delete session_data[this.cookie][name];
}else{
session_data[this.cookie] = {};
}
},

@@ -77,3 +91,3 @@ /**

*/
save: function(){
flush: function(){

@@ -80,0 +94,0 @@ }

{
"name": "thinkjs",
"description": "thinkphp web framework for nodejs",
"version": "0.4.2",
"version": "0.4.4",
"author": {

@@ -6,0 +6,0 @@ "name": "welefen",

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