image path substitution takes location
This commit is contained in:
parent
165e25dac0
commit
b6e81eea74
116
database.uxf
116
database.uxf
@ -1,104 +1,108 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<diagram program="umlet" version="15.0.0">
|
||||
<zoom_level>19</zoom_level>
|
||||
<zoom_level>13</zoom_level>
|
||||
<element>
|
||||
<id>UMLClass</id>
|
||||
<coordinates>
|
||||
<x>133</x>
|
||||
<y>247</y>
|
||||
<w>342</w>
|
||||
<h>266</h>
|
||||
<x>364</x>
|
||||
<y>273</y>
|
||||
<w>299</w>
|
||||
<h>208</h>
|
||||
</coordinates>
|
||||
<panel_attributes>User
|
||||
--
|
||||
<<PK>>- user_id
|
||||
<<PK>>
|
||||
- user_id: INTEGER
|
||||
--
|
||||
- ip address
|
||||
- user agent string
|
||||
- platform
|
||||
- browser
|
||||
- mobile
|
||||
- ip address: TEXT
|
||||
- user agent string: TEXT
|
||||
- platform: TEXT
|
||||
- browser: TEXT
|
||||
- mobile: INTEGER
|
||||
style=autoresize</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLClass</id>
|
||||
<coordinates>
|
||||
<x>1159</x>
|
||||
<y>247</y>
|
||||
<w>247</w>
|
||||
<h>152</h>
|
||||
<x>1092</x>
|
||||
<y>273</y>
|
||||
<w>234</w>
|
||||
<h>130</h>
|
||||
</coordinates>
|
||||
<panel_attributes>FileGroup
|
||||
--
|
||||
<<PK>>- group_id
|
||||
<<PK>>
|
||||
- group_id: INTEGER
|
||||
--
|
||||
- group_name
|
||||
- group_name: TEXT
|
||||
style=autoresize</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>969</x>
|
||||
<y>247</y>
|
||||
<w>228</w>
|
||||
<h>95</h>
|
||||
<x>988</x>
|
||||
<y>273</y>
|
||||
<w>130</w>
|
||||
<h>65</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=-
|
||||
m1=n
|
||||
m2=1
|
||||
</panel_attributes>
|
||||
<additional_attributes>10.0;20.0;100.0;20.0</additional_attributes>
|
||||
<additional_attributes>10.0;20.0;80.0;20.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLClass</id>
|
||||
<coordinates>
|
||||
<x>703</x>
|
||||
<y>228</y>
|
||||
<w>285</w>
|
||||
<h>285</h>
|
||||
<x>754</x>
|
||||
<y>260</y>
|
||||
<w>247</w>
|
||||
<h>221</h>
|
||||
</coordinates>
|
||||
<panel_attributes>Request
|
||||
--
|
||||
<<PK>>- request_id
|
||||
<<PK>>
|
||||
- request_id: INTEGER
|
||||
--
|
||||
- user_id
|
||||
- file name
|
||||
- user_id: INTEGER
|
||||
- group_id: INTEGER
|
||||
--
|
||||
- date
|
||||
- referer
|
||||
- status
|
||||
- date: TEXT
|
||||
- referer: TEXT
|
||||
- status: INTEGER
|
||||
style=autoresize</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>456</x>
|
||||
<y>247</y>
|
||||
<w>285</w>
|
||||
<h>95</h>
|
||||
<x>650</x>
|
||||
<y>273</y>
|
||||
<w>130</w>
|
||||
<h>65</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=-
|
||||
m1=1
|
||||
m2=n
|
||||
</panel_attributes>
|
||||
<additional_attributes>10.0;20.0;130.0;20.0</additional_attributes>
|
||||
<additional_attributes>10.0;20.0;80.0;20.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLClass</id>
|
||||
<coordinates>
|
||||
<x>1159</x>
|
||||
<y>646</y>
|
||||
<w>190</w>
|
||||
<h>152</h>
|
||||
<x>1092</x>
|
||||
<y>546</y>
|
||||
<w>234</w>
|
||||
<h>130</h>
|
||||
</coordinates>
|
||||
<panel_attributes>File
|
||||
--
|
||||
<<PK>>- name
|
||||
<<PK>>
|
||||
- name: TEXT
|
||||
--
|
||||
- group_id
|
||||
- group_id: INTEGER
|
||||
--
|
||||
style=autoresize</panel_attributes>
|
||||
<additional_attributes/>
|
||||
@ -106,24 +110,24 @@ style=autoresize</panel_attributes>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>1216</x>
|
||||
<y>380</y>
|
||||
<w>76</w>
|
||||
<h>304</h>
|
||||
<x>1131</x>
|
||||
<y>390</y>
|
||||
<w>52</w>
|
||||
<h>182</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=-
|
||||
m1=n
|
||||
m2=1
|
||||
</panel_attributes>
|
||||
<additional_attributes>10.0;140.0;10.0;10.0</additional_attributes>
|
||||
<additional_attributes>10.0;120.0;10.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLNote</id>
|
||||
<coordinates>
|
||||
<x>874</x>
|
||||
<y>19</y>
|
||||
<w>570</w>
|
||||
<h>133</h>
|
||||
<x>897</x>
|
||||
<y>117</y>
|
||||
<w>390</w>
|
||||
<h>91</h>
|
||||
</coordinates>
|
||||
<panel_attributes>One group contains multiple files.
|
||||
Lets you group the images from a
|
||||
@ -134,10 +138,10 @@ style=autoresize</panel_attributes>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>1178</x>
|
||||
<y>133</y>
|
||||
<w>57</w>
|
||||
<h>152</h>
|
||||
<x>1105</x>
|
||||
<y>195</y>
|
||||
<w>39</w>
|
||||
<h>104</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<-</panel_attributes>
|
||||
<additional_attributes>10.0;60.0;10.0;10.0</additional_attributes>
|
||||
|
@ -18,6 +18,7 @@ file_ranking_plot_max_files = 15
|
||||
# "plot_figsize" = (60 40),
|
||||
plot_dpi = 300
|
||||
img_dir = /www/analytics/images
|
||||
img_dir = /analytics/images
|
||||
template_html = /home/my-user/analytics/template.html
|
||||
html_out_path = /www/analytics/statistics.html
|
||||
# filegroups = start:/index.html,/about.html,/img_on_index.png;music:/music.html,song.mp3
|
||||
|
@ -32,6 +32,7 @@ settings = {
|
||||
# "plot_figsize": (60, 40),
|
||||
"plot_dpi": 300,
|
||||
"img_dir": "",
|
||||
"img_location": "",
|
||||
"img_filetype": "svg",
|
||||
"template_html": "",
|
||||
"html_out_path": "",
|
||||
|
@ -374,17 +374,17 @@ def visualize(loaded_settings: dict):
|
||||
img_filetype = settings["img_filetype"]
|
||||
names = {
|
||||
# paths
|
||||
"img_file_ranking_last_x_days": f"{img_dir}/ranking_all_time_files_last_x_days.{img_filetype}",
|
||||
"img_referer_ranking_last_x_days": f"{img_dir}/ranking_all_time_referers_last_x_days.{img_filetype}",
|
||||
"img_browser_ranking_last_x_days": f"{img_dir}/ranking_all_time_browsers_last_x_days.{img_filetype}",
|
||||
"img_operating_system_ranking_last_x_days": f"{img_dir}/ranking_all_time_operating_systems_last_x_days.{img_filetype}",
|
||||
"img_users_and_requests_last_x_days": f"{img_dir}/user_request_count_daily_last_x_days.{img_filetype}",
|
||||
"img_file_ranking_last_x_days": f"ranking_all_time_files_last_x_days.{img_filetype}",
|
||||
"img_referer_ranking_last_x_days": f"ranking_all_time_referers_last_x_days.{img_filetype}",
|
||||
"img_browser_ranking_last_x_days": f"ranking_all_time_browsers_last_x_days.{img_filetype}",
|
||||
"img_operating_system_ranking_last_x_days": f"ranking_all_time_operating_systems_last_x_days.{img_filetype}",
|
||||
"img_users_and_requests_last_x_days": f"user_request_count_daily_last_x_days.{img_filetype}",
|
||||
|
||||
"img_file_ranking_total": f"{img_dir}/ranking_all_time_files_total.{img_filetype}",
|
||||
"img_referer_ranking_total": f"{img_dir}/ranking_all_time_referers_total.{img_filetype}",
|
||||
"img_browser_ranking_total": f"{img_dir}/ranking_all_time_browsers_total.{img_filetype}",
|
||||
"img_operating_system_ranking_total": f"{img_dir}/ranking_all_time_operating_systems_total.{img_filetype}",
|
||||
"img_users_and_requests_total": f"{img_dir}/user_request_count_daily_total.{img_filetype}",
|
||||
"img_file_ranking_total": f"ranking_all_time_files_total.{img_filetype}",
|
||||
"img_referer_ranking_total": f"ranking_all_time_referers_total.{img_filetype}",
|
||||
"img_browser_ranking_total": f"ranking_all_time_browsers_total.{img_filetype}",
|
||||
"img_operating_system_ranking_total": f"ranking_all_time_operating_systems_total.{img_filetype}",
|
||||
"img_users_and_requests_total": f"user_request_count_daily_total.{img_filetype}",
|
||||
# values
|
||||
"mobile_user_percentage_total": 0.0,
|
||||
"mobile_user_percentage_last_x_days": 0.0,
|
||||
@ -453,13 +453,13 @@ def visualize(loaded_settings: dict):
|
||||
file_ranking = get_file_ranking(cur, date_str)
|
||||
if gen_img:
|
||||
fig_file_ranking = plot_ranking(file_ranking, xlabel="Filename/Filegroup", ylabel="Number of requests", color_settings=color_settings_filetypes)
|
||||
fig_file_ranking.savefig(names[f'img_file_ranking{suffix}'])
|
||||
fig_file_ranking.savefig(f"{img_dir}/{names[f'img_file_ranking{suffix}']}")
|
||||
|
||||
# REFERER
|
||||
referer_ranking = get_ranking("referer", t_request, settings["referer_ranking_regex_whitelist"], cur, date_str)
|
||||
if gen_img:
|
||||
fig_referer_ranking = plot_ranking(referer_ranking, xlabel="HTTP Referer", ylabel="Number of requests", color_settings=color_settings_alternate)
|
||||
fig_referer_ranking.savefig(names[f'img_referer_ranking{suffix}'])
|
||||
fig_referer_ranking.savefig(f"{img_dir}/{names[f'img_referer_ranking{suffix}']}")
|
||||
|
||||
# USER
|
||||
# user_agent_ranking = get_user_agent_ranking(cur, date_str)
|
||||
@ -492,15 +492,15 @@ def visualize(loaded_settings: dict):
|
||||
fig_daily, ax1, ax2, plots = plot2y(date_names, [len(user_ids) for user_ids in unique_user_ids_dates], [len(request_ids) for request_ids in unique_request_ids_dates], xlabel="Date", ylabel1="User count", label1="Unique users", ylabel2="Request count", label2="Unique requests", color1=palette["red"], color2=palette["blue"])
|
||||
if get_humans:
|
||||
fig_daily, ax1, ax2, plots = plot2y(date_names, [len(user_ids) for user_ids in unique_user_ids_human_dates], [len(request_ids) for request_ids in unique_request_ids_human_dates], label1="Unique users (human)", ylabel2="Einzigartige Anfragen", label2="Unique requests (human)", color1=palette["orange"], color2=palette["green"], fig=fig_daily, ax1=ax1, ax2=ax2, plots=plots)
|
||||
fig_daily.savefig(names[f"img_users_and_requests{suffix}"])
|
||||
fig_daily.savefig(f"{img_dir}{names[f'img_users_and_requests{suffix}']}")
|
||||
|
||||
# os & browser
|
||||
os_ranking, browser_ranking, names[f"mobile_user_percentage{suffix}"] = get_os_browser_mobile_rankings(cur, unique_user_ids_human)
|
||||
if gen_img:
|
||||
fig_os_rating = plot_ranking(os_ranking, xlabel="Platform", ylabel="Share [%]", color_settings=color_settings_operating_systems)
|
||||
fig_os_rating.savefig(names[f"img_operating_system_ranking{suffix}"])
|
||||
fig_os_rating.savefig(f"{img_dir}{names[f'img_operating_system_ranking{suffix}']}")
|
||||
fig_browser_rating = plot_ranking(browser_ranking, xlabel="Browsers", ylabel="Share [%]", color_settings=color_settings_browsers)
|
||||
fig_browser_rating.savefig(names[f"img_browser_ranking{suffix}"])
|
||||
fig_browser_rating.savefig(f"{img_dir}/{names[f'img_browser_ranking{suffix}']}")
|
||||
|
||||
# print("File Ranking", file_ranking)
|
||||
# print("referer Ranking", referer_ranking)
|
||||
@ -516,6 +516,8 @@ def visualize(loaded_settings: dict):
|
||||
with open(settings["template_html"], "r") as file:
|
||||
html = file.read()
|
||||
for name, value in names.items():
|
||||
if "img" in name:
|
||||
value = f"{img_location}/{value}"
|
||||
html = html.replace(f"%{name}", str(value))
|
||||
with open(settings["html_out_path"], "w") as file:
|
||||
file.write(html)
|
||||
|
1
setup.py
1
setup.py
@ -14,6 +14,7 @@ setup(
|
||||
|
||||
packages=["regina"],
|
||||
install_requires=[],
|
||||
python_requires='>=3.10',
|
||||
|
||||
classifiers=[
|
||||
"Operating System :: POSIX :: Linux",
|
||||
|
@ -5,7 +5,7 @@
|
||||
<meta name="description" content="Regina - Nginx Analytics">
|
||||
<meta name="keywords" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Analytics for %server_name</title>
|
||||
<title>Analytics for %server-name</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
|
Loading…
Reference in New Issue
Block a user