@@ -136,6 +136,18 @@ $('#{{ config.components.extra.id }}-comments').bind('input propertychange', fun
136136 };
137137});
138138
139+ // allow override of webapi-url from URL parameter
140+ // defaults to one specified during report creation
141+ function get_api_url(){
142+ const queryString = window.location.search ;
143+ const urlParams = new URLSearchParams(queryString);
144+ web_api_url = urlParams.get ('webapi-url');
145+ if (web_api_url== null){
146+ web_api_url = " {{ metadata.endpoint }}" ;
147+ }
148+ return web_api_url;
149+ }
150+
139151$ ( '#{{ config.components.actions [1].id }}' ).click ( function() {
140152 var payload = read_form();
141153 var md5sum = " {{ metadata.md5sum }}" ;
@@ -151,7 +163,7 @@ $( '#{{ config.components.actions[1].id }}' ).click( function() {
151163 var ratingReq = new XMLHttpRequest();
152164 ratingReq.open (" POST" , " {{ metadata.endpoint }}" );
153165 ratingReq.setRequestHeader (" Content-Type" , " application/json;charset=UTF-8" );
154- ratingReq.setRequestHeader (" Authorization" , authorization );
166+ ratingReq.setRequestHeader (" Authorization" , get_api_url() );
155167 ratingReq.onload = function () {
156168 status = ratingReq.status ;
157169 $ ('#{{ config.components.actions [1].id }}').removeClass ('btn-primary');
@@ -177,12 +189,12 @@ $( 'body' ).on( 'click', '#{{ config.components.artifacts.id }}-group input', fu
177189 $ ('#{{ config.components.actions [0].id }}').removeAttr ('aria-disabled');
178190 $ ('#{{ config.components.actions [1].id }}').removeAttr ('disabled');
179191 };
180-
192+
181193 var payload = read_form();
182194});
183195
184196$ ( 'body' ).on ( 'click', '#{{ config.id }}-toggler', function(e) {
185197 toggle_rating();
186198});
187199</script>
188- </div>
200+ </div>
0 commit comments