Skip to content

Commit

Permalink
阻止屏幕自动关闭且按电源键关闭filebrowser服务
Browse files Browse the repository at this point in the history
  • Loading branch information
guo-yong-zhi committed Aug 27, 2021
0 parents commit 536968c
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 0 deletions.
18 changes: 18 additions & 0 deletions filebrowser/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Kindle 越狱插件 File Browser 使用说明:

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

开始以下步骤前需确保你的 Kindle 已经成功越狱,并安装了 KUAL 插件。

1. 下载插件压缩包,解压得到 filebrowser 文件夹,将其拷贝到 Kindle 根目录下的 extensions 目录中。
2. 插件安装完成后,进入 Kindle 界面,打开 KUAL,可以在菜单中找到【File Browser】,可进行如下操作:
-【 Start 】可开启免登录的 WEB 服务
-【 Start (Auth) 】可开启带登录验证的 WEB 服务(默认用户名密码均为:admin)
-【 Reset 】删除包含配置信息的数据文件 filebrowser.db
-【 Stop 】停止 WEB 服务
3. 开启 WEB 服务后,可以在 Kindle 界面的顶部看到 IP 地址,在同一局域网下即可通过浏览器访问此地址。
4. 服务开启后会阻止屏幕自动关闭,第一次按电源键会关闭filebrowser服务,再按即可正常锁屏休眠。

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

详细说明及问题反馈:https://bookfere.com/post/823.html
12 changes: 12 additions & 0 deletions filebrowser/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension>
<information>
<name>File Browser</name>
<version>1.1</version>
<author>Sparkle</author>
<id>filebrowser</id>
</information>
<menus>
<menu type="json" dynamic="true">menu.json</menu>
</menus>
</extension>
Binary file added filebrowser/filebrowser
Binary file not shown.
40 changes: 40 additions & 0 deletions filebrowser/menu.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"items": [
{
"name": "File Browser",
"priority": -1,
"items": [
{
"name": "Start",
"priority": 1,
"action": "./start.sh",
"param": ""
},
{
"name": "Start (Auth)",
"priority": 2,
"action": "./start_auth.sh",
"param": ""
},
{
"name": "Reset",
"priority": 3,
"action": "rm ./filebrowser.db",
"param": ""
},
{
"name": "Stop",
"priority": 4,
"action": "killall filebrowser",
"param": ""
},
{
"name": "Show Status",
"action": "./show_status.sh",
"param": "",
"exitmenu": false
}
]
}
]
}
10 changes: 10 additions & 0 deletions filebrowser/show_status.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

test_process=$(ps aux | grep "[f]ilebrowser")
if [ -n "$test_process" ]
then
result="File Browser is Running....."
else
result="File Browser is not running."
fi
eips 25 2 "$result"
24 changes: 24 additions & 0 deletions filebrowser/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh
lipc-set-prop -i com.lab126.powerd preventScreenSaver 1
lipc-wait-event com.lab126.hal powerButtonPressed| if read event; then
lipc-set-prop -i com.lab126.powerd preventScreenSaver 0
killall filebrowser
eips 25 2 "File Browser is turned off. "
fi > /dev/null &

iptables -I INPUT -p tcp --dport 80 -j ACCEPT
eips 25 1 "IP: `ifconfig wlan0 | grep 'inet addr' | awk -F '[ :]' '{print $13}'`"

if [ "$(ps aux | grep '[f]ilebrowser')" ];then killall filebrowser;fi

if [ ! -f ./filebrowser.db ]
then
./filebrowser --noauth -a 0.0.0.0 -p 80 -r /mnt/us > /dev/null
else
METHOD=$(./filebrowser config cat | grep 'Auth method' | awk '{print $3}')
if [ 'noauth' != "$METHOD" ];
then
./filebrowser config set --auth.method=noauth > /dev/null
fi
./filebrowser -a 0.0.0.0 -p 80 -r /mnt/us > /dev/null
fi
22 changes: 22 additions & 0 deletions filebrowser/start_auth.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh
lipc-set-prop -i com.lab126.powerd preventScreenSaver 1
lipc-wait-event com.lab126.hal powerButtonPressed| if read event; then
lipc-set-prop -i com.lab126.powerd preventScreenSaver 0
killall filebrowser
eips 25 2 "File Browser is turned off. "
fi > /dev/null &

iptables -I INPUT -p tcp --dport 80 -j ACCEPT
eips 25 1 "IP: `ifconfig wlan0 | grep 'inet addr' | awk -F '[ :]' '{print $13}'`"

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 /mnt/us > /dev/null

0 comments on commit 536968c

Please sign in to comment.