Commit Graph

202 Commits

Author SHA1 Message Date
82162874b8 refactor: Migrate security routes to blueprints
- Create new blueprints/admin/routes_security.py
- Move 5 security routes: admin_security, acknowledge_security_alert,
  resolve_security_alert, unlock_account, api_geoip_stats
- Update templates to use full blueprint names
- Add endpoint aliases for backward compatibility

Phase 6.2d - Security routes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 09:39:12 +01:00
470e2a8bb7 refactor: Migrate admin_it_audit to blueprints
- Move IT audit dashboard route to blueprints/admin/routes_audits.py
- Add ITAudit, ITCollaborationMatch imports
- Update base.html template to use full blueprint name
- Add endpoint alias for backward compatibility

Phase 6.2f continued

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 09:25:31 +01:00
806f9e730e refactor: Migrate digital_maturity_dashboard and admin_krs_audit to blueprints
- Move routes from app.py to blueprints/admin/routes_audits.py
- Add endpoint aliases for backward compatibility
- Update base.html template to use full blueprint names
- Comment old routes in app.py with _old_ prefix

Phase 6.2f of blueprint migration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 09:19:56 +01:00
9dedab2929 refactor: Faza 6.2e - Social Media do blueprintu admin
Przeniesiono 2 trasy do blueprints/admin/routes_social.py:
- admin_social_media (analytics dashboard)
- admin_social_audit (audit dashboard)

Zaktualizowano szablony:
- base.html, dashboard.html, social_audit_dashboard.html

Dodano aliasy dla kompatybilności wstecznej.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 09:07:51 +01:00
61a32d9bfa refactor: Faza 6.2c - Status, Health, Debug do blueprintu admin
Przeniesiono 9 tras do blueprints/admin/routes_status.py:
- admin_status, api_admin_status
- admin_health, api_admin_health
- debug_panel
- api_get_logs, api_logs_stream, api_clear_logs, api_test_log

Zaktualizowano szablony na pełne nazwy blueprintów:
- base.html: admin.admin_status, admin.admin_health
- health_dashboard.html: admin.admin_status

Dodano aliasy dla kompatybilności wstecznej.
Stare trasy w app.py oznaczone jako _old_* (do usunięcia po weryfikacji).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 08:59:15 +01:00
52ffdafd00 refactor: Remove dead SEO/GBP audit code from app.py
Removed 280 lines of dead code after moving to blueprint.
app.py: 11,774 → 11,494 lines (-280)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 08:20:07 +01:00
1384c7f090 refactor: Add SEO & GBP audit routes to admin blueprint (Phase 6.2a)
- Created blueprints/admin/routes_audits.py (2 routes)
- admin_seo, admin_gbp_audit moved from app.py
- Aliases created for backward compatibility

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 08:16:22 +01:00
3e834c168c refactor: Remove dead admin code after Phase 6.1 verification
Removed 831 lines of dead code (_old_* functions):
- Recommendations: 3 functions
- Users: 8 functions
- Fees: 5 functions
- Calendar admin: 3 functions

app.py: 12,605 → 11,774 lines (-831)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 08:09:42 +01:00
44268c5425 refactor: Extract admin blueprint Part 1 (Phase 6)
Moved 19 admin routes to blueprints/admin/:
- Recommendations: 3 routes (list, approve, reject)
- Users: 8 routes (list, add, toggle-admin, toggle-verified, update, assign-company, delete, reset-password)
- Fees: 5 routes (list, generate, mark-paid, bulk-mark-paid, export)
- Calendar admin: 3 routes (list, new, delete)

Note: AI-parse routes (/api/admin/users/ai-parse, ai-create) remain in app.py.

Aliases created for backward compatibility.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 08:05:06 +01:00
55718ed211 refactor: Extract chat blueprint (Phase 5)
- Create blueprints/chat/ with 9 routes:
  - chat, chat_settings, chat_start, chat_send_message
  - chat_get_history, chat_list_conversations, chat_delete_conversation
  - chat_feedback, chat_analytics
- Register chat blueprint with backward-compatible aliases
- Remove dead code from app.py (-458 lines)
- app.py: 13,058 → 12,600 lines (-3.5%)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 07:54:08 +01:00
0f482cc4aa refactor: Extract messages + notifications blueprint (Phase 4)
- Create blueprints/messages/ with 11 routes:
  - messages_inbox, messages_sent, messages_new, messages_send
  - messages_view, messages_reply, api_unread_count
  - api_notifications, api_notification_mark_read
  - api_notifications_mark_all_read, api_notifications_unread_count
- Register messages blueprint with backward-compatible aliases
- Remove dead code from app.py (-340 lines)
- app.py: 13,398 → 13,058 lines (-2.5%)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 07:47:55 +01:00
ad2262388b refactor: Extract forum blueprint (Phase 3)
- Create blueprints/forum/ with 10 routes:
  - forum_index, forum_new_topic, forum_topic, forum_reply
  - admin_forum, admin_forum_pin, admin_forum_lock
  - admin_forum_delete_topic, admin_forum_delete_reply
  - admin_forum_change_status
- Register forum blueprint with backward-compatible aliases
- Remove dead code from app.py (-422 lines)
- app.py: 13,820 → 13,398 lines (-3.1%)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 07:42:18 +01:00
cdd050a0ef refactor(phase2a): Cleanup dead code after blueprint migration
Removed 31 _old_ functions from app.py that were migrated to blueprints.

Stats:
- Lines removed: 1,757 (11.3% reduction)
- app.py: 15,577 → 13,820 lines

All endpoints tested and working:
- Public: /, /login, /register, /health, /release-notes
- Protected: /dashboard, /search, /kalendarz/, /chat
- Aliases: url_for('login') = url_for('auth.login')

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 07:29:31 +01:00
d5adf029aa refactor(phase2a): Extract auth + public blueprints with Alias Bridge
Phase 2a of modular monolith refactoring:

New blueprints:
- blueprints/auth/routes.py (1,040 lines, 20 routes)
  - login, logout, register, verify_2fa, settings_2fa
  - forgot_password, reset_password, verify_email
  - konto_dane, konto_prywatnosc, konto_bezpieczenstwo, konto_blokady
- blueprints/public/routes.py (862 lines, 11 routes)
  - index, company_detail, person_detail, search
  - dashboard, events, new_members, release_notes

Alias Bridge strategy:
- Both url_for('login') and url_for('auth.login') work
- Templates don't require changes (backward compatible)
- Original routes in app.py marked with _old_ prefix (dead code)

Next step: Cleanup dead code from app.py after production verification

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 07:28:18 +01:00
85cb5f14e0 docs: Release notes v1.21.0 - zmiany z 30 stycznia 2026
- Moje konto: nowa sekcja ustawień
- Forum/B2B: panel moderacji dla admina
- Reset hasła: auto-weryfikacja emaila
- UX: ikonka oka, ładne modale

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 20:36:24 +01:00
412745c875 feat: Add unified "Moje konto" (My Account) section
New user account management section with:
- /konto - Edit personal data (name, phone)
- /konto/prywatnosc - Privacy settings
- /konto/bezpieczenstwo - Security settings (2FA, password)
- /konto/blokady - User blocks management

Features:
- Consistent sidebar navigation across all pages
- Responsive layout (mobile-friendly)
- Polish UI with clear section names

Replaces scattered /settings/* routes with unified /konto/* structure.
Menu link updated from "Ustawienia" to "Moje konto".

Fixes user feedback issue #6: "Brak edycji profilu"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:52:00 +01:00
7c6379c815 fix: Auto-verify email on password reset
When user resets password, they've proven inbox access by clicking
the reset link. This change auto-verifies their email address,
eliminating the need to separately verify email after reset.

Fixes user feedback issue #2: "Reset hasła nie weryfikuje emaila"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:41:05 +01:00
3b55e14e67 fix: Poprawiona składnia rate limiter (semicolon zamiast przecinka)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:25:24 +01:00
c5b7930cef fix: Zwiększone limity rate limiting dla lepszego UX
Poprzednie limity (5/h) blokowały użytkowników po kilku próbach.
Nowe limity:
- Default: 1000/dzień, 200/h (było 200/dzień, 50/h)
- /register: 50/h + 200/dzień (było 5/h)
- /login: 60/min + 500/h (było 30/min)
- /forgot-password: 20/h (było 5/h)
- /reset-password: 30/h (było 10/h)
- /resend-verification: 15/h (było 5/h)

Feedback od: Łukasz Gilewicz, Arturo, Jarek BIS

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:22:54 +01:00
4c728778c6 fix: Naprawiono brak duration_seconds w sesjach użytkowników
Problem: get_or_create_analytics_session() aktualizowało last_activity_at
ale nie duration_seconds, co powodowało że czas sesji zawsze wynosił 0 min.

Rozwiązanie: Dodano obliczanie duration_seconds przy każdym page view.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 16:00:16 +01:00
0055857df4 feat: Rozbudowa systemu analityki użytkowników
Nowe funkcjonalności:
- GeoIP enrichment (kraj, miasto, region)
- UTM parameters tracking (source, medium, campaign, term, content)
- Bounce rate calculation
- Search queries logging
- Conversion tracking (register, login, contact_click, rsvp)
- Scroll depth tracking (25%, 50%, 75%, 100%)
- JS error tracking (window.onerror)
- Performance metrics (Web Vitals)
- CSV export (sessions, pageviews, searches, conversions)

Nowe tabele SQL:
- search_queries
- conversion_events
- js_errors
- popular_searches_daily
- hourly_activity

Dashboard rozszerzony o nowe sekcje i metryki.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 15:52:18 +01:00
d9f32b7235 docs: Dodanie powiadomień email do release notes v1.20.0
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 16:12:11 +01:00
7b0b41bac1 feat: Powiadomienie email o nowej rejestracji użytkownika
- Dodano send_registration_notification() analogicznie do send_error_notification()
- Mail wysyłany na ERROR_NOTIFY_EMAIL przy każdej nowej rejestracji
- Zawiera: imię, email, NIP, nazwa firmy, status członkostwa NORDA
- Link do panelu /admin/users

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:53:29 +01:00
e92b237fa4 docs: Reorganizacja release notes - sortowanie i wytłuszczanie
- Wszystkie release notes od v1.0.0 do v1.20.0 posortowane od najważniejszych
- Mega ważne funkcje wytłuszczone <strong>
- Dodano sekcję security w szablonie
- Stworzono przewodnik RELEASE_NOTES_GUIDE.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:36:11 +01:00
615665c4a1 docs: Dodanie PWA i dwóch modeli AI do release notes v1.20.0
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:30:17 +01:00
411fd0f0fb docs: Dodanie upgrade Gemini 3 do release notes v1.20.0
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:29:18 +01:00
aa026eecfc docs: Historia zmian v1.20.0 (29 stycznia 2026)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:27:53 +01:00
25702a808a fix: Użycie operatora @> dla PostgreSQL ARRAY contains
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:23:27 +01:00
624941114a fix: Poprawka składni SQLAlchemy dla ARRAY contains
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:21:27 +01:00
0db3cbc754 feat(announcements): Obsługa wielu kategorii dla ogłoszeń
- Zmiana formularza z select na checkboxy (wiele kategorii)
- Aktualizacja filtrowania: PostgreSQL ANY() dla tablicy categories
- Zachowanie kompatybilności wstecznej (pole category)
- Aktualizacja szablonów list.html i detail.html dla wielu badge'ów

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:19:51 +01:00
cebe52f303 refactor: Rebranding i aktualizacja modelu AI
- Zmiana nazwy: "Norda Biznes Hub" → "Norda Biznes Partner"
- Aktualizacja modelu AI: Gemini 2.0 Flash → Gemini 3 Flash
- Zachowano historyczne odniesienia w timeline i dokumentacji

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 14:08:39 +01:00
002a73863e fix(chat): Use correct AIAPICostLog model name for cost tracking
- Changed from AIApiCost to AIAPICostLog (actual model in database.py)
- Changed total_cost_usd to total_cost (actual field name)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 11:26:15 +01:00
1b2ba66ead feat(chat): Dwa klucze API - Free tier dla Flash, Paid dla Pro
- GOOGLE_GEMINI_API_KEY_FREE: klucz Free tier dla Flash (darmowy)
- GOOGLE_GEMINI_API_KEY: klucz Paid tier dla Pro (płatny)
- GeminiService automatycznie wybiera klucz na podstawie modelu
- Flash pricing ustawiony na $0.00 (Free tier)
- UI pokazuje Flash jako "Darmowy"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 11:19:59 +01:00
26db9a7cc9 feat(chat): Wybór modelu Flash/Pro zamiast Thinking Mode + koszt miesięczny
UI:
- Dropdown wyboru modelu: Flash (szybki, $0.05) vs Pro (analiza, $0.20)
- Wyświetlanie kosztu miesięcznego w headerze
- Badge odpowiedzi pokazuje: model, czas, koszt

Backend:
- Endpoint /api/chat/settings obsługuje model i monthly_cost
- NordaBizChatEngine przyjmuje parametr model
- Koszt zapisywany w tech_info odpowiedzi

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 11:04:29 +01:00
30729ef83e feat(ai): Thinking Mode dla NordaGPT
- Nowy SDK google-genai z obsługą thinking mode
- Przełącznik poziomu rozumowania w UI chatu (3 poziomy)
- Błyskawiczny (minimal) - szybkie odpowiedzi
- Szybki (low) - zrównoważony
- Głęboki (high) - maksymalna analiza
- Endpoint /api/chat/settings do zapisywania preferencji
- Dokumentacja dla NotebookLM (prezentacja)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 10:20:58 +01:00
2c13509cd1 feat(model-comparison): Pełny kontekst NordaGPT
Dodano:
- Audyty GBP (Google Business Profile) - oceny, recenzje
- Audyty SEO (PageSpeed) - wyniki dla stron WWW
- Baza wiedzy ZOPK - elektrownia jądrowa, offshore wind, infrastruktura
- Zasada prywatności - nie podawać ukrytych danych kontaktowych

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 09:18:51 +01:00
3aa302d399 fix(model-comparison): Dodanie brakującego importu ZOPKNews
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 09:16:12 +01:00
e589a13a71 fix(model-comparison): Pełny kontekst NordaGPT zamiast uproszczonego
- Wszystkie firmy z pełnymi danymi (nie tylko 50)
- Osoby w firmach (zarząd, wspólnicy, udziały)
- Tematy forum
- Wydarzenia
- Ogłoszenia B2B
- Rekomendacje
- Aktualności ZOPK
- Social media

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 09:12:07 +01:00
32b42ad8eb fix(admin): Fix Company attribute name description_short 2026-01-29 09:02:05 +01:00
11f73fe5e1 fix(admin): Use gemini_service directly for model comparison 2026-01-29 09:00:13 +01:00
c285d29ed4 fix(admin): Fix model comparison - use internal methods and /tmp for results 2026-01-29 08:50:54 +01:00
652a441a30 feat(admin): Add AI model comparison page
- New admin page /admin/model-comparison for comparing AI responses
- Side-by-side comparison: old model (2.5 Flash-Lite) vs new (3 Flash)
- Questions from real conversations (Artur Wiertel, Maciej Pienczyn)
- Run simulation button to generate new responses
- Added link in admin menu under "Porównanie modeli"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 08:45:33 +01:00
e0df7f2adf feat(ai): Upgrade NordaGPT to Gemini 3 Flash Preview
- Changed AI model from Gemini 2.5 Flash-Lite to Gemini 3 Flash Preview
- Added Gemini 3 models (3-flash, 3-pro) to GEMINI_MODELS config
- Updated GEMINI_PRICING with current 2026 prices
- Updated chat UI: badge, model info modal, specs, timeline
- Benefits: 7x better reasoning, thinking mode, 78% SWE-bench

Cost estimate: ~$40/month at 1000x current usage (Tier 1)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 08:38:02 +01:00
c8f70dc2cf refactor: Centralizacja COMPANY_COUNT_MARKETING = 150
- Dodano stałą globalną COMPANY_COUNT_MARKETING w app.py
- Dodano do context_processor jako COMPANY_COUNT
- Zaktualizowano szablony: index.html, chat.html, landing.html, release_notes
- Jedno miejsce do zmiany gdy Izba zaktualizuje cel

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 00:27:04 +01:00
79c1b2ddd9 feat(health): Nowe endpointy + połączenie release notes v1.19.0
Health monitoring:
- Dodano: /settings/privacy, /settings/blocks, /settings/2fa
- Dodano: /wiadomosci, /wiadomosci/wyslane, /wiadomosci/nowa
- Dodano: /edukacja, /admin/insights

Release notes:
- Połączono v1.18.0 i v1.19.0 w jeden wpis (28 stycznia 2026)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 00:21:43 +01:00
6b8840cf92 feat(categories): Reorganizacja kategorii + release notes v1.19.0
Zmiany w kategoriach:
- Utworzono "Budownictwo ogólne" (9 firm) i "Produkcja ogólna" (13 firm)
- Utworzono "Usługi finansowe" (banki, kantory, ubezpieczenia)
- Rozdzielono "Księgowość" od "Usługi finansowe"
- Przeniesiono INPI i SEO PARTNER do "IT i Technologie"
- Dodano kategorię "Do uzupełnienia" (żółta, 27 firm bez opisu)

Zmiany UI:
- Sortowanie podkategorii malejąco po liczbie firm
- Poprawka podświetlania aktywnej kategorii
- Dropdown blokowania: domena emaila przy duplikatach nazw

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 00:19:22 +01:00
6c1059f133 docs(release): Dodanie v1.18.0 do release notes
Nowe funkcje w v1.18.0 (28 stycznia 2026):
- Prywatność: ukrywanie telefonu/emaila, preferencje kontaktu
- Blokowanie kontaktów (bidirectional)
- Hierarchiczne kategorie firm
- Platforma Edukacyjna
- Panel Insights dla adminów
- RODO: sanityzacja danych wrażliwych w czacie
- Security: izolacja sesji czata

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 23:19:39 +01:00
b19dfa7227 feat(insights): Baza wiedzy i insights dla rozwoju portalu
System zbierania feedbacku z interakcji użytkowników:
1. Źródła wiedzy:
   - Forum (tematy, odpowiedzi)
   - Chat AI (tylko odpowiedzi asystenta - fakty publiczne)
   - Analiza wzorców pytań (zanonimizowana)

2. Kategorie insights:
   - feature_request (propozycje funkcji)
   - bug_report (zgłoszenia błędów)
   - company_search (wyszukiwania firm)
   - question (częste pytania)

3. Panel admina: /admin/insights
   - Przeglądanie insights
   - Zmiana statusów (new → planned → implemented)
   - Synchronizacja z forum/chat

PRIVACY: Pytania użytkowników są analizowane wzorcowo (anonimizacja),
treść pytań NIE trafia do bazy wiedzy.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 22:09:05 +01:00
ca03cb0b3b feat(security): Silnik sanityzacji danych wrażliwych (RODO)
Automatyczne wykrywanie i maskowanie danych wrażliwych w czacie:
- PESEL (walidacja sumy kontrolnej)
- Numery kart kredytowych (algorytm Luhn)
- IBAN (konta bankowe)
- Hasła (detekcja kontekstowa)
- Dowody osobiste i paszporty

NIE wykrywa (zgodnie z wymogami):
- NIP (publiczne dane biznesowe)
- Adresy email (celowo podawane)

API dla adminów: POST /api/admin/test-sanitization

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 22:00:18 +01:00
e7483269a0 security(chat): Izolacja sesji czata i anonimizacja danych
ZMIANY BEZPIECZEŃSTWA:

1. Defense in depth w NordaBizChatEngine:
   - send_message() - wymaga user_id i weryfikuje właściciela rozmowy
   - get_conversation_history() - opcjonalna walidacja user_id
   - Logowanie prób nieautoryzowanego dostępu

2. Anonimizacja w panelu admina:
   - Usunięto wyświetlanie treści zapytań użytkowników
   - Zastąpiono statystykami: długość, kategoria tematyczna
   - Zachowano AI responses (publiczne dane firm)

3. Ochrona prywatności:
   - Użytkownicy NIE mogą zobaczyć zapytań innych użytkowników
   - Admini widzą tylko zanonimizowane statystyki
   - Audit logging dla prób nieautoryzowanego dostępu

Odblokowuje zadanie #10 (Baza wiedzy Norda GPT).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 21:56:35 +01:00