add query string to view requests

This commit is contained in:
Bui 2018-12-05 21:47:35 +00:00
parent ca90d4aea6
commit 1806fb338e
2 changed files with 12 additions and 4 deletions

13
app.py
View File

@ -44,6 +44,7 @@ def get_config():
if not config.get('assets_baseurl'): if not config.get('assets_baseurl'):
config['assets_baseurl'] = ''.join([request.host_url, 'assets']) + '/' config['assets_baseurl'] = ''.join([request.host_url, 'assets']) + '/'
config['_game_version'] = get_version()
return config return config
@ -118,6 +119,14 @@ def get_tja_preview(tja):
return 0 return 0
def get_version():
version = None
if os.path.isfile('version.json'):
version = json.load(open('version.json', 'r'))
return version
@app.teardown_appcontext @app.teardown_appcontext
def close_connection(exception): def close_connection(exception):
db = getattr(g, '_database', None) db = getattr(g, '_database', None)
@ -127,9 +136,7 @@ def close_connection(exception):
@app.route('/') @app.route('/')
def route_index(): def route_index():
version = None version = get_version()
if os.path.isfile('version.json'):
version = json.load(open('version.json', 'r'))
return render_template('index.html', version=version, config=get_config()) return render_template('index.html', version=version, config=get_config())

View File

@ -84,7 +84,8 @@ class Loader{
assets.views.forEach(name => { assets.views.forEach(name => {
var id = this.getFilename(name) var id = this.getFilename(name)
this.promises.push(this.ajax("src/views/" + name).then(page => { var qs = gameConfig._game_version ? '?' + gameConfig._game_version.commit_short : '?'
this.promises.push(this.ajax("src/views/" + name + qs).then(page => {
assets.pages[id] = page assets.pages[id] = page
})) }))
}) })