@@ -1258,10 +1258,19 @@ let huntarrUI = {
12581258 // Listen for change events (for checkboxes, selects, radio buttons)
12591259 settingsContainer . addEventListener ( 'change' , ( event ) => {
12601260 if ( event . target . matches ( 'input, select, textarea' ) ) {
1261- // Special handling for Low Usage Mode - apply immediately
1261+ // Special handling for settings that can take effect immediately
12621262 if ( event . target . id === 'low_usage_mode' ) {
12631263 console . log ( '[huntarrUI] Low Usage Mode toggled, applying immediately' ) ;
12641264 this . applyLowUsageMode ( event . target . checked ) ;
1265+ } else if ( event . target . id === 'timezone' ) {
1266+ console . log ( '[huntarrUI] Timezone changed, applying immediately' ) ;
1267+ this . applyTimezoneChange ( event . target . value ) ;
1268+ } else if ( event . target . id === 'auth_mode' ) {
1269+ console . log ( '[huntarrUI] Authentication mode changed, applying immediately' ) ;
1270+ this . applyAuthModeChange ( event . target . value ) ;
1271+ } else if ( event . target . id === 'check_for_updates' ) {
1272+ console . log ( '[huntarrUI] Update checking toggled, applying immediately' ) ;
1273+ this . applyUpdateCheckingChange ( event . target . checked ) ;
12651274 }
12661275
12671276 this . triggerSettingsAutoSave ( ) ;
@@ -3232,6 +3241,84 @@ let huntarrUI = {
32323241 this . updateStatsDisplay ( window . mediaStats ) ;
32333242 }
32343243 } ,
3244+
3245+ // Apply timezone change immediately
3246+ applyTimezoneChange : function ( timezone ) {
3247+ console . log ( `[huntarrUI] Applying timezone change to: ${ timezone } ` ) ;
3248+
3249+ // Call the backend to apply timezone immediately
3250+ fetch ( './api/settings/apply-timezone' , {
3251+ method : 'POST' ,
3252+ headers : {
3253+ 'Content-Type' : 'application/json'
3254+ } ,
3255+ body : JSON . stringify ( { timezone : timezone } )
3256+ } )
3257+ . then ( response => response . json ( ) )
3258+ . then ( data => {
3259+ if ( data . success ) {
3260+ console . log ( '[huntarrUI] Timezone applied successfully' ) ;
3261+ this . showNotification ( `Timezone changed to ${ timezone } ` , 'success' ) ;
3262+
3263+ // Refresh any time displays that might be affected
3264+ this . refreshTimeDisplays ( ) ;
3265+ } else {
3266+ console . error ( '[huntarrUI] Failed to apply timezone:' , data . error ) ;
3267+ this . showNotification ( `Failed to apply timezone: ${ data . error } ` , 'error' ) ;
3268+ }
3269+ } )
3270+ . catch ( error => {
3271+ console . error ( '[huntarrUI] Error applying timezone:' , error ) ;
3272+ this . showNotification ( `Error applying timezone: ${ error . message } ` , 'error' ) ;
3273+ } ) ;
3274+ } ,
3275+
3276+ // Apply authentication mode change immediately
3277+ applyAuthModeChange : function ( authMode ) {
3278+ console . log ( `[huntarrUI] Authentication mode changed to: ${ authMode } ` ) ;
3279+
3280+ // Show notification about the change
3281+ const modeNames = {
3282+ 'login' : 'Login Mode' ,
3283+ 'local_bypass' : 'Local Bypass Mode' ,
3284+ 'no_login' : 'No Login Mode'
3285+ } ;
3286+
3287+ const modeName = modeNames [ authMode ] || authMode ;
3288+ this . showNotification ( `Authentication mode changed to ${ modeName } ` , 'info' ) ;
3289+
3290+ // Add warning for No Login Mode
3291+ if ( authMode === 'no_login' ) {
3292+ setTimeout ( ( ) => {
3293+ this . showNotification ( 'Warning: No Login Mode disables all authentication. Ensure your reverse proxy is securing access!' , 'warning' ) ;
3294+ } , 1000 ) ;
3295+ }
3296+ } ,
3297+
3298+ // Apply update checking change immediately
3299+ applyUpdateCheckingChange : function ( enabled ) {
3300+ console . log ( `[huntarrUI] Update checking ${ enabled ? 'enabled' : 'disabled' } ` ) ;
3301+ this . showNotification ( `Update checking ${ enabled ? 'enabled' : 'disabled' } ` , 'info' ) ;
3302+ } ,
3303+
3304+ // Refresh time displays after timezone change
3305+ refreshTimeDisplays : function ( ) {
3306+ // Refresh any elements that display time and might be affected by timezone changes
3307+ const timeElements = document . querySelectorAll ( '[data-time], .time-display, .timestamp' ) ;
3308+ timeElements . forEach ( element => {
3309+ // If element has a refresh method or data attribute, trigger refresh
3310+ if ( element . dataset . refreshTime ) {
3311+ // Custom refresh logic could go here
3312+ console . log ( '[huntarrUI] Refreshing time display element' ) ;
3313+ }
3314+ } ) ;
3315+
3316+ // Refresh logs if they're currently visible (they contain timestamps)
3317+ if ( this . currentSection === 'logs' ) {
3318+ console . log ( '[huntarrUI] Refreshing logs for timezone change' ) ;
3319+ // The logs will refresh automatically via the EventSource, but we could trigger a manual refresh here if needed
3320+ }
3321+ } ,
32353322
32363323 // Reset the app cycle for a specific app
32373324 resetAppCycle : function ( app , button ) {
0 commit comments