setup donation page and begging
This commit is contained in:
parent
5a3bf57a32
commit
c54c37b10e
|
@ -36,8 +36,6 @@ def health():
|
|||
'docker': Docker().client.ping()
|
||||
}), 200)
|
||||
|
||||
# @app.errorhandler(404)
|
||||
# def not_found(error):
|
||||
# return make_response(jsonify({
|
||||
# 'error': 'Page not found'
|
||||
# }), 404)
|
||||
@meta_bp.route('/donate')
|
||||
def donate():
|
||||
return render_template('meta/donate.html')
|
||||
|
|
|
@ -15,7 +15,7 @@ from wowstash.library.jsonrpc import Wallet, daemon, to_atomic
|
|||
from wowstash.library.cache import cache
|
||||
from wowstash.forms import Send, Delete, Restore
|
||||
from wowstash.factory import db
|
||||
from wowstash.models import User
|
||||
from wowstash.models import User, DonatePrompt
|
||||
from wowstash import config
|
||||
|
||||
|
||||
|
@ -70,6 +70,25 @@ def dashboard():
|
|||
sleep(1.5)
|
||||
return redirect(url_for('wallet.loading'))
|
||||
|
||||
# Redirect to donate page if user isnt prompted for a bit
|
||||
dp = DonatePrompt.query.filter(
|
||||
DonatePrompt.user == current_user.id
|
||||
).order_by(
|
||||
DonatePrompt.date.desc()
|
||||
).first()
|
||||
if not dp:
|
||||
d = DonatePrompt(user=current_user.id)
|
||||
db.session.add(d)
|
||||
db.session.commit()
|
||||
return redirect(url_for('meta.donate'))
|
||||
|
||||
# If havent seen donate page in some time, show again
|
||||
if dp.hours_elapsed() > 168:
|
||||
d = DonatePrompt(user=current_user.id)
|
||||
db.session.add(d)
|
||||
db.session.commit()
|
||||
return redirect(url_for('meta.donate'))
|
||||
|
||||
address = wallet.get_address()
|
||||
transfers = wallet.get_transfers()
|
||||
for type in transfers:
|
||||
|
|
|
@ -89,3 +89,19 @@ class PasswordReset(db.Model):
|
|||
|
||||
def __repr__(self):
|
||||
return self.id
|
||||
|
||||
|
||||
class DonatePrompt(db.Model):
|
||||
__tablename__ = 'donate_prompts'
|
||||
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
user = db.Column(db.Integer, db.ForeignKey(User.id))
|
||||
date = db.Column(db.DateTime, server_default=func.now())
|
||||
|
||||
def hours_elapsed(self):
|
||||
now = datetime.utcnow()
|
||||
diff = now - self.date
|
||||
return diff.total_seconds() / 60 / 60
|
||||
|
||||
def __repr__(self):
|
||||
return str(f'donate-prompt-{self.id}')
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
{% include 'head.html' %}
|
||||
|
||||
<body id="page-top">
|
||||
|
||||
{% include 'navbar.html' %}
|
||||
|
||||
<header class="masthead">
|
||||
<div class="container h-100">
|
||||
<div class="row h-100">
|
||||
<div class="col-lg-12 my-auto">
|
||||
<div class="header-content mx-auto">
|
||||
<h1 class="mb-4">Donate</h1>
|
||||
<p>Hey, this service is provided to you for free, please consider donating some WOW since I both donate my time and money keeping the service alive and paying for hosting.</p>
|
||||
<p>lza_menace: <code style="background-color: white;">Wo59kvcHiDd48sstysDqGgBAN1fECLKALKw2bPUJhS4UjX9wj2SK4e4GH6HvrBmot6cBrWNE1T65UR6a5SLbzh882c1SXEhiK</code></p>
|
||||
<a href="{{ url_for('wallet.dashboard') }}?to_addr=Wo59kvcHiDd48sstysDqGgBAN1fECLKALKw2bPUJhS4UjX9wj2SK4e4GH6HvrBmot6cBrWNE1T65UR6a5SLbzh882c1SXEhiK#send" class="btn btn-outline btn-xl js-scroll-trigger">Ok, take me to my wallet</a>
|
||||
<br/><br/>
|
||||
<a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ" target=_blank class="btn btn-outline btn-xl js-scroll-trigger">Nah, fuck you menace.</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{% include 'footer.html' %}
|
||||
|
||||
{% include 'scripts.html' %}
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -117,7 +117,7 @@
|
|||
{{ send_form.csrf_token }}
|
||||
<div class="form-group">
|
||||
{{ send_form.address.label }}
|
||||
{{ send_form.address }}
|
||||
<input class="form-control" id="address" name="address" placeholder="Wownero address" required="" type="text" value="{{ request.args.to_addr }}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
{{ send_form.amount.label }}
|
||||
|
@ -130,6 +130,7 @@
|
|||
</ul>
|
||||
<input type="submit" value="Send" class="btn btn-link btn-outline btn-xl">
|
||||
</form>
|
||||
<a href="{{ url_for('meta.donate') }}" style="padding-top: 1em; display: block;">Donation Info</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
|
Loading…
Reference in New Issue