#!/bin/bash

# Usage:
#   ./start.sh
# Later you can replace /usr/lib/masscode and /usr/bin/electron34 using sed

root_dir="/usr/lib/masscode"
electron_bin="/usr/bin/electron34"

# Make sure app.asar exists
if [ ! -f "$root_dir/app/app.asar" ]; then
  echo "Error: app.asar not found under $root_dir/app"
  exit 1
fi

# Tell electron-updater: this is running inside AppImage
export APPIMAGE=1

# Run
echo "Starting Electron app (root directory = $root_dir)"
ELECTRON_FORCE_IS_PACKAGED=true "$electron_bin" "$root_dir/app/app.asar" --no-sandbox "$@"
