load version dynamically
that way the whole dang cache doesnt get invalidated when the version changes
This commit is contained in:
parent
2f83630629
commit
51cf43d073
|
@ -0,0 +1,14 @@
|
|||
(function(){
|
||||
|
||||
if(!('fetch' in window)){
|
||||
return
|
||||
}
|
||||
fetch('/api/about').then(r => r.json()).then(j => {
|
||||
let ident = document.querySelector('#ident');
|
||||
ident.textContent = j.service
|
||||
if(j.version){
|
||||
ident.textContent += ' ' + j.version
|
||||
}
|
||||
})
|
||||
|
||||
})();
|
2
dodo.py
2
dodo.py
|
@ -23,7 +23,7 @@ def task_gen_logo():
|
|||
|
||||
def task_copy_asset():
|
||||
import shutil
|
||||
assets = ('icon.png', 'logotype.png')
|
||||
assets = ('icon.png', 'logotype.png', 'version.js')
|
||||
for asset in assets:
|
||||
yield dict(
|
||||
name=asset,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from flask import render_template, url_for, redirect, request, g, Response
|
||||
from flask import render_template, url_for, redirect, request, g, Response, jsonify
|
||||
from datetime import datetime, timedelta
|
||||
import lib.twitter
|
||||
import lib
|
||||
|
@ -161,3 +161,7 @@ def logout():
|
|||
db.session.commit()
|
||||
g.viewer = None
|
||||
return redirect(url_for('index'))
|
||||
|
||||
@app.route('/api/about')
|
||||
def api_about():
|
||||
return jsonify(service='Forget', version=version.version)
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
<meta name='og:type' content='website' />
|
||||
<meta name='twitter:card' content='summary' />
|
||||
<meta name='twitter:site:id' content='808418'/>
|
||||
<script async src="{{ st('version.js') }}"></script>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
|
@ -27,7 +28,7 @@
|
|||
</header>
|
||||
{% block body %}{% endblock %}
|
||||
<footer>
|
||||
<p>Forget {{version or "dev"}}</p>
|
||||
<p id='ident'>Forget</p>
|
||||
<p>A <a href="https://twitter.com/codl">codl</a> joint</p>
|
||||
<p><a href="https://github.com/codl/forget">Code on Github</a></p>
|
||||
</footer>
|
||||
|
|
Loading…
Reference in New Issue