File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -662,6 +662,10 @@ async def update_settings(
662662 status_code = status .HTTP_403_FORBIDDEN , detail = "Admin access required"
663663 )
664664
665+ # Preserve existing GitHub token when the form submits an empty value.
666+ if not github_token .strip ():
667+ github_token = get_setting (GITHUB_TOKEN , "" )
668+
665669 set_setting (DISCORD_WEBHOOK_URL , discord_webhook_url )
666670 set_setting (GITHUB_TOKEN , github_token )
667671 set_setting (SKIP_SELF_UPDATE , "true" if skip_self_update else "false" )
Original file line number Diff line number Diff line change @@ -134,13 +134,19 @@ <h6><i class="fab fa-discord me-2"></i>Discord Webhook Setup</h6>
134134 if ( settingsForm && typeof window . AjaxLoader !== 'undefined' ) {
135135 settingsForm . addEventListener ( 'submit' , function ( e ) {
136136 AjaxLoader . show ( 'Saving settings...' ) ;
137-
138- // Disable form elements
139- const formElements = settingsForm . querySelectorAll ( 'input, button' ) ;
140- formElements . forEach ( element => {
141- element . disabled = true ;
137+
138+ // Keep inputs submitted; make them read-only while the request goes out.
139+ const inputs = settingsForm . querySelectorAll ( 'input' ) ;
140+ inputs . forEach ( element => {
141+ element . readOnly = true ;
142+ } ) ;
143+
144+ // Disable buttons to prevent double-submit.
145+ const buttons = settingsForm . querySelectorAll ( 'button' ) ;
146+ buttons . forEach ( button => {
147+ button . disabled = true ;
142148 } ) ;
143-
149+
144150 // Update button text
145151 if ( settingsBtn ) {
146152 settingsBtn . innerHTML = '<i class="fas fa-spinner fa-spin me-2"></i>Saving...' ;
@@ -149,4 +155,4 @@ <h6><i class="fab fa-discord me-2"></i>Discord Webhook Setup</h6>
149155 }
150156} ) ;
151157</ script >
152- {% endblock %}
158+ {% endblock %}
You can’t perform that action at this time.
0 commit comments