<commit_before>var express = require('express');
var router = express.Router();
var crypto = require("crypto");

/* GET home page. */
router.get('/auth', function(req, res, next) {
	var token = req.query.token,
		timestamp = req.query.timestamp,
		nonce = req.query.nonce,
		echostr = req.query.echostr;
		console.log(echostr+"---"+ timestamp+"---"+  nonce+"---"+  token)
	if (isLegel(echostr, timestamp, nonce, token)) {
		res.send(echostr);
	} else {
		res.send("失败");
	}
});

function isLegel(signature, timestamp, nonce, token) {
	var array = new Array();
	array[0] = timestamp;
	array[1] = nonce;<commit_msg>修复微信token验证<commit_after>var express = require('express');
var router = express.Router();
var crypto = require("crypto");
var config = require("../../config.json");

/* GET home page. */
router.get('/auth', function(req, res, next) {
	var signature = req.query.signature,
		timestamp = req.query.timestamp,
		nonce = req.query.nonce,
		echostr = req.query.echostr;
		console.log("token=" + config.wechat.token);
		console.log(echostr+"---"+ timestamp+"---"+  nonce+"---"+  signature)
	if (isLegel(signature, timestamp, nonce, config.wechat.token)) {
		res.send(echostr);
	} else {
		res.send("失败");
	}
});

function isLegel(signature, timestamp, nonce, token) {
	var array = new Array();
	array[0] = timestamp;
	array[1] = nonce;
{'fraction_non_alphanumeric': 0.19448584202682564, 'fraction_numerical': 0.0029806259314456036, 'mean_word_length': 4.24609375, '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': '2101472', 'n_tokens_mistral': 490, 'n_tokens_neox': 484, 'n_words': 104}