Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/muyuan/nodeclub
Browse files Browse the repository at this point in the history
  • Loading branch information
kennyz committed Mar 19, 2012
2 parents e7ee680 + ebb79ba commit 08301eb
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 24 deletions.
32 changes: 17 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Node Club 是用 **Node.js** 和 **MongoDb** 开发的新型社区软件,界

## 安装部署

```
```bash
// install node npm mongodb
// run mongod
cd nodeclub
Expand All @@ -27,21 +27,21 @@ node app.js

allowedTags 添加:

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

allowedAttributes 添加:

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

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

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

Expand All @@ -50,19 +50,21 @@ if (req.body && req.body.user_action === 'upload_image') return next();
从现在开始,所有提交都要严格遵循[代码规范](https://github.com/windyrobin/iFrame/blob/master/style.md)

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

Below is the output from `git-summary`.

```
project: nodeclub
commits: 43
files : 242
commits: 53
files : 244
authors:
20 fengmk2 46.5%
9 muyuan 20.9%
7 dead-horse 16.3%
3 Kenny Zhao 7.0%
1 LeToNode 2.3%
1 roymax 2.3%
1 thebrecht 2.3%
1 张洋 2.3%
25 fengmk2 47.2%
9 muyuan 17.0%
8 dead-horse 15.1%
4 ericzhang 7.5%
3 Kenny Zhao 5.7%
1 LeToNode 1.9%
1 roymax 1.9%
1 thebrecht 1.9%
1 张洋 1.9%
```
15 changes: 13 additions & 2 deletions config.default.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
exports.config = {
name: 'Node Club',
description: 'Node Club 是用Node.js开发的社区软件',
version: '0.2.0',
version: '0.2.2',

// site settings
site_headers: [
Expand All @@ -27,6 +27,17 @@ exports.config = {
// 话题列表显示的话题数量
list_topic_count: 20,

// RSS
rss: {
title: 'CNode:Node.js专业中文社区',
link: 'http://cnodejs.org',
language: 'zh-cn',
description: 'CNode:Node.js专业中文社区',

//最多获取的RSS Item数量
max_rss_items: 50
},

// mail SMTP
mail_port: 25,
mail_user: 'club',
Expand All @@ -48,4 +59,4 @@ exports.config = {
var host = exports.config.host;
if (host[host.length - 1] === '/') {
exports.config.host = host.substring(0, host.length - 1);
}
}
43 changes: 43 additions & 0 deletions controllers/rss.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
var topic_ctrl = require('./topic');

var config = require('../config').config;
var data2xml = require('data2xml');
var Markdown = require('node-markdown').Markdown;

exports.index = function (req,res,next) {
if (!config.rss) {
return res.send('Please set `rss` in config.js');
}
var opt = { limit: config.rss.max_rss_items, sort: [['create_at','desc']] };

topic_ctrl.get_topics_by_query({}, opt, function (err, topics) {
if(err) return next(err);

var rss_obj = {
_attr: { version: '2.0' },
channel: {
title: config.rss.title,
link: config.rss.link,
language: config.rss.language,
description: config.rss.description,
item: []
},
};

topics.forEach(function (topic) {
rss_obj.channel.item.push({
title: topic.title,
link: config.rss.link + '/topic/' + topic._id,
guid: config.rss.link + '/topic/' + topic._id,
description: Markdown(topic.content, true),
author: topic.author.name,
pubDate: topic.create_at.toUTCString()
});
});

var rss_content = data2xml('rss', rss_obj);

res.contentType('application/xml');
res.send(rss_content);
});
};
6 changes: 4 additions & 2 deletions controllers/sign.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ exports.showLogin = function(req, res) {
*/
var notJump = [
'/active_account', //active page
'/reset_pass' //reset password page, avoid to reset twice
'/reset_pass', //reset password page, avoid to reset twice
'/signup', //regist page
'/search_pass' //serch pass page
];
/**
* Handle user login.
Expand Down Expand Up @@ -337,4 +339,4 @@ function randomString(size) {
size--;
}
return new_pass;
}
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nodeclub",
"version": "0.2.1",
"version": "0.2.2",
"main": "./app.js",
"private": true,
"dependencies": {
Expand All @@ -11,6 +11,7 @@
"node-markdown": "0.1.0",
"validator": "0.3.7",
"ndir": "0.1.2",
"nodemailer": "0.3.5"
"nodemailer": "0.3.5",
"data2xml": "0.4.0"
}
}
Binary file added public/images/rss_icon&40.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var message = require('./controllers/message');
var tag = require('./controllers/tag');
var topic = require('./controllers/topic');
var reply = require('./controllers/reply');
var rss = require('./controllers/rss');
var upload = require('./controllers/upload');
var static = require('./controllers/static');
var tools =require('./controllers/tools');
Expand Down Expand Up @@ -93,4 +94,7 @@ exports = module.exports = function(app) {
// static
app.get('/about', static.about);
app.get('/faq', static.faq);
};

//rss
app.get('/rss', rss.index);
};
3 changes: 3 additions & 0 deletions views/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
%>
<%- headers[i] %>
<% } %>
<link title="RSS" type="application/rss+xml" rel="alternate" href="/rss" />
<!-- style -->
<link rel="stylesheet" type="text/css" href="/libs/bootstrap/css/bootstrap.css" media="screen" />
<link rel="stylesheet" type="text/css" href="/stylesheets/style.css" media="screen" />
Expand Down Expand Up @@ -73,6 +74,8 @@
<strong><a class='dark' href='/faq'>FAQ</a></strong>
&nbsp;&nbsp;|&nbsp;&nbsp;
<strong><a class='dark' href='https://github.com/muyuan/nodeclub/' target="_blank">Github</a></strong>
&nbsp;&nbsp;|&nbsp;&nbsp;
<strong><a class='dark' href='/rss' target="_blank">RSS</a></strong>
</div>
<div class='sep10'></div>
<div class='col_fade'>
Expand Down
14 changes: 12 additions & 2 deletions views/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@
</div>
<div class='inner'>
<ul class='unstyled'>
<li><a href='http://nodejs.org/' target='_blank'>Nodejs官方网站</a></li>
<li><a href='http://nodejs.org/' target='_blank'>Node 官方网站</a></li>
<li><a href='http://party.cnodejs.net/' target='_blank'>Node Party</a></li>
<li><a href='http://nodebeginner.org/index-zh-cn.html' target='_blank'>Node 入门</a></li>
<!-- <li><a href='http://cnodejs.org/cman/' target='_blank'>Node 中文文档</a></li> -->
<li><a href='http://docs.cnodejs.net/cman/' target='_blank'>Node 中文文档</a></li>
</ul>
</div>
</div>
Expand All @@ -134,4 +134,14 @@
<a href='http://ruby-china.org/?utm_source=nodejs&utm_medium=link&utm_campaign=upyun&md=nodejs' target='_blank'><img src='<%- config.site_static_host %>/images/ruby_china_logo.png' /></a>
</div>
</div>

<div class='sep10'></div>
<div class='panel'>
<div class='header'>
<span class='col_fade'>RSS订阅</span>
</div>
<div class='inner'>
<a href="/rss"><img alt="RSS订阅" src="/images/rss_icon&40.png" /></a>
</div>
</div>
</div>

0 comments on commit 08301eb

Please sign in to comment.