diff --git a/.gitignore b/.gitignore index 6c5ccf6..df15598 100644 --- a/.gitignore +++ b/.gitignore @@ -44,4 +44,4 @@ Temporary Items public/songs public/api taiko.db -public/version.json \ No newline at end of file +version.json \ No newline at end of file diff --git a/app.py b/app.py index 4ee9267..385e16b 100644 --- a/app.py +++ b/app.py @@ -1,9 +1,10 @@ #!/usr/bin/env python2 +import json import sqlite3 import re import os -from flask import Flask, g, jsonify +from flask import Flask, g, jsonify, render_template app = Flask(__name__) DATABASE = 'taiko.db' @@ -66,6 +67,12 @@ def close_connection(exception): 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') def route_api_songs(): songs = query_db('select * from songs where enabled = 1') diff --git a/public/index.html b/public/index.html deleted file mode 100644 index b6d0023..0000000 --- a/public/index.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - 太鼓の達人ウェブ - Taiko no Tatsujin Web - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - diff --git a/public/src/js/loader.js b/public/src/js/loader.js index 275b704..62dce66 100644 --- a/public/src/js/loader.js +++ b/public/src/js/loader.js @@ -13,26 +13,6 @@ class Loader{ this.screen.innerHTML = page this.loaderPercentage = document.querySelector("#loader .percentage") 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.musicGain = snd.buffer.createGain() diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..b8a0251 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + 太鼓の達人ウェブ - Taiko no Tatsujin Web + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
taiko-web ver.{{version.version}} ({{version.commit_short}})
+ + + \ No newline at end of file