mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
add more debug tools, and email me on error
This commit is contained in:
36
server.js
36
server.js
@@ -1,6 +1,38 @@
|
||||
/*process.on('uncaughtException', function (error) {
|
||||
process.on('uncaughtException', function (error) {
|
||||
|
||||
function sendEmail(mailData) {
|
||||
var nodemailer = require("derby-auth/node_modules/nodemailer");
|
||||
|
||||
// create reusable transport method (opens pool of SMTP connections)
|
||||
// TODO derby-auth isn't currently configurable here, if you need customizations please send pull request
|
||||
var smtpTransport = nodemailer.createTransport("SMTP",{
|
||||
service: process.env.SMTP_SERVICE,
|
||||
auth: {
|
||||
user: process.env.SMTP_USER,
|
||||
pass: process.env.SMTP_PASS
|
||||
}
|
||||
});
|
||||
|
||||
// send mail with defined transport object
|
||||
smtpTransport.sendMail(mailData, function(error, response){
|
||||
if(error){
|
||||
console.log(error);
|
||||
}else{
|
||||
console.log("Message sent: " + response.message);
|
||||
}
|
||||
|
||||
smtpTransport.close(); // shut down the connection pool, no more messages
|
||||
});
|
||||
}
|
||||
|
||||
sendEmail({
|
||||
from: "HabitRPG <admin@habitrpg.com>",
|
||||
to: "tylerrenelle@gmail.com",
|
||||
subject: "HabitRPG Error",
|
||||
text: error.stack
|
||||
});
|
||||
console.log(error.stack);
|
||||
});*/
|
||||
});
|
||||
|
||||
require('coffee-script') // remove intermediate compilation requirement
|
||||
require('./src/server').listen(process.env.PORT || 3000);
|
||||
|
||||
13
src/app/debug.coffee
Normal file
13
src/app/debug.coffee
Normal file
@@ -0,0 +1,13 @@
|
||||
moment = require 'moment'
|
||||
|
||||
module.exports.app = (appExports, model) ->
|
||||
user = model.at('_user')
|
||||
|
||||
appExports.emulateNextDay = ->
|
||||
yesterday = +moment().subtract('days', 1).toDate()
|
||||
user.set 'lastCron', yesterday
|
||||
window.location.reload()
|
||||
|
||||
appExports.cheat = ->
|
||||
user.incr 'stats.exp', 20
|
||||
user.incr 'stats.gp', 1000
|
||||
@@ -105,6 +105,8 @@ ready (model) ->
|
||||
|
||||
require('../server/private').app(exports, model)
|
||||
|
||||
require('./debug').app(exports, model)
|
||||
|
||||
user.on 'set', 'tasks.*.completed', (i, completed, previous, isLocal, passed) ->
|
||||
return if passed? && passed.cron # Don't do this stuff on cron
|
||||
direction = () ->
|
||||
@@ -295,10 +297,3 @@ ready (model) ->
|
||||
exports.setFemale = -> user.set('preferences.gender', 'f')
|
||||
exports.setArmorsetV1 = -> user.set('preferences.armorSet', 'v1')
|
||||
exports.setArmorsetV2 = -> user.set('preferences.armorSet', 'v2')
|
||||
|
||||
exports.emulateNextDay = ->
|
||||
yesterday = +moment().subtract('days', 1).toDate()
|
||||
user.set 'lastCron', yesterday
|
||||
window.location.reload()
|
||||
|
||||
|
||||
|
||||
@@ -7,10 +7,7 @@ derby = require 'derby'
|
||||
userSchema =
|
||||
# _id
|
||||
stats: { gp: 0, exp: 0, lvl: 1, hp: 50 }
|
||||
party: {
|
||||
current: null
|
||||
invitation: null
|
||||
}
|
||||
party: { current: null, invitation: null }
|
||||
items: { armor: 0, weapon: 0 }
|
||||
preferences: { gender: 'm', armorSet: 'v1' }
|
||||
idLists:
|
||||
|
||||
@@ -349,9 +349,10 @@
|
||||
<!-- Footer -->
|
||||
<footer class=footer>
|
||||
<div class=container>
|
||||
<!--<div class='pull-right'>
|
||||
<div class='pull-right'>
|
||||
<button class='btn' x-bind="click:emulateNextDay">Emulate Next Day</button>
|
||||
</div>-->
|
||||
<button class='btn' x-bind="click:cheat">Add GP & Exp</button>
|
||||
</div>
|
||||
<div>
|
||||
<ul>
|
||||
<li>Copyright © 2012 OCDevel LLC</li>
|
||||
|
||||
Reference in New Issue
Block a user