diff --git a/admin/class-twp-admin.php b/admin/class-twp-admin.php
index 06c0991..3b21a87 100644
--- a/admin/class-twp-admin.php
+++ b/admin/class-twp-admin.php
@@ -1580,10 +1580,127 @@ class TWP_Admin {
}
});
+
+
+
+ Automatic Updates
+ manual_check_for_updates();
+ if (isset($update_result)) {
+ echo '';
+ echo '
' . esc_html($update_result['message']) . '
';
+ }
+ }
+
+ // Handle save update settings
+ if (isset($_POST['twp_save_update_settings']) && check_admin_referer('twp_update_settings')) {
+ update_option('twp_auto_update_enabled', isset($_POST['twp_auto_update_enabled']) ? '1' : '0');
+ update_option('twp_gitea_repo', sanitize_text_field($_POST['twp_gitea_repo']));
+ update_option('twp_gitea_token', sanitize_text_field($_POST['twp_gitea_token']));
+ echo '';
+ }
+
+ $update_status = $updater->get_update_status();
+ $auto_update_enabled = get_option('twp_auto_update_enabled', '1') === '1';
+ $gitea_repo = get_option('twp_gitea_repo', 'wp-plugins/twilio-wp-plugin');
+ $gitea_token = get_option('twp_gitea_token', '');
+ ?>
+
manual_check_for_updates();
-}
-
// Handle test notification
if (isset($_POST['twp_test_notification']) && check_admin_referer('twp_mobile_settings')) {
require_once TWP_PLUGIN_DIR . 'includes/class-twp-fcm.php';
@@ -49,10 +42,6 @@ if (isset($_POST['twp_save_mobile_settings']) && check_admin_referer('twp_mobile
} else {
update_option('twp_fcm_service_account_json', '');
}
- update_option('twp_auto_update_enabled', isset($_POST['twp_auto_update_enabled']) ? '1' : '0');
- update_option('twp_gitea_repo', sanitize_text_field($_POST['twp_gitea_repo']));
- update_option('twp_gitea_token', sanitize_text_field($_POST['twp_gitea_token']));
-
$settings_saved = true;
}
@@ -60,15 +49,6 @@ if (isset($_POST['twp_save_mobile_settings']) && check_admin_referer('twp_mobile
$fcm_project_id = get_option('twp_fcm_project_id', '');
$fcm_service_account_json = get_option('twp_fcm_service_account_json', '');
$fcm_sa_configured = !empty($fcm_service_account_json) && !empty($fcm_project_id);
-$auto_update_enabled = get_option('twp_auto_update_enabled', '1') === '1';
-$gitea_repo = get_option('twp_gitea_repo', 'wp-plugins/twilio-wp-plugin');
-$gitea_token = get_option('twp_gitea_token', '');
-
-// Get update status
-require_once TWP_PLUGIN_DIR . 'includes/class-twp-auto-updater.php';
-$updater = new TWP_Auto_Updater();
-$update_status = $updater->get_update_status();
-
// Get mobile app statistics
global $wpdb;
$sessions_table = $wpdb->prefix . 'twp_mobile_sessions';
@@ -86,12 +66,6 @@ $total_sessions = $wpdb->get_var("SELECT COUNT(*) FROM $sessions_table");
-
-
-
-
@@ -183,91 +157,6 @@ $total_sessions = $wpdb->get_var("SELECT COUNT(*) FROM $sessions_table");
-
-
-
Automatic Updates
-
-
-
-
API Endpoints
diff --git a/includes/class-twp-auto-updater.php b/includes/class-twp-auto-updater.php
index 2d462d9..d13f265 100644
--- a/includes/class-twp-auto-updater.php
+++ b/includes/class-twp-auto-updater.php
@@ -210,6 +210,12 @@ class TWP_Auto_Updater {
$download_url = $release->zipball_url;
}
+ // Append auth token to download URL for private repos
+ if (!empty($gitea_token) && $download_url) {
+ $separator = (strpos($download_url, '?') !== false) ? '&' : '?';
+ $download_url .= $separator . 'token=' . urlencode($gitea_token);
+ }
+
// Format changelog
$changelog = !empty($release->body) ? $release->body : 'No changelog provided for this release.';