automatic reload on change

This commit is contained in:
themancalledjakob 2024-03-16 09:57:27 +01:00
parent bd87a53872
commit c5bdff23ee
6 changed files with 62 additions and 3 deletions

View file

@ -6,7 +6,15 @@ fly ()
echo $! 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 $@) #echo $(fly /usr/bin/chromium --incognito --screen=1 $@)
#/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 $@ & 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

14
rebuild.sh Executable file
View file

@ -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

17
reloadbrowser.sh Executable file
View file

@ -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

View file

@ -42,11 +42,11 @@ def serve(root, port, run_browser):
keyfile = "ssl/localhost+4-key.pem" keyfile = "ssl/localhost+4-key.pem"
if not os.path.exists(certfile): if not os.path.exists(certfile):
print("using ssl/server.pm")
certfile = "ssl/server.pem" certfile = "ssl/server.pem"
if not os.path.exists(keyfile): if not os.path.exists(keyfile):
print("using ssl/key.pm")
keyfile = "ssl/key.pem" keyfile = "ssl/key.pem"
print(f"using {certfile} and {keyfile} for ssl")
if os.path.exists(certfile) and os.path.exists(keyfile): if os.path.exists(certfile) and os.path.exists(keyfile):
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)

10
watch.sh Executable file
View file

@ -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

10
watchJs.sh Executable file
View file

@ -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