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:
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Run Nebula with portable data storage
|
# 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
|
set -e
|
||||||
|
|
||||||
HERE="$(cd "$(dirname "$0")" && pwd)"
|
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 ---
|
# --- PORTABLE DATA CONFIGURATION ---
|
||||||
# Store user data in a local folder for portable operation
|
# 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=1
|
||||||
export NEBULA_PORTABLE_PATH="$PORTABLE_DATA_DIR"
|
export NEBULA_PORTABLE_PATH="$PORTABLE_DATA_DIR"
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ fi
|
|||||||
# Copy Linux launch wrappers if present in appdir-example
|
# Copy Linux launch wrappers if present in appdir-example
|
||||||
if [ -f "$SCRIPT_DIR/appdir-example/run-nebula.sh" ]; then
|
if [ -f "$SCRIPT_DIR/appdir-example/run-nebula.sh" ]; then
|
||||||
cp "$SCRIPT_DIR/appdir-example/run-nebula.sh" "$DEST/run-nebula.sh"
|
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
|
chmod +x "$DEST/run-nebula.sh" || true
|
||||||
fi
|
fi
|
||||||
if [ -f "$SCRIPT_DIR/appdir-example/steam_appid.txt" ]; then
|
if [ -f "$SCRIPT_DIR/appdir-example/steam_appid.txt" ]; then
|
||||||
@@ -93,6 +94,8 @@ fi
|
|||||||
# Fix permissions
|
# Fix permissions
|
||||||
chmod -R a+r "$DEST/usr/share/icons/hicolor/256x256/apps" || true
|
chmod -R a+r "$DEST/usr/share/icons/hicolor/256x256/apps" || true
|
||||||
chmod +x "$DEST/Nebula" "$DEST/Nebula-Desktop" "$DEST/Nebula-Controller" || 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 "AppDir assembled at $DEST."
|
||||||
echo " Desktop mode: $DEST/Nebula-Desktop"
|
echo " Desktop mode: $DEST/Nebula-Desktop"
|
||||||
|
|||||||
+18
-14
@@ -85,8 +85,8 @@ class PortableDataManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the portable data directory path
|
* Get the portable data directory path
|
||||||
* Uses NEBULA_PORTABLE_PATH if set, otherwise creates 'user-data' in Documents/My Games/<AppName>
|
* Uses NEBULA_PORTABLE_PATH if set, otherwise creates app-local 'user-data'.
|
||||||
* with a safe fallback to the app directory.
|
* Linux AppDir builds prefer 'usr/user-data' to keep writable data inside AppDir.
|
||||||
*/
|
*/
|
||||||
getPortableDataPath() {
|
getPortableDataPath() {
|
||||||
if (this._portableDataPath !== null) {
|
if (this._portableDataPath !== null) {
|
||||||
@@ -111,19 +111,23 @@ class PortableDataManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default: prefer Documents/My Games/<AppName>/user-data
|
// Default: app-local user data
|
||||||
let dataPath = '';
|
// - Windows: beside the executable
|
||||||
try {
|
// - macOS: inside .app Contents (portable bundle)
|
||||||
const docsDir = app.getPath('documents');
|
// - Linux AppDir: <AppDir>/usr/user-data
|
||||||
const appName = app.getName() || 'NebulaBrowser';
|
// - Other Linux/dev: beside the app root
|
||||||
dataPath = path.join(docsDir, 'My Games', appName, 'user-data');
|
|
||||||
} catch (err) {
|
|
||||||
console.warn('[Portable] Failed to resolve Documents path, using app directory');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dataPath) {
|
|
||||||
const appRoot = this._getAppRootDir();
|
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
|
// Validate the path
|
||||||
|
|||||||
+2
-2
@@ -531,8 +531,8 @@ body, html {
|
|||||||
padding-bottom: 1rem;
|
padding-bottom: 1rem;
|
||||||
position: sticky;
|
position: sticky;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background: linear-gradient(180deg, rgba(18, 20, 24, 0), rgba(18, 20, 24, 0.85) 45%, rgba(18, 20, 24, 0.95));
|
background: transparent;
|
||||||
backdrop-filter: blur(6px);
|
backdrop-filter: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
|
|||||||
@@ -84,6 +84,12 @@ done
|
|||||||
# Update main launcher scripts if present
|
# Update main launcher scripts if present
|
||||||
echo ""
|
echo ""
|
||||||
echo "🔄 Syncing launcher scripts..."
|
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
|
for launcher in "Nebula-Desktop" "Nebula-Controller"; do
|
||||||
if [ -f "$SCRIPT_DIR/nebula-appdir/$launcher" ]; then
|
if [ -f "$SCRIPT_DIR/nebula-appdir/$launcher" ]; then
|
||||||
cp "$SCRIPT_DIR/nebula-appdir/$launcher" "$APPDIR_ROOT/$launcher"
|
cp "$SCRIPT_DIR/nebula-appdir/$launcher" "$APPDIR_ROOT/$launcher"
|
||||||
@@ -116,6 +122,11 @@ for dir in "${DIRS[@]}"; do
|
|||||||
fi
|
fi
|
||||||
done
|
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 ""
|
||||||
echo "✅ AppDir updated successfully!"
|
echo "✅ AppDir updated successfully!"
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
Reference in New Issue
Block a user