├── laucher.js ├── DB ├── upDB │ ├── comment.bson │ ├── blog.bson │ ├── blogs.bson │ ├── blog.metadata.json │ ├── comment.metadata.json │ └── blogs.metadata.json └── test │ ├── lang.bson │ └── lang.metadata.json ├── assets ├── module │ └── blog │ │ ├── list │ │ ├── list.css │ │ ├── list_d41d8cd98f.css │ │ ├── list_d41d8cd98f_d41d8cd98f.css │ │ └── list.js │ │ ├── preview │ │ ├── preview.css │ │ ├── preview_d41d8cd98f.css │ │ └── preview_d41d8cd98f_d41d8cd98f.css │ │ ├── mis │ │ ├── mis_1c9ab0ff81.css │ │ ├── mis_1c9ab0ff81_1c9ab0ff81.css │ │ ├── mis.css │ │ └── mis.js │ │ ├── info │ │ ├── info_2496d6ac5b.css │ │ ├── info_2496d6ac5b_2496d6ac5b.css │ │ └── info.css │ │ └── edit │ │ ├── edit_17a0d82df7.css │ │ ├── edit_17a0d82df7_17a0d82df7.css │ │ └── edit.css ├── widget │ └── hint │ │ ├── hint_d41d8cd98f.css │ │ ├── hint_cbf05c6d8c.css │ │ ├── hint_cbf05c6d8c_cbf05c6d8c.css │ │ └── hint.css ├── public │ ├── css │ │ ├── common_e41b9e80ea_d41d8cd98f.css │ │ ├── reset_ca08e7b227.css │ │ ├── reset_ca08e7b227_ca08e7b227.css │ │ ├── markdown_ddc924cd03.css │ │ ├── markdown_ddc924cd03_ddc924cd03.css │ │ └── markdown.css │ └── imgs │ │ ├── cloud.png │ │ └── head.png ├── baidu.png ├── cpu.png ├── login.png ├── sso.png ├── bigpipe.png └── jmeter.png ├── web ├── views │ ├── blog │ │ ├── info │ │ │ └── a │ │ ├── list.ejs │ │ ├── info.ejs │ │ └── info.htx │ ├── 404.ejs │ ├── issue │ │ └── index.ejs │ ├── user │ │ ├── info.ejs │ │ ├── self.ejs │ │ └── edit.ejs │ ├── case │ │ └── list.ejs │ └── common │ │ ├── slide.ejs │ │ ├── header.ejs │ │ └── footer.ejs ├── assets │ ├── module │ │ ├── blog │ │ │ ├── list │ │ │ │ ├── list.css │ │ │ │ └── list.js │ │ │ └── info │ │ │ │ └── info.css │ │ ├── case │ │ │ └── list │ │ │ │ ├── list.css │ │ │ │ └── list.js │ │ ├── issue │ │ │ ├── error │ │ │ │ ├── error.css │ │ │ │ └── error.js │ │ │ ├── index │ │ │ │ ├── index.css │ │ │ │ └── index.js │ │ │ └── index (copy) │ │ │ │ ├── index.css │ │ │ │ └── index.js │ │ └── user │ │ │ ├── edit │ │ │ ├── edit.css │ │ │ └── edit.js │ │ │ ├── info │ │ │ └── info.css │ │ │ └── self │ │ │ └── self.css │ ├── public │ │ ├── imgs │ │ │ ├── bg1.png │ │ │ ├── head.png │ │ │ ├── cloud.png │ │ │ └── qrcode.png │ │ └── js │ │ │ └── zh.js │ ├── widget │ │ └── hint │ │ │ ├── hint.css │ │ │ └── hint.js │ └── core │ │ └── js │ │ ├── event.js │ │ └── base.js ├── config │ ├── redis.js │ ├── server.js │ ├── guard.js │ ├── site.js │ └── logger.js ├── lib │ ├── md5.js │ ├── logger.js │ ├── mailer.js │ └── redis.js ├── server │ ├── case.js │ └── issue.js ├── test │ ├── test-main.js │ └── case │ │ └── core │ │ └── js │ │ └── base_case.js ├── app.js ├── karma.conf.js ├── gulpfile.js └── package.json ├── webES6 ├── dump │ ├── upDB │ │ ├── comment.bson │ │ ├── blog.bson │ │ ├── blogs.bson │ │ ├── blog.metadata.json │ │ ├── comment.metadata.json │ │ └── blogs.metadata.json │ └── test │ │ ├── lang.bson │ │ └── lang.metadata.json ├── assets │ ├── module │ │ ├── list │ │ │ ├── list.css │ │ │ └── list.css?d41d8cd98f │ │ └── blog │ │ │ ├── list │ │ │ ├── list.css │ │ │ └── list.css?d41d8cd98f │ │ │ ├── preview │ │ │ ├── preview.css │ │ │ └── preview.css?d41d8cd98f │ │ │ ├── mis │ │ │ ├── mis.css │ │ │ └── mis.css?125d6259c9 │ │ │ ├── info │ │ │ ├── info.css │ │ │ └── info.css?0a422813ca │ │ │ └── edit │ │ │ ├── edit.css │ │ │ └── edit.css?e24ad0a248 │ ├── git.png │ ├── log.png │ ├── map.jpg │ ├── frame.png │ ├── http.png │ ├── bigpipe.png │ ├── public │ │ ├── imgs │ │ │ ├── cloud.png │ │ │ └── head.png │ │ └── css │ │ │ ├── markdown.css │ │ │ ├── markdown.css?c568c5f6cb │ │ │ └── markdown.css?600854b646 │ └── widget │ │ └── hint │ │ ├── hint.css │ │ └── hint.css?c317a49aab ├── resource │ ├── module │ │ ├── blog │ │ │ ├── list │ │ │ │ ├── list.scss │ │ │ │ ├── .DS_Store │ │ │ │ └── list.js │ │ │ ├── preview │ │ │ │ ├── preview.scss │ │ │ │ └── preview.js │ │ │ ├── .DS_Store │ │ │ ├── mis │ │ │ │ ├── .DS_Store │ │ │ │ ├── mis.scss │ │ │ │ └── mis.js │ │ │ ├── edit │ │ │ │ ├── .DS_Store │ │ │ │ ├── edit.scss │ │ │ │ └── edit.js │ │ │ └── info │ │ │ │ └── info.scss │ │ └── .DS_Store │ ├── .DS_Store │ ├── core │ │ └── .DS_Store │ ├── public │ │ ├── imgs │ │ │ ├── head.png │ │ │ └── cloud.png │ │ ├── js │ │ │ ├── bigpipe.js │ │ │ └── btype.js │ │ └── css │ │ │ └── markdown.scss │ └── widget │ │ └── hint │ │ ├── hint.js │ │ └── hint.scss ├── .babelrc ├── .DS_Store ├── gulp │ ├── .DS_Store │ ├── entry.js │ ├── webpack.js │ ├── imageimg.js │ ├── config.js │ └── webpack.config.js ├── entry.js ├── views │ ├── blog │ │ ├── .DS_Store │ │ ├── mis.ejs │ │ ├── preview.ejs │ │ ├── edit.ejs │ │ ├── info │ │ │ ├── 5720b477303846b20a81e1ed.ejs │ │ │ ├── 5720ac218a3e258a0a287d78.ejs │ │ │ ├── 5720b1b499f705a10a481225.ejs │ │ │ ├── 571e1eb7a61a83b714a42c6a.ejs │ │ │ ├── 5720b757a6e555c30a890179.ejs │ │ │ └── 5720b97d772850cb0a90d786.ejs │ │ ├── list.ejs │ │ └── info.htx │ ├── index.ejs │ └── common │ │ ├── slide.ejs │ │ ├── header.ejs │ │ └── footer.ejs ├── .sass-cache │ ├── 0086bd769221997de606588d417ee0a1c2201a25 │ │ └── info.scssc │ ├── 00e0d4bb043c7b35726486f22fab89b955640d58 │ │ ├── reset.scssc │ │ ├── common.scssc │ │ └── markdown.scssc │ ├── fe2ba5f39279b34b80c9d0d522e51a7f4cc6903e │ │ └── edit.scssc │ └── 596b18f4f48381b6c41d77ed281565b986a6e600 │ │ └── list.scssc ├── controller │ ├── issue.js │ ├── comment.js │ ├── route.js │ └── blog.js ├── config │ └── config.js ├── lib │ ├── utils.js │ ├── code.js │ ├── request.js │ └── loger.js ├── app.js ├── server │ └── comment.js ├── package.json ├── gulp.config.js └── gulpfile.js ├── static ├── assets │ ├── module │ │ ├── list │ │ │ └── list.css │ │ └── blog │ │ │ ├── list │ │ │ └── list.css │ │ │ ├── preview │ │ │ └── preview.css │ │ │ ├── mis │ │ │ └── mis.css │ │ │ ├── info │ │ │ └── info.css │ │ │ └── edit │ │ │ └── edit.css │ ├── public │ │ ├── imgs │ │ │ ├── cloud.png │ │ │ └── head.png │ │ └── css │ │ │ └── markdown.css │ └── widget │ │ └── hint │ │ └── hint.css ├── module │ ├── issue │ │ ├── index (copy) │ │ │ └── index.js │ │ ├── error │ │ │ └── error.js │ │ └── index │ │ │ └── index.js │ ├── case │ │ └── list │ │ │ └── list.js │ ├── user │ │ ├── edit │ │ │ └── edit.js │ │ └── info │ │ │ └── info.js │ └── blog │ │ ├── list │ │ └── list.js │ │ └── info │ │ └── info.js ├── public │ └── js │ │ ├── zh.js │ │ └── common.js ├── core │ └── js │ │ └── base.js └── widget │ └── hint │ └── hint.js ├── serverES6 ├── .babelrc ├── .DS_Store ├── entry.js ├── config │ └── config.js ├── app.js ├── lib │ ├── utils.js │ └── loger.js ├── controller │ ├── comment.js │ ├── blog.js │ └── route.js ├── package.json ├── server │ ├── comment.js │ └── blog.js └── model │ └── db.js ├── docs ├── pic │ └── stack.jpg ├── qa.txt └── sql │ └── server.txt ├── .gitignore ├── check ├── config │ ├── mongo.js │ ├── redis.js │ └── logger.js ├── assets │ ├── core │ │ ├── imgs │ │ │ └── cloud.jpg │ │ └── js │ │ │ ├── npm.js │ │ │ ├── event.js │ │ │ ├── react-dom.js │ │ │ ├── css.min.js │ │ │ └── base.js │ ├── public │ │ ├── imgs │ │ │ ├── bg1.png │ │ │ ├── head.png │ │ │ ├── cloud.png │ │ │ └── qrcode.png │ │ └── js │ │ │ └── zh.js │ ├── module │ │ └── index │ │ │ └── imgs │ │ │ └── cloud.jpg │ └── widget │ │ └── hint │ │ ├── hint.css │ │ └── hint.js ├── lib │ ├── logger.js │ ├── redis.js │ └── toys.js ├── model │ ├── db.js │ └── action.js ├── views │ ├── index.ejs │ └── common │ │ ├── header.ejs │ │ └── footer.ejs ├── webpack.config.js ├── app.js ├── package.json ├── controller │ └── index.js └── server │ └── action.js ├── server ├── config │ ├── redis.js │ ├── mysql.js │ └── logger.js ├── lib │ ├── md5.js │ ├── logger.js │ ├── mailer.js │ ├── redis.js │ └── toys.js ├── app.js ├── model │ ├── user.js │ ├── blog.js │ └── comment.js ├── package.json ├── controller │ └── index.js └── server │ └── comment.js ├── entry.json ├── server.json └── README.md /laucher.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /DB/upDB/comment.bson: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/module/blog/list/list.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web/views/blog/info/a: -------------------------------------------------------------------------------- 1 | ia 2 | 3 | -------------------------------------------------------------------------------- /webES6/dump/upDB/comment.bson: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/module/blog/preview/preview.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/widget/hint/hint_d41d8cd98f.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /static/assets/module/list/list.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web/assets/module/blog/list/list.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web/assets/module/case/list/list.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /webES6/assets/module/list/list.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/module/blog/list/list_d41d8cd98f.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /static/assets/module/blog/list/list.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /static/module/issue/index (copy)/index.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web/assets/module/issue/error/error.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web/assets/module/issue/index/index.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /webES6/assets/module/blog/list/list.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /webES6/resource/module/blog/list/list.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /static/assets/module/blog/preview/preview.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web/assets/module/issue/index (copy)/index.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web/assets/module/issue/index (copy)/index.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /webES6/assets/module/blog/preview/preview.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /webES6/assets/module/list/list.css?d41d8cd98f: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /webES6/resource/module/blog/preview/preview.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/module/blog/preview/preview_d41d8cd98f.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/public/css/common_e41b9e80ea_d41d8cd98f.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /webES6/assets/module/blog/list/list.css?d41d8cd98f: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/module/blog/list/list_d41d8cd98f_d41d8cd98f.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /webES6/assets/module/blog/preview/preview.css?d41d8cd98f: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/module/blog/preview/preview_d41d8cd98f_d41d8cd98f.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /serverES6/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | presets: ['es2015'], 3 | plugins: [] 4 | } 5 | -------------------------------------------------------------------------------- /webES6/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | presets: ['es2015'], 3 | plugins: [] 4 | } 5 | -------------------------------------------------------------------------------- /assets/baidu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/assets/baidu.png -------------------------------------------------------------------------------- /assets/cpu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/assets/cpu.png -------------------------------------------------------------------------------- /assets/login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/assets/login.png -------------------------------------------------------------------------------- /assets/sso.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/assets/sso.png -------------------------------------------------------------------------------- /webES6/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/.DS_Store -------------------------------------------------------------------------------- /DB/test/lang.bson: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/DB/test/lang.bson -------------------------------------------------------------------------------- /DB/upDB/blog.bson: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/DB/upDB/blog.bson -------------------------------------------------------------------------------- /DB/upDB/blogs.bson: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/DB/upDB/blogs.bson -------------------------------------------------------------------------------- /assets/bigpipe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/assets/bigpipe.png -------------------------------------------------------------------------------- /assets/jmeter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/assets/jmeter.png -------------------------------------------------------------------------------- /docs/pic/stack.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/docs/pic/stack.jpg -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | log/ 3 | node_modules/ 4 | webES6/views/blog/info/ 5 | bak/ 6 | .DS_Store 7 | -------------------------------------------------------------------------------- /check/config/mongo.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | host: '127.0.0.1', 3 | db: 'upcheck' 4 | } 5 | -------------------------------------------------------------------------------- /serverES6/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/serverES6/.DS_Store -------------------------------------------------------------------------------- /web/config/redis.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = { 3 | host: '127.0.0.1', 4 | port: 6379 5 | } 6 | -------------------------------------------------------------------------------- /webES6/assets/git.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/assets/git.png -------------------------------------------------------------------------------- /webES6/assets/log.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/assets/log.png -------------------------------------------------------------------------------- /webES6/assets/map.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/assets/map.jpg -------------------------------------------------------------------------------- /webES6/gulp/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/gulp/.DS_Store -------------------------------------------------------------------------------- /check/config/redis.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = { 3 | host: '127.0.0.1', 4 | port: 6379 5 | } 6 | -------------------------------------------------------------------------------- /server/config/redis.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = { 3 | host: '127.0.0.1', 4 | port: 6379 5 | } 6 | -------------------------------------------------------------------------------- /web/views/404.ejs: -------------------------------------------------------------------------------- 1 | <% include common/header.ejs %> 2 | 404 3 | <% include common/footer.ejs %> 4 | -------------------------------------------------------------------------------- /webES6/assets/frame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/assets/frame.png -------------------------------------------------------------------------------- /webES6/assets/http.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/assets/http.png -------------------------------------------------------------------------------- /web/config/server.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = { 3 | hostname: 'server.upopen.cn', 4 | port: 80 5 | } 6 | -------------------------------------------------------------------------------- /webES6/assets/bigpipe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/assets/bigpipe.png -------------------------------------------------------------------------------- /webES6/dump/test/lang.bson: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/dump/test/lang.bson -------------------------------------------------------------------------------- /webES6/dump/upDB/blog.bson: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/dump/upDB/blog.bson -------------------------------------------------------------------------------- /webES6/entry.js: -------------------------------------------------------------------------------- 1 | require('babel-core/register'); 2 | require('babel-polyfill'); 3 | require('./app'); -------------------------------------------------------------------------------- /webES6/resource/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/resource/.DS_Store -------------------------------------------------------------------------------- /DB/test/lang.metadata.json: -------------------------------------------------------------------------------- 1 | {"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"test.lang"}]} -------------------------------------------------------------------------------- /DB/upDB/blog.metadata.json: -------------------------------------------------------------------------------- 1 | {"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"upDB.blog"}]} -------------------------------------------------------------------------------- /assets/public/imgs/cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/assets/public/imgs/cloud.png -------------------------------------------------------------------------------- /assets/public/imgs/head.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/assets/public/imgs/head.png -------------------------------------------------------------------------------- /serverES6/entry.js: -------------------------------------------------------------------------------- 1 | require( 'babel-core/register' ); 2 | require( 'babel-polyfill' ); 3 | require( './app' ) -------------------------------------------------------------------------------- /webES6/dump/upDB/blogs.bson: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/dump/upDB/blogs.bson -------------------------------------------------------------------------------- /webES6/views/blog/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/views/blog/.DS_Store -------------------------------------------------------------------------------- /web/assets/public/imgs/bg1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/web/assets/public/imgs/bg1.png -------------------------------------------------------------------------------- /web/assets/public/imgs/head.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/web/assets/public/imgs/head.png -------------------------------------------------------------------------------- /webES6/resource/core/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/resource/core/.DS_Store -------------------------------------------------------------------------------- /check/assets/core/imgs/cloud.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/check/assets/core/imgs/cloud.jpg -------------------------------------------------------------------------------- /check/assets/public/imgs/bg1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/check/assets/public/imgs/bg1.png -------------------------------------------------------------------------------- /check/assets/public/imgs/head.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/check/assets/public/imgs/head.png -------------------------------------------------------------------------------- /static/public/js/zh.js: -------------------------------------------------------------------------------- 1 | define(function(){return Msg={error:{10001:"User isn't exist!",10100:"Need to sign in!"}},Msg}); -------------------------------------------------------------------------------- /web/assets/public/imgs/cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/web/assets/public/imgs/cloud.png -------------------------------------------------------------------------------- /web/assets/public/imgs/qrcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/web/assets/public/imgs/qrcode.png -------------------------------------------------------------------------------- /webES6/dump/test/lang.metadata.json: -------------------------------------------------------------------------------- 1 | {"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"test.lang"}]} -------------------------------------------------------------------------------- /webES6/dump/upDB/blog.metadata.json: -------------------------------------------------------------------------------- 1 | {"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"upDB.blog"}]} -------------------------------------------------------------------------------- /webES6/resource/module/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/resource/module/.DS_Store -------------------------------------------------------------------------------- /check/assets/public/imgs/cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/check/assets/public/imgs/cloud.png -------------------------------------------------------------------------------- /check/assets/public/imgs/qrcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/check/assets/public/imgs/qrcode.png -------------------------------------------------------------------------------- /entry.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | 'name': 'upopen web', 4 | 'script': 'entry.js', 5 | 'cwd': './webES6', 6 | '' 7 | } 8 | ] -------------------------------------------------------------------------------- /static/assets/public/imgs/cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/static/assets/public/imgs/cloud.png -------------------------------------------------------------------------------- /static/assets/public/imgs/head.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/static/assets/public/imgs/head.png -------------------------------------------------------------------------------- /webES6/assets/public/imgs/cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/assets/public/imgs/cloud.png -------------------------------------------------------------------------------- /webES6/assets/public/imgs/head.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/assets/public/imgs/head.png -------------------------------------------------------------------------------- /webES6/resource/public/imgs/head.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/resource/public/imgs/head.png -------------------------------------------------------------------------------- /static/module/case/list/list.js: -------------------------------------------------------------------------------- 1 | require.config({paths:{common:"/assets/public/js/common"}}),require(["common"],function(){}); -------------------------------------------------------------------------------- /static/module/issue/error/error.js: -------------------------------------------------------------------------------- 1 | require.config({paths:{common:"/assets/public/js/common"}}),require(["common"],function(){}); -------------------------------------------------------------------------------- /static/module/issue/index/index.js: -------------------------------------------------------------------------------- 1 | require.config({paths:{common:"/assets/public/js/common"}}),require(["common"],function(){}); -------------------------------------------------------------------------------- /webES6/resource/module/blog/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/resource/module/blog/.DS_Store -------------------------------------------------------------------------------- /webES6/resource/public/imgs/cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/resource/public/imgs/cloud.png -------------------------------------------------------------------------------- /check/assets/module/index/imgs/cloud.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/check/assets/module/index/imgs/cloud.jpg -------------------------------------------------------------------------------- /webES6/resource/module/blog/mis/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/resource/module/blog/mis/.DS_Store -------------------------------------------------------------------------------- /webES6/resource/module/blog/edit/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/resource/module/blog/edit/.DS_Store -------------------------------------------------------------------------------- /webES6/resource/module/blog/list/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/resource/module/blog/list/.DS_Store -------------------------------------------------------------------------------- /webES6/gulp/entry.js: -------------------------------------------------------------------------------- 1 | const gulp = require( 'gulp' ); 2 | 3 | gulp.task( 'default', ['webpack'], function(){ 4 | console.log(`gulp default`) 5 | }) -------------------------------------------------------------------------------- /webES6/views/index.ejs: -------------------------------------------------------------------------------- 1 | <% include ./common/header.ejs %> 2 |
3 | 4 |
5 | <% include ./common/slide.ejs %> 6 | <% include ./common/footer.ejs %> -------------------------------------------------------------------------------- /DB/upDB/comment.metadata.json: -------------------------------------------------------------------------------- 1 | {"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"upDB.comment"},{"v":1,"key":{"id":1},"name":"id_1","ns":"upDB.comment","background":true}]} -------------------------------------------------------------------------------- /web/views/blog/list.ejs: -------------------------------------------------------------------------------- 1 | <% include ../common/header.ejs %> 2 |
3 | 4 |
5 | <% include ../common/slide.ejs %> 6 | <% include ../common/footer.ejs %> 7 | -------------------------------------------------------------------------------- /webES6/.sass-cache/0086bd769221997de606588d417ee0a1c2201a25/info.scssc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/.sass-cache/0086bd769221997de606588d417ee0a1c2201a25/info.scssc -------------------------------------------------------------------------------- /webES6/.sass-cache/00e0d4bb043c7b35726486f22fab89b955640d58/reset.scssc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/.sass-cache/00e0d4bb043c7b35726486f22fab89b955640d58/reset.scssc -------------------------------------------------------------------------------- /webES6/.sass-cache/fe2ba5f39279b34b80c9d0d522e51a7f4cc6903e/edit.scssc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/.sass-cache/fe2ba5f39279b34b80c9d0d522e51a7f4cc6903e/edit.scssc -------------------------------------------------------------------------------- /web/views/issue/index.ejs: -------------------------------------------------------------------------------- 1 | <% include ../common/header.ejs %> 2 |
3 | 4 |
5 | <% include ../common/slide.ejs %> 6 | <% include ../common/footer.ejs %> 7 | -------------------------------------------------------------------------------- /webES6/.sass-cache/00e0d4bb043c7b35726486f22fab89b955640d58/common.scssc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/.sass-cache/00e0d4bb043c7b35726486f22fab89b955640d58/common.scssc -------------------------------------------------------------------------------- /webES6/dump/upDB/comment.metadata.json: -------------------------------------------------------------------------------- 1 | {"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"upDB.comment"},{"v":1,"key":{"id":1},"name":"id_1","ns":"upDB.comment","background":true}]} -------------------------------------------------------------------------------- /web/lib/md5.js: -------------------------------------------------------------------------------- 1 | 2 | var crypto = require( 'crypto' ); 3 | 4 | module.exports = function(data) { 5 | 6 | return crypto.createHash('md5').update(data).digest('hex').toLowerCase(); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /webES6/.sass-cache/00e0d4bb043c7b35726486f22fab89b955640d58/markdown.scssc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolulu/upopen/HEAD/webES6/.sass-cache/00e0d4bb043c7b35726486f22fab89b955640d58/markdown.scssc -------------------------------------------------------------------------------- /server/config/mysql.js: -------------------------------------------------------------------------------- 1 | 2 | var config = { 3 | host: '127.0.0.1', 4 | port: 3306, 5 | user: 'root', 6 | password: 'xiaolulu', 7 | database: 'updb' 8 | } 9 | 10 | module.exports = config 11 | -------------------------------------------------------------------------------- /server/lib/md5.js: -------------------------------------------------------------------------------- 1 | 2 | var crypto = require( 'crypto' ); 3 | 4 | module.exports = function(data) { 5 | 6 | return crypto.createHash('md5').update(data).digest('hex').toLowerCase(); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /server/lib/logger.js: -------------------------------------------------------------------------------- 1 | var log4js = require( 'log4js' ), 2 | config = require( '../config/logger' ); 3 | 4 | 5 | 6 | log4js.configure( config ); 7 | 8 | module.exports = log4js.getLogger('logInfo'); 9 | -------------------------------------------------------------------------------- /web/lib/logger.js: -------------------------------------------------------------------------------- 1 | var log4js = require( 'log4js' ), 2 | config = require( '../config/logger' ); 3 | 4 | 5 | 6 | log4js.configure( config ); 7 | 8 | module.exports = log4js.getLogger('logInfo'); 9 | -------------------------------------------------------------------------------- /check/assets/public/js/zh.js: -------------------------------------------------------------------------------- 1 | define(function(){ 2 | 3 | Msg = { 4 | error: { 5 | 10001: 'User isn\'t exist!', 6 | 10100: 'Need to sign in!' 7 | } 8 | }; 9 | 10 | return Msg; 11 | 12 | }) 13 | 14 | 15 | -------------------------------------------------------------------------------- /web/assets/public/js/zh.js: -------------------------------------------------------------------------------- 1 | define(function(){ 2 | 3 | Msg = { 4 | error: { 5 | 10001: 'User isn\'t exist!', 6 | 10100: 'Need to sign in!' 7 | } 8 | }; 9 | 10 | return Msg; 11 | 12 | }) 13 | 14 | 15 | -------------------------------------------------------------------------------- /web/assets/module/case/list/list.js: -------------------------------------------------------------------------------- 1 | 2 | require.config({ 3 | //baseUrl: basePath, 4 | paths: { 5 | common: '/assets/public/js/common' 6 | } 7 | }) 8 | 9 | require([ 'common' ], function(){ 10 | 11 | 12 | }) 13 | 14 | 15 | -------------------------------------------------------------------------------- /DB/upDB/blogs.metadata.json: -------------------------------------------------------------------------------- 1 | {"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"upDB.blogs"},{"v":1,"key":{"id":1},"name":"id_1","ns":"upDB.blogs","background":true},{"v":1,"key":{"oid":1},"name":"oid_1","ns":"upDB.blogs","background":true}]} -------------------------------------------------------------------------------- /web/assets/module/issue/error/error.js: -------------------------------------------------------------------------------- 1 | 2 | require.config({ 3 | //baseUrl: basePath, 4 | paths: { 5 | common: '/assets/public/js/common' 6 | } 7 | }) 8 | 9 | require([ 'common' ], function(){ 10 | 11 | 12 | 13 | }) 14 | 15 | 16 | -------------------------------------------------------------------------------- /webES6/dump/upDB/blogs.metadata.json: -------------------------------------------------------------------------------- 1 | {"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"upDB.blogs"},{"v":1,"key":{"id":1},"name":"id_1","ns":"upDB.blogs","background":true},{"v":1,"key":{"oid":1},"name":"oid_1","ns":"upDB.blogs","background":true}]} -------------------------------------------------------------------------------- /webES6/gulp/webpack.js: -------------------------------------------------------------------------------- 1 | const gulp = require( 'gulp' ); 2 | const webpack = require( 'webpack' ); 3 | const config = require( './config' ).webpack; 4 | 5 | console.log( config ); 6 | gulp.task( 'webpack', function(){ 7 | webpack( config ) 8 | }) 9 | 10 | -------------------------------------------------------------------------------- /web/config/guard.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = { 3 | '/user/self': 1, 4 | '/blog/create': 1, 5 | '/blog/fetchEdit': 1, 6 | '/blog/remove': 1, 7 | '/blog/update': 1, 8 | '/comment/create': 2, 9 | '/comment/fetchEdit': 1, 10 | '/comment/remove': 1 11 | } 12 | -------------------------------------------------------------------------------- /webES6/gulp/imageimg.js: -------------------------------------------------------------------------------- 1 | const gulp = require( 'gulp' ); 2 | const config = require( './config' ).images; 3 | const imagemin = require( 'gulp-imagemin' ); 4 | 5 | gulp.task( 'imagemin', function(){ 6 | return gulp.src( config.src ) 7 | .pipe( gulp.dest( config.dest )); 8 | }); -------------------------------------------------------------------------------- /assets/module/blog/list/list.js: -------------------------------------------------------------------------------- 1 | !function(r){function t(o){if(e[o])return e[o].exports;var n=e[o]={exports:{},id:o,loaded:!1};return r[o].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var e={};return t.m=r,t.c=e,t.p="",t(0)}([function(r,t){}]); 2 | //# sourceMappingURL=list.js.map -------------------------------------------------------------------------------- /webES6/controller/issue.js: -------------------------------------------------------------------------------- 1 | import {Kind} from '../lib/code'; 2 | export default [ 3 | { 4 | path: '/job', 5 | method: 'get', 6 | render: 'static/articles/job', 7 | premission: 0, 8 | config: { 9 | title: '工作简历', 10 | assets: '/module/blog/info/info', 11 | Kind 12 | } 13 | } 14 | ] -------------------------------------------------------------------------------- /webES6/config/config.js: -------------------------------------------------------------------------------- 1 | import path from 'path'; 2 | 3 | const server = { 4 | host: 'http://127.0.0.1', 5 | port: 3003 6 | } 7 | 8 | const site = { 9 | siteTitle: '优品开源' 10 | } 11 | 12 | 13 | const logDir = path.normalize(`${__dirname}/../../log`); 14 | 15 | export { 16 | server, 17 | site, 18 | logDir 19 | } -------------------------------------------------------------------------------- /serverES6/config/config.js: -------------------------------------------------------------------------------- 1 | import path from 'path'; 2 | 3 | const self = { 4 | port: 3003 5 | } 6 | 7 | const mongodb = { 8 | host: '127.0.0.1', 9 | port: 27017, 10 | name: 'upDB' 11 | } 12 | 13 | const logDir = path.normalize(`${__dirname}/../../log`); 14 | 15 | export { 16 | self, 17 | mongodb, 18 | logDir 19 | } -------------------------------------------------------------------------------- /assets/module/blog/mis/mis_1c9ab0ff81.css: -------------------------------------------------------------------------------- 1 | .blogItem{margin:20px 0;padding:10px 0;position:relative}.blogItem .info{height:40px}.blogItem .kind{display:inline-block;margin:0 0 0 20px;background:#F87428;color:#fff;padding:0 2px}.blogItem .tool span{margin-right:20px}.blogItem .handle{position:absolute;right:10px;top:10px}.blogItem .handle a{margin-left:20px} -------------------------------------------------------------------------------- /web/server/case.js: -------------------------------------------------------------------------------- 1 | 2 | var qs = require( 'querystring' ), 3 | config = require( '../config/site' ), 4 | redis = require( '../lib/redis' ), 5 | toys = require( '../lib/toys' ); 6 | 7 | function list( req, res ){ 8 | 9 | res.render( 'case/list.ejs', config( req ) ); 10 | 11 | } 12 | 13 | module.exports = { 14 | list: list 15 | } 16 | -------------------------------------------------------------------------------- /assets/module/blog/mis/mis_1c9ab0ff81_1c9ab0ff81.css: -------------------------------------------------------------------------------- 1 | .blogItem{margin:20px 0;padding:10px 0;position:relative}.blogItem .info{height:40px}.blogItem .kind{display:inline-block;margin:0 0 0 20px;background:#F87428;color:#fff;padding:0 2px}.blogItem .tool span{margin-right:20px}.blogItem .handle{position:absolute;right:10px;top:10px}.blogItem .handle a{margin-left:20px} -------------------------------------------------------------------------------- /check/lib/logger.js: -------------------------------------------------------------------------------- 1 | var log4js = require( 'log4js' ), 2 | config = require( '../config/logger' ); 3 | 4 | log4js.configure( config ); 5 | 6 | module.exports = { 7 | logFile: log4js.getLogger( 'file' ), 8 | logInfo: log4js.getLogger( 'info' ), 9 | logWarn: log4js.getLogger( 'warn' ), 10 | logCon: log4js.getLogger( 'console' ) 11 | } 12 | -------------------------------------------------------------------------------- /docs/qa.txt: -------------------------------------------------------------------------------- 1 | web 2 | 3 | 1、各处验证 4 | 5 | 2、首页数据获取 6 | 7 | 3、文章分类 8 | 9 | 4、静态化 10 | 11 | 5、请求返回错误信息处理 12 | 13 | 6、用户详情页设计 14 | 15 | 7、写blog预览功能 16 | 17 | 8、 18 | 19 | 1、get 请求在未登录的情况下如何返回 20 | 21 | ============================================ 22 | 23 | #注册同用户判断 24 | 25 | #分页 26 | 27 | #设置查询的取值字段 28 | 29 | 3、check安全 30 | 31 | 4、web异常安全返回 32 | -------------------------------------------------------------------------------- /assets/module/blog/info/info_2496d6ac5b.css: -------------------------------------------------------------------------------- 1 | .comments{border-top:5px solid #06CBFF}.commentWrap{margin-top:20px}.commentItem{margin:10px 0;border-bottom:1px dotted #06CBFF}.commentItem .user{padding:10px 0}.commentItem .date{float:right}.commentItem .content{line-height:1.8em}.commentUser{width:80%;padding:10px 14px}.commentContent{width:97%;margin:12px 0;padding:10px} -------------------------------------------------------------------------------- /web/config/site.js: -------------------------------------------------------------------------------- 1 | var config = { 2 | 3 | title: '', 4 | page: { 5 | 6 | }, 7 | basePath: '', 8 | min: '' 9 | 10 | }; 11 | 12 | module.exports = function( req, path ){ 13 | return { 14 | title: config.title, 15 | basePath: config.basePath, 16 | path: path || req.path.replace(/(\/[a-z|A-Z]*)?$/,function($1){ ;return $1 + $1}) 17 | } 18 | }; 19 | -------------------------------------------------------------------------------- /web/assets/widget/hint/hint.css: -------------------------------------------------------------------------------- 1 | .hint{ 2 | width: 400px; 3 | height: 100px; 4 | position: fixed; 5 | top: 48%; 6 | left: 50%; 7 | display: none; 8 | margin-left: -200px; 9 | margin-top: -50px; 10 | text-align: center; 11 | z-index: 200; 12 | } 13 | 14 | .hintContent{ 15 | padding: 20px; 16 | color: #fff; 17 | background: rgba( 0, 0, 0, .8 ); 18 | } 19 | -------------------------------------------------------------------------------- /assets/module/blog/info/info_2496d6ac5b_2496d6ac5b.css: -------------------------------------------------------------------------------- 1 | .comments{border-top:5px solid #06CBFF}.commentWrap{margin-top:20px}.commentItem{margin:10px 0;border-bottom:1px dotted #06CBFF}.commentItem .user{padding:10px 0}.commentItem .date{float:right}.commentItem .content{line-height:1.8em}.commentUser{width:80%;padding:10px 14px}.commentContent{width:97%;margin:12px 0;padding:10px} -------------------------------------------------------------------------------- /check/assets/widget/hint/hint.css: -------------------------------------------------------------------------------- 1 | .hint{ 2 | width: 400px; 3 | height: 100px; 4 | position: fixed; 5 | top: 48%; 6 | left: 50%; 7 | display: none; 8 | margin-left: -200px; 9 | margin-top: -50px; 10 | text-align: center; 11 | z-index: 200; 12 | } 13 | 14 | .hintContent{ 15 | padding: 20px; 16 | color: #fff; 17 | background: rgba( 0, 0, 0, .8 ); 18 | } 19 | -------------------------------------------------------------------------------- /web/server/issue.js: -------------------------------------------------------------------------------- 1 | 2 | var config = require( '../config/site' ); 3 | 4 | function index( req, res ){ 5 | res.render( 'issue/index.ejs', config( req, '/issue/index/index') ); 6 | } 7 | 8 | function error( req, res ){ 9 | res.render( 'issue/index.ejs', config( req, '/issue/error/error') ); 10 | } 11 | 12 | module.exports = { 13 | index: index, 14 | error: error 15 | } 16 | -------------------------------------------------------------------------------- /web/test/test-main.js: -------------------------------------------------------------------------------- 1 | var tests = []; 2 | for( var file in window.__karma__.files ){ 3 | if( /_case\.js$/.test( file )){ 4 | tests.push( file ); 5 | } 6 | } 7 | 8 | requirejs.config({ 9 | 10 | baseUrl: '/base', 11 | 12 | paths: { 13 | 'jquery': 'assets/core/js/jquery.min' 14 | }, 15 | 16 | deps: tests, 17 | 18 | callback: window.__karma__.start 19 | 20 | }); 21 | -------------------------------------------------------------------------------- /server.json: -------------------------------------------------------------------------------- 1 | { 2 | "apps" : [{ 3 | "name" : "launcher", 4 | "script" : "./product/server/launcher.js", 5 | "node_args" : "--harmony", 6 | "log_date_format" : "YYYY-MM-DD HH:mm:ss", 7 | "out_file" : "./logs/launcher_out.log", 8 | "error_file" : "./logs/launcher_err.log", 9 | "log_file" : "./logs/launcher_log.log" 10 | }] 11 | } -------------------------------------------------------------------------------- /web/config/logger.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = { 3 | 4 | 'appenders':[ 5 | {'type': 'console','category':'console'}, 6 | { 7 | 'type': 'dateFile', 8 | 'filename':'/root/root/upopen/log/web/', 9 | 'pattern':'yyyyMMdd.log', 10 | 'absolute':true, 11 | 'alwaysIncludePattern':true, 12 | 'category':'logInfo' 13 | } 14 | ], 15 | 'levels':{'logInfo':'DEBUG'} 16 | 17 | } 18 | -------------------------------------------------------------------------------- /server/config/logger.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = { 3 | 4 | 'appenders':[ 5 | {'type': 'console','category':'console'}, 6 | { 7 | 'type': 'dateFile', 8 | 'filename':'/root/root/upopen/log/server/', 9 | 'pattern':'yyyyMMdd.log', 10 | 'absolute':true, 11 | 'alwaysIncludePattern':true, 12 | 'category':'logInfo' 13 | } 14 | ], 15 | 'levels':{'logInfo':'DEBUG'} 16 | 17 | } 18 | -------------------------------------------------------------------------------- /static/core/js/base.js: -------------------------------------------------------------------------------- 1 | define(function(){function r(r,t){for(var e in t)r[e]=t[e];return r}function t(r){for(var t,e=Array.prototype.slice.call(arguments,1);t=e.shift();)for(var n in t)r[n]=t[n];return r}function e(r){return"[object array]"==Object.prototype.toString.call(r).toLowerCase()}return String.prototype.trim=String.prototype.trim||function(){return this.replace(/^\s*/,"").replace(/\s*$/,"")},{extend:r,apply:t,isArray:e}}); -------------------------------------------------------------------------------- /check/model/db.js: -------------------------------------------------------------------------------- 1 | var mongoose = require( 'mongoose' ), 2 | config = require( '../config/mongo' ); 3 | 4 | var path = 'mongodb://' + config.host + '/' + config.db; 5 | mongoose.connect( path, function( err ){ 6 | if( !err ){ 7 | console.log( 'connect to mongodb' ); 8 | } 9 | }); 10 | 11 | var Schema = mongoose.Schema; 12 | 13 | var model = { 14 | mongoose: mongoose, 15 | Schema: Schema 16 | } 17 | 18 | module.exports = model; 19 | -------------------------------------------------------------------------------- /check/views/index.ejs: -------------------------------------------------------------------------------- 1 | <% include common/header.ejs %> 2 |
3 | 4 |
5 |
6 |
7 | 8 |

CATALOG!!

9 |

10 |
11 | 12 | <% include common/footer.ejs %> 13 | -------------------------------------------------------------------------------- /serverES6/app.js: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import bodyParser from 'body-parser'; 3 | import { self as selfConfig } from './config/config'; 4 | import { Router } from './controller/route'; 5 | 6 | const app = express(); 7 | const port = selfConfig.port; 8 | const router = express.Router(); 9 | 10 | app 11 | .use( bodyParser() ) 12 | .use( Router(router) ) 13 | .listen( port, function(){ 14 | console.log(`upopen server starting on listen ${port}`) 15 | }) -------------------------------------------------------------------------------- /server/app.js: -------------------------------------------------------------------------------- 1 | var express = require( 'express' ), 2 | http = require( 'http' ), 3 | bodyParser = require( 'body-parser' ), 4 | controller = require( './controller' ); 5 | 6 | var app = express() 7 | 8 | app.set( 'port', '3003' ); 9 | app.use( bodyParser.urlencoded({ extended: false })); 10 | 11 | controller( app ); 12 | 13 | app.listen( app.get( 'port' ), function(){ 14 | console.log( 'server listening on port ' + app.get( 'port' )); 15 | }) 16 | 17 | 18 | -------------------------------------------------------------------------------- /webES6/resource/public/js/bigpipe.js: -------------------------------------------------------------------------------- 1 | var Bigpipe = function(){ 2 | this.events = {}; 3 | } 4 | 5 | Bigpipe.prototype.on = function(name,event){ 6 | this.events[ name ] = this.events[ name ] || []; 7 | this.events[ name ].push( event ); 8 | } 9 | 10 | Bigpipe.prototype.fire = function(name,data){ 11 | var events = this.events[ name ] || [], 12 | event; 13 | while( event = events.shift() ){ 14 | event.call( this, data ) 15 | } 16 | } 17 | 18 | module.exports = Bigpipe -------------------------------------------------------------------------------- /webES6/lib/utils.js: -------------------------------------------------------------------------------- 1 | import {mkdirSync, existsSync} from 'fs'; 2 | import path from 'path'; 3 | 4 | /* 5 | * create dirname sync 6 | * @param dirname 7 | * @param dirname mode 8 | * return boolean 9 | */ 10 | function mkdirsSync( dirname, mode ){ 11 | 12 | if( existsSync( dirname )){ 13 | return true; 14 | } else { 15 | if( mkdirsSync( path.dirname( dirname), mode )){ 16 | mkdirSync( dirname, mode ) 17 | return true; 18 | } 19 | } 20 | 21 | } 22 | 23 | export { 24 | mkdirsSync 25 | } -------------------------------------------------------------------------------- /check/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | entry: { 3 | index: './assets/module/index/index' 4 | }, 5 | output: { 6 | path: './assets', 7 | filename: '[name].js' 8 | }, 9 | module: { 10 | loaders: [ 11 | { test: /\.css$/, loader: 'style-loader!css-loader!' }, 12 | { test: /\.js$/, loader: 'jsx-loader' }, 13 | { test: /\.(png|jpg)$/, loader: 'url-loader?limit=8192' } 14 | ] 15 | }, 16 | resolve: { 17 | extensions: ['','.jsx','.js','.css'] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /serverES6/lib/utils.js: -------------------------------------------------------------------------------- 1 | import {mkdirSync, existsSync} from 'fs'; 2 | import path from 'path'; 3 | 4 | /* 5 | * create dirname sync 6 | * @param dirname 7 | * @param dirname mode 8 | * return boolean 9 | */ 10 | function mkdirsSync( dirname, mode ){ 11 | 12 | if( existsSync( dirname )){ 13 | return true; 14 | } else { 15 | if( mkdirsSync( path.dirname( dirname), mode )){ 16 | mkdirSync( dirname, mode ) 17 | return true; 18 | } 19 | } 20 | 21 | } 22 | 23 | export { 24 | mkdirsSync 25 | } -------------------------------------------------------------------------------- /web/views/user/info.ejs: -------------------------------------------------------------------------------- 1 | <% include ../common/header.ejs %> 2 | 3 |
4 |
5 | 6 | <%= username %> 7 |
8 |
9 |
10 | blogscomments 11 |
12 |
13 | 14 |
15 |
16 |
17 | 18 | <% include ../common/footer.ejs %> 19 | -------------------------------------------------------------------------------- /assets/module/blog/mis/mis.css: -------------------------------------------------------------------------------- 1 | .blogItem { 2 | margin: 20px 0; 3 | padding: 10px 0; 4 | position: relative; } 5 | 6 | .blogItem .info { 7 | height: 40px; } 8 | 9 | .blogItem .kind { 10 | display: inline-block; 11 | margin: 0 0 0 20px; 12 | background: #F87428; 13 | color: #fff; 14 | padding: 0 2px; } 15 | 16 | .blogItem .tool span { 17 | margin-right: 20px; } 18 | 19 | .blogItem .handle { 20 | position: absolute; 21 | right: 10px; 22 | top: 10px; } 23 | 24 | .blogItem .handle a { 25 | margin-left: 20px; } 26 | -------------------------------------------------------------------------------- /webES6/resource/public/js/btype.js: -------------------------------------------------------------------------------- 1 | var btype = [ 2 | { 3 | id: 'nodejs', 4 | text: 'nodejs' 5 | }, 6 | { 7 | id: 'ubuntu', 8 | text: 'ubuntu' 9 | }, 10 | { 11 | id: 'sql', 12 | text: 'sql' 13 | }, 14 | { 15 | id: 'safe', 16 | text: 'safe' 17 | }, 18 | { 19 | id: 'http', 20 | text: 'http' 21 | }, 22 | { 23 | id: 'client', 24 | text: 'client' 25 | }, 26 | { 27 | id: 'server', 28 | text: 'server' 29 | }, 30 | { 31 | id: 'other', 32 | text: 'other' 33 | } 34 | ]; 35 | 36 | module.exports = btype; -------------------------------------------------------------------------------- /static/assets/module/blog/mis/mis.css: -------------------------------------------------------------------------------- 1 | .blogItem { 2 | margin: 20px 0; 3 | padding: 10px 0; 4 | position: relative; } 5 | 6 | .blogItem .info { 7 | height: 40px; } 8 | 9 | .blogItem .kind { 10 | display: inline-block; 11 | margin: 0 0 0 20px; 12 | background: #F87428; 13 | color: #fff; 14 | padding: 0 2px; } 15 | 16 | .blogItem .tool span { 17 | margin-right: 20px; } 18 | 19 | .blogItem .handle { 20 | position: absolute; 21 | right: 10px; 22 | top: 10px; } 23 | 24 | .blogItem .handle a { 25 | margin-left: 20px; } 26 | -------------------------------------------------------------------------------- /webES6/assets/module/blog/mis/mis.css: -------------------------------------------------------------------------------- 1 | .blogItem { 2 | margin: 20px 0; 3 | padding: 10px 0; 4 | position: relative; } 5 | 6 | .blogItem .info { 7 | height: 40px; } 8 | 9 | .blogItem .kind { 10 | display: inline-block; 11 | margin: 0 0 0 20px; 12 | background: #F87428; 13 | color: #fff; 14 | padding: 0 2px; } 15 | 16 | .blogItem .tool span { 17 | margin-right: 20px; } 18 | 19 | .blogItem .handle { 20 | position: absolute; 21 | right: 10px; 22 | top: 10px; } 23 | 24 | .blogItem .handle a { 25 | margin-left: 20px; } 26 | -------------------------------------------------------------------------------- /check/assets/core/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /webES6/assets/module/blog/mis/mis.css?125d6259c9: -------------------------------------------------------------------------------- 1 | .blogItem { 2 | margin: 20px 0; 3 | padding: 10px 0; 4 | position: relative; } 5 | 6 | .blogItem .info { 7 | height: 40px; } 8 | 9 | .blogItem .kind { 10 | display: inline-block; 11 | margin: 0 0 0 20px; 12 | background: #F87428; 13 | color: #fff; 14 | padding: 0 2px; } 15 | 16 | .blogItem .tool span { 17 | margin-right: 20px; } 18 | 19 | .blogItem .handle { 20 | position: absolute; 21 | right: 10px; 22 | top: 10px; } 23 | 24 | .blogItem .handle a { 25 | margin-left: 20px; } 26 | -------------------------------------------------------------------------------- /web/views/user/self.ejs: -------------------------------------------------------------------------------- 1 | <% include ../common/header.ejs %> 2 | 3 |
4 |
5 | 6 | <%= username %> 7 |
8 |
9 |
10 | blogscomments 11 |
12 |
13 | 14 |
15 |
16 |
17 | 18 | <% include ../common/footer.ejs %> 19 | -------------------------------------------------------------------------------- /static/assets/module/blog/info/info.css: -------------------------------------------------------------------------------- 1 | .comments { 2 | border-top: 5px solid #06CBFF; } 3 | 4 | .commentWrap { 5 | margin-top: 20px; } 6 | 7 | .commentItem { 8 | margin: 10px 0; 9 | border-bottom: 1px dotted #06CBFF; } 10 | 11 | .commentItem .user { 12 | padding: 10px 0; } 13 | 14 | .commentItem .date { 15 | float: right; } 16 | 17 | .commentItem .content { 18 | line-height: 1.8em; } 19 | 20 | .commentUser { 21 | width: 80%; 22 | padding: 10px 14px; } 23 | 24 | .commentContent { 25 | width: 97%; 26 | margin: 12px 0; 27 | padding: 10px; } 28 | -------------------------------------------------------------------------------- /webES6/assets/module/blog/info/info.css: -------------------------------------------------------------------------------- 1 | .comments { 2 | border-top: 5px solid #06CBFF; } 3 | 4 | .commentWrap { 5 | margin-top: 20px; } 6 | 7 | .commentItem { 8 | margin: 10px 0; 9 | border-bottom: 1px dotted #06CBFF; } 10 | 11 | .commentItem .user { 12 | padding: 10px 0; } 13 | 14 | .commentItem .date { 15 | float: right; } 16 | 17 | .commentItem .content { 18 | line-height: 1.8em; } 19 | 20 | .commentUser { 21 | width: 80%; 22 | padding: 10px 14px; } 23 | 24 | .commentContent { 25 | width: 97%; 26 | margin: 12px 0; 27 | padding: 10px; } 28 | -------------------------------------------------------------------------------- /webES6/assets/module/blog/info/info.css?0a422813ca: -------------------------------------------------------------------------------- 1 | .comments { 2 | border-top: 5px solid #06CBFF; } 3 | 4 | .commentWrap { 5 | margin-top: 20px; } 6 | 7 | .commentItem { 8 | margin: 10px 0; 9 | border-bottom: 1px dotted #06CBFF; } 10 | 11 | .commentItem .user { 12 | padding: 10px 0; } 13 | 14 | .commentItem .date { 15 | float: right; } 16 | 17 | .commentItem .content { 18 | line-height: 1.8em; } 19 | 20 | .commentUser { 21 | width: 80%; 22 | padding: 10px 14px; } 23 | 24 | .commentContent { 25 | width: 97%; 26 | margin: 12px 0; 27 | padding: 10px; } 28 | -------------------------------------------------------------------------------- /webES6/lib/code.js: -------------------------------------------------------------------------------- 1 | const Kind = [ 2 | { 3 | text: 'nodejs', 4 | id: 'nodejs' 5 | },{ 6 | text: 'webapp', 7 | id: 'webapp' 8 | },{ 9 | text: 'ubuntu', 10 | id: 'ubuntu' 11 | },{ 12 | text: 'sqlserver', 13 | id: 'sqlserver' 14 | },{ 15 | text: 'safe', 16 | id: 'safe' 17 | },{ 18 | text: 'http', 19 | id: 'http' 20 | },{ 21 | text: 'client', 22 | id: 'client' 23 | },{ 24 | text: 'server', 25 | id: 'server' 26 | },{ 27 | text: 'other', 28 | id: 'other' 29 | },{ 30 | text: 'tool', 31 | id: 'tool' 32 | } 33 | ]; 34 | 35 | export { 36 | Kind 37 | } -------------------------------------------------------------------------------- /static/widget/hint/hint.js: -------------------------------------------------------------------------------- 1 | require.config({map:{"*":{css:"./core/css.min"}},paths:{base:"/assets/core/js/base"}}),define(["base"],function(t){var n=function(){this.init()};t.apply(n.prototype,{defaults:{width:300,height:100},init:function(){this.render()},render:function(){this.el=$("
").addClass("hint"),this.content=$("").addClass("hintContent"),this.el.append(this.content),$("body").append(this.el)},html:function(t){this.content.html(t)},show:function(t){this.html(t||""),this.el.fadeIn();var n=this;setTimeout(function(){n.hide()},2e3)},hide:function(){this.el.fadeOut()}});var e=new n;return e}); -------------------------------------------------------------------------------- /web/assets/module/blog/info/info.css: -------------------------------------------------------------------------------- 1 | .comments{ 2 | border-top:5px solid #06CBFF; 3 | } 4 | 5 | .commentWrap{ 6 | margin-top: 20px; 7 | } 8 | 9 | .commentItem{ 10 | margin: 10px 0; 11 | border-bottom: 1px dotted #06CBFF; 12 | } 13 | 14 | .commentItem .user{ 15 | padding: 10px 0; 16 | } 17 | 18 | .commentItem .date{ 19 | float: right; 20 | } 21 | 22 | .commentItem .content{ 23 | line-height: 1.8em; 24 | } 25 | 26 | .commentUser{ 27 | width: 80%; 28 | padding: 10px 14px; 29 | } 30 | 31 | .commentContent{ 32 | width: 97%; 33 | margin: 12px 0; 34 | padding: 10px; 35 | } 36 | 37 | -------------------------------------------------------------------------------- /webES6/resource/module/blog/mis/mis.scss: -------------------------------------------------------------------------------- 1 | .blogItem{ 2 | margin: 20px 0; 3 | padding: 10px 0; 4 | position: relative; 5 | } 6 | 7 | .blogItem .info{ 8 | height: 40px; 9 | } 10 | 11 | .blogItem .kind{ 12 | display: inline-block; 13 | margin: 0 0 0 20px; 14 | background: #F87428; 15 | color: #fff; 16 | padding: 0 2px; 17 | } 18 | 19 | .blogItem .tool{ 20 | } 21 | 22 | .blogItem .tool span{ 23 | margin-right: 20px; 24 | } 25 | 26 | .blogItem .handle{ 27 | position: absolute; 28 | right: 10px; 29 | top: 10px; 30 | } 31 | 32 | .blogItem .handle a{ 33 | margin-left: 20px; 34 | } 35 | -------------------------------------------------------------------------------- /webES6/.sass-cache/596b18f4f48381b6c41d77ed281565b986a6e600/list.scssc: -------------------------------------------------------------------------------- 1 | 3.4.22 (Selective Steve) 2 | da39a3ee5e6b4b0d3255bfef95601890afd80709 3 | o:Sass::Tree::RootNode :@children[:@filename0: @options{:@templateI":ET: 4 | @linei:@source_rangeo:Sass::Source::Range :@start_poso:Sass::Source::Position; i: @offseti: @end_poso;; i;i: 5 | @fileI"(resource/module/blog/list/list.scss; 6 | T:@importero: Sass::Importers::Filesystem: 7 | @rootI"8/Users/qjdchina/Documents/work/upopen/upopen/webES6; 8 | T:@real_rootI"8/Users/qjdchina/Documents/work/upopen/upopen/webES6; 9 | T:@same_name_warningso:Set: 10 | @hash{ -------------------------------------------------------------------------------- /web/app.js: -------------------------------------------------------------------------------- 1 | /********** 2 | modules 3 | **********/ 4 | var express = require( 'express' ), 5 | http = require( 'http' ), 6 | ejs = require( 'ejs' ), 7 | logger = require( './lib/logger' ), 8 | bodyParser = require( 'body-parser' ), 9 | controller = require( './controller' ); 10 | 11 | var app = express(); 12 | 13 | app.set( 'views', __dirname + '/views' ); 14 | app.set( 'view engine', 'ejs' ); 15 | app.use( '/assets', express.static( 'assets' )); 16 | app.use( bodyParser.urlencoded({ extended: false })); 17 | 18 | controller( app ); 19 | 20 | http.createServer( app ).listen( 3001, function(){ 21 | console.log( 'upopen server start' ); 22 | } ); 23 | -------------------------------------------------------------------------------- /assets/widget/hint/hint_cbf05c6d8c.css: -------------------------------------------------------------------------------- 1 | .Hintdown,.Hintup{-webkit-prespective:300;-webkit-transform-style:preserve-3d;-webkit-animation-duration:.5s;-webkit-animation-iteration-count:1;-webkit-animation-timing-function:ease-out;-webkit-animation-fill-mode:forwards}.Hint{background:#1C9E22;position:fixed;right:0;bottom:-35px;z-index:1000;height:32px;line-height:32px;color:#fff;text-align:center;min-width:200px;padding:0 20px;border:3px solid #fff;border-bottom:none}.Hintdown{-webkit-animation-name:Hintdown;-webkit-animation-delay:.1s}@-webkit-keyframes Hintdown{0%{bottom:0}100%{bottom:-35px}}.Hintup{-webkit-animation-name:Hintup}@-webkit-keyframes Hintup{0%{bottom:-35px}100%{bottom:0}} -------------------------------------------------------------------------------- /assets/widget/hint/hint_cbf05c6d8c_cbf05c6d8c.css: -------------------------------------------------------------------------------- 1 | .Hintdown,.Hintup{-webkit-prespective:300;-webkit-transform-style:preserve-3d;-webkit-animation-duration:.5s;-webkit-animation-iteration-count:1;-webkit-animation-timing-function:ease-out;-webkit-animation-fill-mode:forwards}.Hint{background:#1C9E22;position:fixed;right:0;bottom:-35px;z-index:1000;height:32px;line-height:32px;color:#fff;text-align:center;min-width:200px;padding:0 20px;border:3px solid #fff;border-bottom:none}.Hintdown{-webkit-animation-name:Hintdown;-webkit-animation-delay:.1s}@-webkit-keyframes Hintdown{0%{bottom:0}100%{bottom:-35px}}.Hintup{-webkit-animation-name:Hintup}@-webkit-keyframes Hintup{0%{bottom:-35px}100%{bottom:0}} -------------------------------------------------------------------------------- /assets/module/blog/info/info.css: -------------------------------------------------------------------------------- 1 | .summary { 2 | font-size: 12px; 3 | background: #e2f9cb; 4 | padding: 10px; 5 | line-height: 24px; } 6 | 7 | .comments { 8 | border-top: 5px solid #06CBFF; } 9 | 10 | .commentWrap { 11 | margin-top: 20px; } 12 | 13 | .commentItem { 14 | margin: 10px 0; 15 | border-bottom: 1px dotted #06CBFF; } 16 | 17 | .commentItem .user { 18 | padding: 10px 0; } 19 | 20 | .commentItem .date { 21 | float: right; } 22 | 23 | .commentItem .content { 24 | line-height: 1.8em; } 25 | 26 | .commentUser { 27 | width: 80%; 28 | padding: 10px 14px; } 29 | 30 | .commentContent { 31 | width: 97%; 32 | margin: 12px 0; 33 | padding: 10px; } 34 | -------------------------------------------------------------------------------- /check/assets/core/js/event.js: -------------------------------------------------------------------------------- 1 | 2 | define(function(){ 3 | 4 | var Event = { 5 | on: function( name, callback){ 6 | this._event = this._event || {}; 7 | this._event[ name ] = this._event[ name ] || []; 8 | this._event[ name ].push( callback ); 9 | }, 10 | emit: function( name ){ 11 | this._event = this._event || {}; 12 | var args = Array.prototype.slice.call( arguments, 1 ), 13 | me = this; 14 | if( this._event[ name ] ){ 15 | $.each( this._event[ name ], function( k, v ){ 16 | v.call( me, args ); 17 | } ) 18 | } 19 | } 20 | } 21 | 22 | return Event 23 | }) 24 | -------------------------------------------------------------------------------- /web/assets/core/js/event.js: -------------------------------------------------------------------------------- 1 | 2 | define(function(){ 3 | 4 | var Event = { 5 | on: function( name, callback){ 6 | this._event = this._event || {}; 7 | this._event[ name ] = this._event[ name ] || []; 8 | this._event[ name ].push( callback ); 9 | }, 10 | emit: function( name ){ 11 | this._event = this._event || {}; 12 | var args = Array.prototype.slice.call( arguments, 1 ), 13 | me = this; 14 | if( this._event[ name ] ){ 15 | $.each( this._event[ name ], function( k, v ){ 16 | v.call( me, args ); 17 | } ) 18 | } 19 | } 20 | } 21 | 22 | return Event 23 | }) 24 | -------------------------------------------------------------------------------- /assets/module/blog/edit/edit_17a0d82df7.css: -------------------------------------------------------------------------------- 1 | .userInfo{padding:40px;min-height:400px;background:#fff}.profile{width:200px;min-height:300px;float:right;background:red}.editorForm{width:700px;float:left;margin-top:50px}.editorForm .title{padding:0 8px;border:1px solid #1AAFD0;outline:0;width:520px;font-size:24px}.editorForm .editType{outline:0;width:150px;height:46px;float:right;display:inline-block;background:#F87428;color:#fff;padding:0 2px}.editorForm .editType option{height:24px}.editorForm .editor{width:678px;padding:10px;line-height:1.83em;border:1px solid #1AAFD0;outline:0;margin-top:12px;resize:none}.editorForm .editorHandler{margin:12px 0 0 200px}.editorForm .preview{color:#2B63F9;margin-left:40px} -------------------------------------------------------------------------------- /server/model/user.js: -------------------------------------------------------------------------------- 1 | 2 | var DB = require( './db' ); 3 | 4 | /** 5 | user 6 | */ 7 | var User = {}; 8 | 9 | User.insert = function(data, cb ){ 10 | DB.insert( data, 'user', cb ); 11 | } 12 | 13 | User.fetch = function( fields, data, cb ){ 14 | DB.fetch( fields, data, 'user', cb ); 15 | } 16 | 17 | User.update = function( data, cb ){ 18 | var id = data.id; 19 | delete data.id; 20 | DB.update( id, data, 'user', cb ); 21 | } 22 | 23 | User.remove = function( data, cb ){ 24 | DB.remove( data.id, 'user', cb ); 25 | } 26 | 27 | var user = { 28 | create: User.insert, 29 | fetch: User.fetch, 30 | update: User.update, 31 | remove: User.remove 32 | } 33 | 34 | module.exports = user 35 | -------------------------------------------------------------------------------- /webES6/lib/request.js: -------------------------------------------------------------------------------- 1 | import request from 'request'; 2 | import fetch from 'node-fetch'; 3 | import {stringify} from 'querystring'; 4 | import { server as config } from '../config/config'; 5 | 6 | const Request = ( req, res, path, cb ) => { 7 | let query = ''; 8 | if( req.method === 'GET' ){ 9 | query = '?' + stringify( req.query ); 10 | } 11 | 12 | const option = { 13 | url: `${config.host}:${config.port}${path}${query}`, 14 | form: req.body 15 | } 16 | 17 | console.log( `${config.host}:${config.port}${path}${query}` ); 18 | 19 | request[ req.method.toLowerCase() ]( option, ( err, response, body ) => { 20 | cb( body ) 21 | }); 22 | 23 | } 24 | 25 | export default Request; -------------------------------------------------------------------------------- /assets/module/blog/edit/edit_17a0d82df7_17a0d82df7.css: -------------------------------------------------------------------------------- 1 | .userInfo{padding:40px;min-height:400px;background:#fff}.profile{width:200px;min-height:300px;float:right;background:red}.editorForm{width:700px;float:left;margin-top:50px}.editorForm .title{padding:0 8px;border:1px solid #1AAFD0;outline:0;width:520px;font-size:24px}.editorForm .editType{outline:0;width:150px;height:46px;float:right;display:inline-block;background:#F87428;color:#fff;padding:0 2px}.editorForm .editType option{height:24px}.editorForm .editor{width:678px;padding:10px;line-height:1.83em;border:1px solid #1AAFD0;outline:0;margin-top:12px;resize:none}.editorForm .editorHandler{margin:12px 0 0 200px}.editorForm .preview{color:#2B63F9;margin-left:40px} -------------------------------------------------------------------------------- /server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "upopen-server", 3 | "version": "0.0.1", 4 | "description": "this is a project, server to mysql", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "jxiao", 10 | "license": "ISC", 11 | "dependencies": { 12 | "bluebird": "^3.0.5", 13 | "body-parser": "^1.14.1", 14 | "co": "^4.6.0", 15 | "express": "^4.13.3", 16 | "koa": "^1.1.2", 17 | "koa-route": "^2.4.2", 18 | "log4js": "^0.6.29", 19 | "mysql": "^2.9.0", 20 | "nodemailer": "^1.10.0", 21 | "redis": "^2.4.2", 22 | "thunkify": "^2.1.2", 23 | "thunkify-wrap": "^1.0.4" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /webES6/views/blog/mis.ejs: -------------------------------------------------------------------------------- 1 | <% include ../common/header.ejs %> 2 |
3 | 22 |
23 | <% include ../common/slide.ejs %> 24 | <% include ../common/footer.ejs %> -------------------------------------------------------------------------------- /web/views/blog/info.ejs: -------------------------------------------------------------------------------- 1 | <% include ../common/header.ejs %> 2 |
3 |
4 |
5 | 6 |
7 |
8 |
9 |
10 |

11 |
12 |
13 |
14 | 15 | <% include ../common/slide.ejs %> 16 | <% include ../common/footer.ejs %> 17 | -------------------------------------------------------------------------------- /webES6/resource/module/blog/info/info.scss: -------------------------------------------------------------------------------- 1 | .summary{ 2 | font-size: 12px; 3 | background: rgb(226, 249, 203); 4 | padding: 10px; 5 | line-height: 24px; 6 | } 7 | .comments{ 8 | border-top:5px solid #06CBFF; 9 | } 10 | 11 | .commentWrap{ 12 | margin-top: 20px; 13 | } 14 | 15 | .commentItem{ 16 | margin: 10px 0; 17 | border-bottom: 1px dotted #06CBFF; 18 | } 19 | 20 | .commentItem .user{ 21 | padding: 10px 0; 22 | } 23 | 24 | .commentItem .date{ 25 | float: right; 26 | } 27 | 28 | .commentItem .content{ 29 | line-height: 1.8em; 30 | } 31 | 32 | .commentUser{ 33 | width: 80%; 34 | padding: 10px 14px; 35 | } 36 | 37 | .commentContent{ 38 | width: 97%; 39 | margin: 12px 0; 40 | padding: 10px; 41 | } 42 | 43 | -------------------------------------------------------------------------------- /serverES6/controller/comment.js: -------------------------------------------------------------------------------- 1 | import Comment from '../server/comment'; 2 | 3 | export default [ 4 | { 5 | path: '/fetch', 6 | method: 'get', 7 | premission: 0, 8 | request: ( req, res ) => { 9 | Comment.fetch( req, res ); 10 | } 11 | }, 12 | { 13 | path: '/save', 14 | method: 'post', 15 | premission: 0, 16 | request: ( req, res ) => { 17 | Comment.save( req, res ); 18 | } 19 | }, 20 | { 21 | path: '/update', 22 | method: 'post', 23 | premission: 0, 24 | request: ( req, res ) => { 25 | Comment.update( req, res ); 26 | } 27 | }, 28 | { 29 | path: '/remove', 30 | method: 'delete', 31 | premission: 0, 32 | request: ( req, res ) => { 33 | Comment.remove( req, res ); 34 | } 35 | } 36 | ] -------------------------------------------------------------------------------- /server/model/blog.js: -------------------------------------------------------------------------------- 1 | 2 | var DB = require( './db' ); 3 | 4 | /** 5 | blog 6 | */ 7 | var Blog = { 8 | params: ['id','title','summary','content','date','owner','sort','comment','view','disabled','kind','tags'] 9 | }; 10 | 11 | Blog.insert = function(data, cb ){ 12 | DB.insert( data, 'blog', cb ); 13 | } 14 | 15 | Blog.fetch = function( data, cb ){ 16 | DB.fetch( data, 'blog', cb ); 17 | } 18 | 19 | Blog.update = function( id, data, cb ){ 20 | DB.update( id, data, 'blog', cb ); 21 | } 22 | 23 | Blog.remove = function( id, cb ){ 24 | DB.remove( id, 'blog', cb ); 25 | } 26 | 27 | var blog = { 28 | create: Blog.insert, 29 | fetch: Blog.fetch, 30 | update: Blog.update, 31 | remove: Blog.remove 32 | } 33 | 34 | module.exports = blog 35 | -------------------------------------------------------------------------------- /webES6/gulp/config.js: -------------------------------------------------------------------------------- 1 | const path = require( `path` ); 2 | const src = path.join( __dirname, '../resource' ); 3 | const dest = path.join( __dirname, '../assets' ); 4 | 5 | module.exports = { 6 | images: { 7 | src: `${src}/**/*.png`, 8 | dest: `${dest}` 9 | }, 10 | webpack: { 11 | entry: { 12 | '/module/blog/list/list': `${src}/module/blog/list/list`, 13 | '/module/blog/edit/edit': `${src}/module/blog/edit/edit`, 14 | '/module/blog/info/info': `${src}/module/blog/info/info` 15 | }, 16 | output: { 17 | path: dest, 18 | filename: `[name].js` 19 | }, 20 | resolve: { 21 | extensions: [``,`.js`] 22 | }, 23 | module: { 24 | loaders: [ 25 | { test: /\.scss$/, loader: `style!css!sass` } 26 | ] 27 | } 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /webES6/views/blog/preview.ejs: -------------------------------------------------------------------------------- 1 | <% include ../common/header.ejs %> 2 |
3 |
4 |
5 | {title} 6 | {kind} 7 | 8 |
9 |
10 | 12 | Date: {date} 13 |
14 |
{content}
15 |
16 |
17 | 18 | <% include ../common/slide.ejs %> 19 | <% include ../common/footer.ejs %> 20 | -------------------------------------------------------------------------------- /server/model/comment.js: -------------------------------------------------------------------------------- 1 | 2 | var DB = require( './db' ); 3 | 4 | /** 5 | comment 6 | */ 7 | var Comment = { 8 | params: ['id','owner', 'username', 'content','belong','date'] 9 | }; 10 | 11 | Comment.insert = function(data, cb ){ 12 | DB.insert( data, 'comment', cb ); 13 | } 14 | 15 | Comment.fetch = function( data, cb ){ 16 | DB.fetch( data, 'comment', cb ); 17 | } 18 | 19 | Comment.update = function( data, cb ){ 20 | var id = data.id; 21 | delete data.id; 22 | DB.update( id, data, 'comment', cb ); 23 | } 24 | 25 | Comment.remove = function( id, cb ){ 26 | DB.remove( id, 'comment', cb ); 27 | } 28 | 29 | var comment = { 30 | create: Comment.insert, 31 | fetch: Comment.fetch, 32 | update: Comment.update, 33 | remove: Comment.remove 34 | } 35 | 36 | module.exports = comment 37 | -------------------------------------------------------------------------------- /webES6/controller/comment.js: -------------------------------------------------------------------------------- 1 | import Comment from '../server/comment'; 2 | export default [ 3 | { 4 | path: '/fetch', 5 | method: 'get', 6 | premission: 0, 7 | request: ( req, res ) => { 8 | Comment.fetch( req, res, '/comment/fetch' ); 9 | } 10 | }, 11 | { 12 | path: '/create', 13 | method: 'post', 14 | premission: 0, 15 | request: ( req, res ) => { 16 | Comment.add( req, res, '/comment/save' ); 17 | } 18 | }, 19 | { 20 | path: '/update', 21 | method: 'post', 22 | premission: 0, 23 | request: ( req, res ) => { 24 | Comment.update( req, res, '/comment/update' ); 25 | } 26 | }, 27 | { 28 | path: '/remove', 29 | method: 'delete', 30 | premission: 0, 31 | request: ( req, res ) => { 32 | Comment.remove( req, res, '/comment/remove' ); 33 | } 34 | } 35 | ] -------------------------------------------------------------------------------- /web/karma.conf.js: -------------------------------------------------------------------------------- 1 | module.exports = function( config ){ 2 | 3 | config.set({ 4 | basePath: '', 5 | frameworks: ['should', 'jasmine', 'requirejs' ], 6 | files: [ 7 | {pattern: 'lib/**/*.js', included: false }, 8 | {pattern: 'assets/**/*.js', included: false }, 9 | {pattern: 'test/**/*.js', included: false }, 10 | 'test/test-main.js' 11 | ], 12 | exclude: [], 13 | reporters: ['progress','coverage'], 14 | preprocessors: { 15 | 'test/**/*.js':'coverage', 16 | 'assets/core/**/*.js':'coverage' 17 | }, 18 | coverageReporter:{ 19 | type:'html', 20 | dir:'test/coverage/' 21 | }, 22 | port: 9876, 23 | colors: true, 24 | logLevel: config.LOG_INFO, 25 | autoWatch: true, 26 | browsers: ['Chrome'], 27 | captureTimeout: 60000, 28 | singleRun: false 29 | }); 30 | 31 | }; 32 | -------------------------------------------------------------------------------- /web/views/case/list.ejs: -------------------------------------------------------------------------------- 1 | <% include ../common/header.ejs %> 2 |


3 | check server interface

4 | 3d tank

5 | chess chinaese

6 |











7 |











8 |











9 |











10 |











11 |
12 | <% include ../common/slide.ejs %> 13 | <% include ../common/footer.ejs %> 14 | -------------------------------------------------------------------------------- /webES6/app.js: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import Router from './controller/route'; 3 | import bodyParser from 'body-parser'; 4 | import {logInfo} from './lib/loger'; 5 | 6 | const app = express(); 7 | const router = express.Router(); 8 | const port = '3001'; 9 | 10 | const evn = process.env.NODE_ENV || 'production'; 11 | 12 | console.log( `==${process.env.HOME}` ) 13 | 14 | app 15 | .set( 'views', `${__dirname}/views`) 16 | .set( 'view engine', 'ejs' ) 17 | .use( express.static( `${__dirname}/assets`, { 18 | index: 0, 19 | maxAge: 600000 20 | })) 21 | //.use( express.favicon() ) 22 | .use( bodyParser.urlencoded({ 23 | extended: 1 24 | })) 25 | .use( Router( router )) 26 | .listen( port, function(){ 27 | logInfo.info(`server start listening on ${port}`); 28 | console.log(`server start listening on ${port}`); 29 | }) -------------------------------------------------------------------------------- /static/module/user/edit/edit.js: -------------------------------------------------------------------------------- 1 | require.config({paths:{common:"/assets/public/js/common",hint:"/assets/widget/hint/hint"}}),require(["hint","common"],function(t){function o(t){$.ajax({url:"/blog/fetchEdit",type:"get",dataType:"json",data:{id:t},success:function(t){0==t.code&&(n.val(t.data[0].title),a=t.data[0].id,e.val(t.data[0].content)),console.log(t)}})}var n=$("#title"),e=$("#editor"),i=$("#type"),a="";$("#editorForm").on("submit",function(){var o={title:n.val(),content:e.val(),kind:i.val()};return url="/blog/create",a&&(o.id=a,url="/blog/update"),$.ajax({url:url,type:"post",dataType:"json",data:o,success:function(o){0==o.code&&(t.show("保存成功"),setTimeout(function(){window.location.href=window.location.protocol+"//"+window.location.host+"/user/info"},1e3)),console.log(o)}}),!1}),!function(){location.search&&o(location.search.slice(1).split("=")[1])}()}); -------------------------------------------------------------------------------- /web/gulpfile.js: -------------------------------------------------------------------------------- 1 | var gulp = require( 'gulp' ), 2 | jshint = require( 'gulp-jshint' ), 3 | uglify = require( 'gulp-uglify' ), 4 | Server = require( 'karma' ).Server, 5 | map = require( 'map-stream' ), 6 | stylish = require( 'jshint-stylish' ); 7 | 8 | gulp.task( 'karma', function( cb ){ 9 | new Server({ 10 | configFile: __dirname + '/karma.conf.js', 11 | singleRun: true 12 | }, cb ).start(); 13 | }) 14 | 15 | gulp.task( 'jshint', function(){ 16 | return gulp.src( 'assets/**/**.js') 17 | .pipe( jshint() ) 18 | .pipe( jshint.reporter( stylish ) ); 19 | }); 20 | 21 | gulp.task( 'uglify', function(){ 22 | gulp.src('assets/**/**.js' ) 23 | .pipe( uglify() ) 24 | .pipe( gulp.dest( '/home/cc/Work/upopen/static' )); 25 | }); 26 | 27 | gulp.task( 'default',[ 'karma','jshint', 'uglify' ], function( err ){ 28 | console.log( arguments ); 29 | }) 30 | -------------------------------------------------------------------------------- /check/app.js: -------------------------------------------------------------------------------- 1 | 2 | 'use strict'; 3 | /* 4 | module dependencies 5 | */ 6 | var koa = require( 'koa' ), 7 | controller = require( './controller' ), 8 | render = require( 'koa-views' ), 9 | bodyParser = require( 'koa-bodyparser' ), 10 | statics = require( 'koa-static' ), 11 | logger = require( './lib/logger' ), 12 | path = require( 'path' ); 13 | 14 | var app = koa(); 15 | 16 | /* 17 | middleware 18 | */ 19 | app.use( statics( path.join( __dirname, './'))) 20 | .use( render( path.join( __dirname, './views' ), { default: 'ejs' })) 21 | .use( bodyParser() ) 22 | .use( function *( next ){ 23 | this.body = this.request.body; 24 | yield next; 25 | }); 26 | 27 | controller.all( app ); 28 | 29 | app.listen( '3004', function(){ 30 | logger.logInfo.info( 'server start on port 3004') 31 | console.log( 'check server listening on port 3004'); 32 | }); 33 | -------------------------------------------------------------------------------- /check/config/logger.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = { 3 | 4 | 'appenders':[ 5 | { 6 | 'type': 'console', 7 | 'category':'console' 8 | }, 9 | { 10 | 'type': 'dateFile', 11 | 'category':'info', 12 | 'filename':'/root/root/upopen/log/check/', 13 | 'pattern':'yyyyMMdd_info.log', 14 | 'alwaysIncludePattern':true 15 | }, 16 | { 17 | 'type': 'dateFile', 18 | 'category':'warn', 19 | 'filename':'/root/root/upopen/log/check/', 20 | 'pattern':'yyyyMMdd_warn.log', 21 | 'alwaysIncludePattern':true 22 | }, 23 | { 24 | 'type': 'file', 25 | 'category': 'file', 26 | 'filename': '/root/root/upopen/log/check/file.log', 27 | 'maxLogSize': 1024*1028*10, 28 | 'backups': 2 29 | } 30 | ], 31 | replaceConsole: true, 32 | 'levels':{ 33 | 'console':'all', 34 | 'file': 'all', 35 | 'info': 'all', 36 | 'warn': 'warn' 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /webES6/views/common/slide.ejs: -------------------------------------------------------------------------------- 1 |
2 |
3 |

4 | Blog Class
5 |  Enjoy & Be good at 6 |

7 |
    8 | <% Kind.forEach( function( item ){ %> 9 |
  • <%= item.text %>
  • 10 | <% }) %> 11 |
12 |
13 | 14 |
15 |

16 | Case List
17 |  Useful & Interesting 18 |

19 | 24 |
25 |
26 | -------------------------------------------------------------------------------- /serverES6/controller/blog.js: -------------------------------------------------------------------------------- 1 | import Blog from '../server/blog'; 2 | 3 | export default [ 4 | { 5 | path: '/fetch', 6 | method: 'get', 7 | premission: 0, 8 | request: ( req, res ) => { 9 | Blog.fetch( req, res ); 10 | } 11 | }, 12 | { 13 | path: '/save', 14 | method: 'post', 15 | premission: 0, 16 | request: ( req, res ) => { 17 | Blog.save( req, res ); 18 | } 19 | }, 20 | { 21 | path: '/update', 22 | method: 'post', 23 | premission: 0, 24 | request: ( req, res ) => { 25 | Blog.update( req, res ); 26 | } 27 | }, 28 | { 29 | path: '/updateViewNum', 30 | method: 'get', 31 | premission: 0, 32 | request: ( req, res ) => { 33 | Blog.updateViewNum( req, res ); 34 | } 35 | }, 36 | { 37 | path: '/remove', 38 | method: 'delete', 39 | premission: 0, 40 | request: ( req, res ) => { 41 | Blog.remove( req, res ); 42 | } 43 | } 44 | ] -------------------------------------------------------------------------------- /serverES6/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "upopen_server_es6", 3 | "version": "1.0.0", 4 | "description": "this is server used es6", 5 | "main": "entry.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/xiaolulu/upopen.git" 12 | }, 13 | "author": "潇", 14 | "license": "MIT", 15 | "bugs": { 16 | "url": "https://github.com/xiaolulu/es6/issues" 17 | }, 18 | "homepage": "https://github.com/xiaolulu/es6#readme", 19 | "dependencies": { 20 | "babel-core": "^6.7.7", 21 | "babel-polyfill": "^6.7.4", 22 | "babel-preset-es2015": "^6.6.0", 23 | "body-parser": "^1.15.0", 24 | "express": "^4.13.4", 25 | "log4js": "^0.6.35", 26 | "mongoose": "^4.4.13" 27 | }, 28 | "devDependencies": { 29 | "webpack": "^1.13.0" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /assets/public/css/reset_ca08e7b227.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8";code,kbd,samp,sub,sup,tt{font-size:100%}*{font-family:"Microsoft Yahei",Tahoma,Arial}blockquote,body,code,dd,div,dl,dt,fieldset,form,h1,h2,h3,h4,h5,h6,input,legend,li,ol,p,pre,td,textarea,th,ul{margin:0;padding:0}body{line-height:1.5}table{border-collapse:collapse;border-spacing:0}fieldset,img{border:0}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:400}caption,th{text-align:left}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:'';content:none}:link,:visited{text-decoration:none}abbr,acronym{border:0;font-variant:normal}sup{vertical-align:text-top}sub{vertical-align:text-bottom}input,select,textarea{font-family:inherit;font-size:inherit;font-weight:inherit}legend{color:#000}.clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}.clearfix{display:block}a,button{cursor:pointer} -------------------------------------------------------------------------------- /server/lib/mailer.js: -------------------------------------------------------------------------------- 1 | var nodemailer = require( 'nodemailer' ); 2 | 3 | var transporter = nodemailer.createTransport({ 4 | service: 'QQ', 5 | auth: { 6 | user: '2270112418@qq.com', 7 | pass: 'wgexgblvoftmdici' 8 | } 9 | }); 10 | 11 | function mail( config ){ 12 | 13 | var mailOptions = { 14 | from: '2270112418@qq.com', 15 | to: config.to || '2270112418@qq.com', 16 | subject: config.subject || '

hi, register success

', 17 | text: config.subject || '

hi, register success

', 18 | html: config.html || '

hi, register success

', 19 | attachments: config.annex || [] 20 | }; 21 | 22 | transporter.sendMail(mailOptions, function(error, info){ 23 | if(error){ 24 | console.log(error); 25 | }else{ 26 | console.log('Message sent: ' + info.response); 27 | } 28 | }); 29 | 30 | } 31 | 32 | module.exports = mail; 33 | -------------------------------------------------------------------------------- /web/lib/mailer.js: -------------------------------------------------------------------------------- 1 | var nodemailer = require( 'nodemailer' ); 2 | 3 | var transporter = nodemailer.createTransport({ 4 | service: 'QQ', 5 | auth: { 6 | user: '2270112418@qq.com', 7 | pass: 'wgexgblvoftmdici' 8 | } 9 | }); 10 | 11 | function mail( config ){ 12 | 13 | var mailOptions = { 14 | from: '2270112418@qq.com', 15 | to: config.to || '2270112418@qq.com', 16 | subject: config.subject || '

hi, register success

', 17 | text: config.subject || '

hi, register success

', 18 | html: config.html || '

hi, register success

', 19 | attachments: config.annex || [] 20 | }; 21 | 22 | transporter.sendMail(mailOptions, function(error, info){ 23 | if(error){ 24 | console.log(error); 25 | }else{ 26 | console.log('Message sent: ' + info.response); 27 | } 28 | }); 29 | 30 | } 31 | 32 | module.exports = mail; 33 | -------------------------------------------------------------------------------- /assets/public/css/reset_ca08e7b227_ca08e7b227.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8";code,kbd,samp,sub,sup,tt{font-size:100%}*{font-family:"Microsoft Yahei",Tahoma,Arial}blockquote,body,code,dd,div,dl,dt,fieldset,form,h1,h2,h3,h4,h5,h6,input,legend,li,ol,p,pre,td,textarea,th,ul{margin:0;padding:0}body{line-height:1.5}table{border-collapse:collapse;border-spacing:0}fieldset,img{border:0}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:400}caption,th{text-align:left}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:'';content:none}:link,:visited{text-decoration:none}abbr,acronym{border:0;font-variant:normal}sup{vertical-align:text-top}sub{vertical-align:text-bottom}input,select,textarea{font-family:inherit;font-size:inherit;font-weight:inherit}legend{color:#000}.clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}.clearfix{display:block}a,button{cursor:pointer} -------------------------------------------------------------------------------- /webES6/views/blog/edit.ejs: -------------------------------------------------------------------------------- 1 | <% include ../common/header.ejs %> 2 |
3 |
4 | 5 |
10 |
11 |
12 |
13 | preview 14 |
15 |
16 |
17 | <% include ../common/slide.ejs %> 18 | <% include ../common/footer.ejs %> -------------------------------------------------------------------------------- /webES6/views/common/header.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <%= title %>-<%= siteTitle %> 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
13 |
14 | 19 | 24 |
25 |
26 |
27 | -------------------------------------------------------------------------------- /webES6/resource/module/blog/preview/preview.js: -------------------------------------------------------------------------------- 1 | require( '../../../public/css/markdown.scss' ) 2 | var title = $( '#title' ), 3 | date = $( '#date' ), 4 | summary = $( '#summary' ), 5 | content = $( '#content' ), 6 | kind = $( '#kind' ), 7 | editorBtn = $( '#editorBtn' ), 8 | _id = ''; 9 | 10 | function fetchBlog( id ){ 11 | $.ajax({ 12 | url: '/blog/fetch', 13 | type: 'get', 14 | dataType: 'json', 15 | data: { id: id }, 16 | success: function( ret ){ 17 | if( ret.code == 0 ){ 18 | title.html( ret.data[0].title ); 19 | _id = ret.data[0].id; 20 | date.html( ret.data[0].date ); 21 | kind.html( ret.data[0].kind ); 22 | content.html( ret.data[0].content ); 23 | summary.html( ret.data[0].summary ); 24 | } 25 | console.log( ret ); 26 | } 27 | }); 28 | } 29 | 30 | !function(){ 31 | if( location.search ){ 32 | _id = location.search.slice(1).split('=')[1]; 33 | fetchBlog( _id ); 34 | } 35 | }(); -------------------------------------------------------------------------------- /webES6/gulp/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require( 'path' ); 2 | console.log('webpack file') 3 | module.exports = { 4 | entry: { 5 | '/module/blog/list/list': './resource/module/blog/list/list', 6 | '/module/blog/edit/edit': './resource/module/blog/edit/edit', 7 | '/module/blog/info/info': './resource/module/blog/info/info' 8 | }, 9 | output: { 10 | path: path.join( __dirname, '../assets' ), 11 | filename: '[name].js' 12 | }, 13 | resolve: { 14 | extensions: ['','.js'] 15 | }, 16 | module: { 17 | loaders: [ 18 | { test: /\.scss$/, loader: 'style!css!sass' } 19 | /*, // use ! to chain loaders 20 | { test: /\.less$/, loader: 'style-loader!css-loader!less-loader' }, // use ! to chain loaders 21 | { test: /\.css$/, loader: 'style-loader!css-loader' }, 22 | {test: /\.(png|jpg)$/, loader: 'url-loader?limit=8192'} // inline base64 URLs for <=8k images, direct URLs for the rest*/ 23 | ] 24 | } 25 | } 26 | console.log( path.join( __dirname, '../assets' ) ); -------------------------------------------------------------------------------- /webES6/resource/widget/hint/hint.js: -------------------------------------------------------------------------------- 1 | require( './hint.scss' ); 2 | function Hint( config ){ 3 | this.config = config || {}; 4 | this.init(); 5 | } 6 | 7 | Hint.prototype = { 8 | defaults: { 9 | content: '操作成功' 10 | }, 11 | 12 | init: function(){ 13 | this.render(); 14 | }, 15 | 16 | render: function(){ 17 | this.el = $( '
' ).addClass( 'Hint' ); 18 | $('body').append( this.el ); 19 | return this; 20 | }, 21 | 22 | setValue: function( txt ){ 23 | this.el.html( txt ); 24 | return this; 25 | }, 26 | 27 | show: function( txt ){ 28 | var me = this; 29 | this.setValue( txt ); 30 | this.el.removeClass('Hintdown').addClass('Hintup'); 31 | setTimeout(function(){ 32 | me.el.css('bottom',0); 33 | me.hide(); 34 | },3000) 35 | 36 | }, 37 | 38 | hide: function(){ 39 | this.el.addClass('Hintdown').removeClass('Hintup'); 40 | } 41 | } 42 | 43 | var hint = new Hint(); 44 | 45 | module.exports = { 46 | hint: hint, 47 | Hint: Hint 48 | } -------------------------------------------------------------------------------- /static/module/blog/list/list.js: -------------------------------------------------------------------------------- 1 | require.config({paths:{common:"/assets/public/js/common"}}),require(["common"],function(){function a(a){var n=a?{kind:a}:{};$.ajax({url:"/blog/fetchList",type:"get",dataType:"json",data:n,success:function(a){0==a.code&&s(a.data)}})}function s(a){var s=[];$.each(a,function(a,e){s.push(n(e))}),$("#blogBox").append(s)}function n(a){var s=e.replace(/\{(.*?)\}/g,function(s,n){return a[n]});return $("
").append(s)}var e=['
','{title}','{kind}','',"
",'
{summary}
','
','Views: {view}','Comments: {comment}','Date: {date}',"
"].join("");!function(){var s="";location.search&&(s=location.search.slice(1).split("=")[1]),a(s)}()}); -------------------------------------------------------------------------------- /check/assets/widget/hint/hint.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | var base = require( '../../core/js/base.js' ); 4 | require( './hint.css' ); 5 | 6 | var Hint = function(){ 7 | this.init(); 8 | }; 9 | 10 | base.apply( Hint.prototype, { 11 | 12 | defaults: { 13 | width: 300, 14 | height: 100 15 | }, 16 | 17 | init: function(){ 18 | 19 | this.render() 20 | 21 | }, 22 | 23 | render: function(){ 24 | 25 | this.el = $( '
' ).addClass( 'hint' ); 26 | this.content = $( '' ).addClass( 'hintContent' ); 27 | this.el.append( this.content ); 28 | $( 'body' ).append( this.el ); 29 | 30 | }, 31 | 32 | html: function( txt ){ 33 | 34 | this.content.html( txt ); 35 | 36 | }, 37 | 38 | show: function( txt ){ 39 | 40 | this.html( txt || '' ); 41 | this.el.fadeIn(); 42 | var me = this; 43 | setTimeout( function(){ me.hide() }, 2000 ); 44 | 45 | }, 46 | 47 | hide: function(){ 48 | 49 | this.el.fadeOut(); 50 | 51 | } 52 | 53 | }); 54 | 55 | var hint = new Hint(); 56 | 57 | module.exports = hint; 58 | -------------------------------------------------------------------------------- /web/assets/module/user/edit/edit.css: -------------------------------------------------------------------------------- 1 | .userInfo{ 2 | padding: 40px; 3 | min-height: 400px; 4 | background: #fff; 5 | } 6 | 7 | .profile{ 8 | width: 200px; 9 | min-height: 300px; 10 | float: right; 11 | background: #f00; 12 | } 13 | 14 | .editorForm{ 15 | width: 722px; 16 | float: left; 17 | } 18 | 19 | .editorForm .title{ 20 | padding: 8px; 21 | border: 1px solid #1AAFD0; 22 | outline: 0px; 23 | width: 545px; 24 | font-size: 24px; 25 | } 26 | 27 | .editorForm .type{ 28 | padding: 5px; 29 | outline: 0px; 30 | width: 150px; 31 | height: 46px; 32 | float: right; 33 | } 34 | 35 | .editorForm .type option{ 36 | height: 24px; 37 | } 38 | 39 | .editorForm .editor{ 40 | width: 700px; 41 | padding: 10px; 42 | min-height: 400px; 43 | line-height: 1.83em; 44 | border: 1px solid #1AAFD0; 45 | outline: 0px; 46 | margin-top: 12px; 47 | resize: none; 48 | } 49 | 50 | .editorForm .editorHandler{ 51 | margin: 12px 0 0 200px; 52 | } 53 | 54 | .editorForm .preview{ 55 | color: #2B63F9; 56 | margin-left: 40px; 57 | } 58 | 59 | -------------------------------------------------------------------------------- /static/module/user/info/info.js: -------------------------------------------------------------------------------- 1 | require.config({paths:{common:"/assets/public/js/common",hint:"/assets/widget/hint/hint"}}),require(["hint","common"],function(e){function n(){$.ajax({url:"/blog/fetchEdit",type:"get",dataType:"json",data:{},success:function(e){0==e.code&&a(e.data),console.log(e)}})}function a(e){var n=[];$.each(e,function(e,a){n.push(i(a))}),$(".articles").append(n)}function i(e){var n=$(t.replace(/\{(.*?)\}/g,function(n,a){return e[a]}));return n.find(".delete").on("click",function(){$.ajax({url:"/blog/remove",type:"delete",data:{id:e.id},dataType:"json",success:function(e){0==e.code&&n.remove()}})}),$("
").addClass("blogItem").append(n)}var t=['
','{title}','{kind}',"
",'
','delete','edit',"
",'
',"views: {view}","comments: {comment}","date: {date}","
"].join("");!function(){n()}()}); -------------------------------------------------------------------------------- /web/views/user/edit.ejs: -------------------------------------------------------------------------------- 1 | <% include ../common/header.ejs %> 2 | 3 |
4 |
5 | 6 |
7 |
8 | 9 |
20 |
21 |
22 | preview 23 |
24 |
25 |
26 | 27 | <% include ../common/footer.ejs %> 28 | -------------------------------------------------------------------------------- /webES6/server/comment.js: -------------------------------------------------------------------------------- 1 | import Request from '../lib/request'; 2 | import fs from 'fs'; 3 | import {markdown} from 'markdown'; 4 | 5 | const htx2ejs = function( data, doc ){ 6 | data.content = markdown.toHTML( data.content ); 7 | data.date = data.date.slice(0,10); 8 | doc = doc.replace( /\{(.*?)\}/g, ( $1, $2 ) => { return data[$2] }); 9 | fs.writeFile( `views/blog/info/${data._id}.ejs`, doc, (err) => { console.log( err )} ); 10 | } 11 | 12 | export default { 13 | fetch( req, res, path ){ 14 | Request( req, res, path, ( body ) => { 15 | body = JSON.parse( body ); 16 | body.data.map( item => item.content = markdown.toHTML( item.content )); 17 | res.send( body ); 18 | } ); 19 | }, 20 | 21 | add( req, res, path ){ 22 | Request( req, res, path, ( body ) => { 23 | res.send( body ); 24 | } ) 25 | }, 26 | 27 | update( req, res, path ){ 28 | Request( req, res, path, ( body ) => { 29 | res.send( body ); 30 | } ) 31 | }, 32 | 33 | remove( req, res, path ){ 34 | Request( req, res, path, ( body ) => { 35 | res.send( body ); 36 | } ) 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /assets/module/blog/edit/edit.css: -------------------------------------------------------------------------------- 1 | .userInfo { 2 | padding: 40px; 3 | min-height: 400px; 4 | background: #fff; } 5 | 6 | .profile { 7 | width: 200px; 8 | min-height: 300px; 9 | float: right; 10 | background: #f00; } 11 | 12 | .editorForm { 13 | width: 700px; 14 | float: left; 15 | margin-top: 50px; } 16 | 17 | .editorForm .title { 18 | padding: 0 8px; 19 | border: 1px solid #1AAFD0; 20 | outline: 0px; 21 | width: 520px; 22 | font-size: 24px; } 23 | 24 | .editorForm .editType { 25 | padding: 5px; 26 | outline: 0px; 27 | width: 150px; 28 | height: 46px; 29 | float: right; 30 | display: inline-block; 31 | background: #F87428; 32 | color: #fff; 33 | padding: 0 2px; } 34 | 35 | .editorForm .editType option { 36 | height: 24px; } 37 | 38 | .editorForm .editor { 39 | width: 678px; 40 | padding: 10px; 41 | line-height: 1.83em; 42 | border: 1px solid #1AAFD0; 43 | outline: 0px; 44 | margin-top: 12px; 45 | resize: none; } 46 | 47 | .editorForm .editorHandler { 48 | margin: 12px 0 0 200px; } 49 | 50 | .editorForm .preview { 51 | color: #2B63F9; 52 | margin-left: 40px; } 53 | -------------------------------------------------------------------------------- /static/assets/module/blog/edit/edit.css: -------------------------------------------------------------------------------- 1 | .userInfo { 2 | padding: 40px; 3 | min-height: 400px; 4 | background: #fff; } 5 | 6 | .profile { 7 | width: 200px; 8 | min-height: 300px; 9 | float: right; 10 | background: #f00; } 11 | 12 | .editorForm { 13 | width: 700px; 14 | float: left; 15 | margin-top: 50px; } 16 | 17 | .editorForm .title { 18 | padding: 0 8px; 19 | border: 1px solid #1AAFD0; 20 | outline: 0px; 21 | width: 520px; 22 | font-size: 24px; } 23 | 24 | .editorForm .editType { 25 | padding: 5px; 26 | outline: 0px; 27 | width: 150px; 28 | height: 46px; 29 | float: right; 30 | display: inline-block; 31 | background: #F87428; 32 | color: #fff; 33 | padding: 0 2px; } 34 | 35 | .editorForm .editType option { 36 | height: 24px; } 37 | 38 | .editorForm .editor { 39 | width: 678px; 40 | padding: 10px; 41 | line-height: 1.83em; 42 | border: 1px solid #1AAFD0; 43 | outline: 0px; 44 | margin-top: 12px; 45 | resize: none; } 46 | 47 | .editorForm .editorHandler { 48 | margin: 12px 0 0 200px; } 49 | 50 | .editorForm .preview { 51 | color: #2B63F9; 52 | margin-left: 40px; } 53 | -------------------------------------------------------------------------------- /webES6/assets/module/blog/edit/edit.css: -------------------------------------------------------------------------------- 1 | .userInfo { 2 | padding: 40px; 3 | min-height: 400px; 4 | background: #fff; } 5 | 6 | .profile { 7 | width: 200px; 8 | min-height: 300px; 9 | float: right; 10 | background: #f00; } 11 | 12 | .editorForm { 13 | width: 700px; 14 | float: left; 15 | margin-top: 50px; } 16 | 17 | .editorForm .title { 18 | padding: 0 8px; 19 | border: 1px solid #1AAFD0; 20 | outline: 0px; 21 | width: 520px; 22 | font-size: 24px; } 23 | 24 | .editorForm .editType { 25 | padding: 5px; 26 | outline: 0px; 27 | width: 150px; 28 | height: 46px; 29 | float: right; 30 | display: inline-block; 31 | background: #F87428; 32 | color: #fff; 33 | padding: 0 2px; } 34 | 35 | .editorForm .editType option { 36 | height: 24px; } 37 | 38 | .editorForm .editor { 39 | width: 678px; 40 | padding: 10px; 41 | line-height: 1.83em; 42 | border: 1px solid #1AAFD0; 43 | outline: 0px; 44 | margin-top: 12px; 45 | resize: none; } 46 | 47 | .editorForm .editorHandler { 48 | margin: 12px 0 0 200px; } 49 | 50 | .editorForm .preview { 51 | color: #2B63F9; 52 | margin-left: 40px; } 53 | -------------------------------------------------------------------------------- /webES6/assets/module/blog/edit/edit.css?e24ad0a248: -------------------------------------------------------------------------------- 1 | .userInfo { 2 | padding: 40px; 3 | min-height: 400px; 4 | background: #fff; } 5 | 6 | .profile { 7 | width: 200px; 8 | min-height: 300px; 9 | float: right; 10 | background: #f00; } 11 | 12 | .editorForm { 13 | width: 700px; 14 | float: left; 15 | margin-top: 50px; } 16 | 17 | .editorForm .title { 18 | padding: 0 8px; 19 | border: 1px solid #1AAFD0; 20 | outline: 0px; 21 | width: 520px; 22 | font-size: 24px; } 23 | 24 | .editorForm .editType { 25 | padding: 5px; 26 | outline: 0px; 27 | width: 150px; 28 | height: 46px; 29 | float: right; 30 | display: inline-block; 31 | background: #F87428; 32 | color: #fff; 33 | padding: 0 2px; } 34 | 35 | .editorForm .editType option { 36 | height: 24px; } 37 | 38 | .editorForm .editor { 39 | width: 678px; 40 | padding: 10px; 41 | line-height: 1.83em; 42 | border: 1px solid #1AAFD0; 43 | outline: 0px; 44 | margin-top: 12px; 45 | resize: none; } 46 | 47 | .editorForm .editorHandler { 48 | margin: 12px 0 0 200px; } 49 | 50 | .editorForm .preview { 51 | color: #2B63F9; 52 | margin-left: 40px; } 53 | -------------------------------------------------------------------------------- /webES6/resource/module/blog/edit/edit.scss: -------------------------------------------------------------------------------- 1 | .userInfo{ 2 | padding: 40px; 3 | min-height: 400px; 4 | background: #fff; 5 | } 6 | 7 | .profile{ 8 | width: 200px; 9 | min-height: 300px; 10 | float: right; 11 | background: #f00; 12 | } 13 | 14 | .editorForm{ 15 | width: 700px; 16 | float: left; 17 | margin-top: 50px; 18 | } 19 | 20 | .editorForm .title{ 21 | padding: 0 8px; 22 | border: 1px solid #1AAFD0; 23 | outline: 0px; 24 | width: 520px; 25 | font-size: 24px; 26 | } 27 | 28 | .editorForm .editType{ 29 | padding: 5px; 30 | outline: 0px; 31 | width: 150px; 32 | height: 46px; 33 | float: right; 34 | display: inline-block; 35 | background: #F87428; 36 | color: #fff; 37 | padding: 0 2px; 38 | } 39 | 40 | .editorForm .editType option{ 41 | height: 24px; 42 | } 43 | 44 | .editorForm .editor{ 45 | width: 678px; 46 | padding: 10px; 47 | line-height: 1.83em; 48 | border: 1px solid #1AAFD0; 49 | outline: 0px; 50 | margin-top: 12px; 51 | resize: none; 52 | } 53 | 54 | .editorForm .editorHandler{ 55 | margin: 12px 0 0 200px; 56 | } 57 | 58 | .editorForm .preview{ 59 | color: #2B63F9; 60 | margin-left: 40px; 61 | } 62 | 63 | -------------------------------------------------------------------------------- /web/assets/widget/hint/hint.js: -------------------------------------------------------------------------------- 1 | 2 | require.config({ 3 | map: { 4 | '*': { 5 | 'css': './core/css.min' 6 | } 7 | }, 8 | paths: { 9 | base: '/assets/core/js/base' 10 | } 11 | }) 12 | 13 | define( ['base'], function( base ){ 14 | 15 | var Hint = function(){ 16 | this.init(); 17 | }; 18 | 19 | base.apply( Hint.prototype, { 20 | 21 | defaults: { 22 | width: 300, 23 | height: 100 24 | }, 25 | 26 | init: function(){ 27 | 28 | this.render() 29 | 30 | }, 31 | 32 | render: function(){ 33 | 34 | this.el = $( '
' ).addClass( 'hint' ); 35 | this.content = $( '' ).addClass( 'hintContent' ); 36 | this.el.append( this.content ); 37 | $( 'body' ).append( this.el ); 38 | 39 | }, 40 | 41 | html: function( txt ){ 42 | 43 | this.content.html( txt ); 44 | 45 | }, 46 | 47 | show: function( txt ){ 48 | 49 | this.html( txt || '' ); 50 | this.el.fadeIn(); 51 | var me = this; 52 | setTimeout( function(){ me.hide() }, 2000 ); 53 | 54 | }, 55 | 56 | hide: function(){ 57 | 58 | this.el.fadeOut(); 59 | 60 | } 61 | 62 | }); 63 | 64 | var hint = new Hint(); 65 | 66 | return hint; 67 | 68 | }) 69 | -------------------------------------------------------------------------------- /web/views/common/slide.ejs: -------------------------------------------------------------------------------- 1 |
2 |
3 |

4 | Blog Class
5 |  Enjoy & Be good at 6 |

7 | 17 |
18 | 19 |
20 |

21 | Case List
22 |  Useful & Interesting 23 |

24 | 29 |
30 |
31 | -------------------------------------------------------------------------------- /webES6/views/common/footer.ejs: -------------------------------------------------------------------------------- 1 |
2 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /web/assets/core/js/base.js: -------------------------------------------------------------------------------- 1 | 2 | define(function(){ 3 | 4 | String.prototype.trim = function(){ 5 | return this.replace(/^\s*/,'').replace(/\s*$/,''); 6 | } 7 | 8 | /******************/ 9 | function apply( destination ){ 10 | var args = Array.prototype.slice.call(arguments, 1), 11 | source; 12 | while( source = args.shift()){ 13 | for( var prop in source){ 14 | destination[prop] = source[prop]; 15 | } 16 | }; 17 | return destination 18 | }; 19 | 20 | function isArray( data ){ 21 | 22 | return Object.prototype.toString.call( data ).toLowerCase() == '[object array]'; 23 | 24 | } 25 | 26 | function searchHref( location, id ){ 27 | if( !id ){ 28 | id = location; 29 | location = window.location.search.slice(1); 30 | } 31 | try{ 32 | var _search = location.split(';'), 33 | data = {}; 34 | for( var i = 0; i < _search.length; i++ ){ 35 | var li = _search[i].split( '=' ); 36 | data[ li[0] ] = li[1]; 37 | } 38 | return data[ id ]; 39 | } catch (e){ 40 | return null; 41 | } 42 | 43 | } 44 | 45 | return { 46 | apply: apply, 47 | isArray: isArray, 48 | searchHref: searchHref 49 | } 50 | }) 51 | -------------------------------------------------------------------------------- /check/model/action.js: -------------------------------------------------------------------------------- 1 | 2 | /******************* 3 | module 4 | *******************/ 5 | var DB = require( './db' ); 6 | 7 | /******************* 8 | model 9 | *******************/ 10 | var ActionSchema = new DB.Schema({ 11 | name: String, 12 | kind: String, 13 | description: String, 14 | url: String, 15 | method: String, 16 | params: Object, 17 | owner: String, 18 | date: Date, 19 | sort: Number 20 | }); 21 | 22 | var ActionModel = DB.mongoose.model( 'action', ActionSchema, 'action' ); 23 | 24 | /******************* 25 | method 26 | *******************/ 27 | function *create( data, cb ){ 28 | 29 | return yield ( new ActionModel( data )).save(); 30 | } 31 | 32 | function *fetch( data ){ 33 | 34 | return yield ActionModel.find( data ).exec(); 35 | 36 | } 37 | 38 | function *update( data, cb ){ 39 | 40 | var id = data._id, 41 | owner = data.owner; 42 | delete data._id; 43 | delete data.owner; 44 | return yield ActionModel.update( {_id: id, owner: owner}, data, {} ); 45 | 46 | } 47 | 48 | function *remove( data, cb ){ 49 | 50 | return yield ActionModel.remove( {_id: data.id} ); 51 | 52 | } 53 | 54 | module.exports = { 55 | create: create, 56 | fetch: fetch, 57 | update: update, 58 | remove: remove 59 | } 60 | 61 | -------------------------------------------------------------------------------- /serverES6/controller/route.js: -------------------------------------------------------------------------------- 1 | import blog from './blog'; 2 | import comment from './comment'; 3 | import {logFile} from '../lib/loger'; 4 | 5 | const Routes = { 6 | blog, 7 | comment 8 | } 9 | 10 | const Router = ( router ) => { 11 | 12 | router.use(( req, res, next ) => { 13 | console.log( `${req.method}===${req.path}`); 14 | logFile.info( `${req.method}===${req.path}` ); 15 | console.log('######################') 16 | console.log(req) 17 | console.log('*********************') 18 | console.log(req.body) 19 | next(); 20 | }); 21 | 22 | router.get( '/', ( req, res, next ) => { 23 | res.redirect( '/blog/list' ); 24 | }); 25 | 26 | for( let model in Routes ){ 27 | Routes[model].map( item => { 28 | router.route(`/${model}${item.path}`)[item.method](( req, res, next ) => { 29 | if( item.render ){ 30 | const path = `${typeof item.render === 'string' ? item.render : item.render( req.query.id )}` 31 | res.render( path, item.config || {} ) 32 | } else { 33 | item.request( req, res ); 34 | } 35 | }); 36 | }); 37 | } 38 | 39 | router.use( ( req, res, next ) => { 40 | res.status( 404 ); 41 | res.send( '404' ); 42 | }); 43 | return router 44 | 45 | } 46 | 47 | export { 48 | Router 49 | } -------------------------------------------------------------------------------- /check/views/common/header.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | UPOPEN 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |
15 | 20 | 30 |
31 |
32 |
33 | -------------------------------------------------------------------------------- /web/views/blog/info.htx: -------------------------------------------------------------------------------- 1 | <% include ../../common/header.ejs %> 2 |
3 |
4 |
5 | {title} 6 | {kind} 7 | 8 |
9 |
10 | Views: {view} 11 | Comments: {comment} 12 | Date: {date} 13 |
14 |
{content}
15 |
16 |
17 |
18 | 19 |
20 |
21 |
22 |
23 |

24 |
25 |
26 |
27 | 28 | <% include ../../common/slide.ejs %> 29 | <% include ../../common/footer.ejs %> 30 | -------------------------------------------------------------------------------- /webES6/views/blog/info/5720b477303846b20a81e1ed.ejs: -------------------------------------------------------------------------------- 1 | <% include ../../common/header.ejs %> 2 |
3 |
4 |
5 | Hi 6 | nodejs 7 | 8 |
9 |
10 | 12 | Date: 2016-04-27 13 |
14 |

hello

15 |
16 |
17 |
18 | 19 |
20 |
21 |
22 |
23 |

24 |
25 |
26 |
27 | 28 | <% include ../../common/slide.ejs %> 29 | <% include ../../common/footer.ejs %> 30 | -------------------------------------------------------------------------------- /webES6/views/blog/info/5720ac218a3e258a0a287d78.ejs: -------------------------------------------------------------------------------- 1 | <% include ../../common/header.ejs %> 2 |
3 |
4 |
5 | hi 6 | nodejs 7 | 8 |
9 |
10 | 12 | Date: 2016-04-27 13 |
14 |

wewe

15 |
16 |
17 |
18 | 19 |
20 |
21 |
22 |
23 |

24 |
25 |
26 |
27 | 28 | <% include ../../common/slide.ejs %> 29 | <% include ../../common/footer.ejs %> 30 | -------------------------------------------------------------------------------- /webES6/views/blog/info/5720b1b499f705a10a481225.ejs: -------------------------------------------------------------------------------- 1 | <% include ../../common/header.ejs %> 2 |
3 |
4 |
5 | hi 6 | nodejs 7 | 8 |
9 |
10 | 12 | Date: 2016-04-27 13 |
14 |

heelo

15 |
16 |
17 |
18 | 19 |
20 |
21 |
22 |
23 |

24 |
25 |
26 |
27 | 28 | <% include ../../common/slide.ejs %> 29 | <% include ../../common/footer.ejs %> 30 | -------------------------------------------------------------------------------- /assets/module/blog/mis/mis.js: -------------------------------------------------------------------------------- 1 | !function(e){function a(i){if(n[i])return n[i].exports;var t=n[i]={exports:{},id:i,loaded:!1};return e[i].call(t.exports,t,t.exports,a),t.loaded=!0,t.exports}var n={};return a.m=e,a.c=n,a.p="",a(0)}([function(e,a){function n(e,a,n){var t=e?{kind:e}:{};c=!0,$.ajax({url:"/blog/fetchEdit",type:"get",dataType:"json",data:t,success:function(e){0==e.code&&i(e.data)}})}function i(e){var a=[];$.each(e,function(e,n){a.push(t(n))}),$("#blogBox").append(a)}function t(e){e.date=e.date.slice(0,10),e.summary=e.summary.slice(0,140);var a=o.replace(/\{(.*?)\}/g,function(a,n){return e[n]});return a=$(a),a.find(".delete").on("click",function(){d(e._id)}),$("
").addClass("blogItem").append(a)}function d(e){var a={id:e};$.ajax({url:"/blog/remove",type:"delete",dataType:"json",data:a,success:function(e){0==e.code}})}var o=['
','{title}','{kind}',"
",'
','delete','edit',"
"].join(""),c=!1,r=0,l=50;!function(){var e="";location.search&&(e=location.search.slice(1).split("=")[1]),n(e,r,l),$(window).on("scrollLoading",function(){c||n(e,r+=l,l)})}()}]); 2 | //# sourceMappingURL=mis.js.map -------------------------------------------------------------------------------- /check/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "upopen-check", 3 | "version": "0.0.1", 4 | "description": "this is a project, used to verify the server interface", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/xiaolulu/upopen.git" 12 | }, 13 | "keywords": [ 14 | "check" 15 | ], 16 | "author": "jxiao", 17 | "license": "ISC", 18 | "bugs": { 19 | "url": "https://github.com/xiaolulu/upopen/issues" 20 | }, 21 | "homepage": "https://github.com/xiaolulu/upopen#readme", 22 | "dependencies": { 23 | "co-redis": "^2.0.0", 24 | "ejs": "^2.3.4", 25 | "express": "^4.13.3", 26 | "koa": "^1.1.2", 27 | "koa-bodyparser": "^2.0.1", 28 | "koa-request": "^1.0.0", 29 | "koa-router": "^5.3.0", 30 | "koa-static": "^1.5.2", 31 | "koa-views": "^3.1.0", 32 | "log4js": "^0.6.29", 33 | "mongoose": "^4.2.4", 34 | "redis": "^2.4.2", 35 | "request": "^2.67.0" 36 | }, 37 | "devDependencies": { 38 | "css-loader": "^0.22.0", 39 | "file-loader": "^0.8.4", 40 | "jsx-loader": "^0.13.2", 41 | "style-loader": "^0.13.0", 42 | "url-loader": "^0.5.6", 43 | "webpack": "^1.12.3" 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /webES6/views/blog/info/571e1eb7a61a83b714a42c6a.ejs: -------------------------------------------------------------------------------- 1 | <% include ../../common/header.ejs %> 2 |
3 |
4 |
5 | 123123123 6 | nodejs 7 | 8 |
9 |
10 | 12 | Date: 2016-04-25 13 |
14 |

123123dddd

15 |
16 |
17 |
18 | 19 |
20 |
21 |
22 |
23 |

24 |
25 |
26 |
27 | 28 | <% include ../../common/slide.ejs %> 29 | <% include ../../common/footer.ejs %> 30 | -------------------------------------------------------------------------------- /check/lib/redis.js: -------------------------------------------------------------------------------- 1 | 2 | var redis = require( 'redis' ), 3 | coRedis = require( 'co-redis' ), 4 | qs = require( 'querystring' ), 5 | config = require( '../config/redis' ); 6 | 7 | /******************************* redis client create ***************************************/ 8 | var client = redis.createClient( redis.port, redis.host ), 9 | coClient = coRedis( client ); 10 | 11 | /******************************* redis client create ***************************************/ 12 | client.on("error", function (err) { 13 | console.log( 'redis error ' ); 14 | }); 15 | 16 | client.on( 'connect', function(){ 17 | console.log( 'redis connect ' ); 18 | }); 19 | 20 | /******************************* redis checked is connected before do something ***************************************/ 21 | function *connect(){ 22 | 23 | if( !client.connected ){ 24 | redis.createClient( redis.port, redis.host ); 25 | yield client.on( 'connect' ); 26 | } 27 | 28 | } 29 | 30 | function *get( key,cb ){ 31 | 32 | yield connect(); 33 | return yield coClient.get( key ); 34 | 35 | } 36 | 37 | function *set( key, value ){ 38 | 39 | yield connect(); 40 | return yield coClient.set( key, value ); 41 | 42 | } 43 | 44 | module.exports = { 45 | get: get, 46 | set: set 47 | } 48 | -------------------------------------------------------------------------------- /webES6/views/blog/info/5720b757a6e555c30a890179.ejs: -------------------------------------------------------------------------------- 1 | <% include ../../common/header.ejs %> 2 |
3 |
4 |
5 | Hi 6 | nodejs 7 | 8 |
9 |
10 | 12 | Date: 2016-04-27 13 |
14 |

hello

15 |
16 |
17 |
18 | 19 |
20 |
21 |
22 |
23 |

24 |
25 |
26 |
27 | 28 | <% include ../../common/slide.ejs %> 29 | <% include ../../common/footer.ejs %> 30 | -------------------------------------------------------------------------------- /webES6/views/blog/info/5720b97d772850cb0a90d786.ejs: -------------------------------------------------------------------------------- 1 | <% include ../../common/header.ejs %> 2 |
3 |
4 |
5 | qwe 6 | nodejs 7 | 8 |
9 |
10 | 12 | Date: 2016-04-27 13 |
14 |

qweeqe

15 |
16 |
17 |
18 | 19 |
20 |
21 |
22 |
23 |

24 |
25 |
26 |
27 | 28 | <% include ../../common/slide.ejs %> 29 | <% include ../../common/footer.ejs %> 30 | -------------------------------------------------------------------------------- /web/assets/module/user/info/info.css: -------------------------------------------------------------------------------- 1 | .userInfo{ 2 | padding: 40px; 3 | min-height: 400px; 4 | background: #fff; 5 | } 6 | 7 | .addBlog{ 8 | padding: 20px; 9 | } 10 | 11 | .profile{ 12 | width: 180px; 13 | padding: 20px 10px; 14 | min-height: 450px; 15 | float: right; 16 | text-align: center; 17 | } 18 | 19 | .selfname{ 20 | line-height: 40px; 21 | } 22 | 23 | .fruit{ 24 | width: 722px; 25 | float: left; 26 | } 27 | 28 | .tab{ 29 | border-bottom: 1px solid #afafaf; 30 | height: 40px; 31 | } 32 | 33 | .tabMenu{ 34 | margin-right: 20px; 35 | padding: 10px; 36 | line-height: 20px; 37 | height: 20px; 38 | } 39 | 40 | .tabMenuCurrent{ 41 | background-color: #89BCE3; 42 | color: #fff; 43 | } 44 | 45 | .blogItem{ 46 | margin: 20px 0; 47 | padding: 10px 0; 48 | border-bottom: 1px solid #e3e3e3; 49 | position: relative; 50 | } 51 | 52 | .blogItem .info{ 53 | height: 40px; 54 | } 55 | 56 | .blogItem .kind{ 57 | display: inline-block; 58 | margin: 0 0 0 20px; 59 | background: #F87428; 60 | color: #fff; 61 | padding: 0 2px; 62 | } 63 | 64 | .blogItem .tool{ 65 | } 66 | 67 | .blogItem .tool span{ 68 | margin-right: 20px; 69 | } 70 | 71 | .blogItem .handle{ 72 | position: absolute; 73 | right: 10px; 74 | top: 10px; 75 | } 76 | 77 | .blogItem .handle a{ 78 | margin-left: 20px; 79 | } 80 | 81 | -------------------------------------------------------------------------------- /webES6/views/blog/list.ejs: -------------------------------------------------------------------------------- 1 | <% include ../common/header.ejs %> 2 |
3 | 22 |
23 | 46 | <% include ../common/slide.ejs %> 47 | <% include ../common/footer.ejs %> -------------------------------------------------------------------------------- /assets/widget/hint/hint.css: -------------------------------------------------------------------------------- 1 | .Hint { 2 | background: #1C9E22; 3 | position: fixed; 4 | right: 0; 5 | bottom: -35px; 6 | z-index: 1000; 7 | height: 32px; 8 | line-height: 32px; 9 | color: #fff; 10 | text-align: center; 11 | min-width: 200px; 12 | padding: 0 20px; 13 | border: 3px solid #fff; 14 | border-bottom: none; } 15 | 16 | .Hintdown { 17 | -webkit-prespective: 300; 18 | -webkit-transform-style: preserve-3d; 19 | -webkit-animation-name: back-y-spin; 20 | -webkit-animation-duration: .5s; 21 | -webkit-animation-iteration-count: 1; 22 | -webkit-animation-timing-function: ease-out; 23 | -webkit-animation-name: Hintdown; 24 | -webkit-animation-delay: .1s; 25 | -webkit-animation-fill-mode: forwards; } 26 | 27 | @-webkit-keyframes Hintdown { 28 | 0% { 29 | bottom: 0px; } 30 | 100% { 31 | bottom: -35px; } } 32 | 33 | .Hintup { 34 | -webkit-prespective: 300; 35 | -webkit-transform-style: preserve-3d; 36 | -webkit-animation-name: back-y-spin; 37 | -webkit-animation-duration: .5s; 38 | -webkit-animation-iteration-count: 1; 39 | -webkit-animation-timing-function: ease-out; 40 | -webkit-animation-name: Hintup; 41 | -webkit-animation-fill-mode: forwards; } 42 | 43 | @-webkit-keyframes Hintup { 44 | 0% { 45 | bottom: -35px; } 46 | 100% { 47 | bottom: 0; } } 48 | -------------------------------------------------------------------------------- /static/assets/widget/hint/hint.css: -------------------------------------------------------------------------------- 1 | .Hint { 2 | background: #1C9E22; 3 | position: fixed; 4 | right: 0; 5 | bottom: -35px; 6 | z-index: 1000; 7 | height: 32px; 8 | line-height: 32px; 9 | color: #fff; 10 | text-align: center; 11 | min-width: 200px; 12 | padding: 0 20px; 13 | border: 3px solid #fff; 14 | border-bottom: none; } 15 | 16 | .Hintdown { 17 | -webkit-prespective: 300; 18 | -webkit-transform-style: preserve-3d; 19 | -webkit-animation-name: back-y-spin; 20 | -webkit-animation-duration: .5s; 21 | -webkit-animation-iteration-count: 1; 22 | -webkit-animation-timing-function: ease-out; 23 | -webkit-animation-name: Hintdown; 24 | -webkit-animation-delay: .1s; 25 | -webkit-animation-fill-mode: forwards; } 26 | 27 | @-webkit-keyframes Hintdown { 28 | 0% { 29 | bottom: 0px; } 30 | 100% { 31 | bottom: -35px; } } 32 | 33 | .Hintup { 34 | -webkit-prespective: 300; 35 | -webkit-transform-style: preserve-3d; 36 | -webkit-animation-name: back-y-spin; 37 | -webkit-animation-duration: .5s; 38 | -webkit-animation-iteration-count: 1; 39 | -webkit-animation-timing-function: ease-out; 40 | -webkit-animation-name: Hintup; 41 | -webkit-animation-fill-mode: forwards; } 42 | 43 | @-webkit-keyframes Hintup { 44 | 0% { 45 | bottom: -35px; } 46 | 100% { 47 | bottom: 0; } } 48 | -------------------------------------------------------------------------------- /webES6/assets/widget/hint/hint.css: -------------------------------------------------------------------------------- 1 | .Hint { 2 | background: #1C9E22; 3 | position: fixed; 4 | right: 0; 5 | bottom: -35px; 6 | z-index: 1000; 7 | height: 32px; 8 | line-height: 32px; 9 | color: #fff; 10 | text-align: center; 11 | min-width: 200px; 12 | padding: 0 20px; 13 | border: 3px solid #fff; 14 | border-bottom: none; } 15 | 16 | .Hintdown { 17 | -webkit-prespective: 300; 18 | -webkit-transform-style: preserve-3d; 19 | -webkit-animation-name: back-y-spin; 20 | -webkit-animation-duration: .5s; 21 | -webkit-animation-iteration-count: 1; 22 | -webkit-animation-timing-function: ease-out; 23 | -webkit-animation-name: Hintdown; 24 | -webkit-animation-delay: .1s; 25 | -webkit-animation-fill-mode: forwards; } 26 | 27 | @-webkit-keyframes Hintdown { 28 | 0% { 29 | bottom: 0px; } 30 | 100% { 31 | bottom: -35px; } } 32 | 33 | .Hintup { 34 | -webkit-prespective: 300; 35 | -webkit-transform-style: preserve-3d; 36 | -webkit-animation-name: back-y-spin; 37 | -webkit-animation-duration: .5s; 38 | -webkit-animation-iteration-count: 1; 39 | -webkit-animation-timing-function: ease-out; 40 | -webkit-animation-name: Hintup; 41 | -webkit-animation-fill-mode: forwards; } 42 | 43 | @-webkit-keyframes Hintup { 44 | 0% { 45 | bottom: -35px; } 46 | 100% { 47 | bottom: 0; } } 48 | -------------------------------------------------------------------------------- /webES6/lib/loger.js: -------------------------------------------------------------------------------- 1 | import log4js from 'log4js'; 2 | import { logDir } from '../config/config'; 3 | import { mkdirsSync } from '../lib/utils'; 4 | 5 | const path = `${logDir}/web/`; 6 | console.log( path ) 7 | 8 | mkdirsSync( path, '0777' ) && console.log(`mkdir log directory success`) 9 | 10 | const config = { 11 | 'appenders':[ 12 | { 13 | 'type': 'console', 14 | 'category':'console' 15 | }, 16 | { 17 | 'type': 'dateFile', 18 | 'category':'info', 19 | 'filename': '', 20 | 'pattern':'yyyyMMdd_info.log', 21 | 'alwaysIncludePattern':true 22 | }, 23 | { 24 | 'type': 'dateFile', 25 | 'category':'warn', 26 | 'filename':'', 27 | 'pattern':'yyyyMMdd_warn.log', 28 | 'alwaysIncludePattern':true 29 | }, 30 | { 31 | 'type': 'file', 32 | 'category': 'file', 33 | 'filename': '/file.log', 34 | 'maxLogSize': 1024*1028*10, 35 | 'backups': 10 36 | } 37 | ], 38 | replaceConsole: true, 39 | 'levels':{ 40 | 'console':'all', 41 | 'file': 'all', 42 | 'info': 'all', 43 | 'warn': 'warn' 44 | } 45 | } 46 | 47 | log4js.configure( config, { cwd: `${path}`} ); 48 | 49 | const logFile = log4js.getLogger( 'file' ); 50 | const logInfo = log4js.getLogger( 'info' ); 51 | const logWarn = log4js.getLogger( 'warn' ); 52 | 53 | export { 54 | logFile, 55 | logInfo, 56 | logWarn 57 | }; 58 | -------------------------------------------------------------------------------- /serverES6/lib/loger.js: -------------------------------------------------------------------------------- 1 | import log4js from 'log4js'; 2 | import { logDir } from '../config/config'; 3 | import { mkdirsSync } from '../lib/utils'; 4 | 5 | const path = `${logDir}/server/`; 6 | console.log( path ) 7 | 8 | mkdirsSync( path, '0777' ) && console.log(`mkdir log directory success`) 9 | 10 | const config = { 11 | 'appenders':[ 12 | { 13 | 'type': 'console', 14 | 'category':'console' 15 | }, 16 | { 17 | 'type': 'dateFile', 18 | 'category':'info', 19 | 'filename': '', 20 | 'pattern':'yyyyMMdd_info.log', 21 | 'alwaysIncludePattern':true 22 | }, 23 | { 24 | 'type': 'dateFile', 25 | 'category':'warn', 26 | 'filename':'', 27 | 'pattern':'yyyyMMdd_warn.log', 28 | 'alwaysIncludePattern':true 29 | }, 30 | { 31 | 'type': 'file', 32 | 'category': 'file', 33 | 'filename': '/file.log', 34 | 'maxLogSize': 1024*1028*10, 35 | 'backups': 10 36 | } 37 | ], 38 | replaceConsole: true, 39 | 'levels':{ 40 | 'console':'all', 41 | 'file': 'all', 42 | 'info': 'all', 43 | 'warn': 'warn' 44 | } 45 | } 46 | 47 | log4js.configure( config, { cwd: `${path}`} ); 48 | 49 | const logFile = log4js.getLogger( 'file' ); 50 | const logInfo = log4js.getLogger( 'info' ); 51 | const logWarn = log4js.getLogger( 'warn' ); 52 | 53 | export { 54 | logFile, 55 | logInfo, 56 | logWarn 57 | }; 58 | -------------------------------------------------------------------------------- /webES6/views/blog/info.htx: -------------------------------------------------------------------------------- 1 | <% include ../../common/header.ejs %> 2 |
3 |
4 |
5 | {title} 6 | {kind} 7 | 8 |
9 |
10 | 12 | Date: {date} 13 |
14 |
{summary}
15 |
{content}
16 |
17 |
18 |
19 | 20 |
21 |
22 |
23 |
24 |

25 |
26 |
27 |
28 | 29 | <% include ../../common/slide.ejs %> 30 | <% include ../../common/footer.ejs %> 31 | -------------------------------------------------------------------------------- /webES6/assets/widget/hint/hint.css?c317a49aab: -------------------------------------------------------------------------------- 1 | .Hint { 2 | background: #1C9E22; 3 | position: fixed; 4 | right: 0; 5 | bottom: -35px; 6 | z-index: 1000; 7 | height: 32px; 8 | line-height: 32px; 9 | color: #fff; 10 | text-align: center; 11 | min-width: 200px; 12 | padding: 0 20px; 13 | border: 3px solid #fff; 14 | border-bottom: none; } 15 | 16 | .Hintdown { 17 | -webkit-prespective: 300; 18 | -webkit-transform-style: preserve-3d; 19 | -webkit-animation-name: back-y-spin; 20 | -webkit-animation-duration: .5s; 21 | -webkit-animation-iteration-count: 1; 22 | -webkit-animation-timing-function: ease-out; 23 | -webkit-animation-name: Hintdown; 24 | -webkit-animation-delay: .1s; 25 | -webkit-animation-fill-mode: forwards; } 26 | 27 | @-webkit-keyframes Hintdown { 28 | 0% { 29 | bottom: 0px; } 30 | 100% { 31 | bottom: -35px; } } 32 | 33 | .Hintup { 34 | -webkit-prespective: 300; 35 | -webkit-transform-style: preserve-3d; 36 | -webkit-animation-name: back-y-spin; 37 | -webkit-animation-duration: .5s; 38 | -webkit-animation-iteration-count: 1; 39 | -webkit-animation-timing-function: ease-out; 40 | -webkit-animation-name: Hintup; 41 | -webkit-animation-fill-mode: forwards; } 42 | 43 | @-webkit-keyframes Hintup { 44 | 0% { 45 | bottom: -35px; } 46 | 100% { 47 | bottom: 0; } } 48 | -------------------------------------------------------------------------------- /webES6/resource/widget/hint/hint.scss: -------------------------------------------------------------------------------- 1 | .Hint{ 2 | background: #1C9E22; 3 | position: fixed; 4 | right: 0; 5 | bottom: -35px; 6 | z-index: 1000; 7 | height: 32px; 8 | line-height: 32px; 9 | color: #fff; 10 | text-align: center; 11 | min-width: 200px; 12 | padding: 0 20px; 13 | border: 3px solid #fff; 14 | border-bottom: none; 15 | } 16 | 17 | .Hintdown{ 18 | -webkit-prespective:300; 19 | -webkit-transform-style:preserve-3d; 20 | -webkit-animation-name:back-y-spin; 21 | -webkit-animation-duration:.5s; 22 | -webkit-animation-iteration-count:1; 23 | -webkit-animation-timing-function:ease-out; 24 | -webkit-animation-name:Hintdown; 25 | -webkit-animation-delay: .1s; 26 | -webkit-animation-fill-mode: forwards; 27 | } 28 | 29 | @-webkit-keyframes Hintdown{ 30 | 0%{ 31 | bottom: 0px; 32 | } 33 | 100%{ 34 | bottom: -35px; 35 | } 36 | } 37 | 38 | .Hintup{ 39 | -webkit-prespective:300; 40 | -webkit-transform-style:preserve-3d; 41 | -webkit-animation-name:back-y-spin; 42 | -webkit-animation-duration:.5s; 43 | -webkit-animation-iteration-count:1; 44 | -webkit-animation-timing-function:ease-out; 45 | -webkit-animation-name:Hintup; 46 | -webkit-animation-fill-mode: forwards; 47 | } 48 | 49 | @-webkit-keyframes Hintup{ 50 | 0%{ 51 | bottom: -35px; 52 | } 53 | 100%{ 54 | bottom: 0; 55 | } 56 | } -------------------------------------------------------------------------------- /webES6/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "upopen_web_es6", 3 | "version": "1.0.0", 4 | "description": "使用ES6开发upopen web", 5 | "main": "server.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "潇", 10 | "license": "MIT", 11 | "devDependencies": { 12 | "babel-core": "^6.7.6", 13 | "babel-polyfill": "^6.7.4", 14 | "babel-preset-es2015": "^6.6.0", 15 | "body-parser": "^1.15.0", 16 | "css-loader": "^0.23.1", 17 | "ejs": "^2.4.1", 18 | "express": "^4.13.4", 19 | "gulp": "^3.9.1", 20 | "gulp-htmlmin": "^2.0.0", 21 | "gulp-imagemin": "^2.4.0", 22 | "gulp-jshint": "^2.0.1", 23 | "gulp-md5-assets": "^0.1.9", 24 | "gulp-md5-plus": "^0.2.5", 25 | "gulp-minify-css": "^1.2.4", 26 | "gulp-sass": "^2.3.1", 27 | "gulp-util": "^3.0.7", 28 | "jshint": "^2.9.2", 29 | "mockjs": "^1.0.1-beta2", 30 | "node-fetch": "^1.5.1", 31 | "node-sass": "^3.5.1", 32 | "request": "^2.72.0", 33 | "require-dir": "^0.3.0", 34 | "sass-loader": "^3.2.0", 35 | "style-loader": "^0.13.1", 36 | "webpack-stream": "^3.2.0" 37 | }, 38 | "dependencies": { 39 | "highlight": "^0.2.4", 40 | "log4js": "^0.6.35", 41 | "markdown": "^0.5.0", 42 | "marked": "^0.3.5", 43 | "node-fetch": "^1.5.1", 44 | "webpack": "^1.13.0" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /check/assets/core/js/react-dom.js: -------------------------------------------------------------------------------- 1 | /** 2 | * ReactDOM v0.14.0 3 | * 4 | * Copyright 2013-2015, Facebook, Inc. 5 | * All rights reserved. 6 | * 7 | * This source code is licensed under the BSD-style license found in the 8 | * LICENSE file in the root directory of this source tree. An additional grant 9 | * of patent rights can be found in the PATENTS file in the same directory. 10 | * 11 | */ 12 | // Based off https://github.com/ForbesLindesay/umd/blob/master/template.js 13 | ;(function(f) { 14 | // CommonJS 15 | if (typeof exports === "object" && typeof module !== "undefined") { 16 | module.exports = f(require('react')); 17 | 18 | // RequireJS 19 | } else if (typeof define === "function" && define.amd) { 20 | define(['react'], f); 21 | 22 | // 23 | 24 | 25 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /check/views/common/footer.ejs: -------------------------------------------------------------------------------- 1 |
2 |
3 | 7 |
8 |
9 |
10 |
username
11 | 12 |
password
13 | 14 | 15 |
16 |

17 | Don't have an account yet? 18 | Sign up 19 |

20 |
21 |
22 | 23 | 24 | 25 | 26 | 27 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /web/test/case/core/js/base_case.js: -------------------------------------------------------------------------------- 1 | 2 | define(['assets/core/js/base'], function( Base ){ 3 | 4 | describe( 'checking String.trim', function(){ 5 | 6 | it( '\' str \' will be equal \'str\' ', function(){ 7 | expect( ' str '.trim() ).toEqual( 'str' ); 8 | }); 9 | 10 | }); 11 | 12 | describe( 'checking isArray', function(){ 13 | 14 | it( ' [] will be equal true ', function(){ 15 | expect( Base.isArray([]) ).toEqual( true ); 16 | }); 17 | 18 | it( ' {} will be equal false ', function(){ 19 | expect( Base.isArray({}) ).toEqual( false ); 20 | }); 21 | 22 | }); 23 | 24 | describe( 'checking apply', function(){ 25 | 26 | it( 'apply', function(){ 27 | var objA = { 28 | name: 'xiao', 29 | height: 174 30 | }, 31 | objB = { 32 | name: 'lulu', 33 | weight: 162, 34 | sex: 'miss' 35 | }, 36 | objC = { 37 | name: 'nana', 38 | education: 'undergraduate' 39 | }, 40 | obj = Base.apply( objA, objB, objC ); 41 | obj.should.have.property( 'name', 'nana' ); 42 | obj.should.have.property( 'height', 174 ); 43 | obj.should.have.property( 'weight', 162 ); 44 | obj.should.have.property( 'sex', 'miss' ); 45 | obj.should.have.property( 'education', 'undergraduate' ); 46 | }); 47 | 48 | }); 49 | 50 | describe( 'checking searchHref', function(){ 51 | 52 | it( 'searchHref', function(){ 53 | var location = 'id=account;name=upopen', 54 | id = 'id'; 55 | expect( Base.searchHref( location, id ) ).toEqual( 'account' ); 56 | }); 57 | 58 | }); 59 | 60 | 61 | 62 | }); 63 | -------------------------------------------------------------------------------- /static/module/blog/info/info.js: -------------------------------------------------------------------------------- 1 | require.config({paths:{common:"/assets/public/js/common",hint:"/assets/widget/hint/hint"}}),require(["hint","common"],function(n){function t(n){var t={id:n};$.ajax({url:"/blog/fetchList",type:"get",dataType:"json",data:t,success:function(t){0==t.code&&(e(n),a(t.data[0]))}})}function a(n){var t=c.replace(/\{(.*?)\}/g,function(t,a){return n[a]});$("#blogBox").prepend($("
").append(t))}function e(n){$.ajax({url:"/comment/fetchList",type:"get",dataType:"json",data:{owner:n},success:function(n){0==n.code&&s(n.data)}})}function s(n){var t=[];$.each(n,function(n,a){t.push(o(n,a))}),$("#commentWrap").append(t)}function o(n,t){var a=$("
").addClass("commentItem").append(r.replace(/\{(.*?)\}/g,function(n,a){return t[a]}));return a}var c=['
','{title}','{kind}','',"
",'
','Views: {view}','Comments: {comment}','Date: {date}',"
",'
{content}
'].join(""),i=$("#commentUser"),d=$("#commentContent");$("#commentForm").on("submit",function(){var n={owner:10002,userid:i.val(),content:d.val()};return $.ajax({url:"/comment/create",type:"post",dataType:"json",data:n,success:function(t){console.log(t),0==t.code&&$("#commentWrap").append(o(0,n))}}),!1});var r=['
{userid}{date}
{content}
'].join("");!function(){t(location.search.slice(1).split("=")[1])}()}); -------------------------------------------------------------------------------- /webES6/resource/module/blog/edit/edit.js: -------------------------------------------------------------------------------- 1 | var hint = require( '../../../widget/hint/hint' ).hint; 2 | 3 | var title = $( '#title' ), 4 | summary = $( '#summary' ), 5 | content = $( '#content' ), 6 | type = $( '#type' ), 7 | editorBtn = $( '#editorBtn' ), 8 | _id = ''; 9 | 10 | $( '#editorForm' ).on( 'submit', function(){ 11 | var data = { 12 | title: title.val(), 13 | summary: summary.val(), 14 | content: content.val(), 15 | kind: type.val(), 16 | tags: type.val() 17 | } 18 | url = '/blog/create'; 19 | if( _id = location.search.slice(1).split('=')[1] ){ 20 | data.id = _id; 21 | url = '/blog/update' 22 | } 23 | //editorBtn.attr( 'disabled', true ); 24 | $.ajax({ 25 | url: url, 26 | type: 'post', 27 | dataType: 'json', 28 | data: data, 29 | success: function( ret ){ 30 | if( ret.code == 0 ){ 31 | editorBtn.attr( 'disabled', false ); 32 | hint.show( '保存成功' ); 33 | if( url === '/blog/update' ){ 34 | return; 35 | } 36 | setTimeout( function(){ 37 | window.location.href = '/blog/mis'; 38 | }, 1000 ) 39 | } 40 | } 41 | }); 42 | return false; 43 | }); 44 | 45 | function fetchBlog( id ){ 46 | $.ajax({ 47 | url: '/blog/fetchEdit', 48 | type: 'get', 49 | dataType: 'json', 50 | data: { id: id }, 51 | success: function( ret ){ 52 | if( ret.code == 0 ){ 53 | title.val( ret.data[0].title ); 54 | _id = ret.data[0].id; 55 | content.val( ret.data[0].content ); 56 | summary.val( ret.data[0].summary ); 57 | type.val( ret.data[0].kind ) 58 | 59 | } 60 | console.log( ret ); 61 | } 62 | }); 63 | } 64 | 65 | !function(){ 66 | if( location.search ){ 67 | _id = location.search.slice(1).split('=')[1]; 68 | fetchBlog( _id ); 69 | } 70 | }(); -------------------------------------------------------------------------------- /web/assets/module/user/edit/edit.js: -------------------------------------------------------------------------------- 1 | 2 | require.config({ 3 | //baseUrl: basePath, 4 | paths: { 5 | common: '/assets/public/js/common', 6 | hint: '/assets/widget/hint/hint' 7 | } 8 | }) 9 | 10 | require([ 'hint', 'common' ], function( hint ){ 11 | 12 | var title = $( '#title' ), 13 | editor = $( '#editor' ), 14 | type = $( '#type' ), 15 | editorBtn = $( '#editorBtn' ), 16 | _id = ''; 17 | 18 | $( '#editorForm' ).on( 'submit', function(){ 19 | var data = { 20 | title: title.val(), 21 | content: editor.val(), 22 | kind: type.val(), 23 | tags: type.val() 24 | } 25 | url = '/blog/create'; 26 | if( _id ){ 27 | data.id = _id; 28 | url = '/blog/update' 29 | } 30 | editorBtn.attr( 'disabled', true ); 31 | $.ajax({ 32 | url: url, 33 | type: 'post', 34 | dataType: 'json', 35 | data: data, 36 | success: function( ret ){ 37 | if( ret.code == 0 ){ 38 | hint.show( '保存成功' ); 39 | setTimeout( function(){ 40 | window.location.href = window.location.protocol + '//' + window.location.host + '/user/self'; 41 | }, 1000 ) 42 | } 43 | console.log( ret ); 44 | } 45 | }); 46 | return false; 47 | }); 48 | 49 | function fetchBlog( id ){ 50 | $.ajax({ 51 | url: '/blog/fetchEdit', 52 | type: 'get', 53 | dataType: 'json', 54 | data: { id: id }, 55 | success: function( ret ){ 56 | if( ret.code == 0 ){ 57 | title.val( ret.data[0].title ); 58 | _id = ret.data[0].id; 59 | editor.val( ret.data[0].content ); 60 | } 61 | console.log( ret ); 62 | } 63 | }); 64 | } 65 | 66 | !function(){ 67 | if( location.search ){ 68 | fetchBlog( location.search.slice(1).split('=')[1] ); 69 | } 70 | }(); 71 | 72 | }) 73 | 74 | 75 | -------------------------------------------------------------------------------- /webES6/gulp.config.js: -------------------------------------------------------------------------------- 1 | const path = require( `path` ); 2 | const webpack = require(`webpack`); 3 | const src = path.join( __dirname, './resource' ); 4 | const dest = path.join( __dirname, '../assets' ); 5 | //const dest = path.join( __dirname, '../dev_assets/dev' ); 6 | const cview = path.join( __dirname, './cview' ); 7 | 8 | module.exports = { 9 | images: { 10 | src: `${src}/**/*.{png,jpg}`, 11 | dest: `${dest}` 12 | }, 13 | webpack: { 14 | devtool: 'source-map', 15 | entry: { 16 | '/module/blog/list/list': `${src}/module/blog/list/list`, 17 | '/module/blog/edit/edit': `${src}/module/blog/edit/edit`, 18 | '/module/blog/info/info': `${src}/module/blog/info/info`, 19 | '/module/blog/preview/preview': `${src}/module/blog/preview/preview`, 20 | '/module/blog/mis/mis': `${src}/module/blog/mis/mis` 21 | //'/vendor/js/jquery': `${src}/vendor/js/jquery` 22 | }, 23 | output: { 24 | path: dest, 25 | filename: `[name].js` 26 | }, 27 | resolve: { 28 | extensions: [``,`.js`], 29 | alias: { 30 | $: `jquery` 31 | } 32 | }, 33 | module: { 34 | loaders: [ 35 | { test: /\.scss$/, loader: `style!css!sass` } 36 | ] 37 | }, 38 | plugins : [ 39 | /*new webpack.optimize.MinChunkSizePlugin({ 40 | compress : { 41 | warnings: false 42 | } 43 | }), 44 | new webpack.optimize.UglifyJsPlugin({ 45 | compress: { 46 | warnings: false 47 | } 48 | })*/ 49 | ] 50 | }, 51 | sass: { 52 | src: `${src}/**/*.scss`, 53 | dest: `${dest}` 54 | }, 55 | jshint: { 56 | src: `${src}/**/*.js` 57 | }, 58 | md5: { 59 | src: `${dest}/**/*.css`, 60 | html: `./views/**/*.ejs`, 61 | dest: `${dest}` 62 | }, 63 | html: { 64 | src: `${cview}/**/*.ejs`, 65 | dest: `./views` 66 | } 67 | 68 | } -------------------------------------------------------------------------------- /webES6/controller/route.js: -------------------------------------------------------------------------------- 1 | import blog from './blog'; 2 | import comment from './comment'; 3 | import issue from './issue'; 4 | import {site} from '../config/config'; 5 | import {logFile} from '../lib/loger'; 6 | 7 | const Routes = { 8 | blog, 9 | comment, 10 | issue 11 | } 12 | 13 | const pipe = function( req, res, next ){ 14 | return function( res ){ 15 | res.end(); 16 | } 17 | } 18 | 19 | const Router = ( router ) => { 20 | 21 | router.use((req, res, next) => { 22 | if( req.path === '/favicon.ico' ){ 23 | res.end(); 24 | return; 25 | } 26 | logFile.info(`${req.method}==${req.path}`); 27 | console.log(`${req.method}==${req.path}`); 28 | next(); 29 | }) 30 | 31 | router.get( '/', ( req, res, next ) => { 32 | res.redirect( '/blog/list' ); 33 | }); 34 | 35 | for( let model in Routes ){ 36 | Routes[model].map( item => { 37 | router.route(`/${model}${item.path}`)[item.method](( req, res, next ) => { 38 | 39 | if( item.render ){ 40 | const path = `${typeof item.render === 'string' ? item.render : item.render( req.query.id )}`; 41 | console.log( item.path ); 42 | if( item.path === '/list' ){ 43 | res.render( path, Object.assign( item.config, site ), ( err, str ) => { res.write(str) } ); 44 | //( item.pipe && item.pipe( req, res, next ) ) || res.end(); 45 | item.pipe( req, res, next ) 46 | } else { 47 | res.render( path, Object.assign( item.config, site )); 48 | } 49 | 50 | } else { 51 | item.request( req, res ); 52 | } 53 | }); 54 | }); 55 | } 56 | 57 | router.use( ( req, res, next ) => { 58 | console.log(`${req.method}==${req.path}`) 59 | res.status( 404 ); 60 | res.render( 'noFound.ejs' ); 61 | }); 62 | return router 63 | 64 | } 65 | 66 | 67 | export default Router -------------------------------------------------------------------------------- /check/lib/toys.js: -------------------------------------------------------------------------------- 1 | 2 | var http = require( 'http' ), 3 | qs = require( 'querystring' ), 4 | logger = require( './logger' ), 5 | domain = require( 'domain' ), 6 | request = require( 'koa-request' ), 7 | crypto = require( 'crypto' ); 8 | 9 | var Domain = domain.create(); 10 | 11 | Domain.on( 'error', function( e ){ 12 | logger.error( e ); 13 | }); 14 | 15 | function exist( req, res, method ){ 16 | if( req.method == method ){ 17 | return true; 18 | } else { 19 | res.redirect( '/404.ejs' ); 20 | return false; 21 | } 22 | } 23 | 24 | function getClientIp( req ){ 25 | return req.headers['x-forwarded-for'] || 26 | req.connection.remoteAddress || 27 | req.socket.remoteAddress || 28 | req.connection.socket.remoteAddress; 29 | }; 30 | 31 | var Cookie = { 32 | 33 | get: function( req, name ){ 34 | var cookie = qs.parse( req.headers.cookie, ';', '=' ); 35 | return name ? cookie[ name ] : cookie; 36 | } 37 | 38 | } 39 | 40 | function createSID( req ){ 41 | var sha1 = crypto.createHash( 'sha1' ), 42 | ip = getClientIp( req ); 43 | sha1.update( ip ); 44 | return sha1.digest( 'hex' ); 45 | } 46 | 47 | function checkSID( req ){ 48 | var _cookie = Cookie.get( req, 'JSESSIONID' ); 49 | return createSID( req ) == _cookie; 50 | } 51 | 52 | function *requestA( options ){ 53 | var options = { 54 | url: options.hostname + options.path, 55 | method: options.method, 56 | form: options.data, 57 | headers: options.headers 58 | }; 59 | console.log( options ); 60 | var ret = yield request(options); //Yay, HTTP requests with no callbacks! 61 | return JSON.parse(ret.body); 62 | 63 | } 64 | 65 | module.exports = { 66 | exist: exist, 67 | createSID: createSID, 68 | checkSID: checkSID, 69 | requestA: requestA, 70 | Cookie: Cookie, 71 | Domain: Domain 72 | } 73 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | =========================================================================== 2 | **描述** 3 | 4 | 站点地址: 5 | http://www.upopen.cn 6 | 7 | 本博客旨在从一个系统的角度,系统的学习、使用js、nodejs、sql等周边知识 8 | 学习某技术点时单独做一个demo,难以深度理解应用,将其应用到项目中才是真正的掌握。 9 | 公开这些知识,以便和大家共同进步 10 | 11 | 本系统会尽量多且合理的使用各新知识点 12 | 13 | ============================================================================= 14 | 15 | **系统功能介绍** 16 | 17 | web: web服务端 18 | 19 | 站点前台服务,属前后端分离中的前台,负责页面渲染、与客户端及server端的数据交互,使用http协议 20 | 21 | server: 数据服务端 22 | 23 | 站点后台服务,属前后端分离中的后台,与web服务端及数据库的数据交互,不直接与客户端通信,实际项目中常会用java实现 24 | 25 | check: 26 | 27 | 属工具类服务,用于记录、验证接口功能,在前后端分离过程中,以方便并行开发 28 | 29 | 30 | ============================================================================= 31 | 32 | **系统架构介绍** 33 | 34 | docs:系统文档 35 | 36 | log: 系统日志,独立成单独的服务 37 | 38 | web/ 39 | 40 | check/ 41 | 42 | server/ 43 | 44 | check: 接口记录、验证系统,整体采用MVSC结构,server、web系统也采用相同结构 45 | 46 | app.js 47 | 48 | package.json 49 | 50 | webpack.config.js 51 | 52 | assets/ 静态资源包 53 | 54 | build/ react打包后文件 55 | 56 | model/ 数据层 57 | 58 | views/ 展示层 59 | 60 | controls/ 控制层 61 | 62 | server/ 业务层 63 | 64 | lib/ 工具包 65 | 66 | config/ 配置,运行前需要修改各config里的配置项 67 | 68 | test/ 测试 69 | 70 | server: 大致同check 71 | 72 | web: 大致同check,多了gulp 73 | 74 | static: 静态资源文件 75 | 76 | upload: 上传资源文件 77 | 78 | ============================================================================= 79 | 80 | 更新日志 81 | 82 | 16-01-14 83 | 84 | web服务新增文章静态化功能 85 | 86 | ************************************************** 87 | 88 | 16-01-12 89 | 90 | web新增单元测试功能 91 | 92 | should / jasmine / coverage / karma 93 | 94 | ************************************************** 95 | 96 | 16-01-06 97 | 98 | 基础功能上线 99 | 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /static/public/js/common.js: -------------------------------------------------------------------------------- 1 | require.config({paths:{hint:"/assets/widget/hint/hint",doc:"/assets/public/js/zh"}}),define(["hint","doc"],function(n,s){function e(n){n?($(".signInDialog").fadeIn(),$(".signInMask").fadeIn()):($(".signInMask").fadeOut(),$(".signInDialog").fadeOut(),t.val(""),d.val(""),l.removeClass("hide"),c.removeClass("hide"))}function o(){n.show("User isn't exist"),$(".signInDialog").addClass("dialogWrapError"),setTimeout(function(){$(".signInDialog").removeClass("dialogWrapError")},1e3)}function a(n){n?($(".beforeSignIn").hide(),$(".afterSignIn").show()):($(".beforeSignIn").show(),$(".afterSignIn").hide())}function i(){var n=($.cookies.get("userhead"),$.cookies.get("JSESSIONID"));a(n||!1)}var r=!0,t=$("#username"),d=$("#password");$(".signInMask").on("click",function(){e(!1)}),$("#toSignIn").on("click",function(){e(!0)}),$("#singInLink").on("click",function(){r=!r;var n,s,e;r?(n="SIGN IN",s="Don't have an account yet?",e="Sign up"):(n="CREATE ACCOUNT",s="Already have an account?",e="Sign in"),$("#singInLink").html(e),$(".signInDes").html(s),$(".signInBtn").html(n)});var l=$(".forUsername"),c=$(".forPassword");l.on("click",function(){l.addClass("holderOn"),t.get(0).focus()}),t.on("blur",function(){this.value?l.addClass("hide"):l.removeClass("hide"),l.removeClass("holderOn").addClass("holderOff")}).on("focus",function(){l.addClass("holderOn").removeClass("holderOff"),t.get(0).focus()}),c.on("click",function(){c.addClass("holderOn"),d.get(0).focus()}),d.on("blur",function(){this.value?c.addClass("hide"):c.removeClass("hide"),c.removeClass("holderOn").addClass("holderOff")}).on("focus",function(){c.addClass("holderOn").removeClass("holderOff"),d.get(0).focus()}),$(".signInForm").on("submit",function(){var n={username:t.val(),password:d.val()},i=r;return $.ajax({url:i?"/user/login":"/user/register",type:i?"get":"post",dataType:"json",data:n,success:function(n){0===n.code?(e(!1),a(!0)):o(s[n.code])}}),!1}),function(){i()}()}); -------------------------------------------------------------------------------- /server/controller/index.js: -------------------------------------------------------------------------------- 1 | var user = require( '../server/user' ), 2 | blog = require( '../server/blog' ), 3 | comment = require( '../server/comment' ), 4 | toys = require( '../lib/toys' ), 5 | logger = require( '../lib/logger' ); 6 | 7 | module.exports = function( app ){ 8 | 9 | app.use( function( req, res, next ){ 10 | logger.info( req.method + '::::' + req.path ); 11 | console.log( req.method + '::::' + req.path ); 12 | toys.Domain.run( function(){ 13 | next(); 14 | }); 15 | }); 16 | 17 | app.post( '/user/register', function( req, res ){ 18 | user.register( req, res ); 19 | }); 20 | 21 | app.get( '/user/fetchInfo', function( req, res ){ 22 | user.fetchInfo( req, res ); 23 | }); 24 | 25 | app.get( '/user/login', function( req, res ){ 26 | user.login( req, res ); 27 | }); 28 | 29 | app.get( '/user/logout', function( req, res ){ 30 | user.logout( req, res ); 31 | }); 32 | 33 | app.post( '/user/update', function( req, res ){ 34 | user.update( req,res ); 35 | }); 36 | 37 | app.post( '/blog/update', function( req, res ){ 38 | blog.update( req, res ); 39 | }); 40 | 41 | app.post( '/blog/create', function( req, res ){ 42 | blog.create( req, res ); 43 | }); 44 | 45 | app.delete( '/blog/remove', function( req, res ){ 46 | blog.remove( req, res ); 47 | }); 48 | 49 | app.get( '/blog/fetch', function( req, res ){ 50 | blog.fetch( req, res ); 51 | }); 52 | 53 | app.get( '/comment/fetch', function( req, res ){ 54 | comment.fetch( req, res ); 55 | }); 56 | 57 | 58 | app.post( '/comment/update', function( req, res ){ 59 | comment.update( req, res ); 60 | }); 61 | 62 | app.post( '/comment/create', function( req, res ){ 63 | comment.create( req, res ); 64 | }); 65 | 66 | app.delete( '/comment/remove', function( req, res ){ 67 | comment.remove( req, res ); 68 | }); 69 | 70 | app.use( function( req, res ){ 71 | 72 | res.send({code: 404, msg: '404 error'}); 73 | 74 | }) 75 | 76 | } 77 | 78 | 79 | -------------------------------------------------------------------------------- /serverES6/model/db.js: -------------------------------------------------------------------------------- 1 | /** 2 | 模块引入 3 | */ 4 | import mongoose from 'mongoose'; 5 | import { mongodb as mongodbConfig } from '../config/config'; 6 | 7 | /** 8 | 数据库连接 9 | */ 10 | mongoose.connect( `mongodb://${mongodbConfig.host}:${mongodbConfig.port}/${mongodbConfig.name}`); 11 | 12 | const db = mongoose.connection; 13 | db.on( 'error', function( err ){ 14 | console.log( `mongodb connect err ${err}` ); 15 | }).on( 'open', function( err ){ 16 | console.log( `mongodb connect success` ); 17 | }) 18 | 19 | /** 20 | 数据存储规范化 21 | */ 22 | function initData( Schema, Data ){ 23 | let data = {}; 24 | for( var key in Schema.tree ){ 25 | console.log( key ) 26 | if( key === '_id' || key === '_v' ) break; 27 | data[key] = Data[key]; 28 | } 29 | return data; 30 | } 31 | 32 | /** 33 | 数据插入 34 | */ 35 | const savedb = ( Model, Schema, Data, cb ) => { 36 | new Model( initData( Schema, Data )).save( ( err, docs ) => { 37 | if( err ){ 38 | cb( {code: -1, data: [], msg: err } ); 39 | } else { 40 | cb( {code: 0, data: docs, msg: `save success`}) 41 | } 42 | } ); 43 | }; 44 | 45 | /** 46 | 数据更新 47 | */ 48 | const updatedb = ( Model, id, data, cb ) => { 49 | Model.findByIdAndUpdate( id, data, ( err, docs ) => { 50 | if( err ){ 51 | cb( {code: -1, data: [], msg: err } ); 52 | } else { 53 | cb( {code: 0, data: docs, msg: `update success`}) 54 | } 55 | } ); 56 | }; 57 | 58 | /** 59 | 数据查询 60 | */ 61 | const fetchdb = ( Model, data, cb ) => { 62 | if( data.id ) data._id = data.id; 63 | delete data.id; 64 | Model.find( data, ( err, docs ) => { 65 | if( err ){ 66 | cb( {code: -1, data: [], msg: err } ); 67 | } else { 68 | cb( {code: 0, data: docs, msg: `fetch success`}) 69 | } 70 | } ).sort({date: -1}); 71 | }; 72 | 73 | /** 74 | 数据删除 75 | */ 76 | const removedb = ( Model, id, cb ) => { 77 | Model.remove( {_id: id}, ( err, docs ) => { 78 | if( err ){ 79 | cb( {code: -1, data: [], msg: err } ); 80 | } else { 81 | cb( {code: 0, data: docs, msg: `fetch success`}) 82 | } 83 | } ); 84 | }; 85 | 86 | export { 87 | mongoose, 88 | savedb, 89 | updatedb, 90 | fetchdb, 91 | removedb 92 | } -------------------------------------------------------------------------------- /webES6/resource/public/css/markdown.scss: -------------------------------------------------------------------------------- 1 | .markdown{ 2 | h1, h2, h3, h4, h5, h6 { 3 | font-weight: normal; 4 | line-height: 2em; 5 | } 6 | 7 | h1 { 8 | color: #000000; 9 | font-size: 28pt; 10 | } 11 | 12 | h2 { 13 | border-bottom: 1px solid #CCCCCC; 14 | color: #000000; 15 | font-size: 24px; 16 | } 17 | 18 | h3 { 19 | font-size: 18px; 20 | } 21 | 22 | h4 { 23 | font-size: 16px; 24 | } 25 | 26 | h5 { 27 | font-size: 14px; 28 | } 29 | 30 | h6 { 31 | color: #777777; 32 | background-color: inherit; 33 | font-size: 14px; 34 | } 35 | 36 | hr { 37 | height: 0.2em; 38 | border: 0; 39 | color: #CCCCCC; 40 | background-color: #CCCCCC; 41 | } 42 | 43 | p, blockquote, ul, ol, dl, li, table, pre { 44 | margin: 15px 0; 45 | } 46 | 47 | ul, ol{ 48 | margin: 15px 20px; 49 | } 50 | 51 | a, a:visited { 52 | color: #4183C4; 53 | background-color: inherit; 54 | text-decoration: none; 55 | } 56 | 57 | img{ 58 | max-width: 100%; 59 | } 60 | 61 | #message { 62 | border-radius: 6px; 63 | border: 1px solid #ccc; 64 | display:block; 65 | width:100%; 66 | height:60px; 67 | margin:6px 0px; 68 | } 69 | 70 | button, #ws { 71 | font-size: 10pt; 72 | padding: 4px 6px; 73 | border-radius: 5px; 74 | border: 1px solid #bbb; 75 | background-color: #eee; 76 | } 77 | 78 | code, pre, #ws, #message { 79 | font-family: monospace, Monaco; 80 | font-size: 12px; 81 | border-radius: 3px; 82 | background-color: #F8F8F8; 83 | color: inherit; 84 | } 85 | 86 | code { 87 | border: 1px solid #EAEAEA; 88 | margin: 0 2px; 89 | padding: 0 5px; 90 | } 91 | 92 | pre { 93 | border: 1px solid #CCCCCC; 94 | overflow: auto; 95 | padding: 4px 8px; 96 | } 97 | 98 | pre > code { 99 | border: 0; 100 | margin: 0; 101 | padding: 0; 102 | } 103 | 104 | #ws { background-color: #f8f8f8; } 105 | 106 | .send { color:#77bb77; } 107 | .server { color:#7799bb; } 108 | .error { color:#AA0000; } 109 | em{ 110 | background: #e2f9cb; 111 | padding: 3px; 112 | } 113 | 114 | } 115 | 116 | -------------------------------------------------------------------------------- /static/assets/public/css/markdown.css: -------------------------------------------------------------------------------- 1 | .markdown h1, .markdown h2, .markdown h3, .markdown h4, .markdown h5, .markdown h6 { 2 | font-weight: bold; 3 | line-height: 2em; } 4 | 5 | .markdown h1 { 6 | color: #000000; 7 | font-size: 28pt; } 8 | 9 | .markdown h2 { 10 | border-bottom: 1px solid #CCCCCC; 11 | color: #000000; 12 | font-size: 24px; } 13 | 14 | .markdown h3 { 15 | font-size: 18px; } 16 | 17 | .markdown h4 { 18 | font-size: 16px; } 19 | 20 | .markdown h5 { 21 | font-size: 14px; } 22 | 23 | .markdown h6 { 24 | color: #777777; 25 | background-color: inherit; 26 | font-size: 14px; } 27 | 28 | .markdown hr { 29 | height: 0.2em; 30 | border: 0; 31 | color: #CCCCCC; 32 | background-color: #CCCCCC; } 33 | 34 | .markdown p, .markdown blockquote, .markdown ul, .markdown ol, .markdown dl, .markdown li, .markdown table, .markdown pre { 35 | margin: 15px 0; } 36 | 37 | .markdown ul, .markdown ol { 38 | margin: 15px 20px; } 39 | 40 | .markdown a, .markdown a:visited { 41 | color: #4183C4; 42 | background-color: inherit; 43 | text-decoration: none; } 44 | 45 | .markdown img { 46 | max-width: 100%; } 47 | 48 | .markdown #message { 49 | border-radius: 6px; 50 | border: 1px solid #ccc; 51 | display: block; 52 | width: 100%; 53 | height: 60px; 54 | margin: 6px 0px; } 55 | 56 | .markdown button, .markdown #ws { 57 | font-size: 10pt; 58 | padding: 4px 6px; 59 | border-radius: 5px; 60 | border: 1px solid #bbb; 61 | background-color: #eee; } 62 | 63 | .markdown code, .markdown pre, .markdown #ws, .markdown #message { 64 | font-family: Monaco; 65 | font-size: 10pt; 66 | border-radius: 3px; 67 | background-color: #F8F8F8; 68 | color: inherit; } 69 | 70 | .markdown code { 71 | border: 1px solid #EAEAEA; 72 | margin: 0 2px; 73 | padding: 0 5px; } 74 | 75 | .markdown pre { 76 | border: 1px solid #CCCCCC; 77 | overflow: auto; 78 | padding: 4px 8px; } 79 | 80 | .markdown pre > code { 81 | border: 0; 82 | margin: 0; 83 | padding: 0; } 84 | 85 | .markdown #ws { 86 | background-color: #f8f8f8; } 87 | 88 | .markdown .send { 89 | color: #77bb77; } 90 | 91 | .markdown .server { 92 | color: #7799bb; } 93 | 94 | .markdown .error { 95 | color: #AA0000; } 96 | -------------------------------------------------------------------------------- /webES6/resource/module/blog/list/list.js: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | var blogTmp = ['
', 4 | '{title}', 5 | '{kind}', 6 | '',///user/info?id={owner} 7 | '
', 8 | '
{summary}
', 9 | '', 10 | '
', 11 | //'Views: {view}', 12 | 'Comments: {comment}', 13 | 'Date: {date}', 14 | '
'].join(''); 15 | 16 | function fetchBlog( kind, start, limit ){ 17 | var data = kind ? {kind: kind} : {}; 18 | loading = true; 19 | //data.start = start; 20 | //data.limit = limit; 21 | $.ajax({ 22 | url: '/blog/fetch', 23 | type: 'get', 24 | dataType: 'json', 25 | data: data, 26 | success: function( ret ){ 27 | if( ret.code == 0 ){ 28 | renderItems( ret.data ); 29 | } else { 30 | 31 | } 32 | } 33 | }) 34 | } 35 | 36 | function renderItems( items ){ 37 | var els = []; 38 | $.each( items, function( index, item ){ 39 | els.push( render( item ) ); 40 | }); 41 | $( '#blogBox' ).append( els ); 42 | } 43 | 44 | function render( item ){ 45 | //item.summary += '
.....
<view all>'; 46 | item.date = item.date.slice(0,10); 47 | 48 | item.summary = item.summary.slice(0,140); 49 | var el = blogTmp.replace( /\{(.*?)\}/g, function( $1, $2 ){ 50 | return item[ $2 ]; 51 | }); 52 | return $( '
' ).append( el ); 53 | } 54 | 55 | var loading = false, 56 | start = 0, 57 | limit = 50; 58 | 59 | !function(){ 60 | var _search = ''; 61 | if( location.search ){ 62 | _search = location.search.slice(1).split('=')[1]; 63 | } 64 | //fetchBlog( _search, start, limit ); 65 | $( window ).on( 'scrollLoading', function(){ 66 | if( !loading ){ 67 | fetchBlog( _search, start += limit, limit ) 68 | } 69 | }) 70 | }(); 71 | */ -------------------------------------------------------------------------------- /web/assets/module/issue/index/index.js: -------------------------------------------------------------------------------- 1 | 2 | require.config({ 3 | //baseUrl: basePath, 4 | paths: { 5 | common: '/assets/public/js/common' 6 | } 7 | }) 8 | 9 | require([ 'common' ], function( ){ 10 | logo3d(1); 11 | var blogTmp = ['
', 12 | '{title}', 13 | '{kind}', 14 | '', 15 | '
', 16 | '
{summary}
', 17 | '', 18 | '
', 19 | 'Views: {view}', 20 | 'Comments: {comment}', 21 | 'Date: {date}', 22 | '
'].join(''); 23 | 24 | function fetchBlog( start, limit ){ 25 | loading = true; 26 | var data = { 27 | start: start || 0, 28 | limit: limit || 5 29 | } 30 | $.ajax({ 31 | url: '/blog/fetchList', 32 | type: 'get', 33 | dataType: 'json', 34 | data: data, 35 | success: function( ret ){ 36 | if( ret.code == 0 ){ 37 | renderItems( ret.data ); 38 | if( ret.data.length == limit ){ 39 | loading = false; 40 | } 41 | logo3d(0); 42 | } else { 43 | 44 | } 45 | } 46 | }) 47 | } 48 | 49 | function renderItems( items ){ 50 | var els = []; 51 | $.each( items, function( index, item ){ 52 | els.push( render( item ) ); 53 | }); 54 | $( '#blogBox' ).append( els ); 55 | 56 | } 57 | 58 | function render( item ){ 59 | item.date = item.date.split('T')[0]; 60 | var el = blogTmp.replace( /\{(.*?)\}/g, function( $1, $2 ){ 61 | return item[ $2 ]; 62 | }); 63 | return $( '
' ).append( el ); 64 | } 65 | 66 | var loading = false, 67 | start = 0, 68 | limit = 5; 69 | 70 | $( window ).on( 'scrollLoading', function(){ 71 | if( !loading ){ 72 | fetchBlog( start += limit, limit ) 73 | } 74 | }) 75 | 76 | !function(){ 77 | fetchBlog( start, limit ); 78 | }(); 79 | 80 | }) 81 | 82 | 83 | -------------------------------------------------------------------------------- /webES6/assets/public/css/markdown.css: -------------------------------------------------------------------------------- 1 | .markdown h1, .markdown h2, .markdown h3, .markdown h4, .markdown h5, .markdown h6 { 2 | font-weight: normal; 3 | line-height: 2em; } 4 | 5 | .markdown h1 { 6 | color: #000000; 7 | font-size: 28pt; } 8 | 9 | .markdown h2 { 10 | border-bottom: 1px solid #CCCCCC; 11 | color: #000000; 12 | font-size: 24px; } 13 | 14 | .markdown h3 { 15 | font-size: 18px; } 16 | 17 | .markdown h4 { 18 | font-size: 16px; } 19 | 20 | .markdown h5 { 21 | font-size: 14px; } 22 | 23 | .markdown h6 { 24 | color: #777777; 25 | background-color: inherit; 26 | font-size: 14px; } 27 | 28 | .markdown hr { 29 | height: 0.2em; 30 | border: 0; 31 | color: #CCCCCC; 32 | background-color: #CCCCCC; } 33 | 34 | .markdown p, .markdown blockquote, .markdown ul, .markdown ol, .markdown dl, .markdown li, .markdown table, .markdown pre { 35 | margin: 15px 0; } 36 | 37 | .markdown ul, .markdown ol { 38 | margin: 15px 20px; } 39 | 40 | .markdown a, .markdown a:visited { 41 | color: #4183C4; 42 | background-color: inherit; 43 | text-decoration: none; } 44 | 45 | .markdown img { 46 | max-width: 100%; } 47 | 48 | .markdown #message { 49 | border-radius: 6px; 50 | border: 1px solid #ccc; 51 | display: block; 52 | width: 100%; 53 | height: 60px; 54 | margin: 6px 0px; } 55 | 56 | .markdown button, .markdown #ws { 57 | font-size: 10pt; 58 | padding: 4px 6px; 59 | border-radius: 5px; 60 | border: 1px solid #bbb; 61 | background-color: #eee; } 62 | 63 | .markdown code, .markdown pre, .markdown #ws, .markdown #message { 64 | font-family: monospace, Monaco; 65 | font-size: 12px; 66 | border-radius: 3px; 67 | background-color: #F8F8F8; 68 | color: inherit; } 69 | 70 | .markdown code { 71 | border: 1px solid #EAEAEA; 72 | margin: 0 2px; 73 | padding: 0 5px; } 74 | 75 | .markdown pre { 76 | border: 1px solid #CCCCCC; 77 | overflow: auto; 78 | padding: 4px 8px; } 79 | 80 | .markdown pre > code { 81 | border: 0; 82 | margin: 0; 83 | padding: 0; } 84 | 85 | .markdown #ws { 86 | background-color: #f8f8f8; } 87 | 88 | .markdown .send { 89 | color: #77bb77; } 90 | 91 | .markdown .server { 92 | color: #7799bb; } 93 | 94 | .markdown .error { 95 | color: #AA0000; } 96 | -------------------------------------------------------------------------------- /webES6/assets/public/css/markdown.css?c568c5f6cb: -------------------------------------------------------------------------------- 1 | .markdown h1, .markdown h2, .markdown h3, .markdown h4, .markdown h5, .markdown h6 { 2 | font-weight: normal; 3 | line-height: 2em; } 4 | 5 | .markdown h1 { 6 | color: #000000; 7 | font-size: 28pt; } 8 | 9 | .markdown h2 { 10 | border-bottom: 1px solid #CCCCCC; 11 | color: #000000; 12 | font-size: 24px; } 13 | 14 | .markdown h3 { 15 | font-size: 18px; } 16 | 17 | .markdown h4 { 18 | font-size: 16px; } 19 | 20 | .markdown h5 { 21 | font-size: 14px; } 22 | 23 | .markdown h6 { 24 | color: #777777; 25 | background-color: inherit; 26 | font-size: 14px; } 27 | 28 | .markdown hr { 29 | height: 0.2em; 30 | border: 0; 31 | color: #CCCCCC; 32 | background-color: #CCCCCC; } 33 | 34 | .markdown p, .markdown blockquote, .markdown ul, .markdown ol, .markdown dl, .markdown li, .markdown table, .markdown pre { 35 | margin: 15px 0; } 36 | 37 | .markdown ul, .markdown ol { 38 | margin: 15px 20px; } 39 | 40 | .markdown a, .markdown a:visited { 41 | color: #4183C4; 42 | background-color: inherit; 43 | text-decoration: none; } 44 | 45 | .markdown img { 46 | max-width: 100%; } 47 | 48 | .markdown #message { 49 | border-radius: 6px; 50 | border: 1px solid #ccc; 51 | display: block; 52 | width: 100%; 53 | height: 60px; 54 | margin: 6px 0px; } 55 | 56 | .markdown button, .markdown #ws { 57 | font-size: 10pt; 58 | padding: 4px 6px; 59 | border-radius: 5px; 60 | border: 1px solid #bbb; 61 | background-color: #eee; } 62 | 63 | .markdown code, .markdown pre, .markdown #ws, .markdown #message { 64 | font-family: Monaco; 65 | font-size: 10pt; 66 | border-radius: 3px; 67 | background-color: #F8F8F8; 68 | color: inherit; } 69 | 70 | .markdown code { 71 | border: 1px solid #EAEAEA; 72 | margin: 0 2px; 73 | padding: 0 5px; } 74 | 75 | .markdown pre { 76 | border: 1px solid #CCCCCC; 77 | overflow: auto; 78 | padding: 4px 8px; } 79 | 80 | .markdown pre > code { 81 | border: 0; 82 | margin: 0; 83 | padding: 0; } 84 | 85 | .markdown #ws { 86 | background-color: #f8f8f8; } 87 | 88 | .markdown .send { 89 | color: #77bb77; } 90 | 91 | .markdown .server { 92 | color: #7799bb; } 93 | 94 | .markdown .error { 95 | color: #AA0000; } 96 | -------------------------------------------------------------------------------- /webES6/assets/public/css/markdown.css?600854b646: -------------------------------------------------------------------------------- 1 | .markdown h1, .markdown h2, .markdown h3, .markdown h4, .markdown h5, .markdown h6 { 2 | font-weight: normal; 3 | line-height: 2em; } 4 | 5 | .markdown h1 { 6 | color: #000000; 7 | font-size: 28pt; } 8 | 9 | .markdown h2 { 10 | border-bottom: 1px solid #CCCCCC; 11 | color: #000000; 12 | font-size: 24px; } 13 | 14 | .markdown h3 { 15 | font-size: 18px; } 16 | 17 | .markdown h4 { 18 | font-size: 16px; } 19 | 20 | .markdown h5 { 21 | font-size: 14px; } 22 | 23 | .markdown h6 { 24 | color: #777777; 25 | background-color: inherit; 26 | font-size: 14px; } 27 | 28 | .markdown hr { 29 | height: 0.2em; 30 | border: 0; 31 | color: #CCCCCC; 32 | background-color: #CCCCCC; } 33 | 34 | .markdown p, .markdown blockquote, .markdown ul, .markdown ol, .markdown dl, .markdown li, .markdown table, .markdown pre { 35 | margin: 15px 0; } 36 | 37 | .markdown ul, .markdown ol { 38 | margin: 15px 20px; } 39 | 40 | .markdown a, .markdown a:visited { 41 | color: #4183C4; 42 | background-color: inherit; 43 | text-decoration: none; } 44 | 45 | .markdown img { 46 | max-width: 100%; } 47 | 48 | .markdown #message { 49 | border-radius: 6px; 50 | border: 1px solid #ccc; 51 | display: block; 52 | width: 100%; 53 | height: 60px; 54 | margin: 6px 0px; } 55 | 56 | .markdown button, .markdown #ws { 57 | font-size: 10pt; 58 | padding: 4px 6px; 59 | border-radius: 5px; 60 | border: 1px solid #bbb; 61 | background-color: #eee; } 62 | 63 | .markdown code, .markdown pre, .markdown #ws, .markdown #message { 64 | font-family: monospace, Monaco; 65 | font-size: 12px; 66 | border-radius: 3px; 67 | background-color: #F8F8F8; 68 | color: inherit; } 69 | 70 | .markdown code { 71 | border: 1px solid #EAEAEA; 72 | margin: 0 2px; 73 | padding: 0 5px; } 74 | 75 | .markdown pre { 76 | border: 1px solid #CCCCCC; 77 | overflow: auto; 78 | padding: 4px 8px; } 79 | 80 | .markdown pre > code { 81 | border: 0; 82 | margin: 0; 83 | padding: 0; } 84 | 85 | .markdown #ws { 86 | background-color: #f8f8f8; } 87 | 88 | .markdown .send { 89 | color: #77bb77; } 90 | 91 | .markdown .server { 92 | color: #7799bb; } 93 | 94 | .markdown .error { 95 | color: #AA0000; } 96 | -------------------------------------------------------------------------------- /serverES6/server/blog.js: -------------------------------------------------------------------------------- 1 | import { mongoose, savedb, removedb, updatedb, fetchdb } from '../model/db'; 2 | import comment from './comment'; 3 | 4 | const Schema = mongoose.Schema; 5 | const BlogSchema = mongoose.Schema({ 6 | title: { type: String, default: 'title' }, 7 | summary: { type: String, default: 'summary' }, 8 | content: { type: String, default: 'content' }, 9 | date: { type: Date, default: new Date }, 10 | owner: { type: String, default: 'owner' }, 11 | sort: { type: Number, default: 0 }, 12 | view: { type: Number, default: 0 }, 13 | disabled: { type: Boolean, default: false }, 14 | kind: { type: String, default: 'kind' }, 15 | tags: { type: String, default: '' }, 16 | comment: { type: Number, default: 0 } 17 | }); 18 | 19 | const Blog = mongoose.model( 'blog', BlogSchema, 'blog' ); 20 | 21 | const blog = { 22 | save( req, res ){ 23 | req.body.date = new Date; 24 | const data = req.body; 25 | savedb( Blog, BlogSchema, data, ( ret ) => { res.send( ret )}) 26 | }, 27 | fetch( req, res ){ 28 | const data = req.query; 29 | fetchdb( Blog, data, ( ret ) => { 30 | res.send( ret ); 31 | Blog.update({'_id': data.blogId},{$inc:{view: 1}}, function(err){ 32 | console.log(err); 33 | }); 34 | } ) 35 | /*Blog.find( data ).populate( 'oid' ).exec( function( err, docs ){ 36 | console.log(`${err}--${docs}`); 37 | if( err ){ 38 | res.send( {code: -1, data: [], msg: err } ); 39 | } else { 40 | res.send( {code: 0, data: docs, msg: `fetch success`}) 41 | } 42 | })*/ 43 | }, 44 | update( req, res ){ 45 | req.body.date = new Date; 46 | const data = req.body 47 | const id = data.id; 48 | delete data.id; 49 | updatedb( Blog, id, data, ( ret ) => {res.send( ret )} ) 50 | }, 51 | updateViewNum( req, res ){ 52 | const data = req.query 53 | const id = data.id; 54 | Blog.update({'_id': id },{$inc:{view: 1}}, ( err, docs ) => { 55 | console.log(`${err} == ${docs}`) 56 | if( err ){ 57 | res.send( {code: -1, data: [], msg: err } ); 58 | } else { 59 | res.send( {code: 0, data: docs, msg: `update success`}) 60 | } 61 | } ); 62 | }, 63 | remove( req, res ){ 64 | const id = req.body.id; 65 | removedb( Blog, id, ( ret ) => {res.send( ret )}); 66 | }, 67 | 68 | Blog 69 | } 70 | 71 | export default blog; -------------------------------------------------------------------------------- /check/controller/index.js: -------------------------------------------------------------------------------- 1 | 2 | 'use strict'; 3 | /******************* 4 | module 5 | *******************/ 6 | var action = require( '../server/action' ), 7 | redis = require( '../lib/redis' ), 8 | qs = require( 'querystring' ), 9 | logger = require( '../lib/logger' ), 10 | util = require( 'util' ), 11 | Router = require( 'koa-router' ); 12 | 13 | /******************* 14 | all router 15 | *******************/ 16 | var router = new Router(); 17 | 18 | exports.all = function( app ){ 19 | 20 | app.use( function *(next){ 21 | 22 | try{ 23 | if( this.path == '/' ){ 24 | yield next; 25 | return; 26 | } 27 | logger.logInfo.info( this.method + '::::' + this.path ); 28 | var _time = (new Date).getTime(); 29 | var cookie = this.cookies.get( 'JSESSIONID' ), 30 | owner = 'visitor'; 31 | if( cookie && (owner = yield redis.get( cookie )) ){ 32 | owner = qs.parse( owner ).id; 33 | } 34 | this.request.query.owner = this.request.body.owner = owner; 35 | yield next; 36 | var _timeE = (new Date).getTime(), 37 | _timeU = _timeE - _time; 38 | if( _timeU >= 1000*2 ){ 39 | logger.logWarn.warn( this.method + '::::' + this.path + ' use time ' + _timeU ); 40 | } 41 | logger.logInfo.info( this.method + '::::' + this.path + 'end use time ' + _timeU ); 42 | } catch (e){ 43 | logger.logWarn.error( e ); 44 | this.body = { code: -1, msg: 'server error' }; 45 | } 46 | 47 | }); 48 | 49 | router.get( '/', function *( next ){ 50 | 51 | yield this.render( 'index' ); 52 | 53 | }); 54 | 55 | router.post( '/action/create', function *( next ){ 56 | 57 | this.body = yield action.create( this ); 58 | 59 | }); 60 | 61 | router.get( '/action/fetch', function *( next ){ 62 | 63 | this.body = yield action.fetch( this ); 64 | 65 | }); 66 | 67 | router.post( '/action/update', function *(){ 68 | 69 | this.body = yield action.update( this ); 70 | 71 | }); 72 | 73 | router.delete( '/action/remove', function *(){ 74 | 75 | this.body = yield action.remove( this ); 76 | 77 | }); 78 | 79 | router.post( '/action/check', function *(){ 80 | 81 | this.body = yield action.check( this ); 82 | 83 | }); 84 | 85 | router.all( '*', function *(){ 86 | 87 | this.body = '404'; 88 | 89 | }); 90 | 91 | app.use( router.middleware() ); 92 | 93 | } 94 | -------------------------------------------------------------------------------- /webES6/resource/module/blog/mis/mis.js: -------------------------------------------------------------------------------- 1 | 2 | var blogTmp = ['
', 3 | '{title}', 4 | '{kind}', 5 | '
', 6 | '
', 7 | 'delete', 8 | 'edit', 9 | '
'].join(''); 10 | //'
', 11 | //'views: {view}', 12 | //'comments: {comment}', 13 | //'date: {date}', 14 | //'
'].join(''); 15 | 16 | function fetchBlog( kind, start, limit ){ 17 | var data = kind ? {kind: kind} : {}; 18 | loading = true; 19 | //data.start = start; 20 | //data.limit = limit; 21 | $.ajax({ 22 | url: '/blog/fetchEdit', 23 | type: 'get', 24 | dataType: 'json', 25 | data: data, 26 | success: function( ret ){ 27 | if( ret.code == 0 ){ 28 | renderItems( ret.data ); 29 | } else { 30 | 31 | } 32 | } 33 | }) 34 | } 35 | 36 | function renderItems( items ){ 37 | var els = []; 38 | $.each( items, function( index, item ){ 39 | els.push( render( item ) ); 40 | }); 41 | $( '#blogBox' ).append( els ); 42 | } 43 | 44 | function render( item ){ 45 | //item.summary += '
.....
<view all>'; 46 | item.date = item.date.slice(0,10); 47 | 48 | item.summary = item.summary.slice(0,140); 49 | var el = blogTmp.replace( /\{(.*?)\}/g, function( $1, $2 ){ 50 | return item[ $2 ]; 51 | }); 52 | el = $( el ); 53 | el.find( '.delete' ).on( 'click', function(){ 54 | blogRemove( item._id ); 55 | }) 56 | return $( '
' ).addClass('blogItem').append( el ); 57 | } 58 | 59 | function blogRemove( id ){ 60 | var data = {id: id }; 61 | $.ajax({ 62 | url: '/blog/remove', 63 | type: 'delete', 64 | dataType: 'json', 65 | data: data, 66 | success: function( ret ){ 67 | if( ret.code == 0 ){ 68 | 69 | } else { 70 | 71 | } 72 | } 73 | }) 74 | } 75 | 76 | var loading = false, 77 | start = 0, 78 | limit = 50; 79 | 80 | !function(){ 81 | var _search = ''; 82 | if( location.search ){ 83 | _search = location.search.slice(1).split('=')[1]; 84 | } 85 | fetchBlog( _search, start, limit ); 86 | $( window ).on( 'scrollLoading', function(){ 87 | if( !loading ){ 88 | fetchBlog( _search, start += limit, limit ) 89 | } 90 | }) 91 | }(); -------------------------------------------------------------------------------- /assets/public/css/markdown.css: -------------------------------------------------------------------------------- 1 | .markdown h1, .markdown h2, .markdown h3, .markdown h4, .markdown h5, .markdown h6 { 2 | font-weight: normal; 3 | line-height: 2em; } 4 | 5 | .markdown h1 { 6 | color: #000000; 7 | font-size: 28pt; } 8 | 9 | .markdown h2 { 10 | border-bottom: 1px solid #CCCCCC; 11 | color: #000000; 12 | font-size: 24px; } 13 | 14 | .markdown h3 { 15 | font-size: 18px; } 16 | 17 | .markdown h4 { 18 | font-size: 16px; } 19 | 20 | .markdown h5 { 21 | font-size: 14px; } 22 | 23 | .markdown h6 { 24 | color: #777777; 25 | background-color: inherit; 26 | font-size: 14px; } 27 | 28 | .markdown hr { 29 | height: 0.2em; 30 | border: 0; 31 | color: #CCCCCC; 32 | background-color: #CCCCCC; } 33 | 34 | .markdown p, .markdown blockquote, .markdown ul, .markdown ol, .markdown dl, .markdown li, .markdown table, .markdown pre { 35 | margin: 15px 0; } 36 | 37 | .markdown ul, .markdown ol { 38 | margin: 15px 20px; } 39 | 40 | .markdown a, .markdown a:visited { 41 | color: #4183C4; 42 | background-color: inherit; 43 | text-decoration: none; } 44 | 45 | .markdown img { 46 | max-width: 100%; } 47 | 48 | .markdown #message { 49 | border-radius: 6px; 50 | border: 1px solid #ccc; 51 | display: block; 52 | width: 100%; 53 | height: 60px; 54 | margin: 6px 0px; } 55 | 56 | .markdown button, .markdown #ws { 57 | font-size: 10pt; 58 | padding: 4px 6px; 59 | border-radius: 5px; 60 | border: 1px solid #bbb; 61 | background-color: #eee; } 62 | 63 | .markdown code, .markdown pre, .markdown #ws, .markdown #message { 64 | font-family: monospace, Monaco; 65 | font-size: 12px; 66 | border-radius: 3px; 67 | background-color: #F8F8F8; 68 | color: inherit; } 69 | 70 | .markdown code { 71 | border: 1px solid #EAEAEA; 72 | margin: 0 2px; 73 | padding: 0 5px; } 74 | 75 | .markdown pre { 76 | border: 1px solid #CCCCCC; 77 | overflow: auto; 78 | padding: 4px 8px; } 79 | 80 | .markdown pre > code { 81 | border: 0; 82 | margin: 0; 83 | padding: 0; } 84 | 85 | .markdown #ws { 86 | background-color: #f8f8f8; } 87 | 88 | .markdown .send { 89 | color: #77bb77; } 90 | 91 | .markdown .server { 92 | color: #7799bb; } 93 | 94 | .markdown .error { 95 | color: #AA0000; } 96 | 97 | .markdown em { 98 | background: #e2f9cb; 99 | padding: 3px; } 100 | -------------------------------------------------------------------------------- /server/lib/toys.js: -------------------------------------------------------------------------------- 1 | 2 | var http = require( 'http' ), 3 | qs = require( 'querystring' ), 4 | config = require( '../config/mysql' ), 5 | logger = require( './logger' ), 6 | domain = require( 'domain' ), 7 | crypto = require( 'crypto' ); 8 | 9 | var Domain = domain.create(); 10 | 11 | Domain.on( 'error', function( e ){ 12 | logger.error( e ); 13 | }); 14 | 15 | function exist( req, res, method ){ 16 | if( req.method == method ){ 17 | return true; 18 | } else { 19 | res.redirect( '/404.ejs' ); 20 | return false; 21 | } 22 | } 23 | 24 | function getClientIp( req ){ 25 | return req.headers['x-forwarded-for'] || 26 | req.connection.remoteAddress || 27 | req.socket.remoteAddress || 28 | req.connection.socket.remoteAddress; 29 | }; 30 | 31 | var Cookie = { 32 | 33 | get: function( req, name ){ 34 | var cookie = qs.parse( req.headers.cookie, ';', '=' ); 35 | return name ? cookie[ name ] : cookie; 36 | } 37 | 38 | } 39 | 40 | function createSID( req ){ 41 | var sha1 = crypto.createHash( 'sha1' ), 42 | ip = getClientIp( req ); 43 | sha1.update( ip ); 44 | return sha1.digest( 'hex' ); 45 | } 46 | 47 | function checkSID( req ){ 48 | var _cookie = Cookie.get( req, 'JSESSIONID' ); 49 | return createSID( req ) == _cookie; 50 | } 51 | 52 | function request( options, req, res, cb, fixed ){ 53 | 54 | if( options.method == 'GET' ){ 55 | options.path += '?' + qs.stringify( req.query ) 56 | } else { 57 | req.headers[ 'content-length' ] = qs.stringify( options.data ).length; 58 | } 59 | req.headers[ 'host' ] = config.hostname; 60 | 61 | options.host = config.host; 62 | options.port = config.port; 63 | options.headers = req.headers; 64 | 65 | var HReq = http.request( options, function( HRes ){ 66 | var cookies = HRes.headers['set-cookie']; 67 | cookies && res.setHeader("Set-Cookie",cookies ); 68 | if( fixed ){ 69 | HRes.pipe( res ); 70 | return; 71 | } 72 | 73 | HRes.on( 'data', function( stream ){ 74 | data += stream; 75 | }).on( 'end', function(){ 76 | cb( data ); 77 | }); 78 | }), 79 | data = ''; 80 | 81 | HReq.on( 'error', function( e ){ 82 | console.log( e ); 83 | }); 84 | 85 | HReq.write( qs.stringify( options.data ) ); 86 | HReq.end(); 87 | 88 | } 89 | 90 | module.exports = { 91 | exist: exist, 92 | createSID: createSID, 93 | checkSID: checkSID, 94 | request: request, 95 | Cookie: Cookie, 96 | Domain: Domain 97 | } 98 | -------------------------------------------------------------------------------- /web/assets/module/blog/list/list.js: -------------------------------------------------------------------------------- 1 | 2 | require.config({ 3 | //baseUrl: basePath, 4 | paths: { 5 | common: '/assets/public/js/common' 6 | } 7 | }) 8 | 9 | require([ 'common' ], function(){ 10 | 11 | logo3d(1); 12 | var blogTmp = ['
', 13 | '{title}', 14 | '{kind}', 15 | '', 16 | '
', 17 | '
{summary}
', 18 | '', 19 | '
', 20 | 'Views: {view}', 21 | 'Comments: {comment}', 22 | 'Date: {date}', 23 | '
'].join(''); 24 | 25 | function fetchBlog( kind, start, limit ){ 26 | var data = kind ? {kind: kind} : {}; 27 | loading = true; 28 | data.start = start; 29 | data.limit = limit; 30 | $.ajax({ 31 | url: '/blog/fetchList', 32 | type: 'get', 33 | dataType: 'json', 34 | data: data, 35 | success: function( ret ){ 36 | if( ret.code == 0 ){ 37 | renderItems( ret.data ); 38 | if( ret.data.length == limit ){ 39 | loading = false; 40 | } 41 | logo3d(0); 42 | } else { 43 | 44 | } 45 | } 46 | }) 47 | } 48 | 49 | function renderItems( items ){ 50 | var els = []; 51 | $.each( items, function( index, item ){ 52 | els.push( render( item ) ); 53 | }); 54 | $( '#blogBox' ).append( els ); 55 | } 56 | 57 | function render( item ){ 58 | //item.summary += '
.....
<view all>'; 59 | item.date = item.date.slice(0,10); 60 | var el = blogTmp.replace( /\{(.*?)\}/g, function( $1, $2 ){ 61 | return item[ $2 ]; 62 | }); 63 | return $( '
' ).append( el ); 64 | } 65 | 66 | var loading = false, 67 | start = 0, 68 | limit = 5; 69 | 70 | !function(){ 71 | var _search = ''; 72 | if( location.search ){ 73 | _search = location.search.slice(1).split('=')[1]; 74 | } 75 | fetchBlog( _search, start, limit ); 76 | $( window ).on( 'scrollLoading', function(){ 77 | if( !loading ){ 78 | fetchBlog( _search, start += limit, limit ) 79 | } 80 | }) 81 | }(); 82 | 83 | }) 84 | 85 | 86 | -------------------------------------------------------------------------------- /webES6/gulpfile.js: -------------------------------------------------------------------------------- 1 | const gulp = require( 'gulp' ); 2 | const gutil = require( 'gulp-util'); 3 | const webpack = require( 'webpack' ); 4 | const sass = require( 'gulp-sass' ); 5 | const imagemin = require('gulp-imagemin'); 6 | const jshint = require('gulp-jshint'); 7 | const md5 = require('gulp-md5-plus'); 8 | const minifycss = require('gulp-minify-css'); 9 | 10 | const htmlmin = require('gulp-htmlmin'); 11 | 12 | const config = require( './gulp.config.js' ); 13 | 14 | gulp.task( 'jshint', function(){ 15 | gulp.src( config.jshint.src ) 16 | .pipe( jshint() ) 17 | .pipe( jshint.reporter('YOUR_REPORTER_HERE') ); 18 | }); 19 | 20 | gulp.task('lint', function() { 21 | return gulp.src( config.jshint.src ) 22 | .pipe(jshint()) 23 | .pipe(jshint.reporter('YOUR_REPORTER_HERE')); 24 | }); 25 | 26 | gulp.task( 'webpackmin', function(){ 27 | webpack( config.webpack, function( err, status ){}); 28 | }); 29 | 30 | gulp.task( 'sassmin', function(){ 31 | gulp.src( config.sass.src ) 32 | .pipe( sass().on( 'error', sass.logError )) 33 | .pipe( minifycss() ) 34 | .pipe( gulp.dest( config.sass.dest )); 35 | }); 36 | 37 | gulp.task( 'webpack', function(){ 38 | webpack( config.webpack, function( err, status ){}); 39 | }); 40 | 41 | gulp.task( 'sass', function(){ 42 | gulp.src( config.sass.src ) 43 | .pipe( sass().on( 'error', sass.logError )) 44 | .pipe( gulp.dest( config.sass.dest )); 45 | }); 46 | 47 | gulp.task('imagemin', function(){ 48 | 49 | return gulp.src( config.images.src) 50 | //.pipe(imagemin()) 51 | .pipe(gulp.dest(config.images.dest)) 52 | }); 53 | 54 | gulp.task( 'md5', function(){ 55 | gulp.src( config.md5.src ) 56 | .pipe( md5(10, config.md5.html )) 57 | .pipe( gulp.dest( config.md5.dest )); 58 | } ); 59 | 60 | gulp.task( 'htmlmin', function(){ 61 | gulp.src( config.html.src ) 62 | .pipe( htmlmin({collapseWhitespace: true}) ) 63 | .pipe( gulp.dest( config.html.dest )); 64 | } ); 65 | 66 | 67 | gulp.task( 'default', ['webpack', 'imagemin', 'sass', 'htmlmin' ], function(){ 68 | gutil.log( 'this is gulp default' ); 69 | }); 70 | 71 | /* 72 | gulp.task( 'default', [ ], function(){ 73 | gulp.start('webpack', 'imagemin', 'sass', 'md5'); 74 | gutil.log( 'this is gulp default' ); 75 | }); 76 | */ 77 | 78 | 79 | 80 | var watcher = gulp.watch( './resource/**/*', ['webpack', 'imagemin', 'sass' ], function(){ 81 | gutil.log( 'this is gulp default' ); 82 | }); 83 | 84 | /* 85 | const requireDir = require( 'require-dir' ); 86 | requireDir( './gulp', { recure: true } ); 87 | */ -------------------------------------------------------------------------------- /check/server/action.js: -------------------------------------------------------------------------------- 1 | 2 | 'use strict'; 3 | /******************* 4 | module 5 | *******************/ 6 | var action = require( '../model/action' ), 7 | toys = require( '../lib/toys' ), 8 | qs = require( 'querystring' ); 9 | 10 | 11 | function *create( config ){ 12 | 13 | var data = config.request.body, 14 | ret = yield action.create( data ); 15 | if( ret ){ 16 | return { code: 0, data: ret, msg: 'create action success'}; 17 | } else { 18 | return { code: -1, data: null, msg: 'create action faile'}; 19 | } 20 | 21 | } 22 | 23 | function *fetch( config ){ 24 | 25 | var data = config.request.query, 26 | ret = yield action.fetch( data ); 27 | if( ret ){ 28 | return { code: 0, data: ret, msg: 'fetch action success'}; 29 | } else { 30 | return { code: -1, data: null, msg: 'fetch action faile'}; 31 | } 32 | } 33 | 34 | function *update( config ){ 35 | 36 | var data = config.request.body, 37 | ret = yield action.update( data ); 38 | if( ret ){ 39 | return { code: 0, data: ret, msg: 'update action success'}; 40 | } else { 41 | return { code: -1, data: null, msg: 'update action faile'}; 42 | } 43 | 44 | } 45 | 46 | function *remove( config ){ 47 | 48 | var data = config.request.body, 49 | ret = yield action.remove( data ); 50 | if( ret ){ 51 | return { code: 0, data: ret, msg: 'remove action success'}; 52 | } else { 53 | return { code: -1, data: null, msg: 'remove action faile'}; 54 | } 55 | 56 | } 57 | 58 | function *check( config ){ 59 | debugger 60 | var data = config.request.body, 61 | ret = yield checkAction( data, { cookie: config.header.cookie } ); 62 | if( ret ){ 63 | return { code: 0, data: ret, msg: 'check action success'}; 64 | } else { 65 | return { code: -1, data: null, msg: 'check action faile'}; 66 | } 67 | 68 | } 69 | 70 | function *checkAction( data, headers ){ 71 | 72 | var config = data.actionConfig; 73 | delete data.actionConfig; 74 | 75 | var method = data.method.toUpperCase(), 76 | path = config.path + ( method == 'GET' ? '?' + qs.stringify( data.params ) : '' ); 77 | 78 | var options = { 79 | hostname: config.host, 80 | port: 80, 81 | method: method, 82 | path: path, 83 | data: data.params, 84 | headers: headers 85 | } 86 | /* 87 | if( method == 'POST' ){ 88 | options[ 'headers' ]['content-length'] = qs.stringify( data ).length; 89 | } 90 | */ 91 | return yield toys.requestA( options ); 92 | } 93 | 94 | 95 | module.exports = { 96 | create: create, 97 | fetch: fetch, 98 | update: update, 99 | remove: remove, 100 | check: check 101 | } 102 | -------------------------------------------------------------------------------- /server/server/comment.js: -------------------------------------------------------------------------------- 1 | var db = require( '../model/comment' ), 2 | qs = require( 'querystring' ), 3 | toys = require( '../lib/toys' ), 4 | Validate= require( '../lib/validate' ); 5 | 6 | var Schema = { 7 | model: { 8 | id: { 9 | min: [1, '102001'], 10 | max: [10, '102002'], 11 | num: 102003 12 | }, 13 | username: { 14 | required: 102010, 15 | min: [1, '102011'], 16 | max: [40, '102012'] 17 | }, 18 | content: { 19 | required: 102020, 20 | min: [1, 102021], 21 | max: [2000, 102022] 22 | }, 23 | owner: { 24 | required: 102030, 25 | min: [6, 101031], 26 | max: [40, 101032] 27 | }, 28 | belong: { 29 | required: 102040, 30 | min: [1, 102041], 31 | max: [60, 102042] 32 | } 33 | } 34 | }; 35 | 36 | function create( req, res ){ 37 | 38 | var data = req.body; 39 | data = Validate( data, Schema.model ); 40 | if( data.code ){ 41 | res.send( data ); 42 | return false 43 | } 44 | db.create( data, function( err, docs ){ 45 | if( err ){ 46 | res.send({ code: -1, msg: err } ) 47 | } else { 48 | res.send({ code: 0, msg: 'create comment success', data: docs } ); 49 | } 50 | }); 51 | 52 | } 53 | 54 | function fetch( req, res ){ 55 | var data = req.query, 56 | condition = []; 57 | for( var con in data ){ 58 | condition.push( con ); 59 | } 60 | data = Validate( data, Schema.model, condition ); 61 | if( data.code ){ 62 | res.send( data ); 63 | return false 64 | } 65 | db.fetch( data, function( err, docs ){ 66 | if( err ){ 67 | res.send({ code: -1, msg: err } ) 68 | } else { 69 | for( var i = 0; i < docs.length; i++ ){ 70 | for( var key in docs[i] ){ 71 | docs[i][ key ] = qs.unescape( docs[i][ key ] ); 72 | } 73 | } 74 | res.send({ code: 0, msg: 'fetch comment success', data: docs } ); 75 | } 76 | }); 77 | 78 | } 79 | 80 | function update( req, res ){ 81 | 82 | var data = req.body; 83 | var id = data.id; 84 | delete data.id; 85 | db.update( id, data, function( err, docs ){ 86 | if( err ){ 87 | res.send({ code: -1, msg: err } ) 88 | } else { 89 | res.send({ code: 0, msg: 'update comment success', data: docs } ); 90 | } 91 | }); 92 | } 93 | 94 | function remove( req, res ){ 95 | 96 | var data = req.body; 97 | data = Validate( data, Schema.model, ['id'] ); 98 | if( data.code ){ 99 | res.send( data ); 100 | return false 101 | } 102 | db.remove( data.id, function( err, docs ){ 103 | if( err ){ 104 | res.send({ code: -1, msg: err } ) 105 | } else { 106 | res.send({ code: 0, msg: 'remove comment success', data: docs } ); 107 | } 108 | }); 109 | 110 | } 111 | 112 | module.exports = { 113 | create: create, 114 | fetch: fetch, 115 | update: update, 116 | remove: remove 117 | } 118 | -------------------------------------------------------------------------------- /webES6/controller/blog.js: -------------------------------------------------------------------------------- 1 | import Blog from '../server/blog'; 2 | import {Kind} from '../lib/code'; 3 | 4 | console.log( `===${process.env.NODE_ENV}` ) 5 | export default [ 6 | { 7 | path: '/list', 8 | method: 'get', 9 | render: 'blog/list', 10 | premission: 0, 11 | config: { 12 | title: '文章列表', 13 | assets: '/module/blog/list/list', 14 | Kind 15 | }, 16 | pipe: ( req, res, next ) => { 17 | Blog.fetchPipe( req, res, '/blog/fetch', () => { res.end('') } ); 18 | } 19 | }, 20 | { 21 | path: '/fetch', 22 | method: 'get', 23 | premission: 0, 24 | request: ( req, res ) => { 25 | Blog.fetchList( req, res, '/blog/fetch' ); 26 | } 27 | }, 28 | { 29 | path: '/mis', 30 | method: 'get', 31 | render: 'blog/mis', 32 | premission: 0, 33 | config: { 34 | title: '文章管理', 35 | assets: '/module/blog/mis/mis', 36 | Kind 37 | }, 38 | pipe: ( req, res, next ) => { 39 | Blog.fetchPipe( req, res, '/blog/fetch', () => { res.end('') } ); 40 | } 41 | }, 42 | { 43 | path: '/fetchEdit', 44 | method: 'get', 45 | premission: 0, 46 | request: ( req, res ) => { 47 | Blog.fetchEdit( req, res, '/blog/fetch' ); 48 | } 49 | }, 50 | { 51 | path: '/edit', 52 | method: 'get', 53 | render: 'blog/edit', 54 | premission: 0, 55 | config: { 56 | title: '文章编辑', 57 | assets: '/module/blog/edit/edit', 58 | Kind 59 | } 60 | }, 61 | { 62 | path: '/create', 63 | method: 'post', 64 | premission: 0, 65 | request: ( req, res ) => { 66 | Blog.add( req, res, '/blog/save' ); 67 | } 68 | }, 69 | { 70 | path: '/update', 71 | method: 'post', 72 | premission: 0, 73 | request: ( req, res ) => { 74 | Blog.update( req, res, '/blog/update' ); 75 | } 76 | }, 77 | { 78 | path: '/updateViewNum', 79 | method: 'get', 80 | premission: 0, 81 | request: ( req, res ) => { 82 | Blog.updateViewNum( req, res, '/blog/updateViewNum' ); 83 | } 84 | }, 85 | { 86 | path: '/info', 87 | method: 'get', 88 | render: ( id ) => { return `blog/info/${id}` }, 89 | premission: 0, 90 | config: { 91 | title: '文章详情', 92 | assets: '/module/blog/info/info', 93 | Kind 94 | } 95 | }, 96 | { 97 | path: '/preview', 98 | method: 'get', 99 | render: 'blog/preview', 100 | premission: 0, 101 | config: { 102 | title: '文章详情', 103 | assets: '/module/blog/preview/preview', 104 | Kind 105 | } 106 | }, 107 | { 108 | path: '/remove', 109 | method: 'delete', 110 | premission: 0, 111 | request: ( req, res ) => { 112 | Blog.remove( req, res, '/blog/remove' ); 113 | } 114 | }, 115 | { 116 | path: '/rebuild', 117 | method: 'get', 118 | premission: 0, 119 | request: ( req, res ) => { 120 | Blog.rebuild( req, res, '/blog/fetch' ); 121 | } 122 | } 123 | ] --------------------------------------------------------------------------------