1414 < div class ="auth-modal ">
1515 < h2 > Authentication Required</ h2 >
1616 < p > Please sign in with GitHub to run workflows</ p >
17- < a href ="/auth/github " class ="btn btn-primary "> Sign in with GitHub</ a >
17+ < a href ="/auth/github " id =" auth-link " class ="btn btn-primary "> Sign in with GitHub</ a >
1818 </ div >
1919 </ div >
2020 {% endif %}
@@ -135,7 +135,7 @@ <h1>Run GitHub Action</h1>
135135 {% endif %}
136136 < span class ="user-login "> {{ user.login }}</ span >
137137 </ div >
138- < a href ="/auth/logout " class ="btn btn-secondary btn-small "> Выйти </ a >
138+ < a href ="/auth/logout " class ="btn btn-secondary btn-small "> Logout </ a >
139139 </ div >
140140 </ footer >
141141 </ main >
@@ -434,6 +434,7 @@ <h1>Run GitHub Action</h1>
434434 // Disable button and show message if workflow doesn't support manual trigger
435435 if ( runButton ) {
436436 runButton . disabled = true ;
437+ runButton . classList . remove ( 'btn-active' ) ;
437438 runButton . style . opacity = '0.5' ;
438439 runButton . style . cursor = 'not-allowed' ;
439440 }
@@ -934,6 +935,7 @@ <h1>Run GitHub Action</h1>
934935 // If owner or repo are empty, disable button and show message
935936 if ( ! owner || ! repo ) {
936937 runButton . disabled = true ;
938+ runButton . classList . remove ( 'btn-active' ) ;
937939 runButton . style . opacity = '0.5' ;
938940 runButton . style . cursor = 'not-allowed' ;
939941 permissionMessage . style . display = 'block' ;
@@ -947,6 +949,7 @@ <h1>Run GitHub Action</h1>
947949 if ( response . status === 401 ) {
948950 // Not authenticated
949951 runButton . disabled = true ;
952+ runButton . classList . remove ( 'btn-active' ) ;
950953 runButton . style . opacity = '0.5' ;
951954 runButton . style . cursor = 'not-allowed' ;
952955 permissionMessage . style . display = 'block' ;
@@ -965,6 +968,7 @@ <h1>Run GitHub Action</h1>
965968
966969 if ( data . can_trigger && hasWorkflowDispatch ) {
967970 runButton . disabled = false ;
971+ runButton . classList . add ( 'btn-active' ) ;
968972 runButton . style . opacity = '1' ;
969973 runButton . style . cursor = 'pointer' ;
970974 permissionMessage . textContent = '' ;
@@ -974,6 +978,7 @@ <h1>Run GitHub Action</h1>
974978 }
975979 } else {
976980 runButton . disabled = true ;
981+ runButton . classList . remove ( 'btn-active' ) ;
977982 runButton . style . opacity = '0.5' ;
978983 runButton . style . cursor = 'not-allowed' ;
979984 permissionMessage . style . display = 'block' ;
@@ -991,24 +996,33 @@ <h1>Run GitHub Action</h1>
991996 console . error ( 'Error checking permissions:' , error ) ;
992997 // In case of error, allow attempt (check will be on server)
993998 runButton . disabled = false ;
999+ runButton . classList . add ( 'btn-active' ) ;
9941000 runButton . style . opacity = '1' ;
9951001 runButton . style . cursor = 'pointer' ;
9961002 permissionMessage . textContent = '' ;
9971003 permissionMessage . style . display = 'none' ;
9981004 }
9991005 }
10001006
1001- // Инициализация при загрузке
1007+ // Initialize on page load
10021008 function initAll ( ) {
1003- // Инициализируем скрытое поле return_url из URL параметров, если его нет
1009+ // Update the authorization link to pass the current URL with parameters
1010+ const authLink = document . getElementById ( 'auth-link' ) ;
1011+ if ( authLink && window . location . search ) {
1012+ const currentUrl = window . location . href ;
1013+ const redirectAfter = encodeURIComponent ( currentUrl ) ;
1014+ authLink . href = `/auth/github?redirect_after=${ redirectAfter } ` ;
1015+ }
1016+
1017+ // Initialize the hidden return_url field from URL parameters if not present
10041018 const form = document . getElementById ( 'workflowForm' ) ;
10051019 if ( form ) {
10061020 const urlParams = new URLSearchParams ( window . location . search ) ;
10071021 const returnUrlFromUrl = urlParams . get ( 'return_url' ) ;
10081022 if ( returnUrlFromUrl ) {
10091023 let returnUrlInput = form . querySelector ( 'input[name="return_url"]' ) ;
10101024 if ( ! returnUrlInput ) {
1011- // Создаем скрытое поле, если его нет
1025+ // Create hidden field if it doesn't exist
10121026 returnUrlInput = document . createElement ( 'input' ) ;
10131027 returnUrlInput . type = 'hidden' ;
10141028 returnUrlInput . name = 'return_url' ;
0 commit comments