@ -117,8 +117,7 @@ class Problem extends Model {
let fs = Promise.promisifyAll(require('fs'));
let buf = await fs.readFileAsync(path);
let md5 = require('md5');
let key = md5(buf);
let key = syzoj.utils.md5(buf);
await fs.rename(path, TestData.resolvePath(key));
let file = await TestData.create({
@ -32,7 +32,6 @@
"express-session": "^1.14.1",
"file-size": "^1.0.0",
"gravatar": "^1.5.2",
"md5": "^2.2.1",
"moemark-renderer": "^1.2.0",
"moment": "^2.15.0",
"multer": "^1.2.0",
@ -220,6 +220,12 @@ module.exports = {
removeTitleTag(s) {
return s.replace(/「[\S\s]+?」/, '');
},
md5(data) {
let crypto = require('crypto');
let md5 = crypto.createHash('md5');
md5.update(data);
return md5.digest('hex');
async hitokoto() {
let request = require('request-promise');
return await request({