This commit is contained in:
matthias@arch 2022-11-23 16:53:16 +01:00
parent 1ea034de17
commit f757c5aaef
3 changed files with 8 additions and 0 deletions

View File

@ -6,6 +6,8 @@ from os.path import isfile, isdir
from visualize import visualize from visualize import visualize
from settings_manager import read_settings_file from settings_manager import read_settings_file
version = "1.0"
# default settings, these are overwriteable through a config file # default settings, these are overwriteable through a config file
settings = { settings = {
# GENERAL # GENERAL
@ -87,6 +89,7 @@ if __name__ == '__main__':
if not isfile(config_file): if not isfile(config_file):
error(f"Not a file: '{config_file}'") error(f"Not a file: '{config_file}'")
read_settings_file(config_file, settings) read_settings_file(config_file, settings)
settings["version"] = version
if not settings["server-name"]: missing_arg("server-name") if not settings["server-name"]: missing_arg("server-name")
if not settings["access-log"]: missing_arg("log") if not settings["access-log"]: missing_arg("log")

View File

@ -34,5 +34,6 @@
<img src="%img_referer_ranking" alt="Referer ranking", title="Referer ranking"> <img src="%img_referer_ranking" alt="Referer ranking", title="Referer ranking">
</center> </center>
</div> </div>
<p>These analytics were generated by <a href="https://git.quintern.xyz/MatthiasQuintern/regina">regina %regina_version</a></p>
</body> </body>
</html> </html>

View File

@ -340,11 +340,15 @@ def visualize(loaded_settings: dict):
img_dir = settings["img_dir"] img_dir = settings["img_dir"]
img_filetype = settings["img_filetype"] img_filetype = settings["img_filetype"]
names = { names = {
# general
"regina_version": settings["version"]
# paths
"img_file_ranking": f"{img_dir}/ranking_all_time_files.{img_filetype}", "img_file_ranking": f"{img_dir}/ranking_all_time_files.{img_filetype}",
"img_referer_ranking": f"{img_dir}/ranking_all_time_referers.{img_filetype}", "img_referer_ranking": f"{img_dir}/ranking_all_time_referers.{img_filetype}",
"img_browser_ranking": f"{img_dir}/ranking_all_time_browsers.{img_filetype}", "img_browser_ranking": f"{img_dir}/ranking_all_time_browsers.{img_filetype}",
"img_operating_system_ranking": f"{img_dir}/ranking_all_time_operating_systems.{img_filetype}", "img_operating_system_ranking": f"{img_dir}/ranking_all_time_operating_systems.{img_filetype}",
"img_daily": f"{img_dir}/user_request_count_daily.{img_filetype}", "img_daily": f"{img_dir}/user_request_count_daily.{img_filetype}",
# values
"mobile_user_percentage": 0.0, "mobile_user_percentage": 0.0,
"server-name": settings["server-name"], "server-name": settings["server-name"],
"last_x_days": settings["last_x_days"], "last_x_days": settings["last_x_days"],