Commit Graph

362 Commits

Author SHA1 Message Date
c2205b0815 fix: Poprawione dekodowanie URL Google News + użycie source_domain 2026-01-15 06:10:59 +01:00
8ead7798df fix: Ładowanie DATABASE_URL z .env w skrypcie obrazków 2026-01-15 06:08:59 +01:00
cf56fe7d8a feat(zopk): Skrypt do pobierania obrazków dla newsów
Strategia pobierania obrazków:
1. Rozwiń URL Google News do oryginalnego źródła
2. Pobierz og:image z meta tagów strony
3. Fallback: logo domeny (Clearbit API)
4. Fallback: favicon (Google Favicon API)

Użycie: python scripts/fetch_news_images.py [--dry-run] [--limit N]

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 06:08:10 +01:00
82d4c870a0 style(zopk): Ujednolicenie stylu kart newsów z /zopk/aktualnosci
- Obrazki newsów (lub zielony placeholder z ikoną)
- Większy padding i promień zaokrąglenia kart
- Dłuższe opisy (250 znaków zamiast 200)
- Data w formacie DD.MM.YYYY w jednej linii ze źródłem
- Hover z efektem podniesienia (translateY)
- Responsive: obrazki na pełną szerokość na mobile

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 06:00:10 +01:00
819192bdad feat(zopk): Rozszerzony widok aktualności ze statystykami czasowymi
- Dodano pasek statystyk newsów (łącznie, dzień, tydzień, miesiąc)
- Zwiększono limit wyświetlanych newsów z 10 do 25
- Usunięto przycisk "Zobacz wszystkie" - pełny widok od razu
- Przycisk "Starsze aktualności" pojawia się gdy jest więcej niż 25

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 05:56:00 +01:00
489f04d04d fix(zopk): Newsy auto_approved teraz widoczne na stronie publicznej
BUG: Strona publiczna pokazywała tylko status='approved',
     ale AI ustawia status='auto_approved' dla newsów 3+★.

Wynik: Newsy zatwierdzone przez AI NIE pojawiały się publicznie!

Naprawione miejsca:
- /zopk (strona główna ZOPK)
- /zopk/projekt/<slug> (szczegóły projektu)
- /zopk/aktualnosci (lista newsów)

Teraz wszystkie 3 miejsca pokazują obie wartości:
status IN ('approved', 'auto_approved')

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 05:50:35 +01:00
3beacd8806 fix(zopk): Naprawa duplikatu ID aiEvalResult w modalu
Były dwa elementy z tym samym ID - JavaScript znajdował pierwszy
(poza modalem) zamiast właściwego wewnątrz modala.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 05:46:39 +01:00
1193a2bf48 feat(zopk): Re-ewaluacja newsów z niską oceną zawierających kluczowe tematy
- Nowa funkcja reevaluate_low_score_news() szuka newsów z 1-2★
  zawierających Via Pomerania, NORDA, S6, Droga Czerwona, etc.
- Nowy endpoint POST /admin/zopk/news/reevaluate-low-scores
- Przycisk w UI "Re-ewaluuj niskie oceny" z szczegółowym raportem
- Automatyczne auto-approve jeśli nowa ocena >= 3★

Problem: Artykuły o Via Pomerania miały 1★ bo były ocenione
         przed dodaniem tego tematu do promptu AI.
Rozwiązanie: Re-ewaluacja nowym promptem podniesie ich oceny.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 05:38:20 +01:00
0cbdcaaad6 feat(zopk): Szczegółowe statystyki wyników wyszukiwania newsów
- Zamiana auto-odświeżania na przycisk OK
- Dodanie sekcji szczegółowych statystyk (12 metryk)
- Dodanie listy artykułów odrzuconych przez AI
- Śledzenie czasu przetwarzania
- API zwraca nowe pola: sent_to_ai, ai_rejected_articles, processing_time

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 05:28:10 +01:00
61b8a8e797 feat(zopk): Add AI model info banner to dashboard
Shows:
- Current model: gemini-2.5-flash-lite
- Prompt version: v2 (2026-01-15)
- New topics: +7 infrastructure projects

Tooltip lists: Via Pomerania, S6, Droga Czerwona, etc.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 05:19:12 +01:00
e96d579350 feat(zopk): Expand AI evaluation prompt with key infrastructure projects
Added missing topics to ZOPK AI evaluation prompt:
- Via Pomerania (highway Ustka-Bydgoszcz)
- S6 (Koszalin-Słupsk)
- Droga Czerwona (Port Gdynia)
- Pakt Bezpieczeństwa Pomorze Środkowe
- Deklaracja Bałtycka
- Izba Przedsiębiorców NORDA / Akademia Biznesu NORDA

These topics were incorrectly scored 1-2★ instead of 4-5★.
Updated examples to guide AI better.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 05:17:13 +01:00
223bc91cfa fix: Rename reserved 'metadata' attribute in ZOPKKnowledgeEntity
SQLAlchemy reserves 'metadata' attribute name. Changed to 'entity_metadata'.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 05:08:34 +01:00
db02d3660f feat(zopk): Improve AI scoring and auto-approve threshold
Changes:
- Lower auto-approve threshold from 4★ to 3★ (verified 2026-01-15)
- Add detailed progress bar for ZOPK search process
- Add auto-approved articles list with star ratings
- Document ZOPK topics (ZOP Kaszubia) in CLAUDE.md
- Add 8-second countdown before auto-refresh

Technical:
- zopk_news_service.py: Changed score threshold from >=4 to >=3
- Templates: New CSS for progress phases and results display
- CLAUDE.md: Added "ZOP Kaszubia News" section with topic guidelines

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 05:05:41 +01:00
90da6b9c64 fix: Treat HTTP 429 as OK in health check
429 (Too Many Requests) means the endpoint is working correctly
and is protected by rate limiting - this is expected behavior
for /register endpoint.

- Add 429 to acceptable status codes (200, 302, 304, 429)
- Update legend to explain 429 means protection is working
- Apply to all health check endpoints

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 04:15:39 +01:00
3acbc53b87 fix: Health check - INPI, Waterm + 3 random companies
- Always check INPI and Waterm profiles (fixed)
- Add 3 random company profiles each refresh
- Total 5 company profiles tested for better coverage

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 04:12:22 +01:00
54b3b94482 feat: Add graphical Health Check dashboard
- Add /admin/health route with visual status indicators
- Create health_dashboard.html with category-based endpoint cards
- Color-coded status: green (OK), yellow (warning), red (error)
- Show response times with color indicators (fast/medium/slow)
- Add HTTP status code legend
- Auto-refresh every 2 minutes
- Add link in admin navigation menu
- Categories: public pages, auth, API, admin panel, company profiles

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 22:56:43 +01:00
23f109db2c fix: Update technology stack with verified versions only
- Verify all software versions via SSH (NORDABIZ-01, R11-REVPROXY-01, Proxmox)
- Remove Redis (not used), Gunicorn (app runs directly via python)
- Add PostgreSQL version dynamic fetch from database
- Add Docker version for R11-REVPROXY-01
- Update all package versions to verified values
- Handle unknown versions (Fortigate) with yellow "nieznana" badge
- Add comment with verification date (2026-01-14)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 22:48:21 +01:00
38682bf808 fix: Correct admin calendar path in health check (/admin/kalendarz)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 22:39:03 +01:00
03bd90f33b feat: Add system status dashboard with tech stack visualization
- Add /admin/status route with real-time system metrics (CPU, RAM, disk)
- Add /api/admin/status API endpoint for auto-refresh
- Add technology stack section showing all platform technologies
- Add auto-refresh (5 min) to GeoIP stats in security dashboard
- Add "Status systemu" link to admin navigation menu
- Fix /health/full endpoint list (remove non-existent endpoints)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 22:35:25 +01:00
8ed3724970 feat: Add extended health check endpoint /health/full
- Checks 14 critical endpoints (public + admin pages)
- Returns JSON with pass/fail status for each endpoint
- HTTP 200 if all OK, HTTP 503 if any failures
- Useful for deployment verification and monitoring

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 22:25:13 +01:00
9fdcee35d0 fix: Fix alert_breakdown sum in security dashboard template
Changed from sum(attribute='value') to values()|sum for dict type

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 22:23:02 +01:00
6402ff7f0e docs: Update release notes and CLAUDE.md with security features
- Add GeoIP blocking, security panel, and stats to v1.16.0 release notes
- Add comprehensive security mechanisms table to CLAUDE.md
- Document GeoIP configuration and MaxMind setup
- List all 12 security mechanisms with star ratings

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 22:20:32 +01:00
e9e37796c7 feat: Add security mechanisms list and GeoIP stats to admin dashboard
- New 'Mechanisms' tab listing all security features with star ratings (5★=critical)
- New 'GeoIP' tab with blocking statistics (daily/monthly/yearly/total)
- Country breakdown with flags for blocked connections
- Status indicators for each security mechanism

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 22:16:33 +01:00
341ce29aa9 fix: Use lazy loading for GeoIP config to respect load_dotenv timing
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 22:13:49 +01:00
cb574851cf feat: Add GeoIP blocking for high-risk countries (RU, CN, KP, IR, BY, SY, VE, CU)
- Update security_service.py with BLOCKED_COUNTRIES list
- Add check_geoip() middleware in app.py
- Log blocked attempts with security alerts
- Uses MaxMind GeoLite2-Country database

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 22:11:53 +01:00
1a06b6ab29 feat: Add security dashboard link to admin menu 2026-01-14 21:45:05 +01:00
cfdcfea093 fix: Remove duplicate CSRF input in 2fa_settings.html
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 21:41:01 +01:00
6ec830fabc fix: CSRF token in 2FA templates
Changed {{ csrf_token() }} to proper hidden input field.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 21:35:19 +01:00
0dba52e9c4 feat: Add security features - 2FA, audit log, alerting
Security enhancements:
- Two-Factor Authentication (TOTP) for all users
  - Enable/disable 2FA in settings
  - Backup codes for recovery
  - Login flow with 2FA verification
- Audit log for admin actions
  - Track all sensitive operations
  - IP address and user agent logging
- Security alerts system
  - Alert types: brute_force, honeypot_hit, account_locked, geo_blocked
  - Email notifications for high/critical alerts
  - Dashboard for alert management
- Admin security dashboard (/admin/security)
  - View/acknowledge/resolve alerts
  - Unlock locked accounts
  - 2FA status overview

New files:
- security_service.py: Security utilities
- templates/auth/verify_2fa.html
- templates/auth/2fa_settings.html
- templates/auth/2fa_setup.html
- templates/auth/2fa_backup_codes.html
- templates/admin/security_dashboard.html

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 21:23:27 +01:00
7226e098f6 feat: Honeypot endpoints for malicious bot detection
- Trap URLs: /wp-admin, /phpmyadmin, /.env, /.git/config, etc.
- Log to security.log for fail2ban integration
- Instant 24h ban via fail2ban after 1 hit
2026-01-14 21:13:05 +01:00
10dcbde7a8 feat: Account lockout after 5 failed login attempts
- Lock account for 30 minutes after 5 failed attempts
- Reset counter on successful login
- Log ACCOUNT_LOCKED events to security log
2026-01-14 21:11:33 +01:00
2efad9ba82 feat: Use Redis for rate limiter storage (persistent limits) 2026-01-14 21:08:48 +01:00
b6c58c9312 feat: Add security logger for fail2ban integration
- Security events logged to /var/log/nordabiznes/security.log
- Failed login attempts include IP address
- Format compatible with fail2ban filter
2026-01-14 21:07:09 +01:00
af3ba43c89 feat: Dynamic stats in release notes (companies, categories from DB) 2026-01-14 17:31:10 +01:00
26c76cc691 fix: Update release notes stats (111 firms, 19 categories) 2026-01-14 15:47:43 +01:00
1147e7e27c chore: Merge duplicate release notes (11 Jan, 10 Jan)
- v1.12.0 + v1.13.0 → v1.13.0 (11 stycznia 2026)
- v1.10.0 + v1.11.0 → v1.11.0 (10 stycznia 2026)

One version per day rule applied.
2026-01-14 15:10:53 +01:00
0b1dc49298 chore: Merge release notes from Jan 14 into single v1.16.0 entry
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 15:07:39 +01:00
22e73e4f80 feat: Email DKIM/SPF/DMARC config + year_established data fill
- Added release notes v1.19.0 with today's changes
- Email: DKIM, SPF, DMARC configured for nordabiznes.pl
- Data: year_established filled for 71/111 companies (64%)
- Script: fix_year_established.py for KRS date migration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 15:01:01 +01:00
c8075e0872 feat: Add email test script for manual testing
Script sends welcome emails to specified addresses for testing
DKIM/SPF/DMARC configuration.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 14:09:17 +01:00
abded75fb0 fix: Add fallback background-color for email headers
Outlook and some email clients don't render CSS gradients properly.
Added solid background-color (#1e3a8a) as fallback before gradient.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 12:27:35 +01:00
8c9d95cca9 refactor: Update tagline from "Katalog Firm Członkowskich" to "Platforma Networkingu"
Changed branding across the application:
- email_service.py: Updated footers in password reset and welcome emails
- base.html: Updated meta description and footer text
- landing.html: Updated page title

New tagline: "Platforma Networkingu Regionalnej Izby Przedsiębiorców Norda Biznes"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 11:35:58 +01:00
fdeb9ffd19 fix: Polish diacritics and header contrast in email templates
- Added proper Polish characters (ą, ę, ó, ł, ś, ć, ż, ź, ń)
- Improved header contrast with darker gradient and text-shadow
- Added meta charset UTF-8 for proper encoding
- Fixed warning box text color for better readability

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 11:15:38 +01:00
c1874b73e6 fix: Change email sender display name to "Norda Biznes Hub"
Previously showed "InPi Notifications" which was confusing.
Now emails will display as "Norda Biznes Hub <noreply@inpi.pl>"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 09:46:26 +01:00
a09203ef55 feat: Add email logging and monitoring system
- Add EmailLog model to database.py for tracking sent emails
- Modify email_service.py to log all sent emails to database
- Track email type (welcome, password_reset, notification)
- Record sender, recipient, subject, status, timestamps
- Supports monitoring email delivery success/failure

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 09:26:48 +01:00
749abfa018 fix: Use category_id instead of category relationship in report
- Company.category is a relationship, not a column
- Use Company.category_id for grouping and filtering
- Load category names via separate query to Category table

Fixes 500 error on /raporty/struktura-branzowa

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 08:30:35 +01:00
14e969bc6d fix: Fix AttributeError in report_categories
- Add .label('category') to SQLAlchemy query for proper Row attribute access
- Change filter_by to filter() for better NULL handling

Fixes 500 error on /raporty/struktura-branzowa

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 08:29:00 +01:00
2f37267475 feat: Update footer with INPI branding
- Add INPI logo with link to inpi.pl
- Change copyright to INPI as creator
- Update contact email to maciej.pienczyn@inpi.pl
- Add WhatsApp contact link
- Make phone and email clickable (tel:/mailto:)
- Add CSS styles for footer creator section

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 08:23:43 +01:00
4c70a5b5ce refactor: Rebrand "Chat AI" to "NordaGPT" across UI
- Changed all "Chat AI" labels to "NordaGPT" in navigation menus
- Updated dashboard quick links
- NordaGPT is now the official product name for AI assistant

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 08:20:29 +01:00
fc8e3acb51 fix: Properly render markdown links in chat messages
- Added regex to convert [text](url) markdown links to <a> tags
- Updated raw URL regex with lookbehind/lookahead to avoid duplicate links
- Links now display as clickable text instead of raw markdown syntax

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 08:18:43 +01:00
978c0714d5 feat: Add detailed rate limits and comparison info to model info modal
- Added RPM (15 req/min), TPM (250k tokens/min) to specs table
- Added Thinking mode status (Full vs Experimental)
- Added green "↑ było X" badges showing improvements
- Updated benefits section with concrete before/after numbers

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 08:16:54 +01:00