From 94a718afab8b7be74731d1cb04610bfdc94d25c1 Mon Sep 17 00:00:00 2001 From: Keith Irwin Date: Sat, 18 Mar 2017 13:21:48 -0400 Subject: [PATCH] Various updates --- config/routes/index.js | 41 ++++++++++++++++++++++++++++++++--------- config/routes/misc.js | 35 +++++++++-------------------------- views/error.html | 1 + views/help.html | 40 ++++++++++++++++++++++++++++++++++------ views/pro.html | 21 ++++++--------------- 5 files changed, 82 insertions(+), 56 deletions(-) diff --git a/config/routes/index.js b/config/routes/index.js index 3b42446..aa2fe76 100644 --- a/config/routes/index.js +++ b/config/routes/index.js @@ -5,11 +5,6 @@ const slug = require('slug'), User = require('../models/user.js'), router = require('express').Router(); -// Shortcut to favicon.ico -router.get('/favicon.ico', function(req,res){ - res.redirect('/static/img/icon/by/16-32-48.ico'); -}); - // Index route router.route('/') .get(function(req,res,next){ @@ -87,10 +82,38 @@ router.route('/settings') } ); }); - -router.route('/help') - .get(mw.ensureAuth, function(req,res){ - res.render('help.html', {user:req.session.passport.user}); + + +// Tracman pro +router.route('/pro') + .all(mw.ensureAuth, function(req,res,next){ + next(); + }).get(function(req,res,next){ + User.findById(req.session.passport.user, function(err, user){ + if (err){ mw.throwErr(req,err); } + if (!user){ next(); } + else { res.render('pro.html', {user:user}); } + }); + }).post(function(req,res){ + User.findByIdAndUpdate(req.session.passport.user, + {$set:{ isPro:true }}, + function(err, user){ + if (err){ mw.throwErr(req,err); } + else { req.flash('success','You have been signed up for pro. '); } + res.redirect('/map'); + } + ); }); +// Help +router.route('/help') + .get(mw.ensureAuth, function(req,res){ + res.render('help.html', {user:req.user}); + }); + +// Terms of Service +router.get('/terms', function(req,res){ + res.render('terms.html', {user:req.user}); +}); + module.exports = router; \ No newline at end of file diff --git a/config/routes/misc.js b/config/routes/misc.js index 8a4faf0..b1d93da 100644 --- a/config/routes/misc.js +++ b/config/routes/misc.js @@ -1,17 +1,23 @@ 'use strict'; const router = require('express').Router(), - mw = require('../middleware.js'), slug = require('slug'), User = require('../models/user.js'); +// robots.txt router.get('/robots.txt', function(req,res){ res.type('text/plain'); res.send("User-agent: *\n"+ - "Disallow: /map\n" + "Disallow: /map/*\n" ); }); +// favicon.ico +router.get('/favicon.ico', function(req,res){ + res.redirect('/static/img/icon/by/16-32-48.ico'); +}); + +// Endpoint to validate forms router.get('/validate', function(req,res){ if (req.query.slug) { // validate unique slug User.findOne({slug:slug(req.query.slug)}, function(err, existingUser){ @@ -22,32 +28,9 @@ router.get('/validate', function(req,res){ } }); +// Link to android app in play store router.get('/android', function(req,res){ res.redirect('https://play.google.com/store/apps/details?id=us.keithirwin.tracman'); }); -router.get('/terms', function(req,res){ - res.render('terms.html', {user:req.user}); -}); - -router.route('/pro') - .all(mw.ensureAuth, function(req,res,next){ - next(); - }).get(function(req,res,next){ - User.findById(req.session.passport.user, function(err, user){ - if (err){ mw.throwErr(req,err); } - if (!user){ next(); } - else { res.render('pro.html', {user:user}); } - }); - }).post(function(req,res){ - User.findByIdAndUpdate(req.session.passport.user, - {$set:{ isPro:true }}, - function(err, user){ - if (err){ mw.throwErr(req,err); } - else { req.flash('success','You have been signed up for pro. '); } - res.redirect('/map'); - } - ); - }); - module.exports = router; \ No newline at end of file diff --git a/views/error.html b/views/error.html index 06461a5..ed036b6 100644 --- a/views/error.html +++ b/views/error.html @@ -7,6 +7,7 @@ {% if code %}

{{code}}

{% endif %} {% if message %}

{{message}}

{% endif %} {% if error %}

{{error}}

{% endif %} +

I would really appreciate it if you would report this error.

{% if code %}{% endif %} diff --git a/views/help.html b/views/help.html index 055bace..5341151 100644 --- a/views/help.html +++ b/views/help.html @@ -4,17 +4,45 @@ {% block main %}
-

Help

+

Help

-

Welcome to Tracman! Here's how to get started.

+

Welcome to Tracman! Here's how to get started.

-

Set sets your location once using this device's geolocation. On a GPS-enabled phone, the location will be set to its coordinates.

+

Website map controls

-

Track sets your location as above, but continues to track your location as long as you keep this window open. On a phone, this can drain the battery fast, so be careful!

+

Set sets your location once using this device's geolocation. On a GPS-enabled phone, the location will be set to its coordinates.

+ +

Track sets your location as above, but continues to track your location as long as you keep this window open. To track your location in the background, check out the android app.

+ +

Clear clears your location instantly. Anyone looking at your map will see a blank screen instead. Use this to hide your location.

-

Clear clears your location instantly. Anyone looking at your map will see a blank screen instead. Use this to hide your location.

+

Website settings

-

Share your location by sending the URL to anyone. They won't need an account to view the map.

+

+ +

Android app

+ +

+ +

FAQ

+ + + +

How do I share my location?

+ +

You can share your map's url with anyone. The URL is {% if user %}https://tracman.org/map/{{user.slug}}{% else %}https://tracman.org/map/>your-slug<{% endif %}.

+ +

How accurate is the location?

+ +

+ +

Can I contribute to Tracman?

+ +

Go to map diff --git a/views/pro.html b/views/pro.html index 21e90ba..e5945a5 100644 --- a/views/pro.html +++ b/views/pro.html @@ -3,28 +3,18 @@ {% block main %}
-
+

Tracman Pro

A word from the developer

Hi Folks,

-

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 by paypal - or bitcoin?

+

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 or suggestions you have. 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. 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. -

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 test out the pro features. Keep in mind, they are as unstable as the rest of this product.

Cheers,
Keith Irwin

@@ -32,10 +22,11 @@
{% if user.isPro %}
You are already pro!
+ go to map {% else %} + go home {% endif %} - go home