| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="UTF-8" /> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| <title>Chahua Plugin Management System</title> |
| <style> |
| |
| |
| |
| |
| |
| |
| |
| :root { |
| |
| --bg-primary: #0a0e16; |
| --bg-secondary: #111827; |
| --bg-tertiary: #0d1117; |
| --bg-card: #111827; |
| --text-primary: #f9fafb; |
| --text-secondary: #9ca3af; |
| --text-muted: #6b7280; |
| --accent-blue: #0ea5e9; |
| --accent-blue-hover: #0284c7; |
| --accent-light: #38bdf8; |
| --accent-dark: #0369a1; |
| --border-color: rgba(255, 255, 255, 0.1); |
| --border-hover: rgba(255, 255, 255, 0.2); |
| --shadow-color: rgba(14, 165, 233, 0.25); |
| --success-color: #10b981; |
| --success-green: #10b981; |
| --warning-color: #f59e0b; |
| --warning-orange: #f59e0b; |
| --error-color: #ef4444; |
| --gradient-primary: linear-gradient( |
| 135deg, |
| var(--bg-primary) 0%, |
| var(--bg-secondary) 100% |
| ); |
| --gradient-blue: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%); |
| --gradient-card: linear-gradient( |
| 145deg, |
| rgba(17, 24, 39, 0.8) 0%, |
| rgba(10, 14, 22, 0.9) 100% |
| ); |
| |
| |
| --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05); |
| --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), |
| 0 2px 4px -1px rgba(0, 0, 0, 0.06); |
| --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), |
| 0 4px 6px -2px rgba(0, 0, 0, 0.2); |
| --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), |
| 0 10px 10px -5px rgba(0, 0, 0, 0.25); |
| |
| |
| --shadow-glow: |
| 0 0 0 1px rgba(14, 165, 233, 0.3), |
| 0 0 10px rgba(14, 165, 233, 0.2), |
| 0 0 20px rgba(14, 165, 233, 0.1), |
| 0 4px 20px rgba(14, 165, 233, 0.25); |
| --shadow-glow-strong: |
| 0 0 0 1px rgba(14, 165, 233, 0.5), |
| 0 0 15px rgba(14, 165, 233, 0.4), |
| 0 0 30px rgba(14, 165, 233, 0.3), |
| 0 6px 30px rgba(14, 165, 233, 0.4); |
| --shadow-glow-subtle: |
| 0 0 5px rgba(14, 165, 233, 0.1), |
| 0 0 10px rgba(14, 165, 233, 0.05), |
| 0 2px 8px rgba(14, 165, 233, 0.1); |
| --shadow-glow-card: |
| 0 0 0 1px rgba(14, 165, 233, 0.2), |
| 0 0 8px rgba(14, 165, 233, 0.15), |
| 0 0 16px rgba(14, 165, 233, 0.1), |
| 0 2px 12px rgba(0, 0, 0, 0.2); |
| |
| |
| --glass-bg: linear-gradient( |
| 135deg, |
| rgba(255, 255, 255, 0.08) 0%, |
| rgba(255, 255, 255, 0.03) 100% |
| ); |
| --glass-border: rgba(255, 255, 255, 0.15); |
| --glass-border-hover: rgba(255, 255, 255, 0.25); |
| |
| |
| --grid-color: rgba(255, 255, 255, 0.03); |
| --grid-size: 40px; |
| --grid-thick-color: rgba(14, 165, 233, 0.1); |
| } |
| |
| * { |
| margin: 0; |
| padding: 0; |
| box-sizing: border-box; |
| } |
| |
| html, body { |
| height: 100vh; |
| overflow: hidden; |
| margin: 0; |
| padding: 0 0 8px 0; |
| } |
| |
| |
| |
| |
| |
| |
| body { |
| font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; |
| background-color: var(--bg-primary); |
| color: var(--text-primary); |
| line-height: 1.6; |
| |
| background-image: |
| radial-gradient(1200px 600px at 70% 10%, rgba(14, 165, 233, 0.1), rgba(0, 0, 0, 0) 60%), |
| linear-gradient(var(--grid-color) 1px, transparent 1px), |
| linear-gradient(90deg, var(--grid-color) 1px, transparent 1px); |
| background-size: 100% 100%, 40px 40px, 40px 40px; |
| background-position: 0 0, 0 0, 0 0; |
| background-attachment: fixed; |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| @keyframes subtle-grid-move { |
| 0%, |
| 100% { |
| background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0; |
| } |
| 50% { |
| background-position: 0 0, 0 0, 2px 2px, 2px 2px, 4px 4px, 4px 4px; |
| } |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| .container { |
| max-width: 1200px; |
| margin: 0 auto; |
| padding: 0 20px; |
| } |
| |
| |
| |
| |
| |
| |
| :root { |
| |
| --terminal-bg: var(--bg-secondary); |
| --terminal-border: var(--border-color); |
| --plugin-card-bg: var(--glass-bg); |
| --plugin-card-border: var(--glass-border); |
| --surface-color: var(--bg-card); |
| --primary-text-color: var(--text-primary); |
| --secondary-text-color: var(--text-secondary); |
| --accent-color: var(--accent-blue); |
| --accent-hover-color: var(--accent-blue-hover); |
| --danger-color: var(--error-color); |
| --info-color: var(--accent-light); |
| --font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; |
| --border-radius: 12px; |
| --shadow: var(--shadow-md); |
| --transition: all 0.3s ease; |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| .plugin-image-container { |
| width: 100%; |
| height: 150px; |
| overflow: hidden; |
| border-radius: 12px; |
| margin-bottom: 15px; |
| border: 1px solid var(--border-color); |
| transition: all 0.3s ease; |
| position: relative; |
| background: var(--bg-secondary); |
| } |
| |
| .plugin-image-container:hover { |
| border-color: var(--accent-blue); |
| box-shadow: var(--shadow-glow-subtle); |
| } |
| |
| .plugin-preview-image { |
| width: 100%; |
| height: 100%; |
| object-fit: cover; |
| object-position: center; |
| transition: all 0.3s ease; |
| display: block; |
| } |
| |
| .plugin-preview-image:hover { |
| transform: scale(1.05); |
| } |
| |
| |
| |
| |
| |
| |
| |
| * { |
| margin: 0; |
| padding: 0; |
| box-sizing: border-box; |
| } |
| |
| |
| body { |
| overflow: hidden; |
| height: 100vh; |
| width: 100vw; |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| .container { |
| display: flex; |
| height: calc(100vh - 132px); |
| gap: 5px; |
| padding: 5px; |
| position: relative; |
| max-width: none; |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| .terminal-section { |
| background: var(--glass-bg); |
| border-radius: 16px; |
| color: var(--text-primary); |
| font-family: "Courier New", monospace; |
| box-shadow: var(--shadow-glow-card); |
| backdrop-filter: blur(20px); |
| -webkit-backdrop-filter: blur(20px); |
| border: 1px solid var(--glass-border); |
| display: flex; |
| flex-direction: column; |
| overflow: hidden; |
| flex: 0 0 auto; |
| position: relative; |
| min-width: 400px; |
| max-width: 75%; |
| width: calc(60% - 10px); |
| } |
| |
| .terminal-header { |
| background: linear-gradient( |
| 135deg, |
| var(--accent-blue), |
| var(--accent-dark) |
| ); |
| padding: 15px 20px; |
| border-bottom: 1px solid var(--glass-border); |
| display: flex; |
| align-items: center; |
| gap: 10px; |
| border-radius: 16px 16px 0 0; |
| } |
| |
| .terminal-header h2 { |
| color: white; |
| font-size: 1.1rem; |
| margin: 0; |
| font-weight: 600; |
| text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); |
| } |
| |
| |
| |
| |
| |
| |
| |
| .terminal-status { |
| width: 8px; |
| height: 8px; |
| border-radius: 50%; |
| background: #10b981; |
| animation: pulse 3s infinite; |
| box-shadow: 0 0 10px rgba(16, 185, 129, 0.5); |
| } |
| |
| |
| |
| |
| |
| |
| |
| @keyframes pulse { |
| 0%, |
| 100% { |
| opacity: 1; |
| transform: scale(1); |
| } |
| 50% { |
| opacity: 0.85; |
| transform: scale(1.05); |
| } |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| .log-viewer-container { |
| flex: 1; |
| background: var(--bg-primary); |
| color: var(--text-secondary); |
| font-family: "Consolas", "Courier New", monospace; |
| font-size: 13px; |
| padding: 15px; |
| overflow-y: auto; |
| white-space: pre-wrap; |
| word-break: break-all; |
| margin: 0; |
| border: none; |
| outline: none; |
| border-radius: 0 0 16px 16px; |
| } |
| |
| |
| .log-viewer-container::-webkit-scrollbar { |
| width: 8px; |
| } |
| |
| .log-viewer-container::-webkit-scrollbar-track { |
| background: var(--bg-secondary); |
| border-radius: 4px; |
| } |
| |
| .log-viewer-container::-webkit-scrollbar-thumb { |
| background: var(--accent-blue); |
| border-radius: 4px; |
| } |
| |
| .log-viewer-container::-webkit-scrollbar-thumb:hover { |
| background: var(--accent-blue-hover); |
| } |
| |
| |
| .log-line { |
| display: block; |
| margin: 0; |
| padding: 2px 0; |
| border-left: 3px solid transparent; |
| padding-left: 8px; |
| transition: all 0.2s ease; |
| } |
| |
| .log-line:hover { |
| background: rgba(59, 130, 246, 0.1); |
| border-left-color: var(--accent-blue); |
| } |
| |
| |
| .log-line.log-error { |
| color: #ef4444; |
| font-weight: bold; |
| border-left-color: #ef4444; |
| background: rgba(239, 68, 68, 0.05); |
| } |
| .log-line.log-warning { |
| color: #f59e0b; |
| border-left-color: #f59e0b; |
| background: rgba(245, 158, 11, 0.05); |
| } |
| .log-line.log-success { |
| color: #10b981; |
| border-left-color: #10b981; |
| background: rgba(16, 185, 129, 0.05); |
| } |
| .log-line.log-info { |
| color: var(--text-secondary); |
| } |
| .log-line.log-debug { |
| color: var(--accent-light); |
| } |
| .log-line.log-command { |
| color: #a855f7; |
| font-style: italic; |
| border-left-color: #a855f7; |
| background: rgba(168, 85, 247, 0.05); |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| .terminal-line.info { |
| color: var(--accent-light); |
| } |
| .terminal-line.error { |
| color: #ef4444; |
| } |
| .terminal-line.success { |
| color: #10b981; |
| } |
| .terminal-line.warning { |
| color: #f59e0b; |
| } |
| .terminal-line.user { |
| color: #f59e0b; |
| font-weight: bold; |
| } |
| .terminal-line.command { |
| color: var(--accent-light); |
| } |
| .terminal-line.stdout { |
| color: var(--text-secondary); |
| white-space: pre-wrap; |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| .view-switcher { |
| margin-left: auto; |
| margin-top: 8px; |
| display: flex; |
| justify-content: space-between; |
| width: 100%; |
| gap: 4px; |
| padding: 6px; |
| align-items: center; |
| |
| |
| |
| position: relative; |
| z-index: 100; |
| } |
| |
| .view-btn { |
| background: transparent !important; |
| border: none !important; |
| color: var(--text-secondary) !important; |
| padding: 8px 16px !important; |
| cursor: pointer; |
| border-radius: 8px !important; |
| font-weight: 500 !important; |
| transition: all 0.3s ease !important; |
| box-shadow: none !important; |
| font-size: 14px !important; |
| } |
| |
| .view-btn:hover { |
| background: rgba(59, 130, 246, 0.1) !important; |
| color: var(--accent-blue) !important; |
| transform: translateY(-1px) !important; |
| box-shadow: var(--shadow-glow-subtle) !important; |
| } |
| |
| .view-btn.active { |
| background: var(--gradient-blue) !important; |
| color: white !important; |
| font-weight: 600 !important; |
| box-shadow: var(--shadow-glow) !important; |
| } |
| |
| |
| .refresh-btn { |
| background: rgba(16, 185, 129, 0.1) !important; |
| border: 1px solid rgba(16, 185, 129, 0.3) !important; |
| color: #10b981 !important; |
| padding: 6px 12px !important; |
| margin-left: 8px !important; |
| cursor: pointer; |
| border-radius: 8px !important; |
| font-size: 12px !important; |
| font-weight: 500 !important; |
| transition: all 0.3s ease !important; |
| box-shadow: none !important; |
| } |
| |
| .refresh-btn:hover { |
| background: rgba(16, 185, 129, 0.2) !important; |
| border-color: rgba(16, 185, 129, 0.5) !important; |
| color: #ffffff !important; |
| transform: translateY(-2px) !important; |
| box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3) !important; |
| } |
| |
| .refresh-btn:active { |
| transform: translateY(0) !important; |
| box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3) !important; |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| .view-container { |
| flex: 1; |
| position: relative; |
| overflow: hidden; |
| } |
| |
| .view-panel { |
| position: absolute; |
| top: 0; |
| left: 0; |
| width: 100%; |
| height: 100%; |
| opacity: 0; |
| pointer-events: none; |
| transition: opacity 0.3s ease; |
| visibility: hidden; |
| } |
| |
| .view-panel.active { |
| opacity: 1; |
| pointer-events: auto; |
| visibility: visible; |
| } |
| |
| |
| #marketplace-webview { |
| width: 100%; |
| height: 100%; |
| border: none; |
| background-color: var(--bg-color); |
| } |
| |
| |
| .resize-handle { |
| position: absolute; |
| top: 0; |
| right: -10px; |
| width: 20px; |
| height: 100%; |
| cursor: col-resize; |
| background: transparent; |
| z-index: 10; |
| user-select: none; |
| display: flex; |
| align-items: center; |
| justify-content: center; |
| } |
| |
| .resize-handle::before { |
| content: ""; |
| width: 4px; |
| height: 40px; |
| background: var(--border-color); |
| border-radius: 2px; |
| transition: var(--transition); |
| } |
| |
| .resize-handle:hover::before { |
| background: var(--accent-color); |
| opacity: 0.7; |
| } |
| |
| .resize-handle.resizing::before { |
| background: var(--accent-color); |
| opacity: 1; |
| box-shadow: 0 0 10px rgba(0, 86, 179, 0.5); |
| } |
| |
| |
| |
| |
| |
| |
| |
| .container.resizing { |
| user-select: none; |
| } |
| |
| .container.resizing * { |
| pointer-events: none; |
| } |
| |
| .container.resizing .resize-handle { |
| pointer-events: auto; |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| .sidebar { |
| background: var(--glass-bg); |
| border-radius: 16px; |
| padding: 10px; |
| box-shadow: var(--shadow-glow-card); |
| backdrop-filter: blur(20px); |
| -webkit-backdrop-filter: blur(20px); |
| border: 1px solid var(--glass-border); |
| overflow-y: auto; |
| flex: 1; |
| min-width: 300px; |
| position: relative; |
| display: flex; |
| flex-direction: column; |
| gap: 12px; |
| } |
| |
| |
| .sidebar::-webkit-scrollbar { |
| width: 8px; |
| } |
| |
| .sidebar::-webkit-scrollbar-track { |
| background: rgba(148, 163, 184, 0.1); |
| border-radius: 4px; |
| } |
| |
| .sidebar::-webkit-scrollbar-thumb { |
| background: var(--accent-blue); |
| border-radius: 4px; |
| } |
| |
| .sidebar::-webkit-scrollbar-thumb:hover { |
| background: var(--accent-blue-hover); |
| } |
| |
| .sidebar h2 { |
| color: var(--accent-blue); |
| margin-bottom: 10px; |
| font-size: 1.4rem; |
| text-align: center; |
| font-weight: 700; |
| text-shadow: 0 2px 4px rgba(59, 130, 246, 0.2); |
| } |
| |
| |
| .plugin-grid { |
| display: flex; |
| flex-direction: column; |
| gap: 16px; |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| .fade-in { |
| animation: fadeIn 0.3s ease-in; |
| } |
| |
| @keyframes fadeIn { |
| from { |
| opacity: 0; |
| } |
| to { |
| opacity: 1; |
| } |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| .fade-in { |
| animation: fadeIn 0.3s ease-in; |
| } |
| |
| @keyframes fadeIn { |
| from { |
| opacity: 0; |
| } |
| to { |
| opacity: 1; |
| } |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| .plugin-meta { |
| background: var(--bg-secondary); |
| border: 1px solid var(--glass-border); |
| border-radius: 12px; |
| padding: 1rem; |
| margin: 1rem 0; |
| display: grid; |
| grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); |
| gap: 0.75rem; |
| text-align: left; |
| } |
| |
| .meta-item { |
| display: flex; |
| flex-direction: column; |
| align-items: center; |
| text-align: center; |
| } |
| |
| .meta-label { |
| font-size: 0.9rem; |
| color: var(--text-secondary); |
| margin-bottom: 0.5rem; |
| } |
| |
| .meta-value { |
| font-size: 1.1rem; |
| color: var(--text-primary); |
| font-weight: 600; |
| } |
| |
| |
| .stars { |
| display: flex; |
| gap: 2px; |
| justify-content: center; |
| margin-bottom: 0.25rem; |
| } |
| |
| .star { |
| font-size: 1rem; |
| } |
| |
| .star.filled { |
| color: #ffd700; |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| .error-slide h2 { |
| color: var(--text-primary); |
| margin-bottom: 1rem; |
| font-size: 2rem; |
| } |
| |
| .error-slide p { |
| margin-bottom: 1rem; |
| font-size: 1.1rem; |
| line-height: 1.6; |
| color: var(--text-secondary); |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| .view-switcher { |
| display: flex; |
| justify-content: space-between; |
| align-items: center; |
| padding: 0.15rem 0.3rem; |
| margin: 0.1rem; |
| } |
| |
| .view-tabs { |
| display: flex; |
| gap: 0.15rem; |
| } |
| |
| .view-btn { |
| padding: 0.3rem 0.6rem; |
| background: transparent; |
| border: 1px solid var(--glass-border); |
| color: var(--text); |
| border-radius: 20px; |
| cursor: pointer; |
| font-size: 0.8rem; |
| font-weight: 500; |
| transition: all 0.3s ease; |
| display: flex; |
| align-items: center; |
| gap: 0.4rem; |
| white-space: nowrap; |
| } |
| |
| .view-btn:hover { |
| background: var(--accent-color); |
| color: white; |
| transform: translateY(-2px); |
| box-shadow: 0 5px 15px rgba(0, 123, 255, 0.3); |
| } |
| |
| .view-btn.active { |
| background: linear-gradient( |
| 135deg, |
| var(--accent-color) 0%, |
| var(--secondary-color) 100% |
| ); |
| color: white; |
| border-color: var(--accent-color); |
| box-shadow: 0 4px 15px rgba(0, 123, 255, 0.4); |
| } |
| |
| |
| |
| |
| |
| |
| |
| .loading-state { |
| text-align: center; |
| padding: 2rem 1rem; |
| color: var(--text); |
| background: linear-gradient( |
| 135deg, |
| var(--glass-bg) 0%, |
| var(--accent-color) 20 20% |
| ); |
| border-radius: 15px; |
| margin: 1rem; |
| border: 1px solid var(--glass-border); |
| box-shadow: var(--glass-shadow); |
| } |
| |
| .loading-spinner { |
| width: 50px; |
| height: 50px; |
| border: 4px solid var(--glass-border); |
| border-top: 4px solid var(--accent-color); |
| border-radius: 50%; |
| animation: spin 1s linear infinite; |
| margin: 0 auto 1rem; |
| } |
| |
| @keyframes spin { |
| 0% { |
| transform: rotate(0deg); |
| } |
| 100% { |
| transform: rotate(360deg); |
| } |
| } |
| |
| .error-state { |
| text-align: center; |
| padding: 2rem 1rem; |
| color: var(--text); |
| background: linear-gradient( |
| 135deg, |
| rgba(220, 53, 69, 0.1) 0%, |
| rgba(220, 53, 69, 0.05) 100% |
| ); |
| border-radius: 15px; |
| margin: 1rem; |
| border: 1px solid rgba(220, 53, 69, 0.3); |
| box-shadow: var(--glass-shadow); |
| } |
| |
| .error-state h3 { |
| color: #dc3545; |
| margin-bottom: 1rem; |
| } |
| |
| .retry-button { |
| background: linear-gradient( |
| 135deg, |
| var(--accent-color) 0%, |
| var(--secondary-color) 100% |
| ); |
| color: white; |
| border: none; |
| padding: 0.75rem 1.5rem; |
| border-radius: 25px; |
| cursor: pointer; |
| font-size: 0.9rem; |
| font-weight: 500; |
| transition: all 0.3s ease; |
| margin-top: 1rem; |
| box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3); |
| } |
| |
| .retry-button:hover { |
| background: linear-gradient( |
| 135deg, |
| var(--secondary-color) 0%, |
| var(--accent-color) 100% |
| ); |
| transform: translateY(-2px); |
| box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4); |
| } |
| |
| |
| |
| |
| |
| |
| |
| @media (max-width: 1024px) { |
| |
| } |
| |
| @media (max-width: 768px) { |
| |
| |
| .view-switcher { |
| flex-direction: column; |
| gap: 1rem; |
| padding: 1rem; |
| } |
| |
| .view-tabs { |
| flex-wrap: wrap; |
| justify-content: center; |
| } |
| |
| .view-btn { |
| padding: 0.6rem 1rem; |
| font-size: 0.85rem; |
| white-space: nowrap; |
| } |
| |
| .refresh-btn { |
| min-width: auto; |
| width: 100%; |
| justify-content: center; |
| } |
| |
| .loading-state, |
| .error-state { |
| margin: 1rem; |
| padding: 2rem 1rem; |
| } |
| |
| .modal { |
| width: 95%; |
| max-width: none; |
| margin: 0.5rem; |
| } |
| |
| .modal-body { |
| padding: 1.5rem; |
| } |
| } |
| |
| @media (max-width: 480px) { |
| .slide-presentation-container { |
| margin: 0.25rem; |
| height: calc(100vh - 160px); |
| } |
| |
| .view-switcher { |
| padding: 0.75rem; |
| margin: 0.5rem; |
| } |
| |
| .view-tabs { |
| flex-direction: column; |
| width: 100%; |
| } |
| |
| .view-btn { |
| padding: 0.5rem 1rem; |
| font-size: 0.8rem; |
| width: 100%; |
| justify-content: center; |
| } |
| |
| .action-buttons { |
| flex-direction: column; |
| gap: 0.5rem; |
| } |
| |
| .action-btn { |
| width: 100%; |
| text-align: center; |
| } |
| } |
| |
| @media (max-width: 480px) { |
| .sidebar-header { |
| padding: 1rem; |
| } |
| } |
| |
| |
| |
| .plugin-card { |
| background: var(--gradient-card); |
| border: 1px solid var(--glass-border); |
| border-radius: 12px; |
| padding: 12px; |
| transition: all 0.3s ease; |
| position: relative; |
| overflow: hidden; |
| box-shadow: var(--shadow-glow-subtle); |
| } |
| |
| .plugin-card::before { |
| content: ""; |
| position: absolute; |
| top: 0; |
| left: -100%; |
| width: 100%; |
| height: 100%; |
| background: linear-gradient( |
| 90deg, |
| transparent, |
| rgba(59, 130, 246, 0.1), |
| transparent |
| ); |
| transition: left 0.6s ease; |
| } |
| |
| .plugin-card:hover::before { |
| left: 100%; |
| } |
| |
| .plugin-card:hover { |
| transform: translateY(-2px); |
| border-color: var(--accent-blue); |
| box-shadow: var(--shadow-glow-subtle); |
| } |
| |
| .plugin-card h3 { |
| font-size: 1.1rem; |
| color: var(--primary-text-color); |
| margin-bottom: 10px; |
| font-weight: 600; |
| } |
| |
| .plugin-card p { |
| font-size: 0.9rem; |
| color: var(--secondary-text-color); |
| margin-bottom: 15px; |
| line-height: 1.5; |
| } |
| |
| |
| |
| |
| |
| |
| |
| .plugin-buttons { |
| display: grid; |
| grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); |
| gap: 8px; |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| .button, |
| .plugin-buttons button, |
| button:not(.modal-close-btn):not(.password-toggle) { |
| background: var(--glass-bg) !important; |
| color: var(--accent-blue) !important; |
| border: 1px solid var(--glass-border) !important; |
| padding: 8px 12px; |
| border-radius: 6px; |
| cursor: pointer; |
| font-size: 0.8rem; |
| font-weight: 500; |
| transition: all 0.3s ease; |
| outline: none; |
| text-align: center; |
| backdrop-filter: blur(10px); |
| -webkit-backdrop-filter: blur(10px); |
| position: relative; |
| overflow: hidden; |
| min-height: auto; |
| } |
| |
| .button::before, |
| .plugin-buttons button::before, |
| button:not(.modal-close-btn):not(.password-toggle)::before { |
| content: ""; |
| position: absolute; |
| top: 0; |
| left: -100%; |
| width: 100%; |
| height: 100%; |
| background: linear-gradient( |
| 90deg, |
| transparent, |
| rgba(59, 130, 246, 0.2), |
| transparent |
| ); |
| transition: left 0.5s ease; |
| } |
| |
| .button:hover::before, |
| .plugin-buttons button:hover::before, |
| button:not(.modal-close-btn):not(.password-toggle):hover::before { |
| left: 100%; |
| } |
| |
| .button:hover, |
| .plugin-buttons button:hover, |
| button:not(.modal-close-btn):not(.password-toggle):hover { |
| background: var(--gradient-blue) !important; |
| color: white !important; |
| border-color: var(--accent-blue) !important; |
| transform: translateY(-2px); |
| box-shadow: var(--shadow-glow); |
| } |
| |
| |
| .scan-btn { |
| color: var(--success-color) !important; |
| border-color: rgba(16, 185, 129, 0.3) !important; |
| background: rgba(16, 185, 129, 0.1) !important; |
| } |
| |
| .scan-btn:hover { |
| background: linear-gradient( |
| 135deg, |
| var(--success-color), |
| #059669 |
| ) !important; |
| color: white !important; |
| border-color: var(--success-color) !important; |
| } |
| |
| .folder-btn { |
| color: var(--accent-light) !important; |
| border-color: rgba(96, 165, 250, 0.3) !important; |
| background: rgba(96, 165, 250, 0.1) !important; |
| } |
| |
| .folder-btn:hover { |
| background: linear-gradient( |
| 135deg, |
| var(--accent-light), |
| var(--accent-blue) |
| ) !important; |
| color: white !important; |
| border-color: var(--accent-light) !important; |
| } |
| |
| .build-btn { |
| color: var(--warning-color) !important; |
| border-color: rgba(245, 158, 11, 0.3) !important; |
| background: rgba(245, 158, 11, 0.1) !important; |
| } |
| |
| .build-btn:hover { |
| background: linear-gradient( |
| 135deg, |
| var(--warning-color), |
| #d97706 |
| ) !important; |
| color: white !important; |
| border-color: var(--warning-color) !important; |
| } |
| |
| .info-btn { |
| color: var(--accent-light) !important; |
| border-color: rgba(96, 165, 250, 0.3) !important; |
| background: rgba(96, 165, 250, 0.1) !important; |
| } |
| |
| .info-btn:hover { |
| background: linear-gradient( |
| 135deg, |
| var(--accent-light), |
| var(--accent-blue) |
| ) !important; |
| color: white !important; |
| border-color: var(--accent-light) !important; |
| } |
| |
| .danger-btn { |
| color: var(--danger-color) !important; |
| border-color: var(--danger-color) !important; |
| } |
| |
| .danger-btn:hover { |
| background: var(--danger-color) !important; |
| color: white !important; |
| } |
| |
| |
| .plugin-tools { |
| margin-bottom: 10px; |
| } |
| |
| |
| .loading { |
| text-align: center; |
| color: var(--secondary-text-color); |
| padding: 30px; |
| font-style: italic; |
| background: rgba(0, 86, 179, 0.05); |
| border-radius: var(--border-radius); |
| border: 1px solid var(--border-color); |
| } |
| |
| |
| .debug-info { |
| margin: 10px 0; |
| padding: 15px; |
| background: rgba(0, 86, 179, 0.05); |
| border-radius: var(--border-radius); |
| border-left: 4px solid var(--accent-color); |
| } |
| |
| .debug-stats { |
| display: flex; |
| gap: 15px; |
| font-size: 0.85rem; |
| } |
| |
| .stat-files { |
| color: var(--secondary-text-color); |
| } |
| |
| .stat-issues { |
| color: var(--success-color); |
| } |
| |
| .stat-issues.has-errors { |
| color: var(--danger-color); |
| font-weight: bold; |
| } |
| |
| |
| .modal-overlay { |
| position: fixed; |
| top: 0; |
| left: 0; |
| right: 0; |
| bottom: 0; |
| background: rgba(0, 0, 0, 0.5); |
| display: none; |
| justify-content: center; |
| align-items: center; |
| z-index: 1000; |
| } |
| |
| .modal-overlay.show { |
| display: flex; |
| } |
| |
| .modal-container { |
| background: var(--surface-color); |
| border-radius: var(--border-radius); |
| box-shadow: var(--shadow); |
| min-width: 400px; |
| max-width: 600px; |
| max-height: 80vh; |
| overflow-y: auto; |
| } |
| |
| .modal-header { |
| display: flex; |
| justify-content: space-between; |
| align-items: center; |
| padding: 20px; |
| border-bottom: 1px solid var(--border-color); |
| } |
| |
| .modal-header h3 { |
| color: var(--accent-color); |
| margin: 0; |
| font-size: 1.2rem; |
| } |
| |
| .modal-close-btn { |
| background: transparent; |
| border: none; |
| font-size: 24px; |
| color: var(--secondary-text-color); |
| cursor: pointer; |
| padding: 5px; |
| border-radius: 50%; |
| transition: var(--transition); |
| } |
| |
| .modal-close-btn:hover { |
| background: var(--danger-color); |
| color: white; |
| } |
| |
| .modal-body { |
| padding: 20px; |
| } |
| |
| .status-item { |
| display: flex; |
| justify-content: space-between; |
| padding: 10px 0; |
| border-bottom: 1px solid var(--border-color); |
| } |
| |
| .status-item:last-child { |
| border-bottom: none; |
| } |
| |
| .status-label { |
| font-weight: 600; |
| color: var(--primary-text-color); |
| } |
| |
| .status-value { |
| color: var(--secondary-text-color); |
| } |
| |
| .status-value.small { |
| font-size: 0.85rem; |
| font-family: monospace; |
| } |
| |
| |
| .progress-label { |
| font-size: 0.85rem; |
| color: var(--secondary-text-color); |
| margin-bottom: 5px; |
| } |
| .progress-bar { |
| background: var(--border-color); |
| height: 10px; |
| border-radius: 5px; |
| overflow: hidden; |
| position: relative; |
| } |
| .progress-fill { |
| height: 100%; |
| background: linear-gradient( |
| 90deg, |
| var(--success-color), |
| var(--accent-color) |
| ); |
| transition: width 0.8s ease; |
| position: relative; |
| overflow: hidden; |
| } |
| .progress-fill::before { |
| content: ""; |
| position: absolute; |
| top: 0; |
| left: -100%; |
| width: 100%; |
| height: 100%; |
| background: linear-gradient( |
| 90deg, |
| transparent, |
| rgba(255, 255, 255, 0.3), |
| transparent |
| ); |
| animation: progressShine 2s infinite; |
| } |
| .progress-text { |
| font-size: 0.8rem; |
| color: var(--secondary-text-color); |
| margin-top: 3px; |
| text-align: center; |
| } |
| |
| |
| .time-remaining { |
| font-weight: bold; |
| } |
| .time-critical { |
| color: var(--danger-color); |
| } |
| .time-warning { |
| color: var(--warning-color); |
| } |
| .time-normal { |
| color: var(--success-color); |
| } |
| |
| |
| .status-icon { |
| font-size: 1.2rem; |
| margin-right: 5px; |
| animation: bounce 2s infinite; |
| } |
| .activation-badge { |
| display: inline-block; |
| padding: 4px 8px; |
| border-radius: 12px; |
| font-size: 0.75rem; |
| color: white; |
| font-weight: 500; |
| animation: fadeIn 1s ease-in-out; |
| } |
| .badge-activated { |
| background: var(--success-color); |
| } |
| .badge-pending { |
| background: var(--warning-color); |
| color: var(--bg-color); |
| } |
| .badge-expired { |
| background: var(--danger-color); |
| } |
| |
| |
| |
| |
| |
| |
| |
| @keyframes fadeIn { |
| from { |
| opacity: 0; |
| transform: translateY(10px); |
| } |
| to { |
| opacity: 1; |
| transform: translateY(0); |
| } |
| } |
| |
| @keyframes slideIn { |
| from { |
| transform: translateX(-10px); |
| opacity: 0; |
| } |
| to { |
| transform: translateX(0); |
| opacity: 1; |
| } |
| } |
| |
| @keyframes scaleIn { |
| from { |
| transform: scale(0.98); |
| opacity: 0; |
| } |
| to { |
| transform: scale(1); |
| opacity: 1; |
| } |
| } |
| |
| @keyframes shimmer { |
| 0% { |
| background-position: -200px 0; |
| } |
| 100% { |
| background-position: 200px 0; |
| } |
| } |
| |
| @keyframes bounce { |
| 0%, |
| 20%, |
| 50%, |
| 80%, |
| 100% { |
| transform: translateY(0); |
| } |
| 40% { |
| transform: translateY(-10px); |
| } |
| 60% { |
| transform: translateY(-5px); |
| } |
| } |
| |
| @keyframes progressShine { |
| 0% { |
| left: -100%; |
| } |
| 100% { |
| left: 100%; |
| } |
| } |
| |
| @keyframes pulse { |
| 0% { |
| transform: scale(1); |
| opacity: 1; |
| } |
| 50% { |
| transform: scale(1.01); |
| opacity: 0.9; |
| } |
| 100% { |
| transform: scale(1); |
| opacity: 1; |
| } |
| } |
| |
| @keyframes gentleGlow { |
| 0%, |
| 100% { |
| box-shadow: 0 0 3px rgba(0, 170, 255, 0.2); |
| } |
| 50% { |
| box-shadow: 0 0 6px rgba(0, 170, 255, 0.3); |
| } |
| } |
| |
| @keyframes gentleShake { |
| 0%, |
| 100% { |
| transform: translateX(0); |
| } |
| 25% { |
| transform: translateX(-1px); |
| } |
| 75% { |
| transform: translateX(1px); |
| } |
| } |
| |
| |
| |
| .plugin-card:nth-child(1) { |
| animation-delay: 0.05s; |
| } |
| .plugin-card:nth-child(2) { |
| animation-delay: 0.1s; |
| } |
| .plugin-card:nth-child(3) { |
| animation-delay: 0.15s; |
| } |
| .plugin-card:nth-child(4) { |
| animation-delay: 0.2s; |
| } |
| .plugin-card:nth-child(5) { |
| animation-delay: 0.25s; |
| } |
| .plugin-card:nth-child(6) { |
| animation-delay: 0.3s; |
| } |
| |
| .plugin-buttons button { |
| position: relative; |
| overflow: hidden; |
| transition: all 0.2s ease; |
| padding: 6px 10px; |
| font-size: 0.75rem; |
| } |
| |
| |
| .btn-icon { |
| width: 12px !important; |
| height: 12px !important; |
| margin-right: 4px; |
| } |
| |
| .plugin-buttons button::before { |
| content: ""; |
| position: absolute; |
| top: 0; |
| left: -100%; |
| width: 100%; |
| height: 100%; |
| background: linear-gradient( |
| 90deg, |
| transparent, |
| rgba(255, 255, 255, 0.1), |
| transparent |
| ); |
| transition: all 0.8s ease; |
| } |
| |
| .plugin-buttons button:hover::before { |
| left: 100%; |
| } |
| |
| .plugin-buttons button:active { |
| transform: translateY(1px); |
| transition: all 0.1s; |
| } |
| |
| |
| .success-animation { |
| animation: gentleGlow 0.3s ease-in-out; |
| } |
| |
| .error-animation { |
| animation: gentleShake 0.3s ease-in-out; |
| } |
| |
| |
| .shimmer { |
| background: linear-gradient( |
| 90deg, |
| transparent, |
| rgba(255, 255, 255, 0.05), |
| transparent |
| ); |
| background-size: 200px 100%; |
| animation: shimmer 2.5s infinite; |
| } |
| |
| |
| .header { |
| display: flex; |
| justify-content: space-between; |
| align-items: center; |
| } |
| |
| .header-left { |
| flex: 1; |
| } |
| |
| .header-right { |
| display: flex; |
| align-items: center; |
| gap: 15px; |
| } |
| |
| .theme-controls { |
| display: flex; |
| align-items: center; |
| gap: 10px; |
| } |
| |
| .header-btn { |
| padding: 8px 16px; |
| border: 1px solid var(--border-color); |
| background: var(--surface-color); |
| color: var(--primary-text-color); |
| border-radius: var(--border-radius); |
| cursor: pointer; |
| font-size: 14px; |
| transition: var(--transition); |
| display: flex; |
| align-items: center; |
| gap: 6px; |
| } |
| |
| .header-btn:hover { |
| background: var(--accent-color); |
| color: white; |
| transform: translateY(-1px); |
| box-shadow: var(--shadow); |
| } |
| |
| .header-btn:active { |
| transform: translateY(0); |
| } |
| |
| #themeToggleBtn { |
| min-width: 40px; |
| justify-content: center; |
| } |
| |
| #themeIcon { |
| font-size: 16px; |
| transition: var(--transition); |
| } |
| |
| .dropdown { |
| position: relative; |
| display: inline-block; |
| } |
| |
| .dropdown-toggle, |
| .btn { |
| background-color: transparent; |
| color: white; |
| border: 2px solid rgba(255, 255, 255, 0.5); |
| padding: 10px 16px; |
| border-radius: 8px; |
| cursor: pointer; |
| display: flex; |
| align-items: center; |
| gap: 8px; |
| font-weight: 600; |
| transition: all 0.3s ease; |
| } |
| |
| .dropdown-toggle:hover, |
| .btn:hover { |
| background-color: rgba(255, 255, 255, 0.2); |
| border-color: white; |
| transform: translateY(-1px); |
| box-shadow: 0 4px 8px rgba(255, 255, 255, 0.1); |
| } |
| |
| .dropdown-menu { |
| position: absolute; |
| top: 100%; |
| right: 0; |
| background: var(--surface-color); |
| border: 1px solid var(--border-color); |
| border-radius: 8px; |
| box-shadow: 0 8px 25px var(--shadow-color); |
| min-width: 150px; |
| z-index: 1000; |
| opacity: 0; |
| visibility: hidden; |
| transform: translateY(-10px); |
| transition: all 0.3s ease; |
| } |
| |
| .dropdown-menu.show { |
| opacity: 1; |
| visibility: visible; |
| transform: translateY(0); |
| } |
| |
| .dropdown-item { |
| display: block; |
| padding: 12px 16px; |
| color: var(--primary-text-color); |
| text-decoration: none; |
| font-weight: 500; |
| transition: all 0.2s ease; |
| } |
| |
| .dropdown-item:hover { |
| background-color: var(--accent-color); |
| color: white; |
| } |
| |
| |
| .modal-overlay { |
| position: fixed; |
| top: 0; |
| left: 0; |
| width: 100%; |
| height: 100%; |
| background: rgba(0, 0, 0, 0.8); |
| backdrop-filter: blur(5px); |
| display: flex; |
| justify-content: center; |
| align-items: center; |
| z-index: 2000; |
| opacity: 0; |
| visibility: hidden; |
| transition: all 0.3s ease; |
| } |
| |
| .modal-overlay.show { |
| opacity: 1; |
| visibility: visible; |
| } |
| |
| .modal-container { |
| background: var(--surface-color); |
| border: 1px solid var(--border-color); |
| border-radius: 12px; |
| box-shadow: 0 8px 25px var(--shadow-color); |
| max-width: 500px; |
| width: 90%; |
| max-height: 80vh; |
| overflow-y: auto; |
| transform: scale(0.95); |
| transition: transform 0.3s ease; |
| } |
| |
| .modal-overlay.show .modal-container { |
| transform: scale(1); |
| } |
| |
| .modal-header { |
| display: flex; |
| justify-content: space-between; |
| align-items: center; |
| padding: 20px; |
| border-bottom: 1px solid var(--border-color); |
| background: linear-gradient( |
| 135deg, |
| var(--accent-color) 0%, |
| #0066cc 100% |
| ); |
| color: white; |
| border-radius: 12px 12px 0 0; |
| } |
| |
| .modal-header h3 { |
| margin: 0; |
| display: flex; |
| align-items: center; |
| gap: 10px; |
| font-weight: 600; |
| } |
| |
| .modal-close-btn { |
| background: none; |
| border: none; |
| color: white; |
| font-size: 24px; |
| cursor: pointer; |
| padding: 0; |
| width: 30px; |
| height: 30px; |
| display: flex; |
| align-items: center; |
| justify-content: center; |
| border-radius: 50%; |
| transition: all 0.2s ease; |
| } |
| |
| .modal-close-btn:hover { |
| background: rgba(255, 255, 255, 0.2); |
| transform: scale(1.1); |
| } |
| |
| .modal-body { |
| padding: 20px; |
| color: var(--primary-text-color); |
| } |
| |
| .status-item { |
| display: flex; |
| justify-content: space-between; |
| align-items: center; |
| padding: 12px 0; |
| border-bottom: 1px solid var(--border-color); |
| } |
| |
| .status-item:last-child { |
| border-bottom: none; |
| } |
| |
| .status-label { |
| font-weight: 600; |
| color: var(--secondary-text-color); |
| } |
| |
| .status-value { |
| color: var(--primary-text-color); |
| font-weight: 500; |
| } |
| |
| .status-value.small { |
| font-size: 0.9em; |
| font-family: "Courier New", monospace; |
| background: var(--bg-color); |
| padding: 4px 8px; |
| border-radius: 4px; |
| border: 1px solid var(--border-color); |
| } |
| |
| .terminal-section { |
| animation: slideIn 0.8s ease-out; |
| } |
| |
| .sidebar { |
| animation: slideIn 0.8s ease-out; |
| animation-delay: 0.2s; |
| animation-fill-mode: both; |
| width: 300px; |
| min-width: 280px; |
| transition: var(--transition); |
| } |
| |
| |
| .sidebar-header { |
| display: flex; |
| align-items: center; |
| justify-content: center; |
| padding: 15px 20px; |
| border-bottom: 1px solid var(--border-color); |
| position: sticky; |
| top: 0; |
| background: var(--surface-color); |
| z-index: 10; |
| } |
| |
| .sidebar-title { |
| color: var(--accent-color); |
| margin: 0; |
| font-size: 1.3rem; |
| font-weight: 600; |
| transition: var(--transition); |
| white-space: nowrap; |
| overflow: hidden; |
| } |
| |
| .sidebar-content { |
| overflow: hidden; |
| } |
| |
| .sidebar-full-content { |
| padding: 20px; |
| transition: var(--transition); |
| } |
| |
| .sidebar-quick-actions { |
| display: none; |
| flex-direction: column; |
| gap: 10px; |
| align-items: center; |
| padding: 15px 5px; |
| } |
| |
| |
| .container { |
| transition: var(--transition); |
| } |
| |
| |
| @media (max-width: 1400px) { |
| .sidebar { |
| width: 300px; |
| min-width: 280px; |
| } |
| } |
| |
| @media (max-width: 1200px) { |
| .sidebar { |
| width: 280px; |
| min-width: 260px; |
| } |
| } |
| |
| @media (max-width: 1000px) { |
| .sidebar { |
| width: 260px; |
| min-width: 240px; |
| } |
| } |
| |
| .terminal-line { |
| animation: fadeIn 0.3s ease-in; |
| } |
| |
| .loading { |
| animation: pulse 4s infinite ease-in-out; |
| } |
| |
| |
| .header { |
| position: relative; |
| overflow: hidden; |
| } |
| |
| |
| .header::before { |
| content: ""; |
| position: absolute; |
| top: 0; |
| left: -100%; |
| width: 100%; |
| height: 100%; |
| background: linear-gradient( |
| 90deg, |
| transparent, |
| rgba(255, 255, 255, 0.1), |
| transparent |
| ); |
| |
| } |
| |
| .header h1 { |
| animation: fadeIn 1s ease-in-out; |
| } |
| |
| .header p { |
| animation: fadeIn 1.2s ease-in-out; |
| } |
| |
| |
| .typing-effect { |
| width: 0; |
| white-space: nowrap; |
| overflow: hidden; |
| border-right: 2px solid #667eea; |
| animation: typing 3s steps(40, end), blink 1s infinite; |
| } |
| |
| .action-btn { |
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); |
| color: white; |
| border: none; |
| padding: 8px 12px; |
| border-radius: 6px; |
| cursor: pointer; |
| font-size: 0.85rem; |
| font-weight: 500; |
| transition: all 0.3s ease; |
| position: relative; |
| overflow: hidden; |
| box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3); |
| } |
| |
| .action-btn::before { |
| content: ""; |
| position: absolute; |
| top: 0; |
| left: -100%; |
| width: 100%; |
| height: 100%; |
| background: linear-gradient( |
| 90deg, |
| transparent, |
| rgba(255, 255, 255, 0.4), |
| transparent |
| ); |
| transition: all 0.6s; |
| } |
| |
| .action-btn:hover::before { |
| left: 100%; |
| } |
| |
| .action-btn:hover { |
| transform: translateY(-2px); |
| box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5); |
| } |
| |
| .action-btn:active { |
| transform: translateY(0); |
| transition: all 0.1s; |
| } |
| |
| .action-btn.info { |
| background: linear-gradient(135deg, #17a2b8, #138496); |
| } |
| .action-btn.copy { |
| background: linear-gradient(135deg, #28a745, #1e7e34); |
| } |
| .action-btn.help { |
| background: linear-gradient(135deg, #fd7e14, #e76500); |
| } |
| .action-btn.refresh { |
| background: linear-gradient(135deg, #6c757d, #495057); |
| } |
| |
| |
| |
| |
| .command-input { |
| position: relative; |
| } |
| |
| .command-input:focus { |
| outline: none; |
| background: rgba(255, 255, 255, 0.1); |
| border-radius: 4px; |
| padding: 2px 8px; |
| margin: -2px -8px; |
| } |
| |
| |
| .loading::after { |
| content: "..."; |
| animation: dots 1.5s infinite; |
| } |
| |
| @keyframes dots { |
| 0%, |
| 20% { |
| color: transparent; |
| text-shadow: 0.25em 0 0 transparent, 0.5em 0 0 transparent; |
| } |
| 40% { |
| color: #6c757d; |
| text-shadow: 0.25em 0 0 transparent, 0.5em 0 0 transparent; |
| } |
| 60% { |
| text-shadow: 0.25em 0 0 #6c757d, 0.5em 0 0 transparent; |
| } |
| 80%, |
| 100% { |
| text-shadow: 0.25em 0 0 #6c757d, 0.5em 0 0 #6c757d; |
| } |
| } |
| |
| |
| @keyframes rainbow { |
| 0% { |
| filter: hue-rotate(0deg); |
| } |
| 100% { |
| filter: hue-rotate(360deg); |
| } |
| } |
| |
| .header:hover { |
| |
| transition: all 0.3s ease; |
| } |
| |
| |
| .success-animation { |
| animation: successPulse 0.6s ease-in-out; |
| } |
| |
| @keyframes successPulse { |
| 0% { |
| transform: scale(1); |
| } |
| 50% { |
| transform: scale(1.1); |
| background-color: rgba(40, 167, 69, 0.2); |
| } |
| 100% { |
| transform: scale(1); |
| } |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| .dev-only { |
| display: none !important; |
| } |
| |
| body.dev-mode .dev-only { |
| display: inline-block !important; |
| position: relative; |
| overflow: hidden; |
| } |
| |
| body.dev-mode .dev-only::before { |
| content: ""; |
| position: absolute; |
| top: 0; |
| left: -100%; |
| width: 100%; |
| height: 100%; |
| background: linear-gradient( |
| 90deg, |
| transparent, |
| rgba(255, 255, 255, 0.1), |
| transparent |
| ); |
| animation: devGlow 3s infinite; |
| } |
| |
| @keyframes devGlow { |
| 0% { |
| left: -100%; |
| } |
| 50% { |
| left: 100%; |
| } |
| 100% { |
| left: 100%; |
| } |
| } |
| |
| body.dev-mode .dev-only::after { |
| content: "[DEV]"; |
| position: absolute; |
| top: 2px; |
| right: 5px; |
| font-size: 9px; |
| color: rgba(255, 255, 255, 0.5); |
| font-weight: bold; |
| } |
| |
| |
| .hide { |
| display: none !important; |
| } |
| .fullwidth { |
| width: 100% !important; |
| min-width: 100% !important; |
| max-width: 100% !important; |
| flex: 1 1 auto !important; |
| } |
| |
| |
| |
| |
| |
| #show-marketplace-btn, |
| #refresh-marketplace-btn { |
| display: none !important; |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| .auth-header { |
| display: flex; |
| align-items: center; |
| justify-content: space-between; |
| gap: 0.75rem; |
| padding: 0.4rem 0.6rem; |
| background: var(--glass-bg); |
| border: 1px solid var(--glass-border); |
| border-radius: 12px; |
| backdrop-filter: blur(20px); |
| -webkit-backdrop-filter: blur(20px); |
| margin-bottom: 0.5rem; |
| box-shadow: var(--shadow-glow-card); |
| position: relative; |
| margin-left: auto; |
| } |
| |
| .auth-user-info { |
| display: flex; |
| align-items: center; |
| gap: 0.5rem; |
| padding: 0.3rem 0.5rem; |
| cursor: pointer; |
| border-radius: 8px; |
| transition: all 0.3s ease; |
| position: relative; |
| } |
| |
| .auth-user-info:hover { |
| background: rgba(14, 165, 233, 0.1); |
| border: 1px solid var(--glass-border-hover); |
| } |
| |
| .auth-user-avatar { |
| width: 36px; |
| height: 36px; |
| border-radius: 50%; |
| background: var(--gradient-blue); |
| display: flex; |
| align-items: center; |
| justify-content: center; |
| color: white; |
| font-weight: bold; |
| font-size: 0.9rem; |
| border: 2px solid var(--glass-border); |
| } |
| |
| .auth-user-details { |
| display: flex; |
| flex-direction: column; |
| } |
| |
| .auth-user-name { |
| color: var(--text-primary); |
| font-weight: 600; |
| font-size: 0.95rem; |
| } |
| |
| .auth-user-role { |
| color: var(--text-secondary); |
| font-size: 0.8rem; |
| text-transform: capitalize; |
| } |
| |
| .auth-login-btn { |
| padding: 0.5rem 1rem; |
| background: var(--gradient-blue); |
| color: white; |
| border: none; |
| border-radius: 8px; |
| font-size: 0.85rem; |
| font-weight: 600; |
| cursor: pointer; |
| transition: all 0.3s ease; |
| box-shadow: var(--shadow-glow-subtle); |
| } |
| |
| .auth-login-btn:hover { |
| transform: translateY(-2px); |
| box-shadow: var(--shadow-glow-strong); |
| } |
| |
| .auth-login-btn:disabled { |
| background: #555; |
| cursor: not-allowed; |
| transform: none; |
| box-shadow: none; |
| } |
| |
| |
| .auth-dropdown { |
| position: absolute; |
| top: 100%; |
| right: 0; |
| background: var(--bg-secondary); |
| border: 2px solid var(--glass-border); |
| border-radius: 12px; |
| padding: 0.5rem 0; |
| min-width: 220px; |
| box-shadow: var(--shadow-xl); |
| backdrop-filter: blur(20px); |
| -webkit-backdrop-filter: blur(20px); |
| z-index: 5000; |
| display: none; |
| margin-top: 0.5rem; |
| } |
| |
| .auth-dropdown.show { |
| display: block; |
| animation: fadeIn 0.3s ease; |
| } |
| |
| .auth-dropdown-item { |
| display: flex; |
| align-items: center; |
| gap: 0.75rem; |
| padding: 0.8rem 1rem; |
| color: var(--text-primary); |
| cursor: pointer; |
| transition: all 0.3s ease; |
| font-size: 0.9rem; |
| } |
| |
| .auth-dropdown-item:hover { |
| background: rgba(14, 165, 233, 0.1); |
| color: var(--accent-blue); |
| } |
| |
| .auth-dropdown-divider { |
| height: 1px; |
| background: var(--border-color); |
| margin: 0.5rem 0; |
| } |
| |
| |
| |
| |
| |
| .offline-login-modal { |
| position: fixed; |
| top: 0; |
| left: 0; |
| width: 100%; |
| height: 100%; |
| background: rgba(0, 0, 0, 0.85); |
| z-index: 5000; |
| display: flex; |
| align-items: center; |
| justify-content: center; |
| animation: fadeIn 0.3s ease; |
| backdrop-filter: blur(4px); |
| } |
| |
| .offline-login-container { |
| background: linear-gradient(135deg, #111827 0%, #0d1117 100%); |
| border: 1px solid rgba(14, 165, 233, 0.3); |
| border-radius: 12px; |
| padding: 2.5rem; |
| width: 100%; |
| max-width: 420px; |
| box-shadow: |
| 0 0 0 1px rgba(14, 165, 233, 0.2), |
| 0 0 30px rgba(14, 165, 233, 0.2), |
| 0 20px 40px rgba(0, 0, 0, 0.5); |
| animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); |
| } |
| |
| .offline-login-header { |
| margin-bottom: 2rem; |
| text-align: center; |
| border-bottom: 2px solid rgba(14, 165, 233, 0.2); |
| padding-bottom: 1.5rem; |
| } |
| |
| .offline-login-header h2 { |
| color: var(--text-primary); |
| font-size: 1.5rem; |
| margin-bottom: 0.5rem; |
| font-weight: 600; |
| } |
| |
| .offline-login-header p { |
| color: var(--text-secondary); |
| font-size: 0.9rem; |
| } |
| |
| .offline-login-form { |
| margin-bottom: 1.5rem; |
| } |
| |
| .form-group { |
| margin-bottom: 1.5rem; |
| } |
| |
| .form-group label { |
| display: block; |
| color: var(--text-primary); |
| font-size: 0.95rem; |
| font-weight: 500; |
| margin-bottom: 0.5rem; |
| } |
| |
| .form-group input { |
| width: 100%; |
| padding: 0.75rem 1rem; |
| background: rgba(255, 255, 255, 0.05); |
| border: 1px solid rgba(14, 165, 233, 0.2); |
| border-radius: 6px; |
| color: var(--text-primary); |
| font-size: 1rem; |
| transition: all 0.3s ease; |
| } |
| |
| .form-group input::placeholder { |
| color: var(--text-muted); |
| } |
| |
| .form-group input:focus { |
| outline: none; |
| background: rgba(255, 255, 255, 0.08); |
| border-color: var(--accent-blue); |
| box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1); |
| } |
| |
| .form-group small { |
| display: block; |
| color: var(--text-muted); |
| font-size: 0.8rem; |
| margin-top: 0.3rem; |
| } |
| |
| .form-actions { |
| display: flex; |
| gap: 1rem; |
| margin-bottom: 1.5rem; |
| } |
| |
| .btn-login, .btn-cancel { |
| flex: 1; |
| padding: 0.9rem 1.5rem; |
| border: none; |
| border-radius: 6px; |
| font-size: 0.95rem; |
| font-weight: 600; |
| cursor: pointer; |
| transition: all 0.3s ease; |
| } |
| |
| .btn-login { |
| background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-dark) 100%); |
| color: white; |
| box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3); |
| } |
| |
| .btn-login:hover { |
| background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent-blue) 100%); |
| box-shadow: 0 6px 20px rgba(14, 165, 233, 0.4); |
| transform: translateY(-2px); |
| } |
| |
| .btn-login:active { |
| transform: translateY(0); |
| } |
| |
| .btn-cancel { |
| background: rgba(255, 255, 255, 0.05); |
| color: var(--text-secondary); |
| border: 1px solid rgba(255, 255, 255, 0.1); |
| } |
| |
| .btn-cancel:hover { |
| background: rgba(255, 255, 255, 0.1); |
| color: var(--text-primary); |
| border-color: rgba(255, 255, 255, 0.2); |
| } |
| |
| .demo-users { |
| background: rgba(14, 165, 233, 0.1); |
| border-left: 3px solid var(--accent-blue); |
| padding: 1rem; |
| border-radius: 4px; |
| font-size: 0.85rem; |
| } |
| |
| .demo-users p { |
| color: var(--text-primary); |
| margin-bottom: 0.7rem; |
| font-weight: 500; |
| } |
| |
| .demo-users ul { |
| list-style: none; |
| padding: 0; |
| } |
| |
| .demo-users li { |
| color: var(--text-secondary); |
| padding: 0.3rem 0; |
| } |
| |
| .demo-users code { |
| background: rgba(0, 0, 0, 0.3); |
| padding: 0.2rem 0.4rem; |
| border-radius: 3px; |
| color: var(--accent-light); |
| font-family: 'Monaco', 'Courier New', monospace; |
| } |
| |
| @keyframes slideUp { |
| from { |
| opacity: 0; |
| transform: translateY(20px); |
| } |
| to { |
| opacity: 1; |
| transform: translateY(0); |
| } |
| } |
| |
| @keyframes fadeIn { |
| from { |
| opacity: 0; |
| } |
| to { |
| opacity: 1; |
| } |
| } |
| |
| |
| .auth-loading { |
| display: inline-flex; |
| align-items: center; |
| gap: 0.6rem; |
| color: var(--text-secondary); |
| font-size: 0.9rem; |
| padding: 0.7rem 1rem; |
| } |
| |
| .auth-loading-spinner { |
| width: 18px; |
| height: 18px; |
| border: 2px solid var(--border-color); |
| border-top: 2px solid var(--accent-blue); |
| border-radius: 50%; |
| animation: spin 1s linear infinite; |
| } |
| |
| |
| .permission-dialog { |
| position: fixed; |
| top: 0; |
| left: 0; |
| width: 100%; |
| height: 100%; |
| background: rgba(0, 0, 0, 0.8); |
| z-index: 3000; |
| display: none; |
| align-items: center; |
| justify-content: center; |
| animation: fadeIn 0.3s ease; |
| } |
| |
| .permission-dialog.show { |
| display: flex; |
| } |
| |
| .permission-dialog-content { |
| background: var(--bg-secondary); |
| border: 2px solid var(--accent-blue); |
| border-radius: 16px; |
| padding: 2rem; |
| width: 90%; |
| max-width: 500px; |
| animation: slideIn 0.3s ease; |
| backdrop-filter: blur(20px); |
| -webkit-backdrop-filter: blur(20px); |
| } |
| |
| .permission-dialog-header { |
| display: flex; |
| justify-content: space-between; |
| align-items: center; |
| margin-bottom: 1.5rem; |
| } |
| |
| .permission-dialog-header h3 { |
| color: var(--accent-blue); |
| font-size: 1.4rem; |
| margin: 0; |
| font-weight: 600; |
| } |
| |
| .permission-list { |
| list-style: none; |
| padding: 0; |
| margin: 1rem 0; |
| } |
| |
| .permission-item { |
| display: flex; |
| align-items: center; |
| gap: 0.75rem; |
| padding: 0.75rem 0; |
| color: var(--text-primary); |
| border-bottom: 1px solid var(--border-color); |
| } |
| |
| .permission-item:last-child { |
| border-bottom: none; |
| } |
| |
| .permission-icon { |
| width: 16px; |
| height: 16px; |
| border-radius: 4px; |
| background: var(--accent-blue); |
| flex-shrink: 0; |
| } |
| |
| .permission-dialog-actions { |
| display: flex; |
| gap: 1rem; |
| margin-top: 2rem; |
| justify-content: flex-end; |
| } |
| |
| .btn-permission { |
| padding: 0.8rem 1.6rem; |
| border: 2px solid var(--border-color); |
| border-radius: 8px; |
| background: var(--glass-bg); |
| color: var(--text-primary); |
| cursor: pointer; |
| font-size: 0.9rem; |
| font-weight: 500; |
| transition: all 0.3s ease; |
| backdrop-filter: blur(10px); |
| -webkit-backdrop-filter: blur(10px); |
| } |
| |
| .btn-permission.primary { |
| background: var(--gradient-blue); |
| color: white; |
| border-color: var(--accent-blue); |
| } |
| |
| .btn-permission:hover { |
| border-color: var(--accent-blue); |
| background: rgba(14, 165, 233, 0.1); |
| transform: translateY(-1px); |
| } |
| |
| .btn-permission.primary:hover { |
| background: var(--accent-blue-hover); |
| box-shadow: var(--shadow-glow); |
| } |
| |
| |
| #outer-topnav { |
| position: fixed; |
| top: 0; left: 0; right: 0; |
| height: 44px; |
| display: flex; |
| align-items: center; |
| gap: 4px; |
| padding: 0 12px; |
| background: rgba(10, 14, 22, 0.97); |
| border-bottom: 1px solid rgba(255,255,255,0.08); |
| z-index: 9000; |
| -webkit-app-region: drag; |
| } |
| #outer-topnav .ont-brand { |
| font-size: 13px; |
| font-weight: 600; |
| color: var(--text-primary); |
| letter-spacing: 0.04em; |
| margin-right: 12px; |
| opacity: 0.9; |
| } |
| #outer-topnav .ont-sep { |
| width: 1px; height: 20px; |
| background: rgba(255,255,255,0.12); |
| margin: 0 4px; |
| } |
| #outer-topnav .ont-tab { |
| -webkit-app-region: no-drag; |
| background: transparent; |
| border: none; |
| color: rgba(249,250,251,0.55); |
| font-size: 13px; |
| font-weight: 500; |
| padding: 5px 14px; |
| border-radius: 7px; |
| cursor: pointer; |
| transition: background 0.15s, color 0.15s; |
| } |
| #outer-topnav .ont-tab:hover { |
| background: rgba(14,165,233,0.12); |
| color: var(--accent-blue); |
| } |
| #outer-topnav .ont-tab.active { |
| background: var(--accent-blue); |
| color: #fff; |
| font-weight: 600; |
| } |
| |
| #home-wv-wrap, #chat-wv-wrap { |
| position: fixed; |
| top: 44px; left: 0; right: 0; bottom: 0; |
| z-index: 8999; |
| display: none; |
| } |
| #home-wv-wrap.visible, #chat-wv-wrap.visible { display: block; } |
| #home-wv-wrap webview, #chat-wv-wrap webview { |
| width: 100%; height: 100%; |
| border: none; |
| } |
| |
| body { padding-top: 44px !important; } |
| </style> |
| </head> |
| <body> |
| |
| <div id="outer-topnav"> |
| <span class="ont-brand"> |
| <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:5px"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg> |
| CHAHUADEV FRAMEWORK |
| </span> |
| <span class="ont-sep"></span> |
| <button class="ont-tab active" id="ont-home" onclick="switchTopPage('home')"> |
| <svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:4px"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><polyline points="9 22 9 12 15 12 15 22"/></svg> |
| Home |
| </button> |
| <button class="ont-tab" id="ont-app" onclick="switchTopPage('app')"> |
| <svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:4px"><rect x="2" y="3" width="20" height="14" rx="2" ry="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/></svg> |
| App |
| </button> |
| <button class="ont-tab" id="ont-chat" onclick="switchTopPage('chat')"> |
| <svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:4px"><path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"/></svg> |
| Chat |
| </button> |
| </div> |
| |
| <div id="home-wv-wrap" class="visible"> |
| <webview src="./web/index.html" allowpopups></webview> |
| </div> |
| |
| <div id="chat-wv-wrap"> |
| <webview src="./web/chat.html" allowpopups></webview> |
| </div> |
|
|
| |
| |
| |
| |
| |
|
|
| |
| <div class="view-switcher"> |
| <div class="view-tabs"> |
| <button id="nav-plugins" class="view-btn active"> |
| <svg |
| xmlns="http://www.w3.org/2000/svg" |
| width="16" |
| height="16" |
| viewBox="0 0 24 24" |
| fill="none" |
| stroke="currentColor" |
| stroke-width="2" |
| stroke-linecap="round" |
| stroke-linejoin="round" |
| > |
| <rect x="2" y="3" width="20" height="14" rx="2" ry="2" /> |
| <line x1="8" y1="21" x2="16" y2="21" /> |
| <line x1="12" y1="17" x2="12" y2="21" /> |
| </svg> |
| <span>Plugin Management</span> |
| </button> |
| <button id="nav-store-new" class="dev-only"> |
| <svg |
| xmlns="http://www.w3.org/2000/svg" |
| width="16" |
| height="16" |
| viewBox="0 0 24 24" |
| fill="none" |
| stroke="currentColor" |
| stroke-width="2" |
| stroke-linecap="round" |
| stroke-linejoin="round" |
| > |
| <circle cx="9" cy="21" r="1" /> |
| <circle cx="20" cy="21" r="1" /> |
| <path d="m1 1 4 4 13 0 1 6-13 0" /> |
| <path |
| d="M16 8a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1V8z" |
| /> |
| </svg> |
| <span>Plugin Store</span> |
| </button> |
| </div> |
| |
| |
| <div id="auth-header" class="auth-header"> |
| |
| <div id="auth-status-container"> |
| |
| <div id="auth-guest" class="auth-user-info"> |
| <div class="auth-user-avatar">G</div> |
| <div class="auth-user-details"> |
| <div class="auth-user-name">Guest User</div> |
| <div class="auth-user-role">Guest</div> |
| </div> |
| </div> |
| |
| |
| <div id="auth-user" class="auth-user-info" style="display: none;"> |
| <div id="auth-user-avatar" class="auth-user-avatar">U</div> |
| <div class="auth-user-details"> |
| <div id="auth-user-name" class="auth-user-name">Loading...</div> |
| <div id="auth-user-role" class="auth-user-role">loading</div> |
| </div> |
| |
| <div id="auth-dropdown" class="auth-dropdown"> |
| <div class="auth-dropdown-item" id="auth-profile"> |
| <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> |
| <path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/> |
| <circle cx="12" cy="7" r="4"/> |
| </svg> |
| Profile |
| </div> |
| <div class="auth-dropdown-item" id="auth-permissions"> |
| <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> |
| <rect x="3" y="11" width="18" height="11" rx="2" ry="2"/> |
| <circle cx="12" cy="16" r="1"/> |
| <path d="M7 11V7a5 5 0 0 1 10 0v4"/> |
| </svg> |
| Permissions |
| </div> |
| <div class="auth-dropdown-divider"></div> |
| <div class="auth-dropdown-item" id="auth-logout"> |
| <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> |
| <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/> |
| <polyline points="16,17 21,12 16,7"/> |
| <line x1="21" y1="12" x2="9" y2="12"/> |
| </svg> |
| Logout |
| </div> |
| </div> |
| </div> |
|
|
| |
| <div id="auth-loading" class="auth-loading" style="display: none;"> |
| <div class="auth-loading-spinner"></div> |
| Signing in... |
| </div> |
| </div> |
|
|
| |
| <button id="auth-login-btn" class="auth-login-btn"> |
| <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> |
| <path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4"/> |
| <polyline points="10,17 15,12 10,7"/> |
| <line x1="15" y1="12" x2="3" y2="12"/> |
| </svg> |
| Sign In |
| </button> |
| </div> |
| <div class="view-actions"> |
|
|
| <button |
| id="refresh-store-btn" |
| class="refresh-btn" |
| onclick="refreshStoreWebview()" |
| style="display: none" |
| > |
| <span class="refresh-icon"> |
| <svg |
| width="16" |
| height="16" |
| viewBox="0 0 24 24" |
| fill="none" |
| stroke="currentColor" |
| stroke-width="2" |
| > |
| <path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" /> |
| <path d="M21 3v5h-5" /> |
| <path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" /> |
| <path d="M3 21v-5h5" /> |
| </svg> |
| </span> |
| <span class="refresh-text">รีเฟรช</span> |
| </button> |
| </div> |
| </div> |
|
|
| |
| |
| |
| |
| |
| |
|
|
| |
| <div class="container" id="original-system"> |
| |
| <div class="terminal-section"> |
| <div class="view-container"> |
| <pre |
| id="log-viewer" |
| class="log-viewer-container view-panel active" |
| ></pre> |
|
|
| <webview |
| id="store-webview" |
| src="about:blank" |
| class="view-panel" |
| style="width: 100%; height: 100%; border: none;" |
| partition="persist:store" |
| nodeintegration="false" |
| preload="./preload-webview.js" |
| ></webview> |
|
|
| <webview |
| id="marketplace-webview" |
| class="marketplace-container view-panel" |
| src="about:blank" |
| preload="./preload.js" |
| ></webview> |
| </div> |
|
|
| |
| <div class="resize-handle" id="resizeHandle"></div> |
| </div> |
|
|
| |
| |
| |
| |
| |
|
|
| |
| <div class="sidebar" id="sidebar"> |
| <h2>Plugin & Project Management</h2> |
|
|
| <div class="plugin-tools"> |
| <div class="plugin-buttons"> |
| <button onclick="checkAuthAndExecute('runGeneratorAndRefresh')" class="scan-btn" id="scan-plugin-btn"> |
| <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" style="width:16px; height:16px; margin-right: 5px;"> |
| <path stroke-linecap="round" stroke-linejoin="round" d="M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99" /> |
| </svg> |
| <span>Scan Plugins</span> |
| </button> |
| <button onclick="checkAuthAndExecute('openPluginsFolder')" class="folder-btn" id="open-folder-btn"> |
| <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" style="width:16px; height:16px; margin-right: 5px;"> |
| <path stroke-linecap="round" stroke-linejoin="round" d="M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25H13.19l-2.12-2.12a1.5 1.5 0 00-1.061-.44z" /> |
| </svg> |
| <span>Open Plugin Folder</span> |
| </button> |
| <button onclick="checkAuthAndExecute('runGenerateManifestOnly')" class="build-btn" id="generate-manifest-btn"> |
| <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" style="width:16px; height:16px; margin-right: 5px;"> |
| <path stroke-linecap="round" stroke-linejoin="round" d="M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 010 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 010-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281z" /> |
| <path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" /> |
| </svg> |
| <span>Generate Manifest</span> |
| </button> |
| </div> |
| </div> |
|
|
| <div id="plugin-container"> |
| <div class="loading">Loading Plugins...</div> |
| </div> |
| </div> |
| </div> |
|
|
| |
| |
| |
| |
| |
|
|
| <script> |
| |
| const authDialogScript = document.createElement('script'); |
| authDialogScript.src = './auth-dialog.js'; |
| document.head.appendChild(authDialogScript); |
| |
| |
| const logViewer = document.getElementById("log-viewer"); |
| const pluginContainer = document.getElementById("plugin-container"); |
| |
| const addTerminalLine = (text, type = "info") => { |
| if (!logViewer) return; |
| |
| const timestamp = new Date(); |
| const time = timestamp.toLocaleTimeString("th-TH", { hour12: false }); |
| |
| |
| const logLine = document.createElement("span"); |
| logLine.className = `log-line log-${type}`; |
| |
| |
| logLine.textContent = `[${time}] ${text}\n`; |
| |
| |
| logViewer.appendChild(logLine); |
| |
| |
| logViewer.scrollTop = logViewer.scrollHeight; |
| }; |
| |
| document.addEventListener("keydown", (event) => { |
| if (event.key === "Escape") { |
| |
| if (window.resizeController && window.resizeController.isResizing) { |
| window.resizeController.stopResize(); |
| } |
| } |
| }); |
| |
| |
| |
| async function copyMachineID(machineID) { |
| try { |
| await navigator.clipboard.writeText(machineID); |
| addTerminalLine(` Machine ID copied: ${machineID}`, "success"); |
| } catch (error) { |
| addTerminalLine( |
| `ERROR: Cannot copy: ${error.message}`, |
| "error" |
| ); |
| } |
| } |
| |
| |
| |
| async function scanAndRenderPlugins() { |
| addTerminalLine(" Scanning plugins...", "command"); |
| |
| |
| showLoadingAnimation(pluginContainer, "Scanning Plugins"); |
| |
| |
| |
| const result = await window.electronAPI.plugins.getAll(); |
| |
| console.log( |
| "--- Data from Main Process (get-available-plugins) ---", |
| result |
| ); |
| |
| if (result.success && result.plugins) { |
| pluginContainer.innerHTML = '<div class="plugin-grid"></div>'; |
| const grid = pluginContainer.querySelector(".plugin-grid"); |
| const plugins = result.plugins; |
| |
| if (plugins.length === 0) { |
| grid.innerHTML = `<div class="loading">No plugins or projects found</div>`; |
| addTerminalLine( |
| " No projects available for button generation", |
| "info" |
| ); |
| } else { |
| |
| plugins.forEach((pluginData, index) => { |
| setTimeout(() => { |
| const card = document.createElement("div"); |
| card.className = "plugin-card"; |
| card.style.animationDelay = `${index * 0.1}s`; |
| card.innerHTML = ` |
| ${ |
| pluginData.previewImage |
| ? `<div class="plugin-image-container"><img src="${pluginData.previewImage}" class="plugin-preview-image" alt="Preview for ${pluginData.name}"></div>` |
| : "" |
| } |
| <h3>${getIconForType(pluginData)} ${ |
| pluginData.name |
| }</h3> |
| <p>${ |
| pluginData.description || |
| `ประเภท: ${pluginData.type}` |
| }</p> |
| ${ |
| pluginData.debugInfo |
| ? ` |
| <div class="debug-info"> |
| <div class="debug-stats"> |
| <span class="stat-files"> ${ |
| pluginData.debugInfo.totalFiles || |
| 0 |
| } files</span> |
| <span class="stat-issues ${ |
| pluginData.debugInfo.errors > 0 |
| ? "has-errors" |
| : "" |
| }"> |
| ${ |
| pluginData.debugInfo.errors || |
| 0 |
| } errors, ${ |
| pluginData.debugInfo.warnings || 0 |
| } warnings |
| </span> |
| </div> |
| </div> |
| ` |
| : "" |
| } |
| <div class="plugin-buttons"> |
| ${createPluginButtons(pluginData)} |
| </div> |
| `; |
| grid.appendChild(card); |
| }, index * 100); |
| }); |
| |
| |
| setTimeout(() => { |
| addTerminalLine( |
| `SUCCESS: Scanning complete. Found ${plugins.length} available projects`, |
| "success" |
| ); |
| showNotification( |
| ` พบ ${plugins.length} Pluginที่พร้อมใช้งาน!`, |
| "success" |
| ); |
| }, plugins.length * 100 + 200); |
| } |
| } else { |
| pluginContainer.innerHTML = `<div class="loading">Error loading plugins</div>`; |
| addTerminalLine( |
| `ERROR: Plugin scan failed: ${ |
| result.error || "No data received from Main Process" |
| }`, |
| "error" |
| ); |
| showNotification("ERROR: Failed to scan plugins", "error"); |
| } |
| } |
| |
| |
| |
| async function scanAndRenderPluginsWithDebug() { |
| addTerminalLine(" Scanning plugins with debug info...", "command"); |
| |
| |
| showLoadingAnimation(pluginContainer, "Analyzing Plugins"); |
| |
| try { |
| |
| const result = |
| await window.electronAPI.projectInspector.scanWithDebug(); |
| |
| console.log("--- Enhanced Scan Result ---", result); |
| |
| if (result.success && result.plugins) { |
| pluginContainer.innerHTML = '<div class="plugin-grid"></div>'; |
| const grid = pluginContainer.querySelector(".plugin-grid"); |
| const plugins = result.plugins; |
| |
| if (plugins.length === 0) { |
| grid.innerHTML = `<div class="loading">No plugins or projects found</div>`; |
| addTerminalLine( |
| " No projects available for button generation", |
| "info" |
| ); |
| } else { |
| let totalErrors = 0; |
| let totalWarnings = 0; |
| |
| |
| plugins.forEach((pluginData, index) => { |
| setTimeout(() => { |
| const card = document.createElement("div"); |
| card.className = "plugin-card"; |
| card.style.animationDelay = `${index * 0.1}s`; |
| card.innerHTML = ` |
| ${ |
| pluginData.previewImage |
| ? `<div class="plugin-image-container"><img src="${pluginData.previewImage}" class="plugin-preview-image" alt="Preview for ${pluginData.name}"></div>` |
| : "" |
| } |
| <h3>${getIconForType(pluginData)} ${ |
| pluginData.name |
| }</h3> |
| <p>${ |
| pluginData.description || |
| `ประเภท: ${pluginData.type}` |
| }</p> |
| ${ |
| pluginData.debugInfo |
| ? ` |
| <div class="debug-info"> |
| <div class="debug-stats"> |
| <span class="stat-files"> ${ |
| pluginData.debugInfo |
| .totalFiles || 0 |
| } files</span> |
| <span class="stat-issues ${ |
| pluginData.debugInfo.errors > |
| 0 |
| ? "has-errors" |
| : "" |
| }"> |
| ${ |
| pluginData.debugInfo |
| .errors || 0 |
| } errors, ${ |
| pluginData.debugInfo.warnings || 0 |
| } warnings |
| </span> |
| </div> |
| </div> |
| ` |
| : "" |
| } |
| <div class="plugin-buttons"> |
| ${createPluginButtons(pluginData)} |
| </div> |
| `; |
| grid.appendChild(card); |
| |
| |
| if (pluginData.debugInfo) { |
| totalErrors += pluginData.debugInfo.errors || 0; |
| totalWarnings += pluginData.debugInfo.warnings || 0; |
| } |
| }, index * 100); |
| }); |
| |
| |
| setTimeout(() => { |
| addTerminalLine( |
| `SUCCESS: Enhanced scan complete: ${plugins.length} projects`, |
| "success" |
| ); |
| addTerminalLine( |
| ` Found issues: ${totalErrors} errors, ${totalWarnings} warnings`, |
| totalErrors > 0 ? "error" : "info" |
| ); |
| showNotification( |
| ` Scanned ${plugins.length} plugins with debug info!`, |
| "success" |
| ); |
| }, plugins.length * 100 + 200); |
| } |
| } else { |
| pluginContainer.innerHTML = `<div class="loading">Error scanning with debug</div>`; |
| addTerminalLine( |
| `ERROR: Debug scan failed: ${ |
| result.error || "No data received from Main Process" |
| }`, |
| "error" |
| ); |
| showNotification("ERROR: Failed to scan with debug", "error"); |
| } |
| } catch (error) { |
| console.error("Enhanced scan error:", error); |
| pluginContainer.innerHTML = `<div class="loading">Error during scan</div>`; |
| addTerminalLine( |
| `ERROR: Enhanced scan failed: ${error.message}`, |
| "error" |
| ); |
| showNotification("ERROR: Failed to perform debug scan", "error"); |
| } |
| } |
| |
| |
| |
| async function runGeneratorAndRefresh() { |
| addTerminalLine( |
| " Scanning for new plugins and creating manifest...", |
| "command" |
| ); |
| |
| |
| showLoadingAnimation(pluginContainer, "Creating Manifest"); |
| |
| try { |
| const result = await window.electronAPI.runManifestGenerator(); |
| if (result.success) { |
| addTerminalLine( |
| "SUCCESS: Manifest created! Loading plugin list...", |
| "success" |
| ); |
| showNotification("SUCCESS: Manifest created successfully!", "success"); |
| |
| |
| setTimeout(async () => { |
| await scanAndRenderPlugins(); |
| }, 500); |
| } else { |
| addTerminalLine( |
| `ERROR: Failed to create manifest: ${result.error}`, |
| "error" |
| ); |
| showNotification( |
| "ERROR: Failed to create manifest", |
| "error" |
| ); |
| pluginContainer.innerHTML = `<div class="loading">Error creating manifest</div>`; |
| } |
| } catch (error) { |
| addTerminalLine( |
| `ERROR: Severe IPC error: ${error.message}`, |
| "error" |
| ); |
| showNotification("ERROR: Severe IPC error", "error"); |
| pluginContainer.innerHTML = `<div class="loading">Critical error occurred</div>`; |
| } |
| } |
| |
| |
| |
| |
| |
| |
| async function runGenerateManifestOnly() { |
| addTerminalLine("TOOL: Running Manifest Generator...", "command"); |
| try { |
| const result = await window.electronAPI.runManifestGenerator(); |
| if (result.success) { |
| addTerminalLine("SUCCESS: Manifest files created!", "success"); |
| addTerminalLine(` Output:`, "info"); |
| addTerminalLine(result.output, "stdout"); |
| } else { |
| addTerminalLine( |
| `ERROR: Failed to create manifest: ${result.error}`, |
| "error" |
| ); |
| } |
| } catch (error) { |
| addTerminalLine( |
| `ERROR: Critical IPC error: ${error.message}`, |
| "error" |
| ); |
| } |
| } |
| |
| |
| |
| async function openPluginsFolder() { |
| addTerminalLine(" Opening Plugin folder...", "command"); |
| try { |
| const result = await window.electronAPI.openPluginsFolder(); |
| if (result.success) { |
| addTerminalLine( |
| "SUCCESS: Plugin folder opened in File Explorer", |
| "success" |
| ); |
| addTerminalLine(` Location: ${result.path}`, "info"); |
| addTerminalLine( |
| ' You can place plugin files in this folder and click "Refresh" to scan', |
| "info" |
| ); |
| showNotification(" Plugin folder opened!", "success"); |
| } else { |
| addTerminalLine( |
| `ERROR: Unable to open Plugin folder: ${result.error}`, |
| "error" |
| ); |
| showNotification( |
| "ERROR: Unable to open Plugin folder", |
| "error" |
| ); |
| } |
| } catch (error) { |
| addTerminalLine(`ERROR: IPC Error: ${error.message}`, "error"); |
| showNotification("ERROR: IPC Error", "error"); |
| } |
| } |
| |
| |
| |
| async function startBuildProcess() { |
| addTerminalLine( |
| " Starting application build process...", |
| "command" |
| ); |
| addTerminalLine(" Command: npx electron-builder --win --x64", "command"); |
| addTerminalLine( |
| " Please wait, this process may take several minutes...", |
| "info" |
| ); |
| addTerminalLine( |
| " Build will create MSI and EXE files for Windows installation", |
| "info" |
| ); |
| |
| |
| |
| showNotification(" Starting Build Process...", "info"); |
| |
| |
| const buildStatusDiv = document.createElement("div"); |
| buildStatusDiv.id = "build-status"; |
| buildStatusDiv.style.cssText = ` |
| background: linear-gradient(135deg, #fd7e14, #e76500); |
| color: white; |
| padding: 15px; |
| margin: 10px 0; |
| border-radius: 8px; |
| border-left: 4px solid #fff; |
| animation: pulse 4s infinite ease-in-out; |
| `; |
| buildStatusDiv.innerHTML = ` |
| <div style="display: flex; align-items: center; justify-content: center;"> |
| <div style=" |
| width: 20px; |
| height: 20px; |
| border: 3px solid rgba(255,255,255,0.3); |
| border-top: 3px solid white; |
| border-radius: 50%; |
| animation: spin 1s linear infinite; |
| margin-right: 10px; |
| "></div> |
| <span>Building application...</span> |
| </div> |
| `; |
| |
| try { |
| const result = await window.electronAPI.startBuild(); |
| if (!result.success) { |
| addTerminalLine( |
| `ERROR: Unable to start build: ${result.error}`, |
| "error" |
| ); |
| showNotification("ERROR: Unable to start build", "error"); |
| |
| |
| buildStatusDiv.remove(); |
| } else { |
| addTerminalLine("SUCCESS: Build process started successfully!", "success"); |
| |
| |
| buildStatusDiv.innerHTML = ` |
| <div style="display: flex; align-items: center; justify-content: center;"> |
| <div style=" |
| width: 20px; |
| height: 20px; |
| border: 3px solid rgba(255,255,255,0.3); |
| border-top: 3px solid white; |
| border-radius: 50%; |
| animation: spin 1s linear infinite; |
| margin-right: 10px; |
| "></div> |
| <span> Building in progress... (check logs below)</span> |
| </div> |
| `; |
| } |
| } catch (error) { |
| addTerminalLine( |
| `ERROR: Critical error: ${error.message}`, |
| "error" |
| ); |
| showNotification("ERROR: Critical error", "error"); |
| |
| |
| buildStatusDiv.remove(); |
| } |
| } |
| |
| |
| |
| function onBuildComplete(success) { |
| const buildStatusDiv = document.getElementById("build-status"); |
| if (buildStatusDiv) { |
| if (success) { |
| buildStatusDiv.style.background = |
| "linear-gradient(135deg, #28a745, #1e7e34)"; |
| buildStatusDiv.innerHTML = ` |
| <div style="display: flex; align-items: center; justify-content: center;"> |
| <span style="font-size: 1.2em; margin-right: 10px;">SUCCESS</span> |
| <span> Build complete! Check files in dist/ folder</span> |
| </div> |
| `; |
| showNotification( |
| " Build successful! MSI/EXE files ready", |
| "success" |
| ); |
| } else { |
| buildStatusDiv.style.background = |
| "linear-gradient(135deg, #dc3545, #c82333)"; |
| buildStatusDiv.innerHTML = ` |
| <div style="display: flex; align-items: center; justify-content: center;"> |
| <span style="font-size: 1.2em; margin-right: 10px;">ERROR</span> |
| <span> Build failed! Check logs for details</span> |
| </div> |
| `; |
| showNotification("ERROR: Build failed!", "error"); |
| } |
| |
| |
| setTimeout(() => { |
| buildStatusDiv.remove(); |
| }, 10000); |
| } |
| } |
| |
| |
| |
| function showLoadingAnimation(container, message = "Loading...") { |
| if (!container) return; |
| |
| container.innerHTML = ` |
| <div class="loading" style=" |
| display: flex; |
| flex-direction: column; |
| align-items: center; |
| justify-content: center; |
| padding: 40px 20px; |
| background: var(--glass-bg); |
| border-radius: 12px; |
| border: 1px solid var(--glass-border); |
| backdrop-filter: blur(10px); |
| -webkit-backdrop-filter: blur(10px); |
| "> |
| <div style=" |
| width: 40px; |
| height: 40px; |
| border: 3px solid var(--border-color); |
| border-top: 3px solid var(--accent-blue); |
| border-radius: 50%; |
| animation: spin 1s linear infinite; |
| margin-bottom: 15px; |
| "></div> |
| <div style=" |
| color: var(--text-secondary); |
| font-size: 0.9rem; |
| text-align: center; |
| ">${message}</div> |
| </div> |
| <style> |
| @keyframes spin { |
| 0% { transform: rotate(0deg); } |
| 100% { transform: rotate(360deg); } |
| } |
| </style> |
| `; |
| } |
| |
| |
| |
| function showNotification(message, type = "info") { |
| |
| const existingNotification = |
| document.getElementById("app-notification"); |
| if (existingNotification) { |
| existingNotification.remove(); |
| } |
| |
| const notification = document.createElement("div"); |
| notification.id = "app-notification"; |
| |
| let bgColor, borderColor, textColor; |
| switch (type) { |
| case "success": |
| bgColor = "rgba(16, 185, 129, 0.9)"; |
| borderColor = "#10b981"; |
| textColor = "white"; |
| break; |
| case "error": |
| bgColor = "rgba(239, 68, 68, 0.9)"; |
| borderColor = "#ef4444"; |
| textColor = "white"; |
| break; |
| case "warning": |
| bgColor = "rgba(245, 158, 11, 0.9)"; |
| borderColor = "#f59e0b"; |
| textColor = "white"; |
| break; |
| default: |
| bgColor = "rgba(59, 130, 246, 0.9)"; |
| borderColor = "#3b82f6"; |
| textColor = "white"; |
| } |
| |
| notification.style.cssText = ` |
| position: fixed; |
| top: 20px; |
| right: 20px; |
| z-index: 3000; /* ลดจาก 10000 เป็น 3000 - notification level */ |
| background: ${bgColor}; |
| color: ${textColor}; |
| padding: 12px 20px; |
| border-radius: 8px; |
| border-left: 4px solid ${borderColor}; |
| box-shadow: var(--shadow-xl); |
| backdrop-filter: blur(10px); |
| -webkit-backdrop-filter: blur(10px); |
| transform: translateX(100%); |
| transition: transform 0.3s ease; |
| max-width: 350px; |
| font-weight: 500; |
| `; |
| |
| notification.textContent = message; |
| document.body.appendChild(notification); |
| |
| |
| requestAnimationFrame(() => { |
| notification.style.transform = "translateX(0)"; |
| }); |
| |
| |
| setTimeout(() => { |
| notification.style.transform = "translateX(100%)"; |
| setTimeout(() => { |
| if (notification.parentNode) { |
| notification.remove(); |
| } |
| }, 300); |
| }, 4000); |
| } |
| |
| |
| |
| function createPluginButtons(pluginData) { |
| let buttonsHTML = ""; |
| if (pluginData.buttons && pluginData.buttons.length > 0) { |
| pluginData.buttons.forEach((buttonInfo) => { |
| |
| buttonsHTML += ` |
| <button |
| onclick="checkAuthAndExecute('runPluginAction', '${pluginData.name}', '${ |
| buttonInfo.command |
| }', '${pluginData.path.replace(/\\/g, "\\\\")}')" |
| title="${buttonInfo.tooltip || buttonInfo.name}" |
| > |
| <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-3 h-3 btn-icon"> |
| <path stroke-linecap="round" stroke-linejoin="round" d="M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.324.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 010 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 010-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281z" /> |
| <path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" /> |
| </svg> ${buttonInfo.name} |
| </button> |
| `; |
| }); |
| } |
| buttonsHTML += `<button onclick="checkAuthAndExecute('runPluginAction', '${ |
| pluginData.name |
| }', 'info', '${pluginData.path.replace( |
| /\\/g, |
| "\\\\" |
| )}')" title="แสดงข้อมูล"> |
| <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-3 h-3 btn-icon"> |
| <path stroke-linecap="round" stroke-linejoin="round" d="M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z" /> |
| </svg> ข้อมูล |
| </button>`; |
| return buttonsHTML || "<span>ไม่มีคำสั่งที่ใช้ได้</span>"; |
| } |
| |
| |
| |
| function getIconForType(pluginData) { |
| |
| if (pluginData.icon) { |
| return pluginData.icon; |
| } |
| |
| |
| const icons = { |
| node: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="3"/><path d="M12 1v6m0 6v6"/></svg>', |
| python: |
| '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2C8 2 8 4 8 4v4h8V6s0-4-4-4zM8 10v4s0 4 4 4 4-4 4-4v-4"/></svg>', |
| java: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"/></svg>', |
| api: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"/><path d="M16 6l-4-4-4 4"/><path d="M12 2v15"/></svg>', |
| html: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="16,18 22,12 16,6"/><polyline points="8,6 2,12 8,18"/></svg>', |
| project: |
| '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/></svg>', |
| batch_project: |
| '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M9 9h6m-6 4h6m-6 4h4"/></svg>', |
| executable_project: |
| '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="5,3 19,12 5,21"/></svg>', |
| electron_app: |
| '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="4" width="20" height="16" rx="2"/><path d="M6 8h.01M10 8h.01M14 8h.01"/></svg>', |
| utility_tool: |
| '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg>', |
| chahuadev_studio: |
| '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><polygon points="10,8 16,12 10,16"/></svg>', |
| html_plugin: |
| '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="16,18 22,12 16,6"/><polyline points="8,6 2,12 8,18"/></svg>', |
| javascript_plugin: |
| '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M20 4L8.12 15.88M14.47 14.48L20 20M8.12 8.12L12 12"/></svg>', |
| }; |
| return ( |
| icons[pluginData.type] || |
| '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/></svg>' |
| ); |
| } |
| |
| |
| |
| async function runPluginAction(pluginName, action, projectPath) { |
| |
| if (!authManager || !authManager.isUserAuthenticated()) { |
| if (window.authDialog) { |
| window.authDialog.show(); |
| } else { |
| alert('กรุณาล็อกอินก่อนใช้งาน'); |
| } |
| return; |
| } |
| |
| addTerminalLine( |
| `RUNNING: กำลังรัน Action: "${action}" บนPlugin "${pluginName}"...`, |
| "command" |
| ); |
| |
| try { |
| |
| const result = await window.electronAPI.processCommand({ |
| action: action, |
| pluginName: pluginName, |
| projectPath: projectPath, |
| }); |
| |
| if (result.success) { |
| addTerminalLine(`SUCCESS: Action completed!`, "success"); |
| const output = |
| result.data?.output || result.data?.message || result.message; |
| if (output) { |
| addTerminalLine(output, "stdout"); |
| } |
| } else { |
| addTerminalLine(`ERROR: Action failed: ${result.error}`, "error"); |
| } |
| } catch (err) { |
| addTerminalLine( |
| `ERROR: Critical error (IPC): ${err.message}`, |
| "error" |
| ); |
| } |
| } |
| |
| window.runPluginAction = runPluginAction; |
| |
| |
| |
| async function runExternalCommand(command) { |
| try { |
| |
| |
| const result = await window.electronAPI.executeQuickCommand(command); |
| |
| if (result.success) { |
| |
| addTerminalLine(result.data.output, "stdout"); |
| } else { |
| |
| addTerminalLine(result.error, "error"); |
| } |
| } catch (err) { |
| |
| addTerminalLine(`ERROR: IPC Error: ${err.message}`, "error"); |
| } |
| } |
| |
| |
| |
| async function runGatewayCommand( |
| action, |
| loadingMessage = "กำลังดำเนินการ..." |
| ) { |
| try { |
| addTerminalLine(loadingMessage, "command"); |
| |
| const result = await window.electronAPI.processCommand({ |
| action: action, |
| projectPath: process.cwd ? process.cwd() : ".", |
| }); |
| |
| if (result.success) { |
| addTerminalLine("SUCCESS: Command executed!", "success"); |
| if (result.data && result.data.output) { |
| addTerminalLine(result.data.output, "stdout"); |
| } else if (result.data && result.data.message) { |
| addTerminalLine(result.data.message, "info"); |
| } |
| } else { |
| addTerminalLine(`ERROR: Command failed: ${result.error}`, "error"); |
| } |
| } catch (error) { |
| addTerminalLine(`ERROR: Error: ${error.message}`, "error"); |
| } |
| } |
| |
| |
| |
| function addSuccessEffect(element) { |
| element.classList.add("success-animation"); |
| setTimeout(() => { |
| element.classList.remove("success-animation"); |
| }, 600); |
| } |
| |
| |
| |
| function addClickEffect(event) { |
| const button = event.target; |
| |
| |
| const ripple = document.createElement("span"); |
| const rect = button.getBoundingClientRect(); |
| const size = Math.max(rect.width, rect.height); |
| const x = event.clientX - rect.left - size / 2; |
| const y = event.clientY - rect.top - size / 2; |
| |
| ripple.style.cssText = ` |
| position: absolute; |
| width: ${size}px; |
| height: ${size}px; |
| left: ${x}px; |
| top: ${y}px; |
| background: rgba(255, 255, 255, 0.6); |
| border-radius: 50%; |
| transform: scale(0); |
| animation: ripple 0.6s linear; |
| pointer-events: none; |
| `; |
| |
| |
| |
| if (!document.querySelector("#ripple-style")) { |
| const style = document.createElement("style"); |
| style.id = "ripple-style"; |
| style.textContent = ` |
| @keyframes ripple { |
| to { |
| transform: scale(4); |
| opacity: 0; |
| } |
| } |
| `; |
| document.head.appendChild(style); |
| } |
| |
| button.style.position = "relative"; |
| button.style.overflow = "hidden"; |
| button.appendChild(ripple); |
| |
| setTimeout(() => { |
| ripple.remove(); |
| }, 600); |
| } |
| |
| |
| |
| function addTypingEffect(element, text, speed = 50) { |
| element.textContent = ""; |
| element.classList.add("typing-effect"); |
| |
| let i = 0; |
| const typeWriter = () => { |
| if (i < text.length) { |
| element.textContent += text.charAt(i); |
| i++; |
| setTimeout(typeWriter, speed); |
| } else { |
| element.classList.remove("typing-effect"); |
| } |
| }; |
| typeWriter(); |
| } |
| |
| |
| |
| function initializeButtonEffects() { |
| document.addEventListener("click", (event) => { |
| if (event.target.tagName === "BUTTON") { |
| addClickEffect(event); |
| } |
| }); |
| } |
| |
| |
| |
| |
| function animatePluginCards() { |
| const cards = document.querySelectorAll(".plugin-card"); |
| cards.forEach((card, index) => { |
| card.style.animationDelay = `${index * 0.1}s`; |
| card.classList.add("fadeIn"); |
| }); |
| } |
| |
| |
| |
| |
| function showLoadingAnimation(element, text = "กำลังโหลด") { |
| |
| if (!element) { |
| console.warn( |
| "WARNING: showLoadingAnimation: Element is null or undefined" |
| ); |
| return; |
| } |
| |
| element.innerHTML = ` |
| <div class="loading-container" style="text-align: center; padding: 20px;"> |
| <div class="loading-spinner" style=" |
| width: 40px; |
| height: 40px; |
| border: 4px solid #e9ecef; |
| border-top: 4px solid #667eea; |
| border-radius: 50%; |
| animation: spin 1s linear infinite; |
| margin: 0 auto 10px; |
| "></div> |
| <div class="loading-text">${text}</div> |
| </div> |
| `; |
| |
| |
| |
| |
| if (!document.querySelector("#spinner-style")) { |
| const style = document.createElement("style"); |
| style.id = "spinner-style"; |
| style.textContent = ` |
| @keyframes spin { |
| 0% { transform: rotate(0deg); } |
| 100% { transform: rotate(360deg); } |
| } |
| `; |
| document.head.appendChild(style); |
| } |
| } |
| |
| |
| |
| function showNotification(message, type = "info") { |
| |
| |
| console.log(` [Notification Disabled] ${message} (${type})`); |
| } |
| |
| |
| |
| |
| function isDevMode() { |
| |
| const urlParams = new URLSearchParams(window.location.search); |
| const devParam = urlParams.get("dev") === "true"; |
| const devStorage = localStorage.getItem("chahua_dev_mode") === "true"; |
| const isLocalhost = |
| window.location.hostname === "localhost" || |
| window.location.hostname === "127.0.0.1" || |
| window.location.hostname === ""; |
| |
| return devParam || devStorage || isLocalhost; |
| } |
| |
| |
| |
| |
| function initProductionSecurity() { |
| const isDev = isDevMode(); |
| console.log( |
| "[SECURITY] Security Mode:", |
| isDev ? "DEVELOPMENT" : "PRODUCTION" |
| ); |
| |
| if (!isDev) { |
| |
| const consoleMethods = [ |
| "log", |
| "debug", |
| "info", |
| "warn", |
| "error", |
| "assert", |
| "dir", |
| "dirxml", |
| "group", |
| "groupEnd", |
| "time", |
| "timeEnd", |
| "count", |
| "trace", |
| "profile", |
| "profileEnd", |
| ]; |
| |
| consoleMethods.forEach((method) => { |
| console[method] = function () { |
| |
| }; |
| }); |
| |
| |
| document.addEventListener( |
| "keydown", |
| function (e) { |
| |
| if (e.key === "F12") { |
| e.preventDefault(); |
| e.stopPropagation(); |
| return false; |
| } |
| |
| |
| if ((e.ctrlKey || e.metaKey) && e.shiftKey && e.key === "I") { |
| e.preventDefault(); |
| e.stopPropagation(); |
| return false; |
| } |
| |
| |
| if ((e.ctrlKey || e.metaKey) && e.shiftKey && e.key === "J") { |
| e.preventDefault(); |
| e.stopPropagation(); |
| return false; |
| } |
| |
| |
| if ((e.ctrlKey || e.metaKey) && e.shiftKey && e.key === "C") { |
| e.preventDefault(); |
| e.stopPropagation(); |
| return false; |
| } |
| |
| |
| if ((e.ctrlKey || e.metaKey) && e.key === "u") { |
| e.preventDefault(); |
| e.stopPropagation(); |
| return false; |
| } |
| |
| |
| if ((e.ctrlKey || e.metaKey) && e.key === "s") { |
| e.preventDefault(); |
| e.stopPropagation(); |
| return false; |
| } |
| }, |
| true |
| ); |
| |
| |
| document.addEventListener( |
| "contextmenu", |
| function (e) { |
| e.preventDefault(); |
| e.stopPropagation(); |
| return false; |
| }, |
| true |
| ); |
| |
| |
| document.addEventListener( |
| "selectstart", |
| function (e) { |
| e.preventDefault(); |
| return false; |
| }, |
| true |
| ); |
| |
| document.addEventListener( |
| "dragstart", |
| function (e) { |
| e.preventDefault(); |
| return false; |
| }, |
| true |
| ); |
| |
| |
| let devtools = { |
| open: false, |
| orientation: null, |
| }; |
| |
| const threshold = 160; |
| |
| setInterval(() => { |
| if ( |
| window.outerHeight - window.innerHeight > threshold || |
| window.outerWidth - window.innerWidth > threshold |
| ) { |
| if (!devtools.open) { |
| devtools.open = true; |
| showDeveloperToolsWarning(); |
| } |
| } else { |
| devtools.open = false; |
| hideDeveloperToolsWarning(); |
| } |
| }, 500); |
| |
| |
| let startTime = new Date(); |
| debugger; |
| let endTime = new Date(); |
| if (endTime - startTime > 100) { |
| showDeveloperToolsWarning(); |
| } |
| } |
| |
| return isDev; |
| } |
| |
| |
| |
| |
| function showDeveloperToolsWarning() { |
| if (document.getElementById("dev-tools-warning")) return; |
| |
| const warningOverlay = document.createElement("div"); |
| warningOverlay.id = "dev-tools-warning"; |
| warningOverlay.style.cssText = ` |
| position: fixed; |
| top: 0; |
| left: 0; |
| width: 100%; |
| height: 100%; |
| background: rgba(220, 53, 69, 0.95); |
| color: white; |
| z-index: 10000; /* แก้จาก 999999 เป็น 10000 - security overlay (สูงสุด) */ |
| display: flex; |
| flex-direction: column; |
| justify-content: center; |
| align-items: center; |
| font-family: 'Segoe UI', sans-serif; |
| font-size: 24px; |
| text-align: center; |
| backdrop-filter: blur(10px); |
| `; |
| |
| warningOverlay.innerHTML = ` |
| <div style="max-width: 600px; padding: 40px; background: rgba(0,0,0,0.8); border-radius: 20px; border: 3px solid #dc3545;"> |
| <h1 style="color: #ff6b6b; margin-bottom: 20px; font-size: 2.5em;">ACCESS DENIED: การเข้าถึงถูกปฏิเสธ</h1> |
| <p style="font-size: 1.2em; margin-bottom: 20px; line-height: 1.6;"> |
| ระบบตรวจพบการเปิด Developer Tools<br/> |
| แอปพลิเคชันนี้ได้รับการป้องกันเพื่อSecurity |
| </p> |
| <div style="background: rgba(255,255,255,0.1); padding: 20px; border-radius: 10px; margin: 20px 0;"> |
| <p style="font-size: 1em; margin: 0;"> |
| <svg style="display: inline-block; width: 16px; height: 16px; margin-right: 8px;" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> |
| <rect x="3" y="11" width="18" height="11" rx="2" ry="2"/> |
| <circle cx="12" cy="16" r="1"/> |
| <path d="M7 11V7a5 5 0 0 1 10 0v4"/> |
| </svg> |
| Production Mode Active<br/> |
| SECURITY: Security Features Enabled<br/> |
| <svg style="display: inline-block; width: 16px; height: 16px; margin-right: 8px;" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> |
| <path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/> |
| <circle cx="9" cy="7" r="4"/> |
| <path d="M23 21v-2a4 4 0 0 0-3-3.87"/> |
| <path d="M16 3.13a4 4 0 0 1 0 7.75"/> |
| </svg> |
| For End Users Only |
| </p> |
| </div> |
| <p style="font-size: 0.9em; color: #ffcccb;"> |
| กรุณาปิด Developer Tools เพื่อใช้งานต่อ<br/> |
| หากคุณเป็นนักพัฒนา ให้เพิ่ม ?dev=true ใน URL |
| </p> |
| </div> |
| `; |
| |
| document.body.appendChild(warningOverlay); |
| } |
| |
| |
| |
| |
| |
| function hideDeveloperToolsWarning() { |
| const warning = document.getElementById("dev-tools-warning"); |
| if (warning) { |
| warning.remove(); |
| } |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function devLog(...args) { |
| if (isDevMode()) { |
| console.log(...args); |
| } |
| } |
| |
| |
| |
| |
| |
| function devError(...args) { |
| if (isDevMode()) { |
| console.error(...args); |
| } |
| } |
| |
| |
| |
| |
| |
| function devWarn(...args) { |
| if (isDevMode()) { |
| console.warn(...args); |
| } |
| } |
| |
| |
| |
| |
| |
| document.addEventListener("DOMContentLoaded", async () => { |
| console.log("[CLEANUP] Skipping localStorage cleanup - handled by webview"); |
| |
| |
| try { |
| if (window.electronAPI && window.electronAPI.getPreloadWebviewPath) { |
| window.webviewPreloadPath = await window.electronAPI.getPreloadWebviewPath(); |
| console.log("[WEBVIEW] Preload path initialized:", window.webviewPreloadPath); |
| } |
| } catch (error) { |
| console.warn("[WEBVIEW] Failed to get preload path:", error); |
| } |
| |
| |
| if (window.electronAPI && window.electronAPI.onMessage) { |
| window.electronAPI.onMessage('auth:inject-to-webviews', (tokens) => { |
| console.log("[AUTH] Received tokens to inject to webviews:", tokens); |
| |
| |
| const storeWebview = document.getElementById('store-webview'); |
| if (storeWebview) { |
| storeWebview.send('auth:inject-tokens', tokens); |
| console.log("[AUTH] Tokens sent to store webview"); |
| } |
| |
| |
| const marketplaceWebview = document.getElementById('marketplace-webview'); |
| if (marketplaceWebview) { |
| marketplaceWebview.send('auth:inject-tokens', tokens); |
| console.log("[AUTH] Tokens sent to marketplace webview"); |
| } |
| }); |
| } |
| |
| |
| const isDev = initProductionSecurity(); |
| |
| |
| window.isDev = isDev; |
| |
| addTerminalLine("Initializing system...", "info"); |
| |
| if (isDev) { |
| addTerminalLine( |
| "DEV MODE: Developer Mode: Security features disabled for development", |
| "warning" |
| ); |
| document.body.classList.add("dev-mode"); |
| } else { |
| addTerminalLine( |
| "[SECURE] Production Mode: Security features active", |
| "success" |
| ); |
| document.body.classList.remove("dev-mode"); |
| } |
| |
| if (window.electronAPI) { |
| addTerminalLine( |
| "Script loaded successfully. Connected to main system.", |
| "success" |
| ); |
| |
| |
| try { |
| const runMode = await window.electronAPI.getRunMode(); |
| if (runMode.isDevMode) { |
| console.log("Running in Developer Mode - developer features enabled"); |
| addTerminalLine( |
| "Developer Mode: Special developer tools enabled", |
| "success" |
| ); |
| window.isDev = true; |
| document.body.classList.add("dev-mode"); |
| |
| showNotification( |
| "Developer Mode: Special tools available", |
| "info" |
| ); |
| } else { |
| console.log("Running in Customer Mode - user features only"); |
| addTerminalLine( |
| "Customer Mode: Only features for regular users", |
| "info" |
| ); |
| document.body.classList.remove("dev-mode"); |
| |
| showNotification("Customer Version - Ready to use!", "success"); |
| } |
| } catch (error) { |
| console.error("Unable to check operation mode:", error); |
| addTerminalLine( |
| "Unable to check operation mode - Using normal mode", |
| "warning" |
| ); |
| |
| document.body.classList.remove("dev-mode"); |
| } |
| |
| initializeButtonEffects(); |
| |
| |
| addTerminalLine( |
| "===== Chahua Plugin Management System =====", |
| "success" |
| ); |
| addTerminalLine("Plugin Management System - Log Viewer Mode", "info"); |
| addTerminalLine("System messages and button actions will be displayed here", "info"); |
| addTerminalLine("", "info"); |
| |
| setTimeout(() => { |
| scanAndRenderPlugins(); |
| }, 1000); |
| |
| |
| window.electronAPI.onBuildLog((log) => { |
| |
| if (log.includes("[ERROR]")) { |
| addTerminalLine(log.replace("[ERROR] ", ""), "error"); |
| } else if (log.includes("SUCCESS") || log.includes("")) { |
| addTerminalLine(log, "success"); |
| |
| if (log.includes("Build เสร็จสมบูรณ์")) { |
| onBuildComplete(true); |
| } |
| } else if (log.includes("ERROR") || log.includes("")) { |
| addTerminalLine(log, "error"); |
| |
| if (log.includes("Build ล้มเหลว")) { |
| onBuildComplete(false); |
| } |
| } else { |
| |
| addTerminalLine(log, "stdout"); |
| } |
| }); |
| |
| |
| if (window.electronAPI && window.electronAPI.onEnhancedScanComplete) { |
| window.electronAPI.onEnhancedScanComplete((result) => { |
| console.log(" Enhanced scan complete from menu:", result); |
| if (result.success) { |
| addTerminalLine( |
| " Enhanced scan completed via keyboard shortcut", |
| "success" |
| ); |
| |
| scanAndRenderPluginsWithDebug(); |
| } else { |
| addTerminalLine( |
| `ERROR: Enhanced scan failed: ${result.error}`, |
| "error" |
| ); |
| } |
| }); |
| } |
| |
| |
| setTimeout(() => { |
| showNotification( |
| "ยินดีต้อนรับสู่ระบบจัดการPlugin Chahuadev!", |
| "success" |
| ); |
| }, 2000); |
| |
| |
| window.resizeController = new ResizePanelController(); |
| |
| |
| const systemCheckBtn = document.getElementById("runSystemCheckBtn"); |
| if (systemCheckBtn) { |
| systemCheckBtn.addEventListener("click", async () => { |
| const scope = document.getElementById("diagnosticScope").value; |
| const selectedPlugins = |
| scope === "specific" ? getSelectedPlugins() : []; |
| |
| addTerminalLine( |
| `→ กำลังเริ่มการวินิจฉัย (${getDiagnosticScopeText(scope)})...`, |
| "info" |
| ); |
| |
| try { |
| const result = |
| await window.electronAPI.runParameterizedSystemCheck({ |
| scope: scope, |
| plugins: selectedPlugins, |
| }); |
| |
| if (result.success) { |
| addTerminalLine("SUCCESS: Diagnosis complete", "success"); |
| if (result.message) { |
| addTerminalLine(result.message, "info"); |
| } |
| if (result.fixed) { |
| addTerminalLine( |
| "TOOL: System has been repaired successfully", |
| "success" |
| ); |
| } |
| if ( |
| result.recommendations && |
| result.recommendations.length > 0 |
| ) { |
| addTerminalLine( |
| `TIPS: คำแนะนำ: ${result.recommendations.join(", ")}`, |
| "info" |
| ); |
| } |
| } else { |
| addTerminalLine( |
| `ERROR: Diagnosis failed: ${result.error}`, |
| "error" |
| ); |
| } |
| } catch (error) { |
| addTerminalLine( |
| `ERROR: Unable to start diagnosis: ${error.message}`, |
| "error" |
| ); |
| } |
| }); |
| } |
| |
| addTerminalLine( |
| "Enhanced Webview Bridge System initialized successfully", |
| "success" |
| ); |
| } else { |
| addTerminalLine( |
| "Critical Error: Script loader not found (electronAPI)!", |
| "error" |
| ); |
| } |
| }); |
| |
| |
| |
| function initParameterizedDiagnostics() { |
| const diagnosticScope = document.getElementById("diagnosticScope"); |
| const specificPluginSelector = document.getElementById( |
| "specificPluginSelector" |
| ); |
| |
| if (diagnosticScope) { |
| diagnosticScope.addEventListener("change", function () { |
| if (this.value === "specific") { |
| specificPluginSelector.style.display = "block"; |
| loadAvailablePlugins(); |
| } else { |
| specificPluginSelector.style.display = "none"; |
| } |
| |
| |
| updateDiagnosticButtonText(this.value); |
| }); |
| } |
| } |
| |
| |
| |
| async function loadAvailablePlugins() { |
| const pluginList = document.getElementById("pluginList"); |
| if (!pluginList) return; |
| |
| try { |
| |
| const result = await window.electronAPI.getAvailablePlugins(); |
| |
| if (result.success) { |
| pluginList.innerHTML = ""; |
| result.plugins.forEach((plugin) => { |
| const option = document.createElement("option"); |
| option.value = plugin.path; |
| option.textContent = `${plugin.name} (${plugin.type})`; |
| pluginList.appendChild(option); |
| }); |
| |
| if (result.plugins.length === 0) { |
| const option = document.createElement("option"); |
| option.textContent = "No plugins found"; |
| option.disabled = true; |
| pluginList.appendChild(option); |
| } |
| } else { |
| pluginList.innerHTML = |
| "<option disabled>ไม่สามารถโหลดรายชื่อPluginได้</option>"; |
| } |
| } catch (error) { |
| console.error("Error loading plugins:", error); |
| pluginList.innerHTML = |
| "<option disabled>เกิดข้อผิดพลาดในการโหลด</option>"; |
| } |
| } |
| |
| |
| |
| function getSelectedPlugins() { |
| const pluginList = document.getElementById("pluginList"); |
| if (!pluginList) return []; |
| |
| const selected = []; |
| for (let option of pluginList.selectedOptions) { |
| selected.push(option.value); |
| } |
| return selected; |
| } |
| |
| |
| |
| |
| function getDiagnosticScopeText(scope) { |
| const scopeTexts = { |
| all: "ทั้งระบบ", |
| plugins: "Pluginทั้งหมด", |
| core: "ระบบหลัก", |
| dependencies: "Dependencies", |
| specific: "Pluginที่เลือก", |
| }; |
| return scopeTexts[scope] || "Not specified"; |
| } |
| |
| |
| |
| |
| function updateDiagnosticButtonText(scope) { |
| const button = document.getElementById("runSystemCheckBtn"); |
| if (!button) return; |
| |
| const icon = |
| '<svg style="width: 16px; height: 16px; display: inline-block; margin-right: 8px;" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><circle cx="12" cy="16" r="1"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>'; |
| const texts = { |
| all: `${icon} วินิจฉัยทั้งระบบ`, |
| plugins: `${icon} วินิจฉัยPlugin`, |
| core: `${icon} วินิจฉัยระบบหลัก`, |
| dependencies: `${icon} วินิจฉัย Dependencies`, |
| specific: `${icon} วินิจฉัยPluginที่เลือก`, |
| }; |
| |
| button.innerHTML = texts[scope] || `${icon} Start Diagnosis`; |
| } |
| |
| |
| |
| class ResizePanelController { |
| constructor() { |
| this.isResizing = false; |
| this.startX = 0; |
| this.startWidth = 0; |
| this.sidebar = null; |
| this.container = null; |
| this.resizeHandle = null; |
| |
| this.init(); |
| } |
| |
| init() { |
| this.terminalSection = document.querySelector(".terminal-section"); |
| this.container = document.querySelector(".container"); |
| this.resizeHandle = document.getElementById("resizeHandle"); |
| |
| if (!this.terminalSection || !this.container || !this.resizeHandle) { |
| console.error("ERROR: Resize elements not found"); |
| return; |
| } |
| |
| this.initializeResizePanel(); |
| console.log("Resize panel system initialized"); |
| } |
| |
| initializeResizePanel() { |
| |
| this.boundHandleResize = this.handleResize.bind(this); |
| this.boundStopResize = this.stopResize.bind(this); |
| |
| |
| this.emergencyCleanup = () => { |
| console.log(" Emergency cleanup triggered!"); |
| this.stopResize(); |
| }; |
| |
| |
| this.boundKeydownHandler = (event) => { |
| if (event.key === "Escape") { |
| console.log(" Escape key pressed, stopping resize"); |
| this.emergencyCleanup(); |
| } |
| }; |
| |
| |
| this.resizeHandle.addEventListener("mousedown", (e) => { |
| |
| e.preventDefault(); |
| e.stopPropagation(); |
| |
| console.log("RESIZE: Mouse down on resize handle"); |
| |
| |
| document.addEventListener("mousemove", this.boundHandleResize); |
| document.addEventListener("mouseup", this.boundStopResize); |
| |
| |
| document.addEventListener("mouseleave", this.emergencyCleanup); |
| window.addEventListener("blur", this.emergencyCleanup); |
| document.addEventListener("keydown", this.boundKeydownHandler); |
| |
| |
| this.isResizing = true; |
| this.startX = e.clientX; |
| |
| this.startWidth = this.terminalSection.offsetWidth; |
| |
| |
| this.container.classList.add("resizing"); |
| this.resizeHandle.classList.add("resizing"); |
| |
| |
| this.resizeTimeout = setTimeout(() => { |
| console.log(" Resize timeout - forcing cleanup"); |
| this.emergencyCleanup(); |
| }, 10000); |
| }); |
| } |
| |
| startResize(e) { |
| e.preventDefault(); |
| e.stopPropagation(); |
| |
| console.log("RESIZE: Starting resize"); |
| |
| |
| document.addEventListener("mousemove", this.boundHandleResize); |
| document.addEventListener("mouseup", this.boundStopResize); |
| document.addEventListener("mouseleave", this.boundEmergencyCleanup); |
| window.addEventListener("blur", this.boundEmergencyCleanup); |
| |
| |
| this.isResizing = true; |
| this.startX = e.clientX; |
| this.startWidth = this.sidebar.offsetWidth; |
| |
| |
| this.container.classList.add("resizing"); |
| this.resizeHandle.classList.add("resizing"); |
| |
| |
| this.resizeTimeout = setTimeout(() => { |
| console.log(" Resize timeout - forcing cleanup"); |
| this.emergencyCleanup(); |
| }, 10000); |
| } |
| |
| handleResize(e) { |
| |
| if (!this.isResizing) return; |
| |
| e.preventDefault(); |
| |
| |
| const newWidth = this.startWidth + (e.clientX - this.startX); |
| |
| |
| const minWidth = 400; |
| const maxWidth = this.container.offsetWidth * 0.75; |
| |
| |
| if (newWidth >= minWidth && newWidth <= maxWidth) { |
| this.terminalSection.style.width = newWidth + "px"; |
| } |
| } |
| |
| stopResize() { |
| console.log( |
| " stopResize() called, current isResizing:", |
| this.isResizing |
| ); |
| |
| |
| try { |
| |
| if ( |
| !this.isResizing && |
| this.container.classList.contains("resizing") |
| ) { |
| console.log(" Found orphaned resizing class, cleaning up..."); |
| } |
| |
| |
| if (this.isResizing && window.showNotification) { |
| const currentWidth = this.terminalSection.offsetWidth; |
| window.showNotification( |
| ` ปรับขนาด Terminal เป็น ${currentWidth}px`, |
| "success" |
| ); |
| } |
| } catch (error) { |
| console.error("Error during resize:", error); |
| } finally { |
| |
| console.log(" Finally block: Cleaning up resize state..."); |
| |
| this.isResizing = false; |
| |
| |
| this.container.classList.remove("resizing"); |
| this.resizeHandle.classList.remove("resizing"); |
| |
| |
| document.removeEventListener("mousemove", this.boundHandleResize); |
| document.removeEventListener("mouseup", this.boundStopResize); |
| |
| |
| document.removeEventListener("mouseleave", this.emergencyCleanup); |
| window.removeEventListener("blur", this.emergencyCleanup); |
| document.removeEventListener("keydown", this.boundKeydownHandler); |
| |
| |
| if (this.resizeTimeout) { |
| clearTimeout(this.resizeTimeout); |
| this.resizeTimeout = null; |
| } |
| |
| console.log( |
| "SUCCESS: Resizing stopped and ALL listeners cleaned up." |
| ); |
| } |
| } |
| } |
| |
| |
| window.resizeController = null; |
| |
| |
| |
| function initializeThemeDropdown() { |
| const themeDropdown = document.getElementById("themeDropdown"); |
| |
| if (themeDropdown) { |
| const toggleBtn = themeDropdown.querySelector(".dropdown-toggle"); |
| const menu = themeDropdown.querySelector(".dropdown-menu"); |
| |
| toggleBtn.addEventListener("click", (event) => { |
| event.stopPropagation(); |
| menu.classList.toggle("show"); |
| }); |
| |
| |
| window.addEventListener("click", (event) => { |
| if (themeDropdown && !themeDropdown.contains(event.target)) { |
| menu.classList.remove("show"); |
| } |
| }); |
| |
| |
| const themeItems = menu.querySelectorAll(".dropdown-item"); |
| themeItems.forEach((item) => { |
| item.addEventListener("click", () => { |
| menu.classList.remove("show"); |
| }); |
| }); |
| } |
| |
| console.log("SUCCESS: Theme dropdown initialized"); |
| } |
| |
| |
| window.addEventListener("beforeunload", () => { |
| if (window.electronAPI && window.electronAPI.removeBuildLogListeners) { |
| window.electronAPI.removeBuildLogListeners(); |
| } |
| }); |
| |
| |
| |
| |
| const storeWebview = document.getElementById('store-webview'); |
| |
| if (storeWebview) { |
| |
| storeWebview.addEventListener('ipc-message', (event) => { |
| const { channel, args } = event; |
| const data = args[0]; |
| |
| console.log(`[HOST APP] Received message from webview via '${channel}'`, data); |
| |
| |
| |
| |
| }); |
| } |
| |
| </script> |
| <script> |
| |
| |
| |
| document.addEventListener("DOMContentLoaded", () => { |
| const logPanel = document.getElementById("log-viewer"); |
| const marketplacePanel = document.getElementById("marketplace-webview"); |
| |
| |
| const marketplaceUrl = "./store.html"; |
| |
| let isMarketplaceLoaded = false; |
| |
| |
| |
| |
| function switchView(viewToShow) { |
| console.log(`[VIEW] switchView(${viewToShow}) called`); |
| |
| document |
| .querySelectorAll(".view-panel") |
| .forEach((p) => p.classList.remove("active")); |
| document |
| .querySelectorAll(".view-btn") |
| .forEach((b) => b.classList.remove("active")); |
| |
| |
| const originalSystem = document.getElementById("original-system"); |
| const storeContainer = document.getElementById("store-container"); |
| const refreshStoreBtn = document.getElementById("refresh-store-btn"); |
| |
| if (originalSystem) originalSystem.style.display = "none"; |
| if (storeContainer) storeContainer.style.display = "none"; |
| if (refreshStoreBtn) refreshStoreBtn.style.display = "none"; |
| |
| |
| if (viewToShow === "log") { |
| console.log("LOGS: Showing log panel"); |
| if (logPanel) logPanel.classList.add("active"); |
| if (originalSystem) originalSystem.style.display = "flex"; |
| document.getElementById("nav-plugins")?.classList.add("active"); |
| } else if (viewToShow === "marketplace-new") { |
| console.log("[STORE] Showing Store Webview System"); |
| if (storeContainer) storeContainer.style.display = "block"; |
| if (refreshStoreBtn) refreshStoreBtn.style.display = "block"; |
| document.getElementById("nav-store-new")?.classList.add("active"); |
| |
| |
| initializeStoreWebview(); |
| } |
| } |
| |
| |
| class NativeStoreHelper { |
| constructor() { |
| console.log(" NativeStoreHelper initialized for Desktop App"); |
| this.plugins = []; |
| this.isLoading = false; |
| } |
| |
| |
| async loadPluginsFromAPI() { |
| try { |
| console.log("[PLUGIN] Loading plugins from store API..."); |
| this.isLoading = true; |
| |
| const result = await window.electronAPI.store.getPlugins(); |
| |
| if (result.success && result.plugins) { |
| console.log( |
| `[SUCCESS] Loaded ${result.plugins.length} plugins from store` |
| ); |
| |
| |
| this.plugins = result.plugins.map((plugin) => { |
| return { |
| id: plugin.id, |
| title: plugin.name || plugin.title, |
| name: plugin.name || plugin.title, |
| category: plugin.category || "general", |
| description: plugin.description || "ไม่มีคำอธิบาย", |
| features: this.parseFeatures(plugin.features), |
| price: parseFloat(plugin.price || 0), |
| isFree: parseFloat(plugin.price || 0) === 0, |
| popularity: this.calculatePopularity(plugin), |
| image: |
| plugin.imagePath || |
| plugin.image_path || |
| plugin.image || |
| this.getDefaultPluginImage(), |
| imagePath: |
| plugin.imagePath || |
| plugin.image_path || |
| plugin.image || |
| this.getDefaultPluginImage(), |
| version: plugin.version || "1.0.0", |
| downloadCount: parseInt( |
| plugin.downloadCount || plugin.download_count || 0 |
| ), |
| downloadUrl: plugin.filePath || plugin.file_path || null, |
| isComingSoon: |
| plugin.status === "draft" || |
| plugin.status === "coming_soon", |
| slug: plugin.slug, |
| avgRating: parseFloat( |
| plugin.avgRating || plugin.avg_rating || 0 |
| ), |
| reviewCount: parseInt( |
| plugin.reviewCount || plugin.review_count || 0 |
| ), |
| verifiedReviewCount: parseInt( |
| plugin.verifiedReviewCount || |
| plugin.verified_review_count || |
| 0 |
| ), |
| uploadedBy: plugin.uploaded_by_username || "Admin", |
| createdAt: plugin.created_at, |
| updatedAt: plugin.updated_at, |
| }; |
| }); |
| |
| this.isLoading = false; |
| return this.plugins; |
| } else { |
| throw new Error( |
| result.error || "Unable to load plugin data" |
| ); |
| } |
| } catch (error) { |
| this.isLoading = false; |
| console.error("[ERROR] Failed to load plugins:", error); |
| throw error; |
| } |
| } |
| |
| |
| parseFeatures(features) { |
| if (!features) return []; |
| if (Array.isArray(features)) return features; |
| if (typeof features === "string") { |
| try { |
| |
| return JSON.parse(features); |
| } catch { |
| |
| return features |
| .split(",") |
| .map((f) => f.trim()) |
| .filter((f) => f); |
| } |
| } |
| return []; |
| } |
| |
| |
| calculatePopularity(plugin) { |
| const downloads = parseInt( |
| plugin.downloadCount || plugin.download_count || 0 |
| ); |
| const rating = parseFloat( |
| plugin.avgRating || plugin.avg_rating || 0 |
| ); |
| const reviews = parseInt( |
| plugin.reviewCount || plugin.review_count || 0 |
| ); |
| |
| |
| const popularity = |
| downloads * 0.4 + rating * 20 * 0.3 + reviews * 5 * 0.3; |
| return Math.round(popularity); |
| } |
| |
| |
| getDefaultPluginImage() { |
| return 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect width="100" height="100" fill="%23334155"/><rect x="30" y="30" width="40" height="40" rx="4" fill="none" stroke="%23cbd5e1" stroke-width="2"/><circle cx="40" cy="40" r="2" fill="%23cbd5e1"/><circle cx="60" cy="60" r="2" fill="%23cbd5e1"/><path d="M40 40L60 60" stroke="%23cbd5e1" stroke-width="2"/></svg>'; |
| } |
| |
| |
| generateStarRating(rating, reviewCount = 0) { |
| const fullStars = Math.floor(rating); |
| const hasHalfStar = rating % 1 >= 0.5; |
| const emptyStars = 5 - fullStars - (hasHalfStar ? 1 : 0); |
| |
| const stars = []; |
| |
| |
| for (let i = 0; i < fullStars; i++) { |
| stars.push('<span class="star full">★</span>'); |
| } |
| |
| |
| if (hasHalfStar) { |
| stars.push('<span class="star half">☆</span>'); |
| } |
| |
| |
| for (let i = 0; i < emptyStars; i++) { |
| stars.push('<span class="star empty">☆</span>'); |
| } |
| |
| return ` |
| <div class="plugin-rating" title="${rating.toFixed( |
| 1 |
| )} จาก 5 ดาว (${reviewCount} รีวิว)"> |
| ${stars.join("")} |
| <span class="rating-text">${rating.toFixed( |
| 1 |
| )} (${reviewCount})</span> |
| </div> |
| `; |
| } |
| } |
| |
| |
| const nativeStoreHelper = new NativeStoreHelper(); |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function initializeStoreWebview() { |
| try { |
| console.log("Initializing Store Webview System..."); |
| |
| |
| const storeContainer = document.getElementById("store-container"); |
| const webview = document.getElementById("store-webview"); |
| |
| if (!storeContainer || !webview) { |
| console.error( |
| "[ERROR] Store container or webview element not found" |
| ); |
| addTerminalLine("[ERROR] Webview element not found", "error"); |
| return; |
| } |
| |
| |
| if (webview.src && webview.src !== "about:blank") { |
| console.log("[SUCCESS] Store webview already loaded"); |
| return; |
| } |
| |
| |
| let storeUrl = "https://chahuadev.com/index.html"; |
| |
| console.log(" Loading store, letting webview handle"); |
| |
| console.log(`Loading store from: ${storeUrl}`); |
| webview.src = storeUrl; |
| |
| |
| webview.addEventListener("dom-ready", () => { |
| console.log("[SUCCESS] Store webview loaded successfully"); |
| addTerminalLine("[SUCCESS] Store page loaded successfully", "success"); |
| }); |
| |
| |
| webview.addEventListener('ipc-message', (event) => { |
| const { channel, args } = event; |
| const data = args[0]; |
| |
| console.log(`[APP] Received message from webview on channel "${channel}"`, data); |
| |
| |
| if (channel === 'install-plugin-request' && data && data.pluginId) { |
| addTerminalLine(`[STORE] Received install command for Plugin ID: ${data.pluginId} from web store`, 'command'); |
| |
| |
| if (window.electronAPI && window.electronAPI.executeCommand) { |
| window.electronAPI.executeCommand('install-plugin', data.pluginId) |
| .then(result => { |
| if (result.success) { |
| addTerminalLine(`[SUCCESS] Plugin installed successfully! Path: ${result.installPath}`, 'success'); |
| showNotification('Plugin installed successfully!', 'success'); |
| |
| scanAndRenderPlugins(); |
| } else { |
| addTerminalLine(`[ERROR] Installation failed: ${result.error}`, 'error'); |
| showNotification(`Installation failed: ${result.error}`, 'error'); |
| } |
| }) |
| .catch(error => { |
| addTerminalLine(`[ERROR] Error: ${error.message}`, 'error'); |
| showNotification(`Error: ${error.message}`, 'error'); |
| }); |
| } |
| } |
| |
| }); |
| |
| webview.addEventListener("did-fail-load", (event) => { |
| console.error("Store webview failed to load:", event); |
| console.error("[ERROR] Store webview failed to load:", event); |
| addTerminalLine( |
| "[ERROR] Unable to load store page. Please check your internet connection", |
| "error" |
| ); |
| |
| webview.src = `data:text/html, |
| <div style="padding: 2rem; text-align: center; color: #e74c3c; font-family: Arial;"> |
| <h2>[ERROR] Unable to load store</h2> |
| <p>กรุณาตรวจสอบการเชื่อมต่ออินเทอร์เน็ต</p> |
| <button onclick="location.reload()">ลองใหม่</button> |
| </div> |
| `; |
| }); |
| |
| |
| webview.addEventListener("will-navigate", (event) => { |
| console.log(" Webview navigating to:", event.url); |
| handleWebviewNavigation(event); |
| }); |
| |
| addTerminalLine(" Initializing web store system", "info"); |
| } catch (error) { |
| console.error("[ERROR] Failed to initialize store webview:", error); |
| addTerminalLine( |
| `[ERROR] Error: ${error.message}`, |
| "error" |
| ); |
| } |
| } |
| |
| |
| |
| |
| function refreshStoreWebview() { |
| try { |
| const webview = document.getElementById("store-webview"); |
| if (webview) { |
| console.log("[REFRESH] Refreshing store webview..."); |
| addTerminalLine("[REFRESH] Refreshing store page...", "info"); |
| webview.reload(); |
| } |
| } catch (error) { |
| console.error("[ERROR] Failed to refresh webview:", error); |
| addTerminalLine( |
| `[ERROR] Unable to refresh: ${error.message}`, |
| "error" |
| ); |
| } |
| } |
| |
| |
| window.refreshStoreWebview = refreshStoreWebview; |
| |
| |
| |
| |
| function handleWebviewNavigation(event) { |
| try { |
| const url = new URL(event.url); |
| |
| |
| if ( |
| url.href.includes("chahua-dashboard/dashboard.html") || |
| url.href.includes("payment-success") |
| ) { |
| event.preventDefault(); |
| console.log("[SUCCESS] Payment successful detected!"); |
| addTerminalLine( |
| "[SUCCESS] Payment successful! Updating Plugin...", |
| "success" |
| ); |
| |
| |
| setTimeout(() => { |
| const webview = document.getElementById("store-webview"); |
| if (webview) { |
| webview.reload(); |
| } |
| }, 2000); |
| } |
| } catch (error) { |
| console.error("[ERROR] Error handling webview navigation:", error); |
| } |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| document.addEventListener("DOMContentLoaded", async () => { |
| console.log("[NAVIGATION] Initializing Navigation System..."); |
| |
| |
| try { |
| const storeWebview = document.getElementById('store-webview'); |
| if (storeWebview) { |
| console.log('[APP] Dynamically setting webview preload script...'); |
| const preloadPath = await window.electronAPI.getPreloadPath(); |
| if (preloadPath) { |
| |
| storeWebview.preload = `file://${preloadPath}`; |
| console.log(`[APP] Webview preload set to: ${storeWebview.preload}`); |
| } else { |
| console.error('[APP] Could not get preload path for webview.'); |
| if (typeof addTerminalLine === 'function') { |
| addTerminalLine('ERROR: Unable to configure Webview Preload', 'error'); |
| } |
| } |
| } |
| } catch (error) { |
| console.error('[APP] Error setting webview preload:', error); |
| if (typeof addTerminalLine === 'function') { |
| addTerminalLine(`ERROR: Webview Preload failed: ${error.message}`, 'error'); |
| } |
| } |
| |
| |
| const originalSystem = document.getElementById("original-system"); |
| const storeContainer = document.getElementById("store-container"); |
| const storeWebview = document.getElementById("store-webview"); |
| |
| const navMyPluginsBtn = document.getElementById("nav-plugins"); |
| const navStoreBtn = document.getElementById("nav-store-new"); |
| const refreshStoreBtn = document.getElementById("refresh-store-btn"); |
| |
| |
| if ( |
| !originalSystem || |
| !storeContainer || |
| !navMyPluginsBtn || |
| !navStoreBtn |
| ) { |
| console.error("[ERROR] Required navigation elements not found"); |
| return; |
| } |
| |
| |
| if (!window.isDev) { |
| console.log('[STORE] Store closed - Production Mode Only'); |
| navStoreBtn.style.display = 'none'; |
| storeContainer.style.display = 'none'; |
| } else { |
| console.log('[STORE] Store opened - DEV MODE'); |
| } |
| |
| |
| |
| |
| |
| |
| function showMyPluginsView() { |
| console.log("[NAVIGATION] Switching to My Plugins View"); |
| |
| |
| originalSystem.style.display = "flex"; |
| storeContainer.style.display = "none"; |
| |
| |
| navMyPluginsBtn.classList.add("active"); |
| navStoreBtn.classList.remove("active"); |
| |
| |
| if (refreshStoreBtn) refreshStoreBtn.style.display = "none"; |
| |
| |
| if (typeof loadAndDisplayMyPlugins === "function") { |
| loadAndDisplayMyPlugins(); |
| } else if (typeof runGeneratorAndRefresh === "function") { |
| |
| runGeneratorAndRefresh(); |
| } |
| |
| addTerminalLine("[MY_PLUGINS] Showing My Plugins", "info"); |
| } |
| |
| |
| |
| |
| function showStoreView() { |
| console.log("[STORE] Switching to Store View"); |
| |
| |
| originalSystem.style.display = "none"; |
| storeContainer.style.display = "block"; |
| |
| |
| navMyPluginsBtn.classList.remove("active"); |
| navStoreBtn.classList.add("active"); |
| |
| |
| if (refreshStoreBtn) refreshStoreBtn.style.display = "block"; |
| |
| |
| if (storeWebview) { |
| let storeUrl = "https://chahuadev.com/index.html"; |
| |
| |
| const waitForPreload = async () => { |
| let retries = 0; |
| const maxRetries = 50; |
| |
| while (!window.webviewPreloadPath && retries < maxRetries) { |
| await new Promise(resolve => setTimeout(resolve, 100)); |
| retries++; |
| } |
| |
| if (window.webviewPreloadPath && storeWebview.getAttribute('preload') !== `file://${window.webviewPreloadPath}`) { |
| storeWebview.setAttribute('preload', `file://${window.webviewPreloadPath}`); |
| console.log("[WEBVIEW] Preload applied before loading store:", window.webviewPreloadPath); |
| } |
| |
| return window.webviewPreloadPath; |
| }; |
| |
| if (storeWebview.src === "about:blank" || !storeWebview.src) { |
| console.log("[STORE] Loading store URL:", storeUrl); |
| |
| |
| waitForPreload().then(() => { |
| storeWebview.src = storeUrl; |
| }).catch(error => { |
| console.warn("[WEBVIEW] Preload wait failed, loading anyway:", error); |
| storeWebview.src = storeUrl; |
| }); |
| } |
| } |
| |
| addTerminalLine("[STORE] Showing Store page", "info"); |
| } |
| |
| |
| |
| |
| navMyPluginsBtn.addEventListener("click", (e) => { |
| e.preventDefault(); |
| showMyPluginsView(); |
| }); |
| |
| |
| navStoreBtn.addEventListener("click", (e) => { |
| e.preventDefault(); |
| showStoreView(); |
| }); |
| |
| |
| |
| |
| window.showMyPluginsView = showMyPluginsView; |
| window.showStoreView = showStoreView; |
| |
| |
| |
| |
| showMyPluginsView(); |
| |
| console.log("[SUCCESS] Navigation system initialized successfully"); |
| }); |
| |
| |
| window.switchView = switchView; |
| |
| |
| |
| |
| |
| }); |
| |
| |
| window.addEventListener("beforeunload", () => { |
| if (window.electronAPI && window.electronAPI.removeBuildLogListeners) { |
| window.electronAPI.removeBuildLogListeners(); |
| } |
| }); |
| |
| |
| |
| |
| |
| class AuthManager { |
| constructor() { |
| this.currentUser = null; |
| this.isAuthenticated = false; |
| this.isLoading = false; |
| this.initializeElements(); |
| this.setupEventListeners(); |
| this.checkAuthStatus(); |
| } |
| |
| initializeElements() { |
| this.elements = { |
| authHeader: document.getElementById('auth-header'), |
| authGuest: document.getElementById('auth-guest'), |
| authUser: document.getElementById('auth-user'), |
| authLoading: document.getElementById('auth-loading'), |
| authLoginBtn: document.getElementById('auth-login-btn'), |
| authUserAvatar: document.getElementById('auth-user-avatar'), |
| authUserName: document.getElementById('auth-user-name'), |
| authUserRole: document.getElementById('auth-user-role'), |
| authDropdown: document.getElementById('auth-dropdown'), |
| authProfile: document.getElementById('auth-profile'), |
| authPermissions: document.getElementById('auth-permissions'), |
| authLogout: document.getElementById('auth-logout'), |
| permissionDialog: document.getElementById('permission-dialog'), |
| permissionAllow: document.getElementById('permission-allow'), |
| permissionDeny: document.getElementById('permission-deny') |
| }; |
| } |
| |
| setupEventListeners() { |
| |
| this.elements.authLoginBtn.addEventListener('click', () => this.startLogin()); |
| |
| |
| this.elements.authUser.addEventListener('click', () => this.toggleDropdown()); |
| |
| |
| this.elements.authProfile.addEventListener('click', () => this.showProfile()); |
| this.elements.authPermissions.addEventListener('click', () => this.showPermissions()); |
| this.elements.authLogout.addEventListener('click', () => this.logout()); |
| |
| |
| this.elements.permissionAllow.addEventListener('click', () => this.handlePermission(true)); |
| this.elements.permissionDeny.addEventListener('click', () => this.handlePermission(false)); |
| |
| |
| document.addEventListener('click', (e) => { |
| if (!this.elements.authUser.contains(e.target)) { |
| this.elements.authDropdown.classList.remove('show'); |
| } |
| }); |
| } |
| |
| async checkAuthStatus() { |
| try { |
| this.setLoadingState(true); |
| console.log(' Checking login status...'); |
| |
| |
| if (!window.electronAPI || !window.electronAPI.auth) { |
| console.warn(' Authentication API not available'); |
| this.setGuestState(); |
| return; |
| } |
| |
| |
| const result = await window.electronAPI.auth.checkStatus(); |
| |
| if (result.success && result.authenticated && result.user) { |
| console.log(' Found logged-in user:', result.user); |
| this.setAuthenticatedState(result.user); |
| } else { |
| console.log('ℹ No active login session:', result.error || 'No active session'); |
| |
| await this.attemptAutoLogin(); |
| } |
| } catch (error) { |
| console.error(' Auth check failed:', error); |
| this.setGuestState(); |
| } finally { |
| this.setLoadingState(false); |
| } |
| } |
| |
| async attemptAutoLogin() { |
| try { |
| console.log('[AUTO-LOGIN] Attempting auto-login with demo account...'); |
| |
| |
| const result = await window.electronAPI.auth.offlineLogin('admin', 'demo123'); |
| |
| if (result.success && result.data) { |
| const user = result.data.user; |
| console.log('[AUTO-LOGIN] Success! User:', user.username); |
| this.setAuthenticatedState(user); |
| |
| |
| setTimeout(() => this.showDemoDashboard(), 1500); |
| } else { |
| console.warn('[AUTO-LOGIN] Failed:', result.error); |
| this.setGuestState(); |
| } |
| } catch (error) { |
| console.error('[AUTO-LOGIN] Error:', error); |
| this.setGuestState(); |
| } |
| } |
| |
| showDemoDashboard() { |
| try { |
| console.log('[DEMO-DASHBOARD] Showing dashboard...'); |
| |
| const existingDashboard = document.getElementById('demo-dashboard-modal'); |
| if (existingDashboard) { |
| existingDashboard.remove(); |
| } |
| |
| const dashboard = document.createElement('div'); |
| dashboard.id = 'demo-dashboard-modal'; |
| dashboard.className = 'demo-dashboard-modal'; |
| dashboard.innerHTML = ` |
| <div class="demo-dashboard-container"> |
| <div class="demo-dashboard-header"> |
| <h2> Welcome to Chahuadev Framework!</h2> |
| <p>Demo Dashboard - Plugin Test Mode</p> |
| </div> |
| <div class="demo-dashboard-content"> |
| <div class="feature-grid"> |
| <div class="feature-card"> |
| <h3> My Plugins</h3> |
| <p>Manage and control installed plugins</p> |
| <button onclick="document.getElementById('demo-dashboard-modal').remove();" class="feature-btn">Open</button> |
| </div> |
| <div class="feature-card"> |
| <h3> Plugin Store</h3> |
| <p>Search and install new plugins</p> |
| <button onclick="document.getElementById('demo-dashboard-modal').remove();" class="feature-btn">Open</button> |
| </div> |
| <div class="feature-card"> |
| <h3> Settings</h3> |
| <p>Customize system settings</p> |
| <button onclick="document.getElementById('demo-dashboard-modal').remove();" class="feature-btn">Open</button> |
| </div> |
| <div class="feature-card"> |
| <h3> Statistics</h3> |
| <p>View plugin usage statistics</p> |
| <button onclick="document.getElementById('demo-dashboard-modal').remove();" class="feature-btn">Open</button> |
| </div> |
| </div> |
| </div> |
| <div class="demo-dashboard-footer"> |
| <button onclick="document.getElementById('demo-dashboard-modal').remove();" class="btn-close">Close Dashboard</button> |
| </div> |
| </div> |
| `; |
| |
| document.body.appendChild(dashboard); |
| |
| |
| if (!document.getElementById('demo-dashboard-styles')) { |
| const styles = document.createElement('style'); |
| styles.id = 'demo-dashboard-styles'; |
| styles.textContent = ` |
| .demo-dashboard-modal { |
| position: fixed; |
| top: 0; |
| left: 0; |
| width: 100%; |
| height: 100%; |
| background: rgba(0, 0, 0, 0.5); |
| display: flex; |
| align-items: center; |
| justify-content: center; |
| z-index: 10000; |
| } |
| .demo-dashboard-container { |
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); |
| border-radius: 12px; |
| padding: 30px; |
| max-width: 600px; |
| width: 90%; |
| box-shadow: 0 10px 40px rgba(0,0,0,0.3); |
| animation: slideIn 0.3s ease-out; |
| } |
| @keyframes slideIn { |
| from { transform: translateY(-20px); opacity: 0; } |
| to { transform: translateY(0); opacity: 1; } |
| } |
| .demo-dashboard-header { |
| color: white; |
| text-align: center; |
| margin-bottom: 30px; |
| border-bottom: 2px solid rgba(255,255,255,0.3); |
| padding-bottom: 15px; |
| } |
| .demo-dashboard-header h2 { |
| margin: 0; |
| font-size: 24px; |
| } |
| .demo-dashboard-header p { |
| margin: 10px 0 0 0; |
| opacity: 0.9; |
| } |
| .feature-grid { |
| display: grid; |
| grid-template-columns: 1fr 1fr; |
| gap: 15px; |
| margin-bottom: 20px; |
| } |
| .feature-card { |
| background: rgba(255,255,255,0.95); |
| padding: 15px; |
| border-radius: 8px; |
| text-align: center; |
| } |
| .feature-card h3 { |
| margin: 0 0 5px 0; |
| font-size: 14px; |
| } |
| .feature-card p { |
| margin: 0 0 10px 0; |
| font-size: 12px; |
| color: #666; |
| } |
| .feature-btn { |
| background: #667eea; |
| color: white; |
| border: none; |
| padding: 6px 12px; |
| border-radius: 4px; |
| cursor: pointer; |
| font-size: 12px; |
| } |
| .feature-btn:hover { |
| background: #764ba2; |
| } |
| .demo-dashboard-footer { |
| text-align: center; |
| border-top: 2px solid rgba(255,255,255,0.3); |
| padding-top: 15px; |
| } |
| .btn-close { |
| background: rgba(255,255,255,0.2); |
| color: white; |
| border: 2px solid white; |
| padding: 10px 20px; |
| border-radius: 6px; |
| cursor: pointer; |
| font-size: 14px; |
| } |
| .btn-close:hover { |
| background: rgba(255,255,255,0.3); |
| } |
| `; |
| document.head.appendChild(styles); |
| } |
| |
| console.log('[DEMO-DASHBOARD] Dashboard displayed successfully'); |
| } catch (error) { |
| console.error('[DEMO-DASHBOARD] Error:', error); |
| } |
| } |
| |
| async startLogin() { |
| try { |
| this.setLoadingState(true); |
| addTerminalLine("Starting login process...", "info"); |
| addTerminalLine(" Offline Mode (Offline Demo Mode)", "warning"); |
| addTerminalLine("Username: admin, developer, user", "info"); |
| addTerminalLine("Password: demo123", "info"); |
| |
| if (!window.electronAPI || !window.electronAPI.auth) { |
| throw new Error('Authentication API not available'); |
| } |
| |
| |
| const result = await window.electronAPI.auth.startDeviceFlow(); |
| |
| if (result.success && result.data) { |
| addTerminalLine(result.data.message || "Please enter login credentials", "info"); |
| |
| |
| this.showOfflineLoginForm(); |
| } else { |
| throw new Error(result.error || 'Unable to start login process'); |
| } |
| } catch (error) { |
| console.error(' Login failed:', error); |
| addTerminalLine(` Error: ${error.message}`, "error"); |
| this.setLoadingState(false); |
| } |
| } |
| |
| |
| |
| |
| showOfflineLoginForm() { |
| |
| const existingModal = document.getElementById('offline-login-modal'); |
| if (existingModal) { |
| existingModal.remove(); |
| } |
| |
| const modal = document.createElement('div'); |
| modal.id = 'offline-login-modal'; |
| modal.className = 'offline-login-modal'; |
| modal.innerHTML = ` |
| <div class="offline-login-container"> |
| <div class="offline-login-header"> |
| <h2> Sign In (Offline Demo)</h2> |
| <p>โหมดออฟไลน์ สำหรับการพัฒนา</p> |
| </div> |
| <form class="offline-login-form"> |
| <div class="form-group"> |
| <label for="username">ชื่อผู้ใช้:</label> |
| <input type="text" id="username" name="username" placeholder="admin / developer / user" required> |
| <small>Example: admin, developer, user</small> |
| </div> |
| <div class="form-group"> |
| <label for="password">รหัสผ่าน:</label> |
| <input type="password" id="password" name="password" placeholder="demo123" value="demo123" required> |
| </div> |
| <div class="form-actions"> |
| <button type="submit" class="btn-login">เข้าสู่ระบบ</button> |
| <button type="button" class="btn-cancel">ยกเลิก</button> |
| </div> |
| </form> |
| <div class="demo-users"> |
| <p><strong> ผู้ใช้ทั้งหมด:</strong></p> |
| <ul> |
| <li><code>admin</code> - Administrator (Full permissions)</li> |
| <li><code>developer</code> - Developer (Read/Write)</li> |
| <li><code>user</code> - User (Read-only)</li> |
| </ul> |
| </div> |
| </div> |
| `; |
| |
| document.body.appendChild(modal); |
| |
| |
| const form = modal.querySelector('.offline-login-form'); |
| form.addEventListener('submit', async (e) => { |
| e.preventDefault(); |
| const username = document.getElementById('username').value.trim(); |
| const password = document.getElementById('password').value; |
| |
| await this.submitOfflineLogin(username, password); |
| modal.remove(); |
| }); |
| |
| |
| const cancelBtn = modal.querySelector('.btn-cancel'); |
| cancelBtn.addEventListener('click', () => { |
| modal.remove(); |
| this.setLoadingState(false); |
| }); |
| |
| |
| modal.querySelector('#username').focus(); |
| } |
| |
| |
| |
| |
| async submitOfflineLogin(username, password) { |
| try { |
| addTerminalLine(` Validating: ${username}...`, "info"); |
| |
| const result = await window.electronAPI.auth.offlineLogin(username, password); |
| |
| if (result.success && result.data) { |
| const user = result.data.user; |
| addTerminalLine("[SUCCESS] Login successful!", "success"); |
| addTerminalLine(` Welcome: ${user.username}`, "success"); |
| addTerminalLine(` Email: ${user.email}`, "info"); |
| addTerminalLine(`[USER] Role: ${user.role}`, "info"); |
| |
| this.setAuthenticatedState(user); |
| this.setLoadingState(false); |
| } else { |
| throw new Error(result.error || 'Login failed'); |
| } |
| } catch (error) { |
| console.error(' Offline login failed:', error); |
| addTerminalLine(` Error: ${error.message}`, "error"); |
| this.setLoadingState(false); |
| } |
| } |
| |
| async pollForAuth(deviceCode) { |
| try { |
| const result = await window.electronAPI.auth.pollDeviceAuth(deviceCode); |
| |
| if (result.success && result.data) { |
| const { status, user, accessToken } = result.data; |
| |
| if (status === 'approved' && user && accessToken) { |
| addTerminalLine(" Login successful!", "success"); |
| addTerminalLine(` Welcome: ${user.username || user.name || 'User'}`, "success"); |
| |
| this.setAuthenticatedState(user); |
| this.setLoadingState(false); |
| return; |
| } else if (status === 'pending') { |
| |
| setTimeout(() => this.pollForAuth(deviceCode), 3000); |
| return; |
| } else if (status === 'denied') { |
| throw new Error('User denied login'); |
| } else if (status === 'expired') { |
| throw new Error('Verification code expired. Please try again.'); |
| } |
| } |
| |
| throw new Error(result.error || 'Login failed'); |
| } catch (error) { |
| console.error(' Polling failed:', error); |
| addTerminalLine(` Login failed: ${error.message}`, "error"); |
| this.setLoadingState(false) |
| } |
| } |
| |
| async logout() { |
| try { |
| this.setLoadingState(true); |
| addTerminalLine(" Logging out...", "info"); |
| |
| if (window.electronAPI && window.electronAPI.auth) { |
| const result = await window.electronAPI.auth.logout(); |
| |
| if (result.success) { |
| addTerminalLine(" Logged out", "info"); |
| } else { |
| addTerminalLine(` Error: ${result.error}`, "warning"); |
| } |
| } |
| |
| this.setGuestState(); |
| this.elements.authDropdown.classList.remove('show'); |
| } catch (error) { |
| console.error(' Logout failed:', error); |
| addTerminalLine(` Logout failed: ${error.message}`, "error"); |
| } finally { |
| this.setLoadingState(false); |
| } |
| } |
| |
| setGuestState() { |
| this.isAuthenticated = false; |
| this.currentUser = null; |
| this.elements.authGuest.style.display = 'flex'; |
| this.elements.authUser.style.display = 'none'; |
| this.elements.authLoginBtn.style.display = 'block'; |
| |
| |
| disableProtectedButtons(); |
| } |
| |
| setAuthenticatedState(user) { |
| this.isAuthenticated = true; |
| this.currentUser = user; |
| |
| |
| this.elements.authUserAvatar.textContent = user.username.charAt(0).toUpperCase(); |
| this.elements.authUserName.textContent = user.username; |
| this.elements.authUserRole.textContent = user.role || 'user'; |
| |
| |
| this.elements.authGuest.style.display = 'none'; |
| this.elements.authUser.style.display = 'flex'; |
| this.elements.authLoginBtn.style.display = 'none'; |
| |
| |
| this.enableAuthenticatedFeatures(); |
| } |
| |
| setLoadingState(loading) { |
| this.isLoading = loading; |
| if (loading) { |
| this.elements.authGuest.style.display = 'none'; |
| this.elements.authUser.style.display = 'none'; |
| this.elements.authLoading.style.display = 'flex'; |
| this.elements.authLoginBtn.disabled = true; |
| } else { |
| this.elements.authLoading.style.display = 'none'; |
| this.elements.authLoginBtn.disabled = false; |
| } |
| } |
| |
| enableAuthenticatedFeatures() { |
| |
| |
| document.body.classList.add('authenticated'); |
| |
| |
| enableProtectedButtons(); |
| } |
| |
| toggleDropdown() { |
| if (!this.isAuthenticated) return; |
| this.elements.authDropdown.classList.toggle('show'); |
| } |
| |
| showProfile() { |
| |
| this.elements.authDropdown.classList.remove('show'); |
| |
| const existingProfile = document.getElementById('profile-modal'); |
| if (existingProfile) { |
| existingProfile.remove(); |
| } |
| |
| const modal = document.createElement('div'); |
| modal.id = 'profile-modal'; |
| modal.className = 'profile-modal'; |
| modal.innerHTML = ` |
| <div class="profile-modal-content"> |
| <div class="profile-header"> |
| <div class="profile-avatar"> |
| ${this.currentUser.username.charAt(0).toUpperCase()} |
| </div> |
| <div class="profile-info"> |
| <h2>${this.currentUser.username}</h2> |
| <p>${this.currentUser.role}</p> |
| </div> |
| <button onclick="document.getElementById('profile-modal').remove();" class="profile-close">✕</button> |
| </div> |
| |
| <div class="profile-section"> |
| <h3>General Information</h3> |
| <div class="profile-field"> |
| <label>ชื่อผู้ใช้:</label> |
| <span>${this.currentUser.username}</span> |
| </div> |
| <div class="profile-field"> |
| <label>อีเมล:</label> |
| <span>${this.currentUser.email || 'ไม่มี'}</span> |
| </div> |
| <div class="profile-field"> |
| <label>บทบาท:</label> |
| <span>${this.currentUser.role}</span> |
| </div> |
| </div> |
| |
| <div class="profile-section"> |
| <h3>Permissions</h3> |
| <ul class="permission-list"> |
| ${this.currentUser.role === 'admin' ? ` |
| <li>✓ Manage all Plugins</li> |
| <li>✓ System Configuration</li> |
| <li>✓ View Reports</li> |
| <li>✓ Manage Users</li> |
| ` : this.currentUser.role === 'developer' ? ` |
| <li>✓ Install Plugins</li> |
| <li>✓ Edit Plugins</li> |
| <li>✓ View Reports</li> |
| <li>✗ Manage Users</li> |
| ` : ` |
| <li>✓ View Plugins</li> |
| <li>✓ View Reports</li> |
| <li>✗ Edit Plugins</li> |
| <li>✗ System Configuration</li> |
| `} |
| </ul> |
| </div> |
| |
| <div class="profile-actions"> |
| <button onclick="document.getElementById('profile-modal').remove();" class="btn-close-profile">ปิด</button> |
| </div> |
| </div> |
| `; |
| |
| document.body.appendChild(modal); |
| |
| |
| if (!document.getElementById('profile-modal-styles')) { |
| const styles = document.createElement('style'); |
| styles.id = 'profile-modal-styles'; |
| styles.textContent = ` |
| .profile-modal { |
| position: fixed; |
| top: 0; |
| left: 0; |
| width: 100%; |
| height: 100%; |
| background: rgba(0, 0, 0, 0.6); |
| display: flex; |
| align-items: center; |
| justify-content: center; |
| z-index: 10000; |
| animation: fadeIn 0.2s ease-out; |
| } |
| |
| @keyframes fadeIn { |
| from { opacity: 0; } |
| to { opacity: 1; } |
| } |
| |
| .profile-modal-content { |
| background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%); |
| border-radius: 12px; |
| padding: 30px; |
| max-width: 500px; |
| width: 90%; |
| box-shadow: 0 15px 50px rgba(0,0,0,0.4); |
| color: white; |
| } |
| |
| .profile-header { |
| display: flex; |
| align-items: center; |
| gap: 15px; |
| margin-bottom: 30px; |
| padding-bottom: 20px; |
| border-bottom: 2px solid rgba(255,255,255,0.2); |
| position: relative; |
| } |
| |
| .profile-avatar { |
| width: 70px; |
| height: 70px; |
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); |
| border-radius: 50%; |
| display: flex; |
| align-items: center; |
| justify-content: center; |
| font-size: 28px; |
| font-weight: bold; |
| } |
| |
| .profile-info { |
| flex: 1; |
| } |
| |
| .profile-info h2 { |
| margin: 0; |
| font-size: 20px; |
| } |
| |
| .profile-info p { |
| margin: 5px 0 0 0; |
| opacity: 0.8; |
| font-size: 14px; |
| } |
| |
| .profile-close { |
| position: absolute; |
| right: 0; |
| top: 0; |
| background: none; |
| border: none; |
| color: white; |
| font-size: 24px; |
| cursor: pointer; |
| opacity: 0.7; |
| } |
| |
| .profile-close:hover { |
| opacity: 1; |
| } |
| |
| .profile-section { |
| margin-bottom: 25px; |
| } |
| |
| .profile-section h3 { |
| margin: 0 0 15px 0; |
| font-size: 16px; |
| color: #a8d5ff; |
| border-bottom: 1px solid rgba(255,255,255,0.2); |
| padding-bottom: 10px; |
| } |
| |
| .profile-field { |
| display: flex; |
| justify-content: space-between; |
| align-items: center; |
| padding: 10px 0; |
| border-bottom: 1px solid rgba(255,255,255,0.1); |
| } |
| |
| .profile-field label { |
| font-weight: 500; |
| opacity: 0.8; |
| } |
| |
| .profile-field span { |
| background: rgba(255,255,255,0.1); |
| padding: 5px 12px; |
| border-radius: 4px; |
| font-family: monospace; |
| } |
| |
| .permission-list { |
| list-style: none; |
| padding: 0; |
| margin: 0; |
| } |
| |
| .permission-list li { |
| padding: 10px 0; |
| border-bottom: 1px solid rgba(255,255,255,0.1); |
| font-size: 14px; |
| } |
| |
| .permission-list li:last-child { |
| border-bottom: none; |
| } |
| |
| .profile-actions { |
| text-align: center; |
| margin-top: 25px; |
| } |
| |
| .btn-close-profile { |
| background: rgba(255,255,255,0.2); |
| color: white; |
| border: 2px solid white; |
| padding: 12px 30px; |
| border-radius: 6px; |
| cursor: pointer; |
| font-size: 14px; |
| font-weight: 500; |
| } |
| |
| .btn-close-profile:hover { |
| background: rgba(255,255,255,0.3); |
| } |
| `; |
| document.head.appendChild(styles); |
| } |
| } |
| |
| showPermissions() { |
| |
| this.elements.authDropdown.classList.remove('show'); |
| |
| const existingPermDialog = document.getElementById('perm-modal'); |
| if (existingPermDialog) { |
| existingPermDialog.remove(); |
| } |
| |
| const modal = document.createElement('div'); |
| modal.id = 'perm-modal'; |
| modal.className = 'permission-modal'; |
| modal.innerHTML = ` |
| <div class="permission-modal-content"> |
| <div class="perm-header"> |
| <h2> Permission Configuration</h2> |
| <button onclick="document.getElementById('perm-modal').remove();" class="perm-close">✕</button> |
| </div> |
| |
| <div class="perm-section"> |
| <h3>Role: ${this.currentUser.role}</h3> |
| <p>Current user has the following permissions:</p> |
| </div> |
| |
| <div class="perm-list"> |
| ${this.getCurrentPermissions().map(p => ` |
| <div class="perm-item"> |
| <span class="perm-check">✓</span> |
| <span class="perm-name">${p}</span> |
| </div> |
| `).join('')} |
| </div> |
| |
| <div class="perm-footer"> |
| <button onclick="document.getElementById('perm-modal').remove();" class="btn-close-perm">ปิด</button> |
| </div> |
| </div> |
| `; |
| |
| document.body.appendChild(modal); |
| |
| if (!document.getElementById('permission-modal-styles')) { |
| const styles = document.createElement('style'); |
| styles.id = 'permission-modal-styles'; |
| styles.textContent = ` |
| .permission-modal { |
| position: fixed; |
| top: 0; |
| left: 0; |
| width: 100%; |
| height: 100%; |
| background: rgba(0, 0, 0, 0.6); |
| display: flex; |
| align-items: center; |
| justify-content: center; |
| z-index: 10000; |
| } |
| |
| .permission-modal-content { |
| background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%); |
| border-radius: 12px; |
| padding: 30px; |
| max-width: 450px; |
| width: 90%; |
| box-shadow: 0 15px 50px rgba(0,0,0,0.4); |
| color: white; |
| } |
| |
| .perm-header { |
| display: flex; |
| justify-content: space-between; |
| align-items: center; |
| margin-bottom: 25px; |
| padding-bottom: 15px; |
| border-bottom: 2px solid rgba(255,255,255,0.2); |
| } |
| |
| .perm-header h2 { |
| margin: 0; |
| font-size: 20px; |
| } |
| |
| .perm-close { |
| background: none; |
| border: none; |
| color: white; |
| font-size: 24px; |
| cursor: pointer; |
| opacity: 0.7; |
| } |
| |
| .perm-close:hover { |
| opacity: 1; |
| } |
| |
| .perm-section { |
| margin-bottom: 20px; |
| } |
| |
| .perm-section h3 { |
| margin: 0 0 10px 0; |
| color: #a8d5ff; |
| } |
| |
| .perm-section p { |
| margin: 0; |
| opacity: 0.8; |
| font-size: 14px; |
| } |
| |
| .perm-list { |
| margin: 20px 0; |
| padding: 15px; |
| background: rgba(255,255,255,0.05); |
| border-radius: 8px; |
| } |
| |
| .perm-item { |
| display: flex; |
| align-items: center; |
| gap: 12px; |
| padding: 10px 0; |
| } |
| |
| .perm-check { |
| color: #4ade80; |
| font-weight: bold; |
| } |
| |
| .perm-name { |
| font-size: 14px; |
| } |
| |
| .perm-footer { |
| text-align: center; |
| margin-top: 25px; |
| } |
| |
| .btn-close-perm { |
| background: rgba(255,255,255,0.2); |
| color: white; |
| border: 2px solid white; |
| padding: 10px 25px; |
| border-radius: 6px; |
| cursor: pointer; |
| font-size: 14px; |
| } |
| |
| .btn-close-perm:hover { |
| background: rgba(255,255,255,0.3); |
| } |
| `; |
| document.head.appendChild(styles); |
| } |
| } |
| |
| getCurrentPermissions() { |
| const permissions = { |
| admin: [ |
| 'จัดการPluginทั้งหมด', |
| 'ตั้งค่าระบบและการกำหนดค่า', |
| 'ดูและส่งออกรายงาน', |
| 'จัดการบัญชีผู้ใช้', |
| 'เข้าถึงเดชบอร์ดผู้ดูแลระบบ' |
| ], |
| developer: [ |
| 'ติดตั้งPluginใหม่', |
| 'แก้ไขและอัปเดตPlugin', |
| 'เข้าถึงหน้าทดสอบ', |
| 'ดูรายงานการใช้งาน', |
| 'เข้าถึง API สำหรับการพัฒนา' |
| ], |
| user: [ |
| 'ดูPluginที่ติดตั้ง', |
| 'ดูรายงานพื้นฐาน', |
| 'เปลี่ยนรหัสผ่านส่วนตัว', |
| 'ดูข้อมูลโปรไฟล์' |
| ] |
| }; |
| return permissions[this.currentUser.role] || permissions.user; |
| } |
| |
| handlePermission(allowed) { |
| this.elements.permissionDialog.classList.remove('show'); |
| addTerminalLine(`Permission: ${allowed ? 'Granted' : 'Denied'}`, allowed ? "success" : "warn"); |
| } |
| |
| |
| isUserAuthenticated() { |
| return this.isAuthenticated; |
| } |
| |
| |
| getCurrentUser() { |
| return this.currentUser; |
| } |
| } |
| |
| |
| let authManager; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function checkAuthAndExecute(functionName, ...args) { |
| if (authManager && authManager.isUserAuthenticated()) { |
| |
| if (typeof window[functionName] === 'function') { |
| window[functionName](...args); |
| } |
| } else { |
| |
| if (window.authDialog) { |
| window.authDialog.show(); |
| } else { |
| |
| alert('กรุณาล็อกอินก่อนใช้งาน'); |
| } |
| } |
| } |
| |
| |
| |
| |
| function disableProtectedButtons() { |
| const protectedButtons = [ |
| 'scan-plugin-btn', |
| 'open-folder-btn', |
| 'generate-manifest-btn' |
| ]; |
| |
| protectedButtons.forEach(buttonId => { |
| const button = document.getElementById(buttonId); |
| if (button) { |
| button.style.opacity = '0.5'; |
| button.style.cursor = 'not-allowed'; |
| button.style.filter = 'grayscale(1)'; |
| } |
| }); |
| |
| |
| const pluginContainer = document.getElementById('plugin-container'); |
| if (pluginContainer) { |
| pluginContainer.style.opacity = '0.5'; |
| pluginContainer.style.filter = 'grayscale(1)'; |
| pluginContainer.innerHTML = ` |
| <div class="login-required-message"> |
| <div style="text-align: center; padding: 40px; color: #666;"> |
| <svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="margin-bottom: 16px;"> |
| <rect x="3" y="11" width="18" height="11" rx="2" ry="2"/> |
| <circle cx="12" cy="16" r="1"/> |
| <path d="M7 11V7a5 5 0 0 1 10 0v4"/> |
| </svg> |
| <h3 style="margin-bottom: 8px;">Sign in first to continue</h3> |
| <p style="color: #888;">Please sign in to access plugin management and project features</p> |
| <button onclick="authManager.startLogin()" style=" |
| margin-top: 16px; |
| padding: 8px 16px; |
| background: linear-gradient(135deg, #0ea5e9, #0284c7); |
| color: white; |
| border: none; |
| border-radius: 6px; |
| cursor: pointer; |
| font-weight: 600; |
| ">Sign In</button> |
| </div> |
| </div> |
| `; |
| } |
| } |
| |
| |
| |
| |
| function enableProtectedButtons() { |
| const protectedButtons = [ |
| 'scan-plugin-btn', |
| 'open-folder-btn', |
| 'generate-manifest-btn' |
| ]; |
| |
| protectedButtons.forEach(buttonId => { |
| const button = document.getElementById(buttonId); |
| if (button) { |
| button.style.opacity = '1'; |
| button.style.cursor = 'pointer'; |
| button.style.filter = 'none'; |
| } |
| }); |
| |
| |
| const pluginContainer = document.getElementById('plugin-container'); |
| if (pluginContainer) { |
| pluginContainer.style.opacity = '1'; |
| pluginContainer.style.filter = 'none'; |
| pluginContainer.innerHTML = '<div class="loading">Loading plugins...</div>'; |
| |
| setTimeout(() => { |
| scanAndRenderPlugins(); |
| }, 1000); |
| } |
| } |
| |
| document.addEventListener("DOMContentLoaded", () => { |
| |
| authManager = new AuthManager(); |
| |
| |
| const logPanel = document.getElementById("log-viewer"); |
| const storePanel = document.getElementById("store-webview"); |
| const originalSystem = document.getElementById("original-system"); |
| |
| const navPluginsBtn = document.getElementById("nav-plugins"); |
| const navStoreBtn = document.getElementById("nav-store-new"); |
| const refreshStoreBtn = document.getElementById("refresh-store-btn"); |
| |
| let isStoreLoaded = false; |
| |
| |
| |
| |
| function switchView(viewName) { |
| |
| logPanel.classList.remove("active"); |
| storePanel.classList.remove("active"); |
| navPluginsBtn.classList.remove("active"); |
| navStoreBtn.classList.remove("active"); |
| refreshStoreBtn.style.display = "none"; |
| |
| if (viewName === 'plugins') { |
| |
| logPanel.classList.add("active"); |
| navPluginsBtn.classList.add("active"); |
| addTerminalLine("Showing My Plugins management page", "info"); |
| } else if (viewName === 'store') { |
| |
| storePanel.classList.add("active"); |
| navStoreBtn.classList.add("active"); |
| refreshStoreBtn.style.display = "block"; |
| addTerminalLine("Opening Chahua Plugin Store...", "info"); |
| |
| |
| if (!isStoreLoaded) { |
| let storeUrl = "https://chahuadev.com/index.html"; |
| storePanel.src = storeUrl; |
| isStoreLoaded = true; |
| } |
| } |
| } |
| |
| |
| navPluginsBtn.addEventListener('click', () => switchView('plugins')); |
| navStoreBtn.addEventListener('click', () => switchView('store')); |
| |
| refreshStoreBtn.addEventListener('click', () => { |
| if (storePanel.classList.contains('active')) { |
| addTerminalLine("Refreshing store...", "command"); |
| storePanel.reload(); |
| } |
| }); |
| |
| |
| switchView('plugins'); |
| |
| |
| setTimeout(() => { |
| |
| if (!authManager || !authManager.isUserAuthenticated()) { |
| disableProtectedButtons(); |
| } |
| }, 500); |
| }); |
| </script> |
|
|
| |
| <div id="permission-dialog" class="permission-dialog"> |
| <div class="permission-dialog-content"> |
| <div class="permission-dialog-header"> |
| <h3>Plugin Access Control</h3> |
| </div> |
| <div class="permission-dialog-body"> |
| <p id="permission-plugin-name">Plugin ต้องการอนุญาตการเข้าถึงข้อมูลต่อไปนี้:</p> |
| <ul id="permission-list" class="permission-list"> |
| |
| </ul> |
| </div> |
| <div class="permission-dialog-actions"> |
| <button id="permission-deny" class="btn-permission">ปฏิเสธ</button> |
| <button id="permission-allow" class="btn-permission primary">อนุญาต</button> |
| </div> |
| </div> |
| </div> |
| <script> |
| |
| function switchTopPage(page) { |
| if (page === 'chat' && window.isDev) { |
| page = 'home'; |
| } |
| |
| var homeWrap = document.getElementById('home-wv-wrap'); |
| var chatWrap = document.getElementById('chat-wv-wrap'); |
| var ontHome = document.getElementById('ont-home'); |
| var ontApp = document.getElementById('ont-app'); |
| var ontChat = document.getElementById('ont-chat'); |
| |
| |
| homeWrap.classList.remove('visible'); |
| if (chatWrap) chatWrap.classList.remove('visible'); |
| ontHome.classList.remove('active'); |
| ontApp.classList.remove('active'); |
| if (ontChat) ontChat.classList.remove('active'); |
| |
| if (page === 'home') { |
| homeWrap.classList.add('visible'); |
| ontHome.classList.add('active'); |
| } else if (page === 'chat') { |
| if (chatWrap) chatWrap.classList.add('visible'); |
| if (ontChat) ontChat.classList.add('active'); |
| } else { |
| ontApp.classList.add('active'); |
| } |
| } |
| |
| |
| (function applyChatModePolicy() { |
| if (!window.isDev) return; |
| var chatTab = document.getElementById('ont-chat'); |
| var chatWrap = document.getElementById('chat-wv-wrap'); |
| if (chatTab) chatTab.style.display = 'none'; |
| if (chatWrap) chatWrap.classList.remove('visible'); |
| })(); |
| </script> |
| </body> |
| </html> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|