Various updates

master
Keith Irwin 2017-03-18 13:21:48 -04:00
parent ee7c874d3c
commit 94a718afab
No known key found for this signature in database
GPG Key ID: 378933C743E2BBC0
5 changed files with 82 additions and 56 deletions

View File

@ -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;

View File

@ -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;

View File

@ -7,6 +7,7 @@
{% if code %}<h2>{{code}}</h2>{% endif %}
{% if message %}<h3>{{message}}</h3>{% endif %}
{% if error %}<p>{{error}}</p>{% endif %}
<p>I would really appreciate it if you would <a href="https://github.com/Tracman-org/Server/issues/new">report this error</a>. </p>
{% if code %}<img style="width:100%" src="https://http.cat/{{code}}.jpg">{% endif %}
</div>
</section>

View File

@ -4,17 +4,45 @@
{% block main %}
<section class='container'>
<h2>Help</h2>
<h1>Help</h1>
<p><i>Welcome to Tracman! Here's how to get started. </i></p>
<p><i>Welcome to Tracman! Here's how to get started. </i></p>
<p><u>Set</u> sets your location once using this device's geolocation. On a GPS-enabled phone, the location will be set to its coordinates. </p>
<h2>Website map controls</h2>
<p><u>Track</u> 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! </p>
<p><u>Set</u> sets your location once using this device's geolocation. On a GPS-enabled phone, the location will be set to its coordinates. </p>
<p><u>Track</u> 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 <a href="/android">android app</a>. </p>
<p><u>Clear</u> clears your location instantly. Anyone looking at your map will see a blank screen instead. Use this to hide your location. </p>
<p><u>Clear</u> clears your location instantly. Anyone looking at your map will see a blank screen instead. Use this to hide your location. </p>
<h2>Website settings</h2>
<p>Share your location by sending the URL to anyone. They won't need an account to view the map. </p>
<p></p>
<h2>Android app</h2>
<p></p>
<h2>FAQ</h2>
<ul>
<li>How do I share my location?</li>
<li>How accurate is the location?</li>
<li>Can I contribute to Tracman?</li>
</ul>
<h3>How do I share my location?</h3>
<p>You can share your map's url with anyone. The URL is {% if user %}<a href="https://tracman.org/map/{{user.slug}}">https://tracman.org/map/{{user.slug}}</a>{% else %}<u>https://tracman.org/map/&gt;your-slug&lt;</u>{% endif %}. </p>
<h3>How accurate is the location?</h3>
<p></p>
<h3>Can I contribute to Tracman?</h3>
<p></p>
<a href="/map" class='btn' style="width:60%; position:relative; left:20%; background:#333">Go to map <i class='fa fa-angle-right'></i></a>

View File

@ -3,28 +3,18 @@
{% block main %}
<section class='dark'>
<div class='container'>
<h1>Tracman Pro</h1>
<h3>A word from the developer</h3>
<p>Hi Folks, </p>
<p>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 <a href="https://www.paypal.com/us/cgi-bin/webscr?cmd=_flow&SESSION=56toCNZRvXj-_J6kC_5D258zMwjyU7hLvxKFQXsIG5_nzVlAhEw2VLFf7K0&dispatch=5885d80a13c0db1f8e263663d3faee8defcd6970d4fd9d661117ac2649af92bb">paypal</a>
or <a href="bitcoin:1GXbuM398Y2tYwSaQhNQHXWF1AN6GeRgQh?label=tracman">bitcoin</a>? </p>
<p>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 <a href="https://cash.me/$KeithIrwin">money</a> or <a href="bitcoin:16KY9k6qdXqDD3mWwr8hrD7ky18AqYSJDo?label=tracman">bitcoin</a>? </p>
<p>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 <a href="/bug">bugs</a>
you encounter or <a href="/suggestion">suggestions</a> you have. And keep in mind that at some
point, when we launch out of beta, Tracman Pro will <em>not</em> be free and <strong>you will
lose your pro membership</strong> unless start paying for it.
<p>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 <a href="https://github.com/Tracman-org/Server/issues/new">inform me about any bugs</a> you encounter. And keep in mind that at some point, when we launch out of beta, Tracman Pro will <em>not</em> be free and <strong>you will lose your pro membership</strong> unless start paying for it.
<p>That said, just click the button below to test out the pro features. Keep in mind, they are
as <a href="/#disclaimer">unstable</a> as the rest of this product.
<p>That said, just click the button below to test out the pro features. Keep in mind, they are as <a href="/#disclaimer">unstable</a> as the rest of this product.
<p>Cheers, <br>
<a href="https://keithirwin.us/">Keith Irwin</a></p>
@ -32,10 +22,11 @@
<form class='row flexbox' action="#" method="POST">
{% if user.isPro %}
<div class='alert alert-success'><i class="fa fa-check-circle"></i> You are already pro! </div>
<a class='btn' href="/map">go to map</a>
{% else %}
<button type="submit" class='btn yellow'>GO PRO</button>
<a class='btn' href="/map">go home</a>
{% endif %}
<a class='btn' href="/dashboard">go home</a>
</form>
</div>