Add mobile app infrastructure and Gitea auto-update support
This commit adds comprehensive mobile app support to enable a native Android app that won't timeout or sleep when the screen goes dark.
New Features:
- JWT-based authentication system (no WordPress session dependency)
- REST API endpoints for mobile app (agent status, queue management, call control)
- Server-Sent Events (SSE) for real-time updates to mobile app
- Firebase Cloud Messaging (FCM) integration for push notifications
- Gitea-based automatic plugin updates
- Mobile app admin settings page
New Files:
- includes/class-twp-mobile-auth.php - JWT authentication with login/refresh/logout
- includes/class-twp-mobile-api.php - REST API endpoints under /twilio-mobile/v1
- includes/class-twp-mobile-sse.php - Real-time event streaming
- includes/class-twp-fcm.php - Push notification handling
- includes/class-twp-auto-updater.php - Gitea-based auto-updates
- admin/mobile-app-settings.php - Admin configuration page
Modified Files:
- includes/class-twp-activator.php - Added twp_mobile_sessions table
- includes/class-twp-core.php - Load and initialize mobile classes
- admin/class-twp-admin.php - Added Mobile App menu item and settings page
Database Changes:
- New table: twp_mobile_sessions (stores JWT refresh tokens and FCM tokens)
API Endpoints:
- POST /twilio-mobile/v1/auth/login
- POST /twilio-mobile/v1/auth/refresh
- POST /twilio-mobile/v1/auth/logout
- GET/POST /twilio-mobile/v1/agent/status
- GET /twilio-mobile/v1/queues/state
- POST /twilio-mobile/v1/calls/{call_sid}/accept
- GET /twilio-mobile/v1/stream/events (SSE)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -52,7 +52,8 @@ class TWP_Activator {
|
||||
'twp_callbacks',
|
||||
'twp_call_recordings',
|
||||
'twp_user_extensions',
|
||||
'twp_queue_assignments'
|
||||
'twp_queue_assignments',
|
||||
'twp_mobile_sessions'
|
||||
);
|
||||
|
||||
$missing_tables = array();
|
||||
@@ -361,7 +362,25 @@ class TWP_Activator {
|
||||
KEY agent_id (agent_id),
|
||||
KEY started_at (started_at)
|
||||
) $charset_collate;";
|
||||
|
||||
|
||||
// Mobile sessions table
|
||||
$table_mobile_sessions = $wpdb->prefix . 'twp_mobile_sessions';
|
||||
$sql_mobile_sessions = "CREATE TABLE $table_mobile_sessions (
|
||||
id int(11) NOT NULL AUTO_INCREMENT,
|
||||
user_id bigint(20) NOT NULL,
|
||||
refresh_token varchar(500) NOT NULL,
|
||||
fcm_token text,
|
||||
device_info text,
|
||||
created_at datetime DEFAULT CURRENT_TIMESTAMP,
|
||||
expires_at datetime NOT NULL,
|
||||
last_used datetime DEFAULT CURRENT_TIMESTAMP,
|
||||
is_active tinyint(1) DEFAULT 1,
|
||||
PRIMARY KEY (id),
|
||||
KEY user_id (user_id),
|
||||
KEY is_active (is_active),
|
||||
KEY expires_at (expires_at)
|
||||
) $charset_collate;";
|
||||
|
||||
dbDelta($sql_schedules);
|
||||
dbDelta($sql_queues);
|
||||
dbDelta($sql_queued_calls);
|
||||
@@ -377,7 +396,8 @@ class TWP_Activator {
|
||||
dbDelta($sql_recordings);
|
||||
dbDelta($sql_user_extensions);
|
||||
dbDelta($sql_queue_assignments);
|
||||
|
||||
dbDelta($sql_mobile_sessions);
|
||||
|
||||
// Add missing columns for existing installations
|
||||
self::add_missing_columns();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user