Prefer usr/user-data for portable data

Rename and consolidate portable user-data to usr/user-data and update tooling and runtime to match. Updated appdir-example/run-nebula.sh to point at usr/user-data; make-appdir.sh and update-appdir.sh now patch/copy the launcher, create the usr/user-data directory and set secure permissions (mkdir -p, chmod 700), and remove sed backups. portable-data.js now defaults to app-local user-data and prefers <AppDir>/usr/user-data on Linux AppDir builds (with safe fs checks). Also minor UI change in renderer/setup.css to make the footer background transparent and disable the backdrop blur.
This commit is contained in:
2026-02-19 17:33:26 +13:00
parent 0137df60dd
commit 618ea7d12d
5 changed files with 36 additions and 18 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
#!/bin/bash
# Run Nebula with portable data storage
# User data (cookies, history, bookmarks) is stored in usr/data/ alongside the app.
# User data (cookies, history, bookmarks) is stored in usr/user-data/ alongside the app.
set -e
HERE="$(cd "$(dirname "$0")" && pwd)"
@@ -11,7 +11,7 @@ export LD_LIBRARY_PATH="$HERE/usr/lib:$HERE/usr/lib64:$LD_LIBRARY_PATH"
# --- PORTABLE DATA CONFIGURATION ---
# Store user data in a local folder for portable operation
PORTABLE_DATA_DIR="$HERE/usr/data"
PORTABLE_DATA_DIR="$HERE/usr/user-data"
export NEBULA_PORTABLE=1
export NEBULA_PORTABLE_PATH="$PORTABLE_DATA_DIR"
+3
View File
@@ -67,6 +67,7 @@ fi
# Copy Linux launch wrappers if present in appdir-example
if [ -f "$SCRIPT_DIR/appdir-example/run-nebula.sh" ]; then
cp "$SCRIPT_DIR/appdir-example/run-nebula.sh" "$DEST/run-nebula.sh"
sed -i.bak 's|usr/data|usr/user-data|g' "$DEST/run-nebula.sh" && rm -f "$DEST/run-nebula.sh.bak"
chmod +x "$DEST/run-nebula.sh" || true
fi
if [ -f "$SCRIPT_DIR/appdir-example/steam_appid.txt" ]; then
@@ -93,6 +94,8 @@ fi
# Fix permissions
chmod -R a+r "$DEST/usr/share/icons/hicolor/256x256/apps" || true
chmod +x "$DEST/Nebula" "$DEST/Nebula-Desktop" "$DEST/Nebula-Controller" || true
mkdir -p "$DEST/usr/user-data"
chmod 700 "$DEST/usr/user-data" || true
echo "AppDir assembled at $DEST."
echo " Desktop mode: $DEST/Nebula-Desktop"
+18 -14
View File
@@ -85,8 +85,8 @@ class PortableDataManager {
/**
* Get the portable data directory path
* Uses NEBULA_PORTABLE_PATH if set, otherwise creates 'user-data' in Documents/My Games/<AppName>
* with a safe fallback to the app directory.
* Uses NEBULA_PORTABLE_PATH if set, otherwise creates app-local 'user-data'.
* Linux AppDir builds prefer 'usr/user-data' to keep writable data inside AppDir.
*/
getPortableDataPath() {
if (this._portableDataPath !== null) {
@@ -111,19 +111,23 @@ class PortableDataManager {
}
}
// Default: prefer Documents/My Games/<AppName>/user-data
let dataPath = '';
try {
const docsDir = app.getPath('documents');
const appName = app.getName() || 'NebulaBrowser';
dataPath = path.join(docsDir, 'My Games', appName, 'user-data');
} catch (err) {
console.warn('[Portable] Failed to resolve Documents path, using app directory');
}
if (!dataPath) {
// Default: app-local user data
// - Windows: beside the executable
// - macOS: inside .app Contents (portable bundle)
// - Linux AppDir: <AppDir>/usr/user-data
// - Other Linux/dev: beside the app root
const appRoot = this._getAppRootDir();
dataPath = path.join(appRoot, 'user-data');
let dataPath = path.join(appRoot, 'user-data');
if (process.platform === 'linux') {
const appDirUsr = path.join(appRoot, 'usr');
try {
if (fs.existsSync(appDirUsr) && fs.statSync(appDirUsr).isDirectory()) {
dataPath = path.join(appDirUsr, 'user-data');
}
} catch (err) {
console.warn('[Portable] Could not inspect Linux AppDir usr path, using app root user-data');
}
}
// Validate the path
+2 -2
View File
@@ -531,8 +531,8 @@ body, html {
padding-bottom: 1rem;
position: sticky;
bottom: 0;
background: linear-gradient(180deg, rgba(18, 20, 24, 0), rgba(18, 20, 24, 0.85) 45%, rgba(18, 20, 24, 0.95));
backdrop-filter: blur(6px);
background: transparent;
backdrop-filter: none;
}
.btn {
+11
View File
@@ -84,6 +84,12 @@ done
# Update main launcher scripts if present
echo ""
echo "🔄 Syncing launcher scripts..."
if [ -f "$SCRIPT_DIR/appdir-example/run-nebula.sh" ]; then
cp "$SCRIPT_DIR/appdir-example/run-nebula.sh" "$APPDIR_ROOT/run-nebula.sh"
sed -i.bak 's|usr/data|usr/user-data|g' "$APPDIR_ROOT/run-nebula.sh" && rm -f "$APPDIR_ROOT/run-nebula.sh.bak"
chmod +x "$APPDIR_ROOT/run-nebula.sh" || true
echo " ✓ run-nebula.sh"
fi
for launcher in "Nebula-Desktop" "Nebula-Controller"; do
if [ -f "$SCRIPT_DIR/nebula-appdir/$launcher" ]; then
cp "$SCRIPT_DIR/nebula-appdir/$launcher" "$APPDIR_ROOT/$launcher"
@@ -116,6 +122,11 @@ for dir in "${DIRS[@]}"; do
fi
done
# Ensure portable user-data directory exists for Linux AppDir builds
mkdir -p "$APPDIR_ROOT/usr/user-data"
chmod 700 "$APPDIR_ROOT/usr/user-data" || true
echo " ✓ usr/user-data/"
echo ""
echo "✅ AppDir updated successfully!"
echo ""