@@ -10682,7 +10682,40 @@ document.addEventListener("DOMContentLoaded", async function(event) {
1068210682 } ) ;
1068310683 }
1068410684
10685+ var serverFallbackUndoState = null ;
10686+
10687+ function getServerFallbackInputState ( ) {
10688+ return {
10689+ server2 : ! ! ( document . getElementById ( "server2" ) && document . getElementById ( "server2" ) . checked ) ,
10690+ server3 : ! ! ( document . getElementById ( "server3" ) && document . getElementById ( "server3" ) . checked )
10691+ } ;
10692+ }
10693+
10694+ function setServerFallbackInputState ( state ) {
10695+ [ "server2" , "server3" ] . forEach ( function ( id ) {
10696+ var input = document . getElementById ( id ) ;
10697+ if ( input && input . checked !== ! ! state [ id ] ) {
10698+ input . checked = ! ! state [ id ] ;
10699+ updateSettings ( input , true ) ;
10700+ }
10701+ } ) ;
10702+ refreshLinks ( ) ;
10703+ }
10704+
10705+ function undoServerFallbackForDockLinks ( ) {
10706+ if ( ! serverFallbackUndoState ) {
10707+ return ;
10708+ }
10709+ setServerFallbackInputState ( serverFallbackUndoState ) ;
10710+ serverFallbackUndoState = null ;
10711+ showServerFallbackBanner ( null , "Server Fallback was undone. Your previous dock/overlay link settings are restored." , true ) ;
10712+ }
10713+
1068510714 function enableServerFallbackForDockLinks ( ) {
10715+ if ( ! confirm ( "Server Fallback changes your dock and overlay links. After enabling, copy the updated links into OBS or reload/re-add those sources. Continue?" ) ) {
10716+ return ;
10717+ }
10718+ serverFallbackUndoState = getServerFallbackInputState ( ) ;
1068610719 [ "server2" , "server3" ] . forEach ( function ( id ) {
1068710720 var input = document . getElementById ( id ) ;
1068810721 if ( input && ! input . checked ) {
@@ -10691,7 +10724,7 @@ document.addEventListener("DOMContentLoaded", async function(event) {
1069110724 }
1069210725 } ) ;
1069310726 refreshLinks ( ) ;
10694- showServerFallbackBanner ( null , "Server Fallback is enabled. Re-open or reload your dock and overlays using the updated links." , true ) ;
10727+ showServerFallbackBanner ( null , "Server Fallback is enabled. Copy the updated dock/overlay links into OBS, then reload those sources." , true , false , true ) ;
1069510728 }
1069610729
1069710730 function getServerFallbackBanner ( ) {
@@ -10702,13 +10735,14 @@ document.addEventListener("DOMContentLoaded", async function(event) {
1070210735 return banner ;
1070310736 }
1070410737
10705- function showServerFallbackBanner ( health , customMessage , success , hideEnableButton ) {
10738+ function showServerFallbackBanner ( health , customMessage , success , hideEnableButton , showUndoButton ) {
1070610739 var banner = getServerFallbackBanner ( ) ;
1070710740 if ( ! banner ) {
1070810741 return ;
1070910742 }
1071010743 var messageNode = banner . querySelector ( '[data-role="message"]' ) ;
1071110744 var enableButton = banner . querySelector ( '[data-role="enable"]' ) ;
10745+ var undoButton = banner . querySelector ( '[data-role="undo"]' ) ;
1071210746 var dismissButton = banner . querySelector ( '[data-role="dismiss"]' ) ;
1071310747 var message = customMessage || ( health && ! health . webRTCSupported
1071410748 ? "This browser does not appear to support WebRTC. If the fake test message did not appear, Server Fallback may help."
@@ -10726,6 +10760,15 @@ document.addEventListener("DOMContentLoaded", async function(event) {
1072610760 } ;
1072710761 }
1072810762 }
10763+ if ( undoButton ) {
10764+ undoButton . style . display = showUndoButton && serverFallbackUndoState ? "" : "none" ;
10765+ if ( ! undoButton . dataset . boundServerFallback ) {
10766+ undoButton . dataset . boundServerFallback = "1" ;
10767+ undoButton . onclick = function ( ) {
10768+ undoServerFallbackForDockLinks ( ) ;
10769+ } ;
10770+ }
10771+ }
1072910772 if ( dismissButton ) {
1073010773 var dismissLabel = dismissButton . querySelector ( "span" ) || dismissButton ;
1073110774 dismissLabel . textContent = success ? "OK" : "Not now" ;
0 commit comments