Move version strings to build script

This commit is contained in:
chylex 2019-02-06 02:35:23 +01:00
parent 5fce875399
commit 7a70e7b35b
5 changed files with 17 additions and 6 deletions

View File

@ -8,6 +8,10 @@ import os
import distutils.dir_util
VERSION_SHORT = "BETA v.9"
VERSION_FULL = VERSION_SHORT + ", released 19 Sep 2018"
EXEC_UGLIFYJS_WIN = "{2}/lib/uglifyjs.cmd --parse bare_returns --compress --mangle toplevel --mangle-props keep_quoted,reserved=[{3}] --output \"{1}\" \"{0}\""
EXEC_UGLIFYJS_AUTO = "uglifyjs --parse bare_returns --compress --mangle toplevel --mangle-props keep_quoted,reserved=[{3}] --output \"{1}\" \"{0}\""
EXEC_YUI = "java -jar lib/yuicompressor-2.4.8.jar --charset utf-8 --line-break 160 --type css -o \"{1}\" \"{0}\""
@ -42,7 +46,7 @@ with open("reserve.txt", "r") as reserved:
def combine_files(input_pattern, output_file):
with fileinput.input(sorted(glob.glob(input_pattern))) as stream:
for line in stream:
output_file.write(line)
output_file.write(line.replace("{{{version:full}}}", VERSION_FULL))
def build_tracker_html():
@ -88,7 +92,7 @@ def build_tracker_userscript():
userscript_base = "src/base/track.user.js"
with open(userscript_base, "r") as base:
userscript_contents = base.read().split("{{{contents}}}")
userscript_contents = base.read().replace("{{{version}}}", VERSION_SHORT).split("{{{contents}}}")
with open(output_file, "w") as out:
out.write(userscript_contents[0])
@ -156,6 +160,13 @@ def build_website():
web_style_file = "bld/web/style.css"
distutils.dir_util.copy_tree("web", "bld/web")
index_file = "bld/web/index.php"
with open(index_file, "r") as index:
index_contents = index.read()
with open(index_file, "w") as index:
index.write(index_contents.replace("{{{version:web}}}", VERSION_SHORT.replace(" ", " ")))
os.makedirs("bld/web/build", exist_ok = True)
shutil.copyfile(tracker_file_html, "bld/web/build/track.html")

View File

@ -1,6 +1,6 @@
// ==UserScript==
// @name Discord History Tracker
// @version BETA v.9
// @version {{{version}}}
// @license MIT
// @namespace https://chylex.com
// @homepageURL https://dht.chylex.com/

View File

@ -51,7 +51,7 @@ var GUI = (function(){
showModal(560, `
<p>Discord History Tracker is developed by <a href='https://chylex.com'>chylex</a> as an <a href='${linkGH}/blob/master/LICENSE.md'>open source</a> project.</p>
<sub>BETA v.9, released 19 Sep 2018</sub>
<sub>{{{version:full}}}</sub>
<p>Please, report any issues and suggestions to the <a href='${linkGH}/issues'>tracker</a>. If you want to support the development, please spread the word and consider <ref='https://www.patreon.com/chylex'>becoming a patron</a>. Any support is appreciated!</p>
<p><a href='${linkGH}/issues'>Issue Tracker</a> &nbsp;&mdash;&nbsp; <a href='${linkGH}'>GitHub Repository</a> &nbsp;&mdash;&nbsp; <a href='https://twitter.com/chylexmc'>Developer's Twitter</a></p>`);
};

View File

@ -223,7 +223,7 @@ ${radio("asm", "pause", "Pause Tracking")}
${radio("asm", "switch", "Switch to Next Channel")}
<p id='dht-cfg-note'>
It is recommended to disable link and image previews to avoid putting unnecessary strain on your browser.<br><br>
<sub>BETA v.9, released 19 Sep 2018</sub>
<sub>{{{version:full}}}</sub>
</p>`);
// elements

View File

@ -13,7 +13,7 @@
</head>
<body>
<div class="inner">
<h1>Discord History Tracker <span class="version">BETA&nbsp;v.9</span>&nbsp;<span class="bar">|</span>&nbsp;<span class="notes"><a href="https://github.com/chylex/Discord-History-Tracker/wiki/Release-Notes">Release&nbsp;Notes</a></span></h1>
<h1>Discord History Tracker <span class="version">{{{version:web}}}</span>&nbsp;<span class="bar">|</span>&nbsp;<span class="notes"><a href="https://github.com/chylex/Discord-History-Tracker/wiki/Release-Notes">Release&nbsp;Notes</a></span></h1>
<p>Discord History Tracker is a browser script that lets you locally save chat history in your servers, groups, and private conversations.</p>
<p>When the script is active, it will load history of the selected text channel up to the first message, and let you download it for offline viewing in your browser.</p>