Prechádzať zdrojové kódy

Add git info to home page.

scossu 9 mesiacov pred
rodič
commit
8bb201fa55

+ 2 - 0
requirements.txt

@@ -1,6 +1,8 @@
 # Core application dependencies.
+aksharamukha>=2.2,<3
 flask>=2.3,<3
 flask-cors>=4.0,<5
 python-dotenv>=1.0,<2
 pyyaml>=6.0,<7
 uwsgi>=2.0,<2.1
+yiddish==0.0.21

+ 5 - 0
scriptshifter/__init__.py

@@ -18,6 +18,11 @@ The default is None in which causes the feedback form to be disabled.
 """
 SMTP_HOST = environ.get("TXL_SMTP_HOST")
 
+with open(path.join(path.dirname(APP_ROOT), "VERSION")) as fh:
+    version_info = fh.readlines()
+GIT_TAG = version_info[0].strip()
+GIT_COMMIT = version_info[1].strip()
+
 logging.basicConfig(
         # filename=environ.get("TXL_LOGFILE", "/dev/stdout"),
         level=environ.get("TXL_LOGLEVEL", logging.WARN))

+ 5 - 1
scriptshifter/rest_api.py

@@ -10,7 +10,10 @@ from smtplib import SMTP
 from flask import Flask, jsonify, render_template, request
 from flask_cors import CORS
 
-from scriptshifter import EMAIL_FROM, EMAIL_TO, SMTP_HOST, SMTP_PORT
+from scriptshifter import (
+        EMAIL_FROM, EMAIL_TO,
+        GIT_COMMIT, GIT_TAG,
+        SMTP_HOST, SMTP_PORT)
 from scriptshifter.exceptions import ApiError
 from scriptshifter.tables import list_tables, load_table
 from scriptshifter.trans import transliterate
@@ -69,6 +72,7 @@ def index():
     return render_template(
             "index.html",
             languages=list_tables(),
+            version_info=(GIT_TAG, GIT_COMMIT),
             feedback_form=SMTP_HOST is not None)
 
 

+ 4 - 0
scriptshifter/templates/layout.html

@@ -21,5 +21,9 @@
             </div>
           </section>
         </main>
+        <footer>
+            <p>Scriptshifter version: tag {{ version_info[0] }} &mdash;&nbsp;
+            commit # {{ version_info[1] }}</p>
+        </footer>
     </body>
 </html>