<commit_before>var User = require('../models/user');
var Article = require('../models/article');
var md5 = require('../lib/md5');
var marked = require('marked');
var moment = require('moment');

// 检测登陆状态
function checkLogin(req, res, next) {
  if (!req.session.user) {
    req.flash('info', '未登录!');
    return res.redirect('/login');
  }
  next();
}


function checkNotLogin(req, res, next) {
  if (req.session.user) {
    req.flash('info', '已登录!');
    return res.redirect('back');
  }
  next();
}

module.exports = function (app) {

  // 主页
  app.get('/', function (req, res, next) {
        Article.getList(function(err,list){
            if (err) {
                console.log(err);
                return next(err);
            }
            res.render('index', {
              title: '主页',
              user: req.session.user,
              flash: req.flash('info').toString(),
              list: list
            });
        });
  });

  // 注册显示
  app.get('/reg', checkNotLogin);
  app.get('/reg', function (req, res, next) {
    res.render('reg', {
      title: '注册',
      user: req.session.user,
      flash: req.flash('info').toString()
    });
  });

<commit_msg>update title<commit_after>var User = require('../models/user');
var Article = require('../models/article');
var md5 = require('../lib/md5');
var marked = require('marked');
var moment = require('moment');

// 检测登陆状态
function checkLogin(req, res, next) {
  if (!req.session.user) {
    req.flash('info', '未登录!');
    return res.redirect('/login');
  }
  next();
}


function checkNotLogin(req, res, next) {
  if (req.session.user) {
    req.flash('info', '已登录!');
    return res.redirect('back');
  }
  next();
}

module.exports = function (app) {

  // 主页
  app.get('/', function (req, res, next) {
        Article.getList(function(err,list){
            if (err) {
                console.log(err);
                return next(err);
            }
            res.render('index', {
              title: '云沐小屋',
              user: req.session.user,
              flash: req.flash('info').toString(),
              list: list
            });
        });
  });

  // 注册显示
  app.get('/reg', checkNotLogin);
  app.get('/reg', function (req, res, next) {
    res.render('reg', {
      title: '注册',
      user: req.session.user,
      flash: req.flash('info').toString()
    });
  });


{'fraction_non_alphanumeric': 0.1949978804578211, 'fraction_numerical': 0.001695633743111488, 'mean_word_length': 2.1052631578947367, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '456768', 'n_tokens_mistral': 794, 'n_tokens_neox': 810, 'n_words': 155}