Skip to content

Commit

Permalink
fix display residue after kill
Browse files Browse the repository at this point in the history
  • Loading branch information
guo-yong-zhi committed May 2, 2022
1 parent 1314b26 commit b13a085
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 8 deletions.
3 changes: 2 additions & 1 deletion filebrowser/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
<extension>
<information>
<name>File Browser</name>
<version>1.2</version>
<version>1.3</version>
<author>Sparkle</author>
<author>guoyongzhi</author>
<id>filebrowser</id>
</information>
<menus>
Expand Down
Binary file modified filebrowser/filebrowser
Binary file not shown.
6 changes: 6 additions & 0 deletions filebrowser/filebrowser_kill.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
lipc-send-event com.lab126.hal powerButtonPressed
sleep 5
ps aux | grep [f]ilebrowser | awk '{print $2}' | xargs -i kill {} > /dev/null
lipc-set-prop -i com.lab126.powerd preventScreenSaver 0
eips 30 1 " "
eips 30 3 " "
File renamed without changes.
File renamed without changes.
48 changes: 48 additions & 0 deletions filebrowser/filebrowser_start_auth_root.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/sh
iptables -I INPUT -p tcp --dport 80 -j ACCEPT

# enable wireless if it is currently off
WIFI_IS_OFF=0
if [ 0 -eq `lipc-get-prop com.lab126.cmd wirelessEnable` ]; then
eips 30 3 "WiFi is off, turning it on now"
lipc-set-prop com.lab126.cmd wirelessEnable 1
WIFI_IS_OFF=1
fi

# start filebrowser in the background
if [ "$(ps aux | grep '[f]ilebrowser')" ];then killall filebrowser;fi

if [ -f ./filebrowser.db ]
then
METHOD=$(./filebrowser config cat | grep 'Auth method' | awk '{print $3}')
if [ 'json' != "$METHOD" ]
then
./filebrowser config set --auth.method=json > /dev/null
fi
fi
./filebrowser -a 0.0.0.0 -p 80 -r / > /dev/null &

# refresh IP display in the background
while :; do
eips 30 1 "== `ifconfig wlan0 | grep 'inet addr' | awk -F '[ :]' '{print $13}'` =="
sleep 5
done > /dev/null &

# waiting for powerButtonPressed
lipc-set-prop -i com.lab126.powerd preventScreenSaver 1
lipc-wait-event com.lab126.hal powerButtonPressed | read event #it's blocking
lipc-set-prop -i com.lab126.powerd preventScreenSaver 0
kill $(jobs -p)
eips 30 3 "File Browser is turned off. "

# Restore WiFi status
if [ 1 -eq $WIFI_IS_OFF ]; then
lipc-set-prop com.lab126.cmd wirelessEnable 0
sleep 0.5
eips 30 3 "Turning off WiFi "
fi

# Clear screen
sleep 1
eips 30 1 " "
eips 30 3 " "
18 changes: 12 additions & 6 deletions filebrowser/menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,37 @@
{
"name": "Start",
"priority": 1,
"action": "./start.sh",
"action": "./filebrowser_start.sh",
"param": ""
},
{
"name": "Start (Auth)",
"priority": 2,
"action": "./start_auth.sh",
"action": "./filebrowser_start_auth.sh",
"param": ""
},
{
"name": "Show Status",
"name": "Start (root path)",
"priority": 3,
"action": "./filebrowser_start_auth_root.sh",
"param": ""
},
{
"name": "Show Status",
"priority": 4,
"action": "./show_status.sh",
"param": "",
"exitmenu": false
},
{
"name": "Kill",
"priority": 4,
"action": "killall filebrowser",
"priority": 5,
"action": "./filebrowser_kill.sh",
"param": ""
},
{
"name": "Reset",
"priority": 5,
"priority": 6,
"action": "rm ./filebrowser.db",
"param": ""
}
Expand Down
2 changes: 1 addition & 1 deletion filebrowser/show_status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ then
else
result="File Browser is not running "
fi
eips 29 3 "$result"
eips 30 3 "$result"

0 comments on commit b13a085

Please sign in to comment.