mitznjay commited on
Commit
4f876bd
·
verified ·
1 Parent(s): 91d8540

Add 2 files

Browse files
Files changed (2) hide show
  1. index.html +84 -103
  2. prompts.txt +1 -3
index.html CHANGED
@@ -482,21 +482,54 @@
482
  }
483
 
484
  // Handle login form submission
485
- document.getElementById('login-form').addEventListener('submit', function(e) {
486
  e.preventDefault();
487
 
488
- // In a real app, you would validate and send to server
489
- // For demo purposes, we'll just show the dashboard
490
- showPage('dashboard');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
491
 
492
  // Clear form
493
  this.reset();
494
  });
495
 
496
  // Handle signup form submission
497
- document.getElementById('signup-form').addEventListener('submit', function(e) {
498
  e.preventDefault();
499
 
 
 
500
  const password = document.getElementById('signup-password').value;
501
  const confirmPassword = document.getElementById('signup-confirm-password').value;
502
 
@@ -505,19 +538,58 @@
505
  return;
506
  }
507
 
508
- // In a real app, you would send to server
509
- // For demo, we'll show success message and redirect to login
510
- alert('Account created successfully! Please login.');
511
- showPage('login');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
512
 
513
  // Clear form
514
  this.reset();
515
  });
516
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
517
  // Logout function
518
  function logout() {
519
- // In a real app, you would clear session/token
520
- // For demo, just go back to home
 
 
 
521
  showPage('home');
522
  }
523
 
@@ -716,96 +788,5 @@
716
  <td class="px-4 py-2">Steam Client</td>
717
  <td class="px-4 py-2">High</td>
718
  <td class="px-4 py-2">Enabled</td>
719
- <td class="px-4 py-2"><button class="text-indigo-600 hover:text-indigo-800 text-xs">Disable</button></td>
720
- </tr>
721
- <tr>
722
- <td class="px-4 py-2">Adobe Updater</td>
723
- <td class="px-4 py-2">Low</td>
724
- <td class="px-4 py-2">Disabled</td>
725
- <td class="px-4 py-2"><button class="text-indigo-600 hover:text-indigo-800 text-xs">Enable</button></td>
726
- </tr>
727
- </tbody>
728
- </table>
729
- </div>
730
- </div>
731
- <div class="bg-blue-50 p-3 rounded-lg text-sm text-blue-700">
732
- <i class="fas fa-lightbulb mr-2"></i> Disabling unnecessary startup programs can help your computer boot faster.
733
- </div>
734
- `;
735
- break;
736
-
737
- case 'duplicateFiles':
738
- resultHtml = `
739
- <div class="p-4 bg-green-50 rounded-lg mb-4">
740
- <div class="flex items-center text-green-600 mb-2">
741
- <i class="fas fa-check-circle mr-2"></i>
742
- <h4 class="font-semibold">Duplicate Files Scan Complete</h4>
743
- </div>
744
- <p class="text-sm text-gray-700 mb-3">Found 3 sets of duplicate files taking up 450MB of space:</p>
745
- <div class="border rounded-lg overflow-hidden">
746
- <table class="min-w-full text-sm">
747
- <thead class="bg-gray-50">
748
- <tr>
749
- <th class="px-4 py-2 text-left">File</th>
750
- <th class="px-4 py-2 text-left">Size</th>
751
- <th class="px-4 py-2 text-left">Copies</th>
752
- </tr>
753
- </thead>
754
- <tbody class="divide-y divide-gray-200">
755
- <tr>
756
- <td class="px-4 py-2">vacation.jpg</td>
757
- <td class="px-4 py-2">3.2MB</td>
758
- <td class="px-4 py-2">2 copies</td>
759
- </tr>
760
- <tr>
761
- <td class="px-4 py-2">report.docx</td>
762
- <td class="px-4 py-2">1.5MB</td>
763
- <td class="px-4 py-2">3 copies</td>
764
- </tr>
765
- <tr>
766
- <td class="px-4 py-2">presentation.pptx</td>
767
- <td class="px-4 py-2">12.4MB</td>
768
- <td class="px-4 py-2">2 copies</td>
769
- </tr>
770
- </tbody>
771
- </table>
772
- </div>
773
- <div class="mt-3">
774
- <button class="bg-indigo-600 text-white px-4 py-2 rounded-lg text-sm hover:bg-indigo-700 smooth-transition">
775
- <i class="fas fa-trash-alt mr-2"></i> Delete Selected Duplicates
776
- </button>
777
- </div>
778
- </div>
779
- `;
780
- break;
781
-
782
- case 'backupReminder':
783
- resultHtml = `
784
- <div class="p-4 bg-green-50 rounded-lg">
785
- <div class="flex items-center text-green-600 mb-2">
786
- <i class="fas fa-check-circle mr-2"></i>
787
- <h4 class="font-semibold">Backup Reminder Set</h4>
788
- </div>
789
- <p class="text-sm text-gray-700 mb-3">You'll be reminded to back up your Documents folder every 7 days.</p>
790
- <div class="bg-blue-50 p-3 rounded-lg text-sm text-blue-700">
791
- <i class="fas fa-lightbulb mr-2"></i> Consider using cloud storage or an external drive for backups.
792
- </div>
793
- </div>
794
- `;
795
- break;
796
- }
797
-
798
- resultsContent.innerHTML = resultHtml;
799
- }, 1500);
800
- }
801
-
802
- // Close results panel
803
- function closeResults() {
804
- document.getElementById('results-panel').classList.add('hidden');
805
- }
806
-
807
- // Initialize - show home page
808
- showPage('home');
809
- </script>
810
- <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=mitznjay/tech-maintenance" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
811
  </html>
 
482
  }
483
 
484
  // Handle login form submission
485
+ document.getElementById('login-form').addEventListener('submit', async function(e) {
486
  e.preventDefault();
487
 
488
+ const email = document.getElementById('login-email').value;
489
+ const password = document.getElementById('login-password').value;
490
+
491
+ try {
492
+ const response = await fetch('/api/auth/login', {
493
+ method: 'POST',
494
+ headers: {
495
+ 'Content-Type': 'application/json'
496
+ },
497
+ body: JSON.stringify({ email, password })
498
+ });
499
+
500
+ const data = await response.json();
501
+
502
+ if (response.ok) {
503
+ // Store the token in localStorage
504
+ localStorage.setItem('token', data.token);
505
+ localStorage.setItem('userName', data.name);
506
+
507
+ // Show dashboard
508
+ showPage('dashboard');
509
+
510
+ // Update welcome message
511
+ const welcomeMessage = document.querySelector('#dashboard-page .text-2xl');
512
+ if (welcomeMessage) {
513
+ welcomeMessage.textContent = `Welcome back, ${data.name}!`;
514
+ }
515
+ } else {
516
+ alert(data.message || 'Login failed');
517
+ }
518
+ } catch (error) {
519
+ console.error('Login error:', error);
520
+ alert('An error occurred during login');
521
+ }
522
 
523
  // Clear form
524
  this.reset();
525
  });
526
 
527
  // Handle signup form submission
528
+ document.getElementById('signup-form').addEventListener('submit', async function(e) {
529
  e.preventDefault();
530
 
531
+ const name = document.getElementById('signup-name').value;
532
+ const email = document.getElementById('signup-email').value;
533
  const password = document.getElementById('signup-password').value;
534
  const confirmPassword = document.getElementById('signup-confirm-password').value;
535
 
 
538
  return;
539
  }
540
 
541
+ try {
542
+ const response = await fetch('/api/auth/signup', {
543
+ method: 'POST',
544
+ headers: {
545
+ 'Content-Type': 'application/json'
546
+ },
547
+ body: JSON.stringify({ name, email, password })
548
+ });
549
+
550
+ const data = await response.json();
551
+
552
+ if (response.ok) {
553
+ alert('Account created successfully! Please login.');
554
+ showPage('login');
555
+ } else {
556
+ alert(data.message || 'Signup failed');
557
+ }
558
+ } catch (error) {
559
+ console.error('Signup error:', error);
560
+ alert('An error occurred during signup');
561
+ }
562
 
563
  // Clear form
564
  this.reset();
565
  });
566
 
567
+ // Check if user is logged in on page load
568
+ document.addEventListener('DOMContentLoaded', function() {
569
+ const token = localStorage.getItem('token');
570
+ const userName = localStorage.getItem('userName');
571
+
572
+ if (token && userName) {
573
+ // Show dashboard
574
+ showPage('dashboard');
575
+
576
+ // Update welcome message
577
+ const welcomeMessage = document.querySelector('#dashboard-page .text-2xl');
578
+ if (welcomeMessage) {
579
+ welcomeMessage.textContent = `Welcome back, ${userName}!`;
580
+ }
581
+ } else {
582
+ showPage('home');
583
+ }
584
+ });
585
+
586
  // Logout function
587
  function logout() {
588
+ // Clear localStorage
589
+ localStorage.removeItem('token');
590
+ localStorage.removeItem('userName');
591
+
592
+ // Go back to home
593
  showPage('home');
594
  }
595
 
 
788
  <td class="px-4 py-2">Steam Client</td>
789
  <td class="px-4 py-2">High</td>
790
  <td class="px-4 py-2">Enabled</td>
791
+ <td class="px-4 py-2"><button class="text-indigo-600 hover:text-indigo-800 text-xs">Disable
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
792
  </html>
prompts.txt CHANGED
@@ -1,3 +1 @@
1
- Build a web-based application called 'Tech PC Maintenance Center'. This will be a beginner-friendly portal where users can log in to access simple computer maintenance tools. For now, focus only on building: A homepage with a simple introduction A signup page (create account) A login page (login to existing account) A simple user dashboard after login (can just say 'Welcome to Tech PC Maintenance Center'). Make it mobile-friendly and clean. Use plain HTML/CSS/JS or a simple framework if necessary, but no heavy backend features yet. I will add the tools later.
2
- Now add a full basic PC maintenance dashboard to the logged-in user's home screen. The dashboard should include easy-to-understand buttons for the following actions: Clean Temporary Files (cleans temp folder safely) Delete Browser Cache (option for Chrome, Firefox, Edge) Check Disk Space (shows how much free space is left) Organize Downloads Folder (group files by type: Documents, Images, Videos) Scan for Large Files (identify files over 500MB and list them) Startup Program Manager (list startup programs with the option to disable) Duplicate File Finder (scan selected folder for duplicate files) Simple Backup Reminder (button that reminds user to back up Documents folder) For now, actions can show a success message or simulate the process safely. Create a clean, easy-to-use layout: Use big friendly buttons for each function Add short descriptions under each button Organize tools into sections if possible (e.g., Cleaning, Organizing, Managing) The goal is to make this beginner-friendly, mobile-friendly, and safe — no dangerous actions or destructive file deletion without confirmation.
3
- Upgrade the 'Tech PC Maintenance Center' app. Keep the same design and frontend layout, but now add real functionality: Create a working signup system (store users in a simple database — email, name, password). Create a working login system (validate credentials, redirect to dashboard). Make passwords securely hashed (use a basic hashing method). Use a lightweight backend like Node.js + Express + SQLite database (or any simple server + database combination). Keep everything beginner-friendly, safe, and ready for hosting. Important: Maintain mobile responsiveness. Keep fake tool actions (PC Maintenance buttons) simulated for now — no real PC changes yet. I want full downloadable project files (frontend + backend)
 
1
+ Add real signup and login functionality to Tech PC Maintenance Center. Save user emails, names, and hashed passwords in a SQLite database. Use Node.js and Express for the backend. After login, redirect users to the dashboard. Keep the frontend design the same. The maintenance tools can stay simulated for now.