diff --git a/config/routes/index.js b/config/routes/index.js index 086a7fc..4f4f589 100644 --- a/config/routes/index.js +++ b/config/routes/index.js @@ -6,84 +6,86 @@ const mw = require('../middleware.js'), xss = require('xss'), User = require('../models.js').user; -// Index -router.get('/', (req,res,next)=>{ - res.render('index'); -}); - -// Help -router.get('/help', mw.ensureAuth, (req,res)=>{ - res.render('help'); -}); - -// Terms of Service and Privacy Policy -router.get('/terms', (req,res)=>{ - res.render('terms'); -}) -.get('/privacy', (req,res)=>{ - res.render('privacy'); -}); - -// robots.txt -router.get('/robots.txt', (req,res)=>{ - res.type('text/plain'); - res.send("User-agent: *\n"+ - "Disallow: /map/*\n" - ); -}); - -// favicon.ico -router.get('/favicon.ico', (req,res)=>{ - res.redirect('/static/img/icon/by/16-32-48.ico'); -}); - -// Endpoint to validate forms -router.get('/validate', (req,res)=>{ +module.exports = router - // Validate unique slug - if (req.query.slug) { - User.findOne({ slug: slug(req.query.slug) }) - .then( (existingUser)=>{ - if (existingUser && existingUser.id!==req.user.id) { - res.sendStatus(400); - } - else { res.sendStatus(200); } - }) - .catch( (err)=>{ mw.throwErr(err,req); }); - } - - // Validate unique email - else if (req.query.email) { - User.findOne({ email: req.query.email }) - .then( (existingUser)=>{ - if (existingUser && existingUser.id!==req.user.id) { - res.sendStatus(400); - } - else { res.sendStatus(200); } - }) - .catch( (err)=>{ mw.throwErr(err,req); }); - } - - // Create slug - else if (req.query.slugify) { - res.send(slug(xss(req.query.slugify))); - } - - else if (req.query.xss) { - res.send(xss(req.query.xss)); - } - -}); + // Index + .get('/', (req,res,next)=>{ + res.render('index'); + }) -// Link to androidapp in play store -router.get('/android', (req,res)=>{ - res.redirect('https://play.google.com/store/apps/details?id=us.keithirwin.tracman'); -}); + // Help + .get('/help', mw.ensureAuth, (req,res)=>{ + res.render('help'); + }) + + // Terms of Service and Privacy Policy + .get('/terms', (req,res)=>{ + res.render('terms'); + }) + .get('/privacy', (req,res)=>{ + res.render('privacy'); + }) + + // robots.txt + .get('/robots.txt', (req,res)=>{ + res.type('text/plain'); + res.send("User-agent: *\n"+ + "Disallow: /map/*\n" + ); + }) + + // favicon.ico + .get('/favicon.ico', (req,res)=>{ + res.redirect('/static/img/icon/by/16-32-48.ico'); + }) + + // Endpoint to validate forms + .get('/validate', (req,res)=>{ + + // Validate unique slug + if (req.query.slug) { + User.findOne({ slug: slug(req.query.slug) }) + .then( (existingUser)=>{ + if (existingUser && existingUser.id!==req.user.id) { + res.sendStatus(400); + } + else { res.sendStatus(200); } + }) + .catch( (err)=>{ mw.throwErr(err,req); }); + } + + // Validate unique email + else if (req.query.email) { + User.findOne({ email: req.query.email }) + .then( (existingUser)=>{ + if (existingUser && existingUser.id!==req.user.id) { + res.sendStatus(400); + } + else { res.sendStatus(200); } + }) + .catch( (err)=>{ mw.throwErr(err,req); }); + } + + // Create slug + else if (req.query.slugify) { + res.send(slug(xss(req.query.slugify))); + } + + else if (req.query.xss) { + res.send(xss(req.query.xss)); + } + + }) + + // Link to androidapp in play store + .get('/android', (req,res)=>{ + res.redirect('https://play.google.com/store/apps/details?id=us.keithirwin.tracman'); + }) + + // Link to iphone app in the apple store + // ... maybe someday + .get('/ios', (req,res)=>{ + res.redirect('/help#why-is-there-no-ios-app'); + }) -// Link to iphone app in the apple store -// ... maybe someday -router.get('/ios', (req,res)=>{ - res.redirect('/help#why-is-there-no-ios-app'); -}); - -module.exports = router; +; diff --git a/config/routes/settings.js b/config/routes/settings.js index 1494d54..502608f 100644 --- a/config/routes/settings.js +++ b/config/routes/settings.js @@ -66,6 +66,7 @@ router.route('/') req.flash('warning', `${req.body.email} is not a valid email address. `); res.redirect('/settings'); } + else { // Email changed @@ -231,6 +232,7 @@ router.route('/password/:token') mw.throwErr(new Error(`That password could be cracked in ${daysToCrack} days! Come up with a more complex password that would take at least 10 days to crack. `)); res.redirect(`/settings/password/${req.params.token}`); } + else { // Delete token @@ -282,7 +284,7 @@ router.route('/pro') {$set:{ isPro:true }}) .then( (user)=>{ req.flash('success','You have been signed up for pro. '); - res.redirect('/map'); + res.redirect(req.session.next||'/settings'); }) .catch( (err)=>{ mw.throwErr(err,req); diff --git a/static/css/base.css b/static/css/base.css index 331bb33..de43f40 100644 --- a/static/css/base.css +++ b/static/css/base.css @@ -113,6 +113,8 @@ section { .red, .red:hover { color: #fb6e3d !important; } .yellow, .yellow:hover { color: #fbc93d !important; } .green, .green:hover { color: #8ae137 !important; } +.inline { display: inline; } +.inline-block { display: inline-block; } .shadow { -moz-box-shadow: .18vw .18vw .36vw #000; diff --git a/views/pro.html b/views/pro.html index e5945a5..cecc37e 100644 --- a/views/pro.html +++ b/views/pro.html @@ -1,5 +1,13 @@ {% extends 'templates/base.html' %} -{% block title %}{{ super() }} | Pro{% endblock %} +{% block title %}{{super()}} | Pro{% endblock %} + +{% block head %}{{super()}} + +{% endblock %} {% block main %}
@@ -12,20 +20,23 @@

Glad you're enjoying my website and app. I made the whole thing, from front to backend, and I'm really proud of it! However, I'm a long-haul trucker by day and coding is just a hobby. I don't make any money off this website, and I pay the server fees out of my own pocket. Do you pity me enough to donate some money or bitcoin?

-

To make a little money off this service, I'm going to be offering a pro version with more features. It'll be cheap, probably $1 or $2 per month. However, while Tracman is in beta, you can beta test the pro version too. Be sure to inform me about any bugs you encounter. And keep in mind that at some point, when we launch out of beta, Tracman Pro will not be free and you will lose your pro membership unless start paying for it. +

To make a little money off this service, I'm going to be offering a pro version with more features. It'll be cheap, probably $1 or $2 per month. While Tracman is in beta, you can test the pro version for free. Be sure to inform me about any bugs you encounter. And keep in mind that at some point, when we launch out of beta, Tracman Pro will not be free and you will lose your pro membership unless start paying for it.

-

That said, just click the button below to test out the pro features. Keep in mind, they are as unstable as the rest of this product. +

That said, just click the button below to try pro out.

Cheers,
Keith Irwin

-
+ {% if user.isPro %} -
You are already pro!
- go to map +
+ + You are already pro! +
+ go back {% else %} - - go home + + go home {% endif %}