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 93ea504
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 17 deletions.
11 changes: 5 additions & 6 deletions filebrowser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ Kindle 越狱插件 File Browser 使用说明:
2. 插件安装完成后,进入 Kindle 界面,打开 KUAL,可以在菜单中找到【File Browser】,可进行如下操作:
-【 Start 】可开启免登录的 WEB 服务
-【 Start (Auth) 】可开启带登录验证的 WEB 服务(默认用户名密码均为:admin)
-【 Reset 】删除包含配置信息的数据文件 filebrowser.db。谨慎点击。
-【 Kill 】强行中止后台的 WEB 服务(用于debug),请勿用于正常退出。谨慎点击。
-【 Reset 】删除包含配置信息的数据文件 filebrowser.db
-【 Stop 】停止 WEB 服务
3. 如果服务开启时设备 WiFi 处于关闭状态,WiFi 会被自动打开并在服务关闭后恢复原来状态。
4. 开启 WEB 服务后,可以在 Kindle 界面的顶部看到 IP 地址,在同一局域网下即可通过浏览器访问此地址。
5. 服务开启后会阻止屏幕自动关闭,请使用电源键关闭filebrowser服务,再按电源键即可正常锁屏休眠。
6. 顶部残留 IP 显示意味着服务未完全关闭,提醒用户该设备将不会熄屏和休眠。按一次电源键后 IP 会消失,否则请重启设备。
5. 服务开启后会阻止屏幕自动关闭,第一次按电源键会关闭filebrowser服务,再按即可正常锁屏休眠。

=======================================================

=======================================================
可前往 https://github.com/filebrowser/filebrowser 下载linux-armv7版本的release,用以更新插件的二进制文件`extensions/filebrowser/filebrowser`
详细说明及问题反馈:https://bookfere.com/post/823.html
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.
4 changes: 4 additions & 0 deletions filebrowser/filebrowser_kill.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
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 " "
24 changes: 15 additions & 9 deletions filebrowser/menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,39 @@
{
"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": "./show_status.sh",
"param": "",
"exitmenu": false
"action": "./filebrowser_start_auth_root.sh",
"param": ""
},
{
"name": "Kill",
"name": "Show Status",
"priority": 4,
"action": "killall filebrowser",
"param": ""
"action": "./show_status.sh",
"param": "",
"exitmenu": false
},
{
"name": "Reset",
"priority": 5,
"action": "rm ./filebrowser.db",
"param": ""
},
{
"name": "Kill",
"priority": 6,
"action": "./filebrowser_kill.sh",
"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 93ea504

Please sign in to comment.