diff --git a/src/main/main.js b/src/main/main.js index 6fdec28..440384e 100644 --- a/src/main/main.js +++ b/src/main/main.js @@ -12,8 +12,6 @@ const ROOT = path.join(__dirname, '..', '..'); const PRELOAD = path.join(__dirname, '..', 'preload'); const RENDERER = path.join(__dirname, '..', 'renderer'); const SETTINGS = path.join(__dirname, '..', 'settings'); -const SETUP = path.join(__dirname, '..', 'setup'); -const SETUP_PRELOAD = path.join(__dirname, '..', 'preload', 'preload-setup.js'); // Settings store (will be initialized when app is ready) const store = new SimpleStore({ @@ -29,9 +27,6 @@ const store = new SimpleStore({ // Settings window reference let settingsWindow = null; -// Setup window reference -let setupWindow = null; - // BrowserView reference (for reset functionality) let mainBrowserView = null; @@ -341,14 +336,7 @@ function createWindow() { }); // Get the saved stream URL - const streamUrl = store ? store.get('streamUrl') : null; - if (!streamUrl) { - createSetupWindow(); - return; - } - - const fullUrl = - streamUrl.startsWith('http://') || streamUrl.startsWith('https://') ? streamUrl : `https://${streamUrl}/`; + const fullUrl = 'https://pstream.net'; view.webContents.loadURL(fullUrl); // Show error page when the main document fails to load (e.g. no connection, DNS) @@ -1002,46 +990,6 @@ function openSettingsWindow(parentWindow = null) { }); } -function createSetupWindow() { - if (setupWindow) { - setupWindow.focus(); - return; - } - - const platform = process.env.PLATFORM_OVERRIDE || process.platform; - const isMac = platform === 'darwin'; - const iconPath = path.join(ROOT, isMac ? 'app.icns' : 'logo.png'); - - setupWindow = new BrowserWindow({ - width: 600, - height: 400, - minWidth: 400, - minHeight: 300, - resizable: false, - autoHideMenuBar: true, - backgroundColor: '#1f2025', - icon: iconPath, - webPreferences: { - nodeIntegration: false, - contextIsolation: true, - preload: SETUP_PRELOAD, - }, - title: 'P-Stream Setup', - show: false, - }); - - setupWindow.setMenu(null); - setupWindow.loadFile(path.join(SETUP, 'setup.html')); - - setupWindow.once('ready-to-show', () => { - setupWindow.show(); - }); - - setupWindow.on('closed', () => { - setupWindow = null; - }); -} - // Auto-updater configuration autoUpdater.autoDownload = false; // Don't auto-download, users download manually autoUpdater.autoInstallOnAppQuit = false; // Don't auto-install, users install manually @@ -1690,47 +1638,6 @@ ipcMain.handle('set-stream-url', async (event, url) => { return true; }); -// IPC handler for saving the domain from the setup window -ipcMain.handle('save-domain', async (event, domain) => { - try { - if (!store) { - throw new Error('Settings store not available'); - } - - let normalizedDomain = domain.trim(); - - if (!normalizedDomain || normalizedDomain.length === 0) { - throw new Error('Domain cannot be empty'); - } - - // Basic validation: ensure it looks like a domain or IP - if (!normalizedDomain.includes('.') && !normalizedDomain.match(/^\d{1,3}(\.\d{1,3}){3}$/)) { - throw new Error('Please enter a valid domain or IP address (e.g., pstream.example.com or 192.168.1.1)'); - } - - store.set('streamUrl', normalizedDomain); - - // Close the setup window - if (setupWindow) { - setupWindow.close(); - } - - // Load the stream URL into the main BrowserView - if (mainBrowserView && mainBrowserView.webContents) { - const fullUrl = - normalizedDomain.startsWith('http://') || normalizedDomain.startsWith('https://') - ? normalizedDomain - : `https://${normalizedDomain}/`; - mainBrowserView.webContents.loadURL(fullUrl); - } - - return { success: true }; - } catch (error) { - console.error('Failed to save domain:', error); - return { success: false, error: error.message }; - } -}); - // IPC handler for resetting the app ipcMain.handle('reset-app', async () => { try { @@ -1830,9 +1737,11 @@ ipcMain.handle('reload-stream-page', () => { if (!mainBrowserView || !mainBrowserView.webContents) return; const streamUrl = store ? store.get('streamUrl') : null; if (!streamUrl) { - mainBrowserView.webContents.loadFile(path.join(SETUP, 'setup.html')); + const fullUrl = 'https://pstream.net'; + mainBrowserView.webContents.loadURL(fullUrl); return; } + const fullUrl = streamUrl.startsWith('http://') || streamUrl.startsWith('https://') ? streamUrl : `https://${streamUrl}/`; mainBrowserView.webContents.loadURL(fullUrl); diff --git a/src/setup/setup.css b/src/setup/setup.css deleted file mode 100644 index 4a5d8e1..0000000 --- a/src/setup/setup.css +++ /dev/null @@ -1,102 +0,0 @@ -:root { - --bg-main: #030303; - --bg-card: #0d0d0d; - --text-primary: #ffffff; - --text-secondary: #868686; - --accent: #8288fe; - --border: #2e2e2e; - --danger: #e44f4f; -} - -* { - margin: 0; - padding: 0; - box-sizing: border-box; -} - -body { - font-family: 'DM Sans', sans-serif; - background-color: var(--bg-main); - color: var(--text-primary); - padding: 40px; - min-height: 100vh; - -webkit-font-smoothing: antialiased; - overflow-x: hidden; - display: flex; - justify-content: center; - align-items: center; -} - -.container { - width: 100%; - max-width: 400px; - padding: 24px; - text-align: center; -} - -h1 { - font-size: 24px; - font-weight: 700; - color: var(--text-primary); - margin-bottom: 12px; -} - -p { - font-size: 14px; - color: var(--text-secondary); - line-height: 1.4; - margin-bottom: 24px; -} - -.form { - display: flex; - flex-direction: column; - gap: 12px; -} - -#domain-input { - padding: 12px 16px; - background: var(--bg-card); - border: 1px solid var(--border); - border-radius: 6px; - color: var(--text-primary); - font-size: 16px; - font-family: inherit; - transition: border-color 0.2s; -} - -#domain-input:focus { - outline: none; - border-color: var(--accent); -} - -#domain-input::placeholder { - color: var(--text-secondary); -} - -#save-button { - padding: 12px 16px; - background: var(--accent); - color: #ffffff; - border: none; - border-radius: 6px; - font-size: 16px; - font-weight: 500; - cursor: pointer; - transition: background-color 0.2s; -} - -#save-button:hover { - background: #6c72d8; -} - -#save-button:active { - background: #585ed0; -} - -.error { - color: var(--danger); - font-size: 14px; - margin-top: 12px; - min-height: 20px; -} diff --git a/src/setup/setup.html b/src/setup/setup.html deleted file mode 100644 index e12c8d7..0000000 --- a/src/setup/setup.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - P-Stream Setup - - - - -
-

P-Stream Setup

-

Please enter the domain or IP address of your self-hosted P-Stream server.

-
- - -
-

-
- - - diff --git a/src/setup/setup.js b/src/setup/setup.js deleted file mode 100644 index 997f5cc..0000000 --- a/src/setup/setup.js +++ /dev/null @@ -1,20 +0,0 @@ -/* eslint-env browser */ -document.addEventListener('DOMContentLoaded', () => { - const domainInput = document.getElementById('domain-input'); - const saveButton = document.getElementById('save-button'); - const errorMessage = document.getElementById('error-message'); - - saveButton.addEventListener('click', async () => { - const domain = domainInput.value.trim(); - if (!domain) { - errorMessage.textContent = 'Please enter a domain.'; - return; - } - - try { - await window.__PSTREAM_SETUP__.saveDomain(domain); - } catch (error) { - errorMessage.textContent = error.message; - } - }); -});