File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,25 @@ export default {
22
22
return new Promise ( ( resolve , reject ) => {
23
23
const xhr = new XMLHttpRequest ( ) ;
24
24
xhr . open ( 'GET' , 'config.json' ) ;
25
+
26
+ // Allow using query string to set upload pass
27
+ const params = new URLSearchParams ( window . location . search ) ;
28
+ const querystringUploadPass = params . get ( "upload_key" ) ;
29
+
30
+ if ( querystringUploadPass ) {
31
+ state . uploadPass = querystringUploadPass ;
32
+ params . delete ( "upload_key" ) ; // Remove the parameter
33
+
34
+ // Build the new URL
35
+ const newUrl =
36
+ params . toString ( ) . length > 0
37
+ ? window . location . pathname + "?" + params . toString ( )
38
+ : window . location . pathname ; // Remove "?" if no other params exist
39
+
40
+ // Update the URL without reloading
41
+ window . history . replaceState ( null , "" , newUrl ) ;
42
+ }
43
+
25
44
state . uploadPass && xhr . setRequestHeader ( 'x-passwd' , state . uploadPass ) ;
26
45
xhr . onload = ( ) => {
27
46
if ( xhr . status === 200 ) {
You can’t perform that action at this time.
0 commit comments