Unverified Commit 1e13258b authored by Kroese's avatar Kroese Committed by GitHub
Browse files

feat: Dynamic page content (#585)

parent 2c7cea04
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ docker run -it --rm -p 5000:5000 --device=/dev/kvm --cap-add NET_ADMIN --stop-ti
    
    - Start the container and get some coffee.

    - Connect to port 5000 of the container in your web browser.
    - Connect to [port 5000](http://localhost:5000) of the container in your web browser.

    - Wait until DSM is ready, choose an username and password, and you will be taken to the desktop.

+2 −2
Original line number Diff line number Diff line
@@ -174,8 +174,8 @@ fi

rm -rf "$TMP" && mkdir -p "$TMP"

MSG="Downloading $BASE.pat..."
info "Install: $MSG" && html "$MSG"
info "Install: Downloading $BASE.pat..."
html "Install: Downloading DSM from Synology..."

PAT="/$BASE.pat"
rm -f "$PAT"
+2 −2
Original line number Diff line number Diff line
@@ -254,8 +254,8 @@ if [[ "$DHCP" == [Yy1]* ]]; then
  # Configuration for DHCP IP
  configureDHCP

  MSG="Please wait while discovering IP..."
  html "$MSG" "2000"
  MSG="Booting DSM instance..."
  html "$MSG"

else

+2 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ info () { printf "%b%s%b" "\E[1;34m❯ \E[1;36m" "$1" "\E[0m\n" >&2; }
error () { printf "%b%s%b" "\E[1;31m❯ " "ERROR: $1" "\E[0m\n" >&2; }

file="/run/shm/dsm.url"
info="/run/shm/msg.html"
page="/run/shm/index.html"
address="/run/shm/qemu.ip"
shutdown="/run/shm/qemu.end"
@@ -80,6 +81,7 @@ if [[ "$location" != "20.20"* ]]; then
  HTML="${HTML/\[5\]/}"

  echo "$HTML" > "$page"
  echo "$body" > "$info"

else

+4 −4
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ echo
# Helper variables

STORAGE="/storage"
INFO="/dev/shm/msg.html"
PAGE="/run/shm/index.html"
TEMPLATE="/var/www/index.html"
FOOTER1="$APP for Docker v$(</run/version)"
@@ -118,6 +119,7 @@ html()
{
    local title
    local body
    local script
    local footer

    title=$(escape "$APP")
@@ -129,10 +131,7 @@ html()
      body="<p class=\"loading\">${body/.../}</p>"
    fi

    local timeout="4999"
    [ -n "${2:-}" ] && timeout="$2"
    local script="<script>setTimeout(() => { document.location.reload(); }, $timeout);</script>"
    [[ "$timeout" == "0" ]] && script=""
    [ -n "${2:-}" ] && script="$2" || script=""

    local HTML
    HTML=$(<"$TEMPLATE")
@@ -143,6 +142,7 @@ html()
    HTML="${HTML/\[5\]/$FOOTER2}"

    echo "$HTML" > "$PAGE"
    echo "$body" > "$INFO"

    return 0
}
Loading