Anurag commited on
Commit
6f65a3c
·
unverified ·
2 Parent(s): ec8e293ed2df08

env-builder UX and gateway robustness

Browse files

Improve Jupyter token security, env-builder UX, browser/dbus support, and gateway robustness

Files changed (1) hide show
  1. env-builder.js +9 -28
env-builder.js CHANGED
@@ -2487,40 +2487,21 @@ $('clearAll').onclick = () => {
2487
  };
2488
  $('applyImport').onclick = () => {
2489
  try {
2490
- applyObj(parseEnv($('importText').value), true);
2491
- showToast('Imported ✓');
 
 
 
 
 
 
2492
  } catch (e) {
2493
  showToast('Import failed');
2494
  alert(e.message);
2495
  }
2496
  };
2497
 
2498
- // Auto-import: paste karo aur turant parse + apply ho jaata hai
2499
- $('importText').addEventListener('paste', () => {
2500
- setTimeout(() => {
2501
- try {
2502
- const val = $('importText').value.trim();
2503
- if (!val) return;
2504
- applyObj(parseEnv(val), true);
2505
- showToast('Auto-imported ✓');
2506
- } catch (e) {
2507
- showToast('Import failed');
2508
- }
2509
- }, 0);
2510
- });
2511
-
2512
- // Live typing: jaise jaise type karo env format mein, bundle banta jaata hai
2513
- $('importText').addEventListener('input', () => {
2514
- const val = $('importText').value.trim();
2515
- if (!val) return;
2516
- // Sirf agar valid env/bundle format lag raha ho tabhi auto-apply
2517
- const looksLikeEnv = val.includes('=') || val.startsWith('{') || /^[A-Za-z0-9_\-]{20,}$/.test(val);
2518
- if (looksLikeEnv) {
2519
- try {
2520
- applyObj(parseEnv(val), true);
2521
- } catch (e) { /* silent — user abhi type kar raha hai */ }
2522
- }
2523
- });
2524
  $('addCustom').onclick = () => addCustomRow();
2525
  $('applyBundle').onclick = () => {
2526
  try {
 
2487
  };
2488
  $('applyImport').onclick = () => {
2489
  try {
2490
+ const parsed = parseEnv($('importText').value);
2491
+ const count = Object.keys(parsed).length;
2492
+ if (!count) {
2493
+ showToast('No valid env keys found');
2494
+ return;
2495
+ }
2496
+ applyObj(parsed, true);
2497
+ showToast(`Imported ${count} key${count > 1 ? 's' : ''} ✓`);
2498
  } catch (e) {
2499
  showToast('Import failed');
2500
  alert(e.message);
2501
  }
2502
  };
2503
 
2504
+ // Import is explicit via the Import & Apply button to avoid surprising UI resets.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2505
  $('addCustom').onclick = () => addCustomRow();
2506
  $('applyBundle').onclick = () => {
2507
  try {