Merge pull request #51 from bui/avoid-cache

prevent css/js caching
This commit is contained in:
Bui 2018-10-10 22:06:34 +01:00 committed by GitHub
commit e2ad2b2737
5 changed files with 71 additions and 84 deletions

2
.gitignore vendored
View File

@ -44,4 +44,4 @@ Temporary Items
public/songs public/songs
public/api public/api
taiko.db taiko.db
public/version.json version.json

9
app.py
View File

@ -1,9 +1,10 @@
#!/usr/bin/env python2 #!/usr/bin/env python2
import json
import sqlite3 import sqlite3
import re import re
import os import os
from flask import Flask, g, jsonify from flask import Flask, g, jsonify, render_template
app = Flask(__name__) app = Flask(__name__)
DATABASE = 'taiko.db' DATABASE = 'taiko.db'
@ -66,6 +67,12 @@ def close_connection(exception):
db.close() db.close()
@app.route('/')
def route_index():
version = json.load(open('version.json', 'r'))
return render_template('index.html', version=version)
@app.route('/api/songs') @app.route('/api/songs')
def route_api_songs(): def route_api_songs():
songs = query_db('select * from songs where enabled = 1') songs = query_db('select * from songs where enabled = 1')

View File

@ -1,62 +0,0 @@
<!----------------------------------------------------------------------->
<!-- -->
<!-- TAIKO WEB TATSUJIN -->
<!-- 2015-2018 -->
<!-- Created by Clemaister, maintained by Bui -->
<!-- https://github.com/bui/taiko-web -->
<!-- -->
<!----------------------------------------------------------------------->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>太鼓の達人ウェブ - Taiko no Tatsujin Web</title>
<link rel="icon" href="/assets/img/favicon.png" type="image/png">
<meta name="viewport" content="width=device-width, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" href="/src/css/main.css"/>
<link rel="stylesheet" href="/src/css/loader.css">
<link rel="stylesheet" href="/src/css/titlescreen.css">
<link rel="stylesheet" href="/src/css/loadsong.css">
<link rel="stylesheet" href="/src/css/game.css">
<script src="/src/js/lib/fontdetect.min.js"></script>
<script src="/src/js/assets.js"></script>
<script src="/src/js/loadsong.js"></script>
<script src="/src/js/parsesong.js"></script>
<script src="/src/js/titlescreen.js"></script>
<script src="/src/js/scoresheet.js"></script>
<script src="/src/js/songselect.js"></script>
<script src="/src/js/keyboard.js"></script>
<script src="/src/js/game.js"></script>
<script src="/src/js/controller.js"></script>
<script src="/src/js/circle.js"></script>
<script src="/src/js/view.js"></script>
<script src="/src/js/mekadon.js"></script>
<script src="/src/js/gamepad.js"></script>
<script src="/src/js/tutorial.js"></script>
<script src="/src/js/scalablecanvas.js"></script>
<script src="/src/js/element.js"></script>
<script src="/src/js/soundbuffer.js"></script>
<script src="/src/js/p2.js"></script>
<script src="/src/js/canvasasset.js"></script>
<script src="/src/js/pageevents.js"></script>
<script src="/src/js/viewassets.js"></script>
<script src="/src/js/gamerules.js"></script>
<script src="/src/js/canvasdraw.js"></script>
<script src="/src/js/loader.js"></script>
<script src="/src/js/canvastest.js"></script>
<script src="/src/js/canvascache.js"></script>
</head>
<body>
<div id="assets"></div>
<div id="screen"></div>
<div id="version"></div>
<script src="/src/js/main.js"></script>
</body>
</html>

View File

@ -13,26 +13,6 @@ class Loader{
this.screen.innerHTML = page this.screen.innerHTML = page
this.loaderPercentage = document.querySelector("#loader .percentage") this.loaderPercentage = document.querySelector("#loader .percentage")
this.loaderProgress = document.querySelector("#loader .progress") this.loaderProgress = document.querySelector("#loader .progress")
var versionTag = document.getElementById("version")
this.ajax("/version.json").then(function(resp){
var versionLink = document.createElement("a")
versionLink.setAttribute("target", "_blank")
versionLink.setAttribute("class", "stroke-sub")
try {
var parsed = JSON.parse(resp)
versionLink.setAttribute("href", "https://github.com/bui/taiko-web/commit/" + parsed.commit)
var ver_string = "taiko-web ver." + parsed.version + " (" + parsed.commit_short + ")"
} catch(e) {
versionLink.setAttribute("href", "https://github.com/bui/taiko-web")
var ver_string = "taiko-web (unknown version)"
} finally {
versionLink.appendChild(document.createTextNode(ver_string))
versionLink.setAttribute("alt", ver_string)
versionTag.appendChild(versionLink)
}
})
snd.buffer = new SoundBuffer() snd.buffer = new SoundBuffer()
snd.musicGain = snd.buffer.createGain() snd.musicGain = snd.buffer.createGain()

62
templates/index.html Normal file
View File

@ -0,0 +1,62 @@
<!----------------------------------------------------------------------->
<!-- -->
<!-- TAIKO WEB TATSUJIN -->
<!-- 2015-2018 -->
<!-- Created by Clemaister, maintained by Bui -->
<!-- https://github.com/bui/taiko-web -->
<!-- -->
<!----------------------------------------------------------------------->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>太鼓の達人ウェブ - Taiko no Tatsujin Web</title>
<link rel="icon" href="/assets/img/favicon.png" type="image/png">
<meta name="viewport" content="width=device-width, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" href="/src/css/main.css?{{version.commit_short}}"/>
<link rel="stylesheet" href="/src/css/loader.css?{{version.commit_short}}">
<link rel="stylesheet" href="/src/css/titlescreen.css?{{version.commit_short}}">
<link rel="stylesheet" href="/src/css/loadsong.css?{{version.commit_short}}">
<link rel="stylesheet" href="/src/css/game.css?{{version.commit_short}}">
<script src="/src/js/lib/fontdetect.min.js?{{version.commit_short}}"></script>
<script src="/src/js/assets.js?{{version.commit_short}}"></script>
<script src="/src/js/loadsong.js?{{version.commit_short}}"></script>
<script src="/src/js/parsesong.js?{{version.commit_short}}"></script>
<script src="/src/js/titlescreen.js?{{version.commit_short}}"></script>
<script src="/src/js/scoresheet.js?{{version.commit_short}}"></script>
<script src="/src/js/songselect.js?{{version.commit_short}}"></script>
<script src="/src/js/keyboard.js?{{version.commit_short}}"></script>
<script src="/src/js/game.js?{{version.commit_short}}"></script>
<script src="/src/js/controller.js?{{version.commit_short}}"></script>
<script src="/src/js/circle.js?{{version.commit_short}}"></script>
<script src="/src/js/view.js?{{version.commit_short}}"></script>
<script src="/src/js/mekadon.js?{{version.commit_short}}"></script>
<script src="/src/js/gamepad.js?{{version.commit_short}}"></script>
<script src="/src/js/tutorial.js?{{version.commit_short}}"></script>
<script src="/src/js/scalablecanvas.js?{{version.commit_short}}"></script>
<script src="/src/js/element.js?{{version.commit_short}}"></script>
<script src="/src/js/soundbuffer.js?{{version.commit_short}}"></script>
<script src="/src/js/p2.js?{{version.commit_short}}"></script>
<script src="/src/js/canvasasset.js?{{version.commit_short}}"></script>
<script src="/src/js/pageevents.js?{{version.commit_short}}"></script>
<script src="/src/js/viewassets.js?{{version.commit_short}}"></script>
<script src="/src/js/gamerules.js?{{version.commit_short}}"></script>
<script src="/src/js/canvasdraw.js?{{version.commit_short}}"></script>
<script src="/src/js/loader.js?{{version.commit_short}}"></script>
<script src="/src/js/canvastest.js?{{version.commit_short}}"></script>
<script src="/src/js/canvascache.js?{{version.commit_short}}"></script>
</head>
<body>
<div id="assets"></div>
<div id="screen"></div>
<div id="version"><a href="https://github.com/bui/taiko-web/commit/{{version.commit}}" target="_blank" class="stroke-sub" alt="taiko-web ver.{{version.version}} ({{version.commit_short}})">taiko-web ver.{{version.version}} ({{version.commit_short}})</a></div>
<script src="/src/js/main.js?{{version.commit_short}}"></script>
</body>
</html>