waroca commited on
Commit
c918ce6
·
verified ·
1 Parent(s): 41c4134

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. app.py +1 -1
  2. components/subscriptions.py +3 -60
app.py CHANGED
@@ -202,7 +202,7 @@ def main():
202
  height=120,
203
  elem_classes="hero-logo"
204
  )
205
- gr.HTML('<p class="hero-subtitle">Your pass to private data.</p>')
206
 
207
  # Simple auth row with Gradio 6 LoginButton
208
  with gr.Row():
 
202
  height=120,
203
  elem_classes="hero-logo"
204
  )
205
+ gr.HTML('<div style="width:100%;text-align:center;"><p class="hero-subtitle">Your pass to private data.</p></div>')
206
 
207
  # Simple auth row with Gradio 6 LoginButton
208
  with gr.Row():
components/subscriptions.py CHANGED
@@ -114,7 +114,7 @@ def create_subscriptions_html(subscriptions):
114
  <p class="config-desc">Add to your Claude Desktop config:</p>
115
  <div class="code-wrapper">
116
  <pre class="code-block">{mcp_config_escaped}</pre>
117
- <button class="btn-copy" data-copy-id="{drawer_id}-mcp" data-copy-value="{copy_data[f"{drawer_id}-mcp"]}">Copy</button>
118
  </div>
119
  </div>
120
  </details>
@@ -129,7 +129,7 @@ def create_subscriptions_html(subscriptions):
129
  <div class="config-content">
130
  <div class="code-wrapper">
131
  <pre class="code-block prompt-block">{example_prompt_escaped}</pre>
132
- <button class="btn-copy" data-copy-id="{drawer_id}-prompt" data-copy-value="{copy_data[f"{drawer_id}-prompt"]}">Copy</button>
133
  </div>
134
  </div>
135
  </details>
@@ -144,7 +144,7 @@ def create_subscriptions_html(subscriptions):
144
  <div class="config-content">
145
  <div class="code-wrapper">
146
  <code class="token-block">{html.escape(access_token)}</code>
147
- <button class="btn-copy" data-copy-id="{drawer_id}-token" data-copy-value="{copy_data[f"{drawer_id}-token"]}">Copy</button>
148
  </div>
149
  </div>
150
  </details>
@@ -536,63 +536,6 @@ def create_subscriptions_html(subscriptions):
536
  }}
537
  </style>
538
 
539
- <script>
540
- // Use MutationObserver to attach handlers when elements are added
541
- (function() {{
542
- // Handle copy button clicks via event delegation on document
543
- document.addEventListener('click', function(e) {{
544
- var btn = e.target.closest('.btn-copy');
545
- if (btn && btn.hasAttribute('data-copy-value')) {{
546
- e.preventDefault();
547
- e.stopPropagation();
548
- var b64Value = btn.getAttribute('data-copy-value');
549
- if (b64Value) {{
550
- try {{
551
- var text = atob(b64Value);
552
- navigator.clipboard.writeText(text).then(function() {{
553
- var originalText = btn.textContent;
554
- btn.textContent = 'Copied!';
555
- btn.classList.add('copied');
556
- setTimeout(function() {{
557
- btn.textContent = originalText;
558
- btn.classList.remove('copied');
559
- }}, 2000);
560
- }}).catch(function() {{
561
- // Fallback
562
- var ta = document.createElement('textarea');
563
- ta.value = text;
564
- ta.style.cssText = 'position:fixed;opacity:0';
565
- document.body.appendChild(ta);
566
- ta.select();
567
- document.execCommand('copy');
568
- document.body.removeChild(ta);
569
- var originalText = btn.textContent;
570
- btn.textContent = 'Copied!';
571
- btn.classList.add('copied');
572
- setTimeout(function() {{
573
- btn.textContent = originalText;
574
- btn.classList.remove('copied');
575
- }}, 2000);
576
- }});
577
- }} catch(err) {{
578
- console.error('Copy failed:', err);
579
- }}
580
- }}
581
- }}
582
- }}, true);
583
-
584
- // Handle Escape key to close drawers
585
- document.addEventListener('keydown', function(e) {{
586
- if (e.key === 'Escape') {{
587
- var drawers = document.querySelectorAll('.drawer-overlay.show');
588
- drawers.forEach(function(d) {{
589
- d.classList.remove('show');
590
- }});
591
- document.body.style.overflow = '';
592
- }}
593
- }});
594
- }})();
595
- </script>
596
  """
597
 
598
  return result_html
 
114
  <p class="config-desc">Add to your Claude Desktop config:</p>
115
  <div class="code-wrapper">
116
  <pre class="code-block">{mcp_config_escaped}</pre>
117
+ <button class="btn-copy" onclick="(function(b,v){{var t=atob(v);navigator.clipboard.writeText(t).then(function(){{b.textContent='Copied!';b.classList.add('copied');setTimeout(function(){{b.textContent='Copy';b.classList.remove('copied')}},2000)}}).catch(function(){{var a=document.createElement('textarea');a.value=t;a.style.cssText='position:fixed;opacity:0';document.body.appendChild(a);a.select();document.execCommand('copy');document.body.removeChild(a);b.textContent='Copied!';b.classList.add('copied');setTimeout(function(){{b.textContent='Copy';b.classList.remove('copied')}},2000)}})}})( this,'{copy_data[f"{drawer_id}-mcp"]}')">Copy</button>
118
  </div>
119
  </div>
120
  </details>
 
129
  <div class="config-content">
130
  <div class="code-wrapper">
131
  <pre class="code-block prompt-block">{example_prompt_escaped}</pre>
132
+ <button class="btn-copy" onclick="(function(b,v){{var t=atob(v);navigator.clipboard.writeText(t).then(function(){{b.textContent='Copied!';b.classList.add('copied');setTimeout(function(){{b.textContent='Copy';b.classList.remove('copied')}},2000)}}).catch(function(){{var a=document.createElement('textarea');a.value=t;a.style.cssText='position:fixed;opacity:0';document.body.appendChild(a);a.select();document.execCommand('copy');document.body.removeChild(a);b.textContent='Copied!';b.classList.add('copied');setTimeout(function(){{b.textContent='Copy';b.classList.remove('copied')}},2000)}})}})( this,'{copy_data[f"{drawer_id}-prompt"]}')">Copy</button>
133
  </div>
134
  </div>
135
  </details>
 
144
  <div class="config-content">
145
  <div class="code-wrapper">
146
  <code class="token-block">{html.escape(access_token)}</code>
147
+ <button class="btn-copy" onclick="(function(b,v){{var t=atob(v);navigator.clipboard.writeText(t).then(function(){{b.textContent='Copied!';b.classList.add('copied');setTimeout(function(){{b.textContent='Copy';b.classList.remove('copied')}},2000)}}).catch(function(){{var a=document.createElement('textarea');a.value=t;a.style.cssText='position:fixed;opacity:0';document.body.appendChild(a);a.select();document.execCommand('copy');document.body.removeChild(a);b.textContent='Copied!';b.classList.add('copied');setTimeout(function(){{b.textContent='Copy';b.classList.remove('copied')}},2000)}})}})( this,'{copy_data[f"{drawer_id}-token"]}')">Copy</button>
148
  </div>
149
  </div>
150
  </details>
 
536
  }}
537
  </style>
538
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
539
  """
540
 
541
  return result_html