MeowSky49887 commited on
Commit
6b9f20e
·
verified ·
1 Parent(s): 9c7b745

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -19
app.py CHANGED
@@ -379,26 +379,31 @@ async def play():
379
  </script>
380
  <script>
381
  (function() {{
382
- const originalFetch = window.fetch;
383
- window.fetch = function(input, init = {{}}) {{
384
- if(init.headers) {{
385
- // ถ้า headers เป็น Headers object
386
- if(init.headers instanceof Headers) {{
387
- if(init.headers.has('Authorization')) {{
388
- const authValue = init.headers.get('Authorization');
389
- init.headers.delete('Authorization');
390
- init.headers.set('X-Authorization', authValue);
 
 
 
 
 
 
 
 
 
 
 
 
 
391
  }}
392
- }} else if (typeof init.headers === 'object') {{
393
- // ถ้า headers เป็น plain object
394
- if('Authorization' in init.headers) {{
395
- init.headers['X-Authorization'] = init.headers['Authorization'];
396
- delete init.headers['Authorization'];
397
- }}
398
- }}
399
- }}
400
- return originalFetch(input, init);
401
- }};
402
  }})();
403
  </script>
404
  </body>
 
379
  </script>
380
  <script>
381
  (function() {{
382
+ const originalFetch = window.fetch;
383
+ window.fetch = function(input, init = {{}}) {{
384
+ if(init.headers) {{
385
+ if(init.headers instanceof Headers) {{
386
+ if(init.headers.has('Authorization')) {{
387
+ let authValue = init.headers.get('Authorization');
388
+ if (typeof authValue === 'string' && authValue.startsWith('Basic ')) {{
389
+ authValue = authValue.slice(6);
390
+ }}
391
+ init.headers.delete('Authorization');
392
+ init.headers.set('X-Authorization', authValue);
393
+ }}
394
+ }} else if (typeof init.headers === 'object') {{
395
+ if('Authorization' in init.headers) {{
396
+ let authValue = init.headers['Authorization'];
397
+ if (typeof authValue === 'string' && authValue.startsWith('Basic ')) {{
398
+ authValue = authValue.slice(6);
399
+ }}
400
+ init.headers['X-Authorization'] = authValue;
401
+ delete init.headers['Authorization'];
402
+ }}
403
+ }}
404
  }}
405
+ return originalFetch(input, init);
406
+ }};
 
 
 
 
 
 
 
 
407
  }})();
408
  </script>
409
  </body>