Initial commit (without build artifacts)

This commit is contained in:
2025-12-28 21:36:50 +13:00
parent 8843185fd6
commit 21da448e8f
9 changed files with 193 additions and 228 deletions
+24
View File
@@ -86,3 +86,27 @@ typings/
site-history.json site-history.json
bookmarks.json bookmarks.json
bookmarks.backup.json bookmarks.backup.json
# AppImage / SteamOS
squashfs-root/
*.AppImage
# Electron build output
dist/
build/
out/
release/
# Native binaries
nebula
nebula.exe
# Node/Electron
node_modules/
# Logs
*.log
# Build artifacts
nebula-appdir/
*.asar
-101
View File
@@ -1,101 +0,0 @@
# GPU Fix Guide for Nebula Browser
## Common GPU Issues
Nebula Browser is an Electron-based application that uses Chromium's rendering engine. Some systems may experience GPU-related issues such as:
- Black/blank screens
- Webviews not loading content
- Flickering or visual artifacts
- Application crashes
## SteamOS / Steam Deck
### Symptoms
On SteamOS (Steam Deck), you may see:
- Browser chrome loads (tab bar, URL bar visible)
- Web page content area is completely black/empty
- No error messages visible
### Cause
This is caused by GPU compositing conflicts between Electron's Chromium renderer and Gamescope (Steam Deck's compositor). The AMD GPU in Steam Deck handles nested compositor contexts differently.
### Solution
**Option 1: Automatic Detection (Recommended)**
The latest version of Nebula automatically detects SteamOS/Gamescope and applies the necessary fixes. Simply update to the latest version.
**Option 2: Manual Launch Script**
Use the provided `start-steamos.sh` script:
```bash
chmod +x start-steamos.sh
./start-steamos.sh
```
**Option 3: Command-line Flags**
If running manually, add these flags:
```bash
electron . --ozone-platform=x11 --disable-gpu-compositing --disable-gpu-vsync --no-sandbox --disable-dev-shm-usage
```
**Option 4: Environment Variable**
Set the `ELECTRON_OZONE_PLATFORM_HINT` environment variable:
```bash
export ELECTRON_OZONE_PLATFORM_HINT=x11
npm start
```
## Linux (General)
### Wayland
If running on a Wayland compositor (GNOME Wayland, KDE Wayland, Sway, etc.):
```bash
electron . --ozone-platform=wayland --enable-features=UseOzonePlatform,WaylandWindowDecorations
```
### X11
For X11 sessions:
```bash
electron . --ozone-platform=x11
```
### NVIDIA GPUs
If using NVIDIA proprietary drivers:
```bash
electron . --disable-gpu-sandbox --no-sandbox
```
## Windows
### Intel/AMD Integrated Graphics Issues
If experiencing blank screens on Windows with integrated graphics:
1. Try running with `start-gpu-safe.bat`
2. Update your graphics drivers
3. Disable hardware acceleration in settings (if available)
### Multiple GPU Systems
On laptops with both integrated and discrete GPUs:
- Right-click the Nebula shortcut
- Select "Run with graphics processor"
- Choose your dedicated GPU
## macOS
macOS typically has fewer GPU issues, but if problems occur:
```bash
electron . --disable-gpu
```
## Diagnostic Information
To see GPU information and diagnostics:
1. Open Nebula Browser
2. Navigate to `nebula://gpu` or `chrome://gpu`
3. Check the "Graphics Feature Status" section
## Reporting Issues
If none of the above solutions work, please report the issue with:
1. Operating system and version
2. GPU model and driver version
3. Contents of `chrome://gpu` page
4. Any error messages from terminal/console
+44
View File
@@ -0,0 +1,44 @@
Converting extracted AppImage (`squashfs-root`) into a distributable AppDir for Steam
If your environment lacks `rsync`, use `cp -a` to copy the extracted AppImage into a clean AppDir and prepare it for upload to Steam.
1) Copy the extracted AppImage to an AppDir folder
```bash
cp -a squashfs-root/ nebula-appdir
```
2) Unpack `app.asar` to edit or include app sources (optional; requires `npx asar`)
```bash
cd nebula-appdir/resources
npx asar extract app.asar app
# keep a backup if you want
mv app app.orig && rm app.asar
cd ../../
```
3) Add/verify launcher (we added `nebula-appdir/Nebula`):
```bash
chmod +x nebula-appdir/Nebula
```
Run locally:
```bash
cd nebula-appdir
./Nebula
```
4) Ensure binary & permissions are correct
```bash
chmod +x nebula-appdir/nebula
```
5) Package or upload to Steam
- Create a tarball to upload as game files, or upload the AppDir contents as the depot.
```bash
tar -czf nebula-appdir.tar.gz -C nebula-appdir .
```
- In Steamworks, set the launch command to `./Nebula` (or `./nebula`).
Notes
- `--no-sandbox` reduces Chromium sandboxing; prefer fixing `chrome-sandbox` and enabling sandboxing when possible.
- Using the AppDir avoids AppImage/FUSE dependency on target systems.
- Test on a clean SteamOS/Deck image before publishing.
+19 -92
View File
@@ -5,36 +5,6 @@ class GPUConfig {
constructor() { constructor() {
this.isGPUSupported = false; this.isGPUSupported = false;
this.fallbackApplied = false; this.fallbackApplied = false;
this.isSteamOS = false;
this.isLinux = process.platform === 'linux';
}
// Detect if running on SteamOS/Steam Deck
detectSteamOS() {
if (!this.isLinux) return false;
try {
const fs = require('fs');
// Check for SteamOS identifiers
if (fs.existsSync('/etc/steamos-release')) return true;
if (fs.existsSync('/usr/share/steamos/steamos.conf')) return true;
// Check os-release for SteamOS
if (fs.existsSync('/etc/os-release')) {
const osRelease = fs.readFileSync('/etc/os-release', 'utf8');
if (osRelease.includes('SteamOS') || osRelease.includes('steamos')) return true;
}
// Check if running under Gamescope (Steam Deck's compositor)
if (process.env.GAMESCOPE_WAYLAND_DISPLAY || process.env.SteamDeck) return true;
// Check for Steam runtime environment
if (process.env.STEAM_RUNTIME || process.env.SteamAppId) return true;
} catch (err) {
console.log('SteamOS detection error:', err.message);
}
return false;
} }
// Apply GPU configuration based on system capabilities // Apply GPU configuration based on system capabilities
@@ -45,62 +15,22 @@ class GPUConfig {
const platform = process.platform; const platform = process.platform;
const arch = process.arch; const arch = process.arch;
this.isSteamOS = this.detectSteamOS(); console.log(`Platform: ${platform}, Architecture: ${arch}`);
console.log(`Platform: ${platform}, Architecture: ${arch}, SteamOS: ${this.isSteamOS}`);
// Apply Linux/SteamOS specific configuration FIRST (before app ready)
if (this.isLinux) {
this.applyLinuxSettings();
}
// Start with conservative settings that usually work // Start with conservative settings that usually work
this.applyConservativeSettings(); this.applyConservativeSettings();
// Try to enable GPU features progressively // On Linux/SteamOS, force disable GPU and sandbox to ensure webview stability
this.tryEnableGPU(); if (platform === 'linux') {
} console.log('Linux detected: Disabling GPU and enforcing no-sandbox');
app.commandLine.appendSwitch('disable-gpu');
// Linux-specific settings for proper rendering app.commandLine.appendSwitch('no-sandbox');
applyLinuxSettings() { this.fallbackApplied = true;
console.log('Applying Linux-specific GPU settings...'); return;
// Ozone platform selection - critical for rendering on Linux
// Check for Wayland vs X11 environment
const waylandDisplay = process.env.WAYLAND_DISPLAY;
const gamescope = process.env.GAMESCOPE_WAYLAND_DISPLAY;
const x11Display = process.env.DISPLAY;
if (this.isSteamOS || gamescope) {
// SteamOS/Gamescope: Force X11 backend for better compatibility
// Gamescope provides X11 compatibility layer that works better with Electron
console.log('SteamOS/Gamescope detected - using X11 Ozone backend');
app.commandLine.appendSwitch('ozone-platform', 'x11');
// Disable GPU compositing issues on Steam Deck AMD GPU
app.commandLine.appendSwitch('disable-gpu-compositing');
app.commandLine.appendSwitch('disable-gpu-vsync');
// Use software rendering for webviews if needed
app.commandLine.appendSwitch('disable-accelerated-2d-canvas');
// Fix for AMD GPU rendering issues
app.commandLine.appendSwitch('use-gl', 'desktop');
app.commandLine.appendSwitch('enable-features', 'UseOzonePlatform');
} else if (waylandDisplay && !x11Display) {
// Pure Wayland environment
console.log('Wayland detected - using Wayland Ozone backend');
app.commandLine.appendSwitch('ozone-platform', 'wayland');
app.commandLine.appendSwitch('enable-features', 'UseOzonePlatform,WaylandWindowDecorations');
} else if (x11Display) {
// X11 environment
console.log('X11 detected - using X11 Ozone backend');
app.commandLine.appendSwitch('ozone-platform', 'x11');
} }
// Common Linux fixes // Try to enable GPU features progressively
app.commandLine.appendSwitch('disable-features', 'VizDisplayCompositor'); this.tryEnableGPU();
app.commandLine.appendSwitch('enable-unsafe-swiftshader');
} }
applyConservativeSettings() { applyConservativeSettings() {
@@ -119,26 +49,23 @@ class GPUConfig {
tryEnableGPU() { tryEnableGPU() {
try { try {
// Skip aggressive GPU features on SteamOS - they conflict with Gamescope
if (this.isSteamOS) {
console.log('SteamOS detected - skipping aggressive GPU acceleration');
return;
}
// GPU acceleration switches // GPU acceleration switches
app.commandLine.appendSwitch('ignore-gpu-blacklist'); app.commandLine.appendSwitch('ignore-gpu-blacklist');
app.commandLine.appendSwitch('ignore-gpu-blocklist'); app.commandLine.appendSwitch('ignore-gpu-blocklist');
app.commandLine.appendSwitch('enable-gpu-rasterization');
app.commandLine.appendSwitch('enable-zero-copy'); // On Linux/SteamOS, these aggressive flags can cause webview rendering issues (black screen)
// We disable them for Linux to ensure stability
if (process.platform !== 'linux') {
app.commandLine.appendSwitch('enable-gpu-rasterization');
app.commandLine.appendSwitch('enable-zero-copy');
}
// Video acceleration (usually safer than full GPU) // Video acceleration (usually safer than full GPU)
app.commandLine.appendSwitch('enable-accelerated-video-decode'); app.commandLine.appendSwitch('enable-accelerated-video-decode');
app.commandLine.appendSwitch('enable-accelerated-mjpeg-decode'); app.commandLine.appendSwitch('enable-accelerated-mjpeg-decode');
// Conservative feature enabling - skip on Linux to avoid conflicts // Conservative feature enabling
if (!this.isLinux) { app.commandLine.appendSwitch('enable-features', 'VaapiVideoDecoder');
app.commandLine.appendSwitch('enable-features', 'VaapiVideoDecoder');
}
console.log('GPU acceleration switches applied'); console.log('GPU acceleration switches applied');
} catch (err) { } catch (err) {
+59
View File
@@ -0,0 +1,59 @@
#!/usr/bin/env bash
# Assemble nebula-appdir from extracted squashfs-root
set -euo pipefail
SRC="${1:-squashfs-root}"
DEST="${2:-nebula-appdir}"
if [ ! -d "$SRC" ]; then
echo "Source $SRC not found. Extract the AppImage first (./dist/Nebula-*.AppImage --appimage-extract)"
exit 1
fi
# Copy extracted contents into DEST
mkdir -p "$DEST"
cp -a "$SRC/." "$DEST/"
# Ensure launcher/binary exist
if [ -f "$DEST/run-nebula.sh" ]; then
mv "$DEST/run-nebula.sh" "$DEST/Nebula" 2>/dev/null || true
fi
chmod +x "$DEST/Nebula" || true
# Ensure directories for icons and desktop entries
mkdir -p "$DEST/usr/share/icons/hicolor/256x256/apps"
mkdir -p "$DEST/usr/share/applications"
# Copy icon if present at top level of extracted AppImage
if [ -f "$SRC/nebula.png" ]; then
cp "$SRC/nebula.png" "$DEST/usr/share/icons/hicolor/256x256/apps/nebula.png"
fi
# Also embed project icon if present in repo assets
PROJECT_ICON="$(cd "$(dirname "$0")" && pwd)/assets/images/Logos/Nebula-Favicon.png"
if [ -f "$PROJECT_ICON" ]; then
echo "Embedding project icon into AppDir: $PROJECT_ICON"
cp "$PROJECT_ICON" "$DEST/usr/share/icons/hicolor/256x256/apps/nebula.png"
fi
# Install desktop file into AppDir
if [ -f "$DEST/nebula.desktop" ]; then
cp "$DEST/nebula.desktop" "$DEST/usr/share/applications/nebula.desktop"
else
cat > "$DEST/usr/share/applications/nebula.desktop" <<'EOF'
[Desktop Entry]
Name=Nebula
Comment=Nebula Browser
Exec=./Nebula %U
Terminal=false
Type=Application
Icon=nebula
Categories=Network;WebBrowser;
StartupWMClass=Nebula
EOF
fi
# Fix permissions
chmod -R a+r "$DEST/usr/share/icons/hicolor/256x256/apps" || true
chmod +x "$DEST/Nebula" || true
echo "AppDir assembled at $DEST. Run with: $DEST/Nebula"
+2 -2
View File
@@ -5,8 +5,8 @@
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {
"start": "electron .", "start": "electron .",
"start:steamos": "electron . --ozone-platform=x11 --disable-gpu-compositing --disable-gpu-vsync --no-sandbox --disable-dev-shm-usage --disable-features=VizDisplayCompositor", "start:dev": "electron . --no-sandbox --disable-gpu",
"start:linux-safe": "electron . --disable-gpu --disable-gpu-compositing --no-sandbox", "start:linux": "electron . --no-sandbox",
"dist": "electron-builder", "dist": "electron-builder",
"run": "electron ." "run": "electron ."
}, },
+27
View File
@@ -1,5 +1,11 @@
// preload.js - Optimized version // preload.js - Optimized version
const { contextBridge, ipcRenderer } = require('electron'); const { contextBridge, ipcRenderer } = require('electron');
let pathModule;
try {
pathModule = require('path');
} catch (err) {
pathModule = null;
}
// Cache DOM references for performance // Cache DOM references for performance
let domReady = false; let domReady = false;
@@ -75,6 +81,27 @@ const electronAPI = {
saveImageFromNet: async (url) => ipcRenderer.invoke('save-image-from-url', { url }) saveImageFromNet: async (url) => ipcRenderer.invoke('save-image-from-url', { url })
}; };
// Provide absolute path to the renderer preload for webview guests so
// webview `preload` attributes use an absolute, resolvable path on all platforms.
const webviewPreloadAbsolutePath = pathModule ? pathModule.join(__dirname, 'preload.js') : null;
electronAPI.getWebviewPreloadPath = () => webviewPreloadAbsolutePath;
// Fixup any static <webview preload="..."> attributes in the DOM early so
// guests receive an absolute path instead of a relative one that may fail
// to resolve inside the guest process.
window.addEventListener('DOMContentLoaded', () => {
try {
if (webviewPreloadAbsolutePath) {
const els = document.querySelectorAll('webview[preload]');
for (const el of els) {
try { el.setAttribute('preload', webviewPreloadAbsolutePath); } catch {};
}
}
} catch (e) {
// non-fatal
}
});
// Cache for bookmarks to reduce IPC calls // Cache for bookmarks to reduce IPC calls
let bookmarksCache = null; let bookmarksCache = null;
let bookmarksCacheTime = 0; let bookmarksCacheTime = 0;
+18 -2
View File
@@ -368,7 +368,16 @@ function createTab(inputUrl) {
webview.src = resolvedUrl; webview.src = resolvedUrl;
webview.setAttribute('allowpopups', ''); webview.setAttribute('allowpopups', '');
webview.setAttribute('partition', 'persist:main'); webview.setAttribute('partition', 'persist:main');
webview.setAttribute('preload', '../preload.js'); // Use absolute preload path provided by the main-window preload to ensure
// the guest process can resolve the file (important on Linux/SteamOS).
try {
const preloadPath = (window.electronAPI && typeof window.electronAPI.getWebviewPreloadPath === 'function')
? window.electronAPI.getWebviewPreloadPath()
: '../preload.js';
webview.setAttribute('preload', preloadPath);
} catch (e) {
webview.setAttribute('preload', '../preload.js');
}
// Add attributes needed for Google OAuth and sign-in flows // Add attributes needed for Google OAuth and sign-in flows
webview.setAttribute('webpreferences', 'allowRunningInsecureContent=false,javascript=true,webSecurity=true'); webview.setAttribute('webpreferences', 'allowRunningInsecureContent=false,javascript=true,webSecurity=true');
try { try {
@@ -667,7 +676,14 @@ function convertHomeTabToWebview(tabId, inputUrl, resolvedUrl) {
webview.src = resolvedUrl; webview.src = resolvedUrl;
webview.setAttribute('allowpopups', ''); webview.setAttribute('allowpopups', '');
webview.setAttribute('partition', 'persist:main'); webview.setAttribute('partition', 'persist:main');
webview.setAttribute('preload', '../preload.js'); try {
const preloadPath = (window.electronAPI && typeof window.electronAPI.getWebviewPreloadPath === 'function')
? window.electronAPI.getWebviewPreloadPath()
: '../preload.js';
webview.setAttribute('preload', preloadPath);
} catch (e) {
webview.setAttribute('preload', '../preload.js');
}
// Add attributes needed for Google OAuth and sign-in flows // Add attributes needed for Google OAuth and sign-in flows
webview.setAttribute('webpreferences', 'allowRunningInsecureContent=false,javascript=true,webSecurity=true'); webview.setAttribute('webpreferences', 'allowRunningInsecureContent=false,javascript=true,webSecurity=true');
try { try {
-31
View File
@@ -1,31 +0,0 @@
#!/bin/bash
# SteamOS/Steam Deck launch script for Nebula Browser
# This script applies necessary flags for proper rendering on SteamOS/Gamescope
# Detect if running on SteamOS
if [ -f /etc/steamos-release ] || [ -f /usr/share/steamos/steamos.conf ]; then
echo "SteamOS detected"
fi
# Detect if running under Gamescope (Steam Deck's compositor)
if [ -n "$GAMESCOPE_WAYLAND_DISPLAY" ] || [ -n "$SteamDeck" ]; then
echo "Gamescope/Steam Deck environment detected"
fi
# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Launch Nebula with SteamOS-compatible flags
# These flags help with webview rendering issues on AMD GPUs under Gamescope
exec electron "$SCRIPT_DIR" \
--ozone-platform=x11 \
--disable-gpu-compositing \
--disable-gpu-vsync \
--disable-accelerated-2d-canvas \
--use-gl=desktop \
--no-sandbox \
--disable-dev-shm-usage \
--disable-gpu-sandbox \
--disable-features=VizDisplayCompositor \
--enable-unsafe-swiftshader \
"$@"