diff --git a/browser.sh b/browser.sh index 790f0c4..533746c 100755 --- a/browser.sh +++ b/browser.sh @@ -6,7 +6,15 @@ fly () echo $! } +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +PREVIOUS_DIR=$(pwd) + +cd $DIR + #echo $(fly /usr/bin/chromium --incognito --screen=1 $@) #/usr/bin/chromium --incognito --screen=1 $@ & fly flatpak run com.github.Eloston.UngoogledChromium --screen=1 --disk-cache-dir=/dev/null --disk-cache-size=1 --enable-logging --password-store=basic --v=1 $@ & -echo $! +browser_pid=$! +echo $browser_pid > .browserpid + +cd $PREVIOUS_DIR diff --git a/rebuild.sh b/rebuild.sh new file mode 100755 index 0000000..2ceb914 --- /dev/null +++ b/rebuild.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +PREVIOUS_DIR=$(pwd) + +cd $DIR + +./lightclean.sh + +emmake make -j12 + +./reloadbrowser.sh + +cd $PREVIOUS_DIR diff --git a/reloadbrowser.sh b/reloadbrowser.sh new file mode 100755 index 0000000..583fcca --- /dev/null +++ b/reloadbrowser.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +PREVIOUS_DIR=$(pwd) + +cd $DIR + +# get active window in a variable +lol=$(xdotool getactivewindow) + +# reload the browser +xdotool search --onlyvisible --sync --pid $(cat ./.browserpid) --name chromium windowactivate --sync key CTRL+SHIFT+R + +# reactivate old window +xdotool windowactivate $lol + +cd $PREVIOUS_DIR diff --git a/serve.py b/serve.py index 2cc79d5..ab466c2 100755 --- a/serve.py +++ b/serve.py @@ -42,11 +42,11 @@ def serve(root, port, run_browser): keyfile = "ssl/localhost+4-key.pem" if not os.path.exists(certfile): - print("using ssl/server.pm") certfile = "ssl/server.pem" if not os.path.exists(keyfile): - print("using ssl/key.pm") keyfile = "ssl/key.pem" + + print(f"using {certfile} and {keyfile} for ssl") if os.path.exists(certfile) and os.path.exists(keyfile): context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) diff --git a/watch.sh b/watch.sh new file mode 100755 index 0000000..6992ea4 --- /dev/null +++ b/watch.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +PREVIOUS_DIR=$(pwd) + +cd $DIR + +echo "$(git ls-files src && git ls-files bin/data)" | entr -d ./rebuild.sh + +cd $PREVIOUS_DIR diff --git a/watchJs.sh b/watchJs.sh new file mode 100755 index 0000000..a0a820a --- /dev/null +++ b/watchJs.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +PREVIOUS_DIR=$(pwd) + +cd $DIR + +echo "$(git ls-files bin/em/variabletime/web)" | entr -d ./reloadbrowser.sh + +cd $PREVIOUS_DIR