HAL1993 commited on
Commit
94f4104
·
verified ·
1 Parent(s): 6c659a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -425,8 +425,9 @@ def create_demo():
425
  }
426
  </style>
427
  <script>
428
- // Enforce /spaceishere path check
429
- if (!window.location.pathname.includes('spaceishere')) {
 
430
  document.body.innerHTML = '<h1 style="color:#ef4444;font-family:sans-serif;text-align:center;margin-top:100px;">500 Internal Server Error</h1>';
431
  throw new Error('500');
432
  }
@@ -447,9 +448,7 @@ def create_demo():
447
  // Log all toolbar elements
448
  const toolbarSelectors = [
449
  '.image-container[aria-label="Input Image"] .file-upload',
450
- '.image-container[aria-label="Input Image"] .file
451
-
452
- -preview',
453
  '.image-container[aria-label="Input Image"] .image-actions',
454
  '.image-container[aria-label="Input Image"] .gr-file-upload',
455
  '.image-container[aria-label="Input Image"] .gr-file',
 
425
  }
426
  </style>
427
  <script>
428
+ // Strict path check for exactly /spaceishere or /spaceishere/*
429
+ const validPathRegex = /^\/spaceishere(\/.*)?$/;
430
+ if (!validPathRegex.test(window.location.pathname)) {
431
  document.body.innerHTML = '<h1 style="color:#ef4444;font-family:sans-serif;text-align:center;margin-top:100px;">500 Internal Server Error</h1>';
432
  throw new Error('500');
433
  }
 
448
  // Log all toolbar elements
449
  const toolbarSelectors = [
450
  '.image-container[aria-label="Input Image"] .file-upload',
451
+ '.image-container[aria-label="Input Image"] .file-preview',
 
 
452
  '.image-container[aria-label="Input Image"] .image-actions',
453
  '.image-container[aria-label="Input Image"] .gr-file-upload',
454
  '.image-container[aria-label="Input Image"] .gr-file',