diff --git a/app.py b/app.py index 3b4b3b8..f793990 100644 --- a/app.py +++ b/app.py @@ -31,6 +31,10 @@ logger = logging.getLogger(__name__) def log_page_view(page: str, user_agent: str = None): """Protokolliert Seitenaufrufe ohne IP-Adressen""" + # Zugriffe auf /stats nicht loggen, da sie die Statistiken verfälschen + if page == "stats": + return + timestamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S') user_agent_clean = user_agent[:100] if user_agent else 'Unknown' logger.info(f"PAGE_VIEW: {page} | User-Agent: {user_agent_clean}") @@ -72,6 +76,9 @@ def get_statistics(): 'top_search_patterns': {} } + # Sammle alle relevanten Aktivitäten + all_activities = [] + try: # Aktuelle Log-Datei lesen log_file = logs_dir / 'app.log' @@ -84,6 +91,16 @@ def get_statistics(): if 'PAGE_VIEW: ' in line: page = line.split('PAGE_VIEW: ')[1].split(' |')[0] stats['page_views_by_page'][page] = stats['page_views_by_page'].get(page, 0) + 1 + + # PAGE_VIEW Einträge als Aktivität sammeln + timestamp = line.split(' - ')[0] if ' - ' in line else '' + if timestamp: + # /stats-Zugriffe aus den Aktivitäten filtern + if 'PAGE_VIEW: stats' not in line: + all_activities.append({ + 'timestamp': timestamp, + 'line': line.strip() + }) elif 'SEARCH:' in line: stats['total_searches'] += 1 @@ -102,12 +119,11 @@ def get_statistics(): pos_part = line.split('pos=\'')[1].split('\'')[0] if pos_part: stats['top_search_patterns'][pos_part] = stats['top_search_patterns'].get(pos_part, 0) + 1 - - # Letzte 10 Aktivitäten - if len(stats['recent_activity']) < 10: + + # SEARCH Einträge als Aktivität sammeln timestamp = line.split(' - ')[0] if ' - ' in line else '' if timestamp: - stats['recent_activity'].append({ + all_activities.append({ 'timestamp': timestamp, 'line': line.strip() }) @@ -124,6 +140,12 @@ def get_statistics(): stats['total_searches'] += 1 except Exception as e: logger.error(f"Fehler beim Lesen der Backup-Datei {backup_file}: {e}") + + # Neueste 10 Aktivitäten auswählen + if all_activities: + # Nach Timestamp sortieren (neueste zuerst) + all_activities.sort(key=lambda x: x['timestamp'], reverse=True) + stats['recent_activity'] = all_activities[:10] except Exception as e: logger.error(f"Fehler beim Lesen der Statistiken: {e}") diff --git a/cookies.txt b/cookies.txt new file mode 100644 index 0000000..9c436ed --- /dev/null +++ b/cookies.txt @@ -0,0 +1,5 @@ +# Netscape HTTP Cookie File +# https://curl.se/docs/http-cookies.html +# This file was generated by libcurl! Edit at your own risk. + +#HttpOnly_localhost FALSE / FALSE 0 session eyJfZmxhc2hlcyI6W3siIHQiOlsic3VjY2VzcyIsIkVyZm9sZ3JlaWNoIGFuZ2VtZWxkZXQhIl19XSwibG9nZ2VkX2luIjp0cnVlfQ.aK1WBQ.KYWoG-YM2oKOpNz-3XUSFpOQQHs diff --git a/stats_clean.html b/stats_clean.html new file mode 100644 index 0000000..9c33995 --- /dev/null +++ b/stats_clean.html @@ -0,0 +1,292 @@ + + + + + + Statistiken - Wordle‑Cheater + + + + +
+
+

📊 Statistik-Dashboard

+ +
+ +
+
+

📈 Gesamte Seitenaufrufe

+
56
+
Alle protokollierten Seitenaufrufe
+
+ +
+

🔍 Gesamte Suchvorgänge

+
8
+
Alle durchgeführten Wortsuche
+
+ +
+

📱 Seitenaufrufe pro Seite

+ + +
+ index: 22 +
+ +
+ service_worker: 27 +
+ +
+ stats: 7 +
+ + +
+
+ +
+

🔍 Suchvorgänge nach Quellen

+ +
+ + + +
+
7
+
OpenThesaurus
+
+ + + +
+ +
+ + +
+

🎯 Häufigste Suchmuster (Positionen)

+ +
+ y + 3 +
+ +
+ sk + 3 +
+ +
+ ie + 2 +
+ +
+ + +
+

⏰ Letzte Aktivitäten

+ + +
+ 2025-08-26 08:36:41,302 + PAGE_VIEW: index | User-Agent: curl/8.14.1 +
+ +
+ 2025-08-20 10:12:18,338 + PAGE_VIEW: service_worker | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 10:12:16,697 + SEARCH: pos='sk' includes='' excludes='d' sources=['OT'] | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 10:12:16,676 + PAGE_VIEW: index | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 10:00:04,429 + SEARCH: pos='sk' includes='' excludes='d' sources=['OT'] | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 10:00:04,400 + PAGE_VIEW: index | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 09:59:43,963 + PAGE_VIEW: service_worker | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 09:59:42,302 + SEARCH: pos='sk' includes='' excludes='d' sources=['OT'] | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 09:59:42,277 + PAGE_VIEW: index | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 09:59:14,621 + PAGE_VIEW: service_worker | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ + +
+
+ + \ No newline at end of file diff --git a/stats_final.html b/stats_final.html new file mode 100644 index 0000000..d4f67e8 --- /dev/null +++ b/stats_final.html @@ -0,0 +1,292 @@ + + + + + + Statistiken - Wordle‑Cheater + + + + +
+
+

📊 Statistik-Dashboard

+ +
+ +
+
+

📈 Gesamte Seitenaufrufe

+
56
+
Alle protokollierten Seitenaufrufe
+
+ +
+

🔍 Gesamte Suchvorgänge

+
8
+
Alle durchgeführten Wortsuche
+
+ +
+

📱 Seitenaufrufe pro Seite

+ + +
+ index: 22 +
+ +
+ service_worker: 27 +
+ +
+ stats: 7 +
+ + +
+
+ +
+

🔍 Suchvorgänge nach Quellen

+ +
+ + + +
+
7
+
OpenThesaurus
+
+ + + +
+ +
+ + +
+

🎯 Häufigste Suchmuster (Positionen)

+ +
+ y + 3 +
+ +
+ sk + 3 +
+ +
+ ie + 2 +
+ +
+ + +
+

⏰ Letzte Aktivitäten

+ + +
+ 2025-08-26 08:39:50,609 + PAGE_VIEW: stats | User-Agent: curl/8.14.1 +
+ +
+ 2025-08-26 08:38:44,652 + PAGE_VIEW: stats | User-Agent: curl/8.14.1 +
+ +
+ 2025-08-26 08:38:18,674 + PAGE_VIEW: stats | User-Agent: curl/8.14.1 +
+ +
+ 2025-08-26 08:37:45,518 + PAGE_VIEW: stats | User-Agent: curl/8.14.1 +
+ +
+ 2025-08-26 08:36:59,678 + PAGE_VIEW: stats | User-Agent: curl/8.14.1 +
+ +
+ 2025-08-26 08:36:57,042 + PAGE_VIEW: stats | User-Agent: curl/8.14.1 +
+ +
+ 2025-08-26 08:36:41,302 + PAGE_VIEW: index | User-Agent: curl/8.14.1 +
+ +
+ 2025-08-20 10:12:18,338 + PAGE_VIEW: service_worker | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 10:12:16,697 + SEARCH: pos='sk' includes='' excludes='d' sources=['OT'] | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 10:12:16,676 + PAGE_VIEW: index | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ + +
+
+ + \ No newline at end of file diff --git a/stats_new.html b/stats_new.html new file mode 100644 index 0000000..3e0e578 --- /dev/null +++ b/stats_new.html @@ -0,0 +1,292 @@ + + + + + + Statistiken - Wordle‑Cheater + + + + +
+
+

📊 Statistik-Dashboard

+ +
+ +
+
+

📈 Gesamte Seitenaufrufe

+
55
+
Alle protokollierten Seitenaufrufe
+
+ +
+

🔍 Gesamte Suchvorgänge

+
8
+
Alle durchgeführten Wortsuche
+
+ +
+

📱 Seitenaufrufe pro Seite

+ + +
+ index: 22 +
+ +
+ service_worker: 27 +
+ +
+ stats: 6 +
+ + +
+
+ +
+

🔍 Suchvorgänge nach Quellen

+ +
+ + + +
+
7
+
OpenThesaurus
+
+ + + +
+ +
+ + +
+

🎯 Häufigste Suchmuster (Positionen)

+ +
+ y + 3 +
+ +
+ sk + 3 +
+ +
+ ie + 2 +
+ +
+ + +
+

⏰ Letzte Aktivitäten

+ + +
+ 2025-08-20 08:39:01,608 + PAGE_VIEW: index | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 08:39:01,632 + SEARCH: pos='ie' includes='' excludes='muskrotnbgz' sources=['OT'] | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 08:39:03,273 + PAGE_VIEW: service_worker | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 08:39:04,596 + PAGE_VIEW: index | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 08:39:04,623 + SEARCH: pos='ie' includes='' excludes='muskrotnbgz' sources=['OT'] | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 08:39:06,219 + PAGE_VIEW: service_worker | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 09:05:33,558 + PAGE_VIEW: service_worker | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 09:05:37,195 + PAGE_VIEW: service_worker | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 09:05:53,161 + PAGE_VIEW: service_worker | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 09:05:55,907 + PAGE_VIEW: service_worker | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ + +
+
+ + \ No newline at end of file diff --git a/stats_output.html b/stats_output.html new file mode 100644 index 0000000..1f541f4 --- /dev/null +++ b/stats_output.html @@ -0,0 +1,292 @@ + + + + + + Statistiken - Wordle‑Cheater + + + + +
+
+

📊 Statistik-Dashboard

+ +
+ +
+
+

📈 Gesamte Seitenaufrufe

+
53
+
Alle protokollierten Seitenaufrufe
+
+ +
+

🔍 Gesamte Suchvorgänge

+
8
+
Alle durchgeführten Wortsuche
+
+ +
+

📱 Seitenaufrufe pro Seite

+ + +
+ index: 22 +
+ +
+ service_worker: 27 +
+ +
+ stats: 4 +
+ + +
+
+ +
+

🔍 Suchvorgänge nach Quellen

+ +
+ + + +
+
7
+
OpenThesaurus
+
+ + + +
+ +
+ + +
+

🎯 Häufigste Suchmuster (Positionen)

+ +
+ y + 3 +
+ +
+ sk + 3 +
+ +
+ ie + 2 +
+ +
+ + +
+

⏰ Letzte Aktivitäten

+ + +
+ 2025-08-20 08:39:01,608 + PAGE_VIEW: index | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 08:39:01,632 + SEARCH: pos='ie' includes='' excludes='muskrotnbgz' sources=['OT'] | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 08:39:03,273 + PAGE_VIEW: service_worker | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 08:39:04,596 + PAGE_VIEW: index | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 08:39:04,623 + SEARCH: pos='ie' includes='' excludes='muskrotnbgz' sources=['OT'] | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 08:39:06,219 + PAGE_VIEW: service_worker | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 09:05:33,558 + PAGE_VIEW: service_worker | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 09:05:37,195 + PAGE_VIEW: service_worker | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 09:05:53,161 + PAGE_VIEW: service_worker | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ +
+ 2025-08-20 09:05:55,907 + PAGE_VIEW: service_worker | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Sa +
+ + +
+
+ + \ No newline at end of file diff --git a/templates/stats.html b/templates/stats.html index 3042bb7..98ff846 100644 --- a/templates/stats.html +++ b/templates/stats.html @@ -191,18 +191,21 @@
{% set max_count = [stats.searches_by_source.OT, stats.searches_by_source.WF, stats.searches_by_source.Both] | max %} {% if stats.searches_by_source.OT > 0 %} +
{{ stats.searches_by_source.OT }}
OpenThesaurus
{% endif %} {% if stats.searches_by_source.WF > 0 %} +
{{ stats.searches_by_source.WF }}
Wordfreq
{% endif %} {% if stats.searches_by_source.Both > 0 %} +
{{ stats.searches_by_source.Both }}
Beide