Skip to content

Commit

Permalink
merge from source
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreyZhao committed Mar 5, 2012
2 parents 3ae4db9 + 5996060 commit eb921c7
Show file tree
Hide file tree
Showing 63 changed files with 1,391 additions and 947 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
config.js
node_modules
.naeindex
public/user_data
2 changes: 2 additions & 0 deletions .naeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
public/user_data/*
.git
56 changes: 56 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

n.n.n / 2012-03-04
==================

* ensure IncomingForm.UPLOAD_DIR
* ensure upload image dir exists
* fixed csrf bug in mark message read
* remove customHost
* add .naeignore files
* * merge cnodeclub to nodeclub; * add more settings for custom site; * fixed upload.js not worked bug;
* Merge pull request #4 from dead-horse/master
* Merge pull request #11 from thebrecht/master
* 话题回复数纳入二级回复,样式调整
* 支持table,邮件提醒
* 加入亂數產生新密碼
* fix style
* bugs fixed
* Merge pull request #3 from LeToNode/master
* Merge pull request #6 from ericzhang-cn/master
* markdown语法粗体应为两个星号,原描述有误
* Merge pull request #2 from roymax/master
* change to async
* change to async
* Update README.md
* 修复`abc+label@gmail.com`格式的注册邮箱不能成功激活的问题
* commit
* project init
* first commit

n.n.n / 2012-03-04
==================

* ensure IncomingForm.UPLOAD_DIR
* ensure upload image dir exists
* fixed csrf bug in mark message read
* remove customHost
* add .naeignore files
* * merge cnodeclub to nodeclub; * add more settings for custom site; * fixed upload.js not worked bug;
* Merge pull request #4 from dead-horse/master
* Merge pull request #11 from thebrecht/master
* 话题回复数纳入二级回复,样式调整
* 支持table,邮件提醒
* 加入亂數產生新密碼
* fix style
* bugs fixed
* Merge pull request #3 from LeToNode/master
* Merge pull request #6 from ericzhang-cn/master
* markdown语法粗体应为两个星号,原描述有误
* Merge pull request #2 from roymax/master
* change to async
* change to async
* Update README.md
* 修复`abc+label@gmail.com`格式的注册邮箱不能成功激活的问题
* commit
* project init
* first commit
85 changes: 63 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,67 @@
##Node Club

###### 介绍
Node Club 是用 **Node.js****MongoDb** 开发的新型社区软件,界面优雅,功能丰富,小巧迅速,已在Node.js 中文技术社区 [CNode](http://cnodejs.org) 得到应用,但你完全可以用它搭建自己的社区。

###### 安装部署
// install node npm mongodb
// run mongod
cd nodeclub
npm install ./
cp config.default.js config.js
// modify the config file as yours
node app.js
# nodeclub

基于nodejs的社区系统

## 介绍

Node Club 是用 **Node.js****MongoDb** 开发的新型社区软件,界面优雅,功能丰富,小巧迅速,
已在Node.js 中文技术社区 [CNode](http://cnodejs.org) 得到应用,但你完全可以用它搭建自己的社区。

## 安装部署

```
// install node npm mongodb
// run mongod
cd nodeclub
npm install ./
cp config.default.js config.js
// modify the config file as yours
node app.js
```

###### 其它
## 其它

小量修改了两个依赖模块:node-markdown,express

1.node-markdown/lib/markdown.js allowedTags 添加 `embed` 标签以支持 flash 视频,allowedAttributes 添加:

embed:'src|quality|width|height|align|allowScriptAccess|allowFullScreen|mode|type'
2.express/node_modules/connect/lib/middleware/csrf.js 添加:
* node-markdown/lib/markdown.js

allowedTags 添加:

```
embed //支持 flash 视频
table|thead|tbody|tr|td|th|caption //支持表格
```

if (req.xhr === true) return next();
if (req.body.user_action && req.body.user_action == 'upload_image') return next();

allowedAttributes 添加:

```
embed:'src|quality|width|height|align|allowScriptAccess|allowFullScreen|mode|type'
table: 'class'
```

* express/node_modules/connect/lib/middleware/csrf.js 添加:

```
if (req.body && req.body.user_action === 'upload_image') return next();
```

## 关于pull request

从现在开始,所有提交都要严格遵循[代码规范](https://github.com/windyrobin/iFrame/blob/master/style.md)

## Authors
Below is the output from git-summary.

```
project: nodeclub
commits: 29
files : 240
authors:
13 fengmk2 44.8%
9 muyuan 31.0%
3 dead-horse 10.3%
1 LeToNode 3.4%
1 roymax 3.4%
1 thebrecht 3.4%
1 张洋 3.4%
```
106 changes: 33 additions & 73 deletions app.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,106 +1,66 @@
var express = require('express'),
routes = require('./routes'),
config = require('./config').config;
/*!
* nodeclub - app.js
*/

var app = express.createServer();
/**
* Module dependencies.
*/

var path = require('path');
var express = require('express');
var routes = require('./routes');
var config = require('./config').config;

var static_dir = __dirname+'/public';
var app = express.createServer();

// configuration in all env
app.configure(function(){
app.configure(function() {
var viewsRoot = path.join(__dirname, 'views');
app.set('view engine', 'html');
app.set('views', __dirname + '/views');
app.register('.html',require('ejs'));
app.set('views', viewsRoot);
app.register('.html', require('ejs'));
app.use(express.bodyParser());
app.use(express.cookieParser());
app.use(express.session({
secret:config.session_secret,
secret: config.session_secret,
}));
// custom middleware
app.use(routes.auth_user);
app.use(require('./controllers/sign').auth_user);
app.use(express.csrf());

// plugins
var plugins = config.plugins || [];
for (var i = 0, l = plugins.length; i < l; i++) {
var p = plugins[i];
app.use(require('./plugins/' + p[0])(p[1]));
}
});

//set static,dynamic helpers
// set static, dynamic helpers
app.helpers({
config:config
config: config
});
app.dynamicHelpers({
csrf: function(req,res){
csrf: function(req,res) {
return req.session ? req.session._csrf : '';
},
});

var static_dir = path.join(__dirname, 'public');
app.configure('development', function(){
app.use(express.static(static_dir));
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});

app.configure('production', function(){
var one_year=1000*60*60*24*365;
app.use(express.static(static_dir,{maxAge:one_year}));
var maxAge = 3600000 * 24 * 30;
app.use(express.static(static_dir, { maxAge: maxAge }));
app.use(express.errorHandler());
app.set('view cache',true);
app.set('view cache', true);
});

// routes
app.get('/signup', routes.signup);
app.get('/signin', routes.signin);
app.get('/signout', routes.signout);
app.post('/signup', routes.signup);
app.post('/signin', routes.signin);

app.get('/user/:name', routes.user_index);
app.get('/setting', routes.user_setting);
app.get('/stars', routes.show_stars);
app.get('/users/top100', routes.users_top100);
app.get('/my/tags', routes.get_collect_tags);
app.get('/my/topics', routes.get_collect_topics);
app.get('/my/messages', routes.get_messages);
app.get('/my/follower', routes.get_followers);
app.get('/my/following', routes.get_followings);
app.get('/user/:name/topics', routes.list_user_topics);
app.get('/user/:name/replies', routes.list_user_replies);
app.post('/setting', routes.user_setting);
app.post('/user/follow', routes.follow_user);
app.post('/user/un_follow', routes.un_follow_user);
app.post('/user/set_star', routes.set_star);
app.post('/user/cancel_star', routes.cancel_star);
app.post('/messages/mark_read', routes.mark_message_read);
app.post('/messages/mark_all_read', routes.mark_all_messages_read);

app.get('/tags/edit', routes.edit_tags);
app.get('/tag/:name', routes.list_topic_by_tag);
app.get('/tag/:name/edit', routes.edit_tag);
app.get('/tag/:name/delete', routes.delete_tag);
app.post('/tag/add', routes.add_tag);
app.post('/tag/:name/edit', routes.edit_tag);
app.post('/tag/collect', routes.collect_tag);
app.post('/tag/de_collect', routes.de_collect_tag);

app.get('/topic/create', routes.create_topic);
app.get('/topic/:tid', routes.topic_index);
app.get('/topic/:tid/edit', routes.edit_topic);
app.get('/topic/:tid/delete', routes.delete_topic);
app.post('/topic/create', routes.create_topic);
app.post('/topic/:tid/edit', routes.edit_topic);
app.post('/topic/collect', routes.collect_topic);
app.post('/topic/de_collect', routes.de_collect_topic);

app.post('/:topic_id/reply',routes.reply_topic);
app.post('/:topic_id/reply2',routes.reply2_topic);
app.post('/reply/:reply_id/delete', routes.delete_reply);

app.get('/', routes.index);

app.post('/upload/image', routes.upload_image);
app.post('/search_pass', routes.search_pass);
app.get('/active_account', routes.active_account);
app.get('/search_pass', routes.search_pass);
app.get('/reset_pass',routes.reset_pass);
app.get('/site_tools', routes.site_tools);
app.get('/about', routes.about);
app.get('/faq', routes.faq);
routes(app);

app.listen(config.port);
console.log("NodeClub listening on port %d in %s mode", app.address().port, app.settings.env);
Expand Down
28 changes: 23 additions & 5 deletions config.default.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,25 @@
exports.config = {
name: 'Node Club',
description: 'Node Club 是用Node.js开发的社区软件',
host: 'http://127.0.0.1/',
version: '0.2.0',

// site settings
site_headers: [
'<meta name="author" content="慕远@TaoBao" />',
],
host: 'http://127.0.0.1', // host 结尾不要添加'/'
site_logo: '', // default is `name`
site_navs: [
// [ path, title, [target=''] ]
[ '/about', '关于' ],
],

db: 'mongodb://127.0.0.1/node_club',
session_secret: 'node_club',
auth_cookie_name: 'node_club',
port: 80,
version: '0.0.1',

// topics list count
// 话题列表显示的话题数量
list_topic_count: 20,

// mail SMTP
Expand All @@ -26,7 +37,14 @@ exports.config = {
//weibo app key
weibo_key: 10000000,

// admins
admins: {admin:true}
// admin 可删除话题,编辑标签,设某人为达人
admins: { admin: true },

// [ [ plugin_name, options ], ... ]
plugins: []
};

var host = exports.config.host;
if (host[host.length - 1] === '/') {
exports.config.host = host.substring(0, host.length - 1);
}
Loading

0 comments on commit eb921c7

Please sign in to comment.