# Weibo-HotSign Frontend Flask-based web frontend for the Weibo-HotSign multi-user signin system. ## Features - User registration and login with JWT authentication - Weibo account management (add, edit, delete) - Signin task configuration with Cron expressions - Signin log viewing with pagination and filtering - Responsive design with clean UI ## Setup ### Prerequisites - Python 3.8+ - pip ### Installation 1. Create a virtual environment: ```bash python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate ``` 2. Install dependencies: ```bash pip install -r requirements.txt ``` 3. Create `.env` file from `.env.example`: ```bash cp .env.example .env ``` 4. Update `.env` with your configuration: ``` FLASK_ENV=development FLASK_DEBUG=True SECRET_KEY=your-secret-key-here API_BASE_URL=http://localhost:8000 AUTH_BASE_URL=http://localhost:8001 ``` ### Running ```bash python app.py ``` The application will be available at `http://localhost:5000` ## Project Structure ``` frontend/ ├── app.py # Main Flask application ├── requirements.txt # Python dependencies ├── .env.example # Environment variables template ├── templates/ # HTML templates │ ├── base.html # Base template with navigation │ ├── login.html # Login page │ ├── register.html # Registration page │ ├── dashboard.html # Account list │ ├── add_account.html # Add account form │ ├── edit_account.html # Edit account form │ ├── account_detail.html # Account details with tasks and logs │ ├── add_task.html # Add task form │ ├── 404.html # 404 error page │ └── 500.html # 500 error page └── README.md # This file ``` ## API Integration The frontend communicates with two backend services: - **Auth Service** (default: http://localhost:8001) - `/auth/register` - User registration - `/auth/login` - User login - `/auth/refresh` - Token refresh - `/auth/me` - Get current user - **API Service** (default: http://localhost:8000) - `/api/v1/accounts` - Account CRUD operations - `/api/v1/accounts/{id}/tasks` - Task management - `/api/v1/accounts/{id}/signin-logs` - Signin logs ## Features ### Authentication - User registration with password strength validation - Login with email and password - JWT token-based authentication - Automatic token refresh on expiration ### Account Management - Add multiple Weibo accounts with encrypted cookies - View account list with status indicators - Edit account details and cookies - Delete accounts with cascade deletion ### Task Configuration - Create signin tasks with Cron expressions - Enable/disable tasks - Delete tasks - View task status ### Signin Logs - View signin history for each account - Pagination support - Status filtering - Reward information display ## Security - Passwords are validated for strength (uppercase, lowercase, number, special char, 8+ chars) - Cookies are encrypted on the backend - JWT tokens are used for authentication - Session-based state management - CSRF protection via Flask-Session ## Styling The frontend uses a custom CSS framework with: - Responsive grid layout - Card-based design - Color-coded status badges - Mobile-friendly navigation - Smooth transitions and hover effects ## Error Handling - Graceful error messages for API failures - Connection error handling - Form validation - 404 and 500 error pages ## Development To enable debug mode and auto-reload: ```bash export FLASK_ENV=development export FLASK_DEBUG=True python app.py ``` ## License MIT