@@ -743,8 +743,8 @@ def generate_config_with_current_values() -> str:
743743# List of secret keys to load from env/config
744744SECRET_KEYS = ("SESSION_PASSWORD" , "SMTP_PASSWORD" , "WEBHOOK_URL" , "PROXY_URL" )
745745
746- # List of error messages indicating an Instagram has been flagged for 'automation' or 'botting'
747- FLAGGED_TRIGGERS = ("detected automated checks" , "ProfileNotExistsException" , "cannot access local variable" , " checkpoint_required" )
746+ # List of error substrings that unambiguously indicate the session account or IP has been flagged (challenge/checkpoint/shadowban)
747+ FLAGGED_TRIGGERS = ("detected automated checks" , "checkpoint_required" )
748748
749749# Default value for network-related timeouts in functions
750750FUNCTION_TIMEOUT = 15
@@ -7133,14 +7133,14 @@ def _get_iphone_json(path, params, **kwargs):
71337133 NEXT_CHECK_TIME = None
71347134 NEXT_CHECK_DISPLAY = "Paused"
71357135 update_check_times (next_time = "Paused" , user = user , increment_count = False )
7136- # Pause this thread also
71377136 log_activity ("Stopping monitoring" , user = user )
7138- print_cur_ts ("\n Timestamp:\t \t \t \t " )
7139- else :
7140- print_cur_ts ("\n Timestamp:\t \t \t \t " )
7137+ print_cur_ts ("\n Timestamp:\t \t \t \t " )
7138+
7139+ # Without the Web Dashboard there is no in-place session recovery so exit since the flagged session is dead for every target
7140+ if not WEB_DASHBOARD_ENABLED :
71417141 signal_handler (signal .SIGINT , None , message = '' )
71427142
7143- # Wait for session refresh or stop event
7143+ # Web Dashboard can re-import a session and resume, so wait for that or a stop event
71447144 if WEB_DASHBOARD_ENABLED :
71457145 while not (stop_event and stop_event .is_set ()):
71467146 if SESSION_REFRESHED_EVENT .wait (timeout = 1.0 ):
@@ -8196,8 +8196,6 @@ def _get_iphone_json(path, params, **kwargs):
81968196 # Handle session recovery for automated checks/challenge errors
81978197 if any (t in error_msg for t in FLAGGED_TRIGGERS ):
81988198 err_str = f"Session account '{ SESSION_USERNAME or '<anonymous>' } ' has been flagged. Log into Instagram and clear warnings."
8199- for i in range (50 ):
8200- log_activity (f"({ i } ) - { err_str } " , user = user )
82018199 update_ui_data (targets = {user : {'status' : f'Paused: { err_str } ' }})
82028200 print (f"* Error: { err_str } " )
82038201
@@ -8213,14 +8211,14 @@ def _get_iphone_json(path, params, **kwargs):
82138211 NEXT_CHECK_TIME = None
82148212 NEXT_CHECK_DISPLAY = "Paused"
82158213 update_check_times (next_time = "Paused" , user = user , increment_count = False )
8216- # Pause this thread also
82178214 log_activity ("Stopping monitoring" , user = user )
8218- print_cur_ts ("\n Timestamp:\t \t \t \t " )
8219- else :
8220- print_cur_ts ("\n Timestamp:\t \t \t \t " )
8215+ print_cur_ts ("\n Timestamp:\t \t \t \t " )
8216+
8217+ # Without the Web Dashboard there is no in-place session recovery so exit since the flagged session is dead for every target
8218+ if not WEB_DASHBOARD_ENABLED :
82218219 signal_handler (signal .SIGINT , None , message = '' )
82228220
8223- # Wait for session refresh or stop event
8221+ # Web Dashboard can re-import a session and resume, so wait for that or a stop event
82248222 while not (stop_event and stop_event .is_set ()):
82258223 if SESSION_REFRESHED_EVENT .wait (timeout = 1.0 ):
82268224 # Session refreshed!
0 commit comments