diff --git a/filebrowser/README.md b/filebrowser/README.md new file mode 100644 index 0000000..f09f4c9 --- /dev/null +++ b/filebrowser/README.md @@ -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 diff --git a/filebrowser/config.xml b/filebrowser/config.xml new file mode 100644 index 0000000..3e919af --- /dev/null +++ b/filebrowser/config.xml @@ -0,0 +1,12 @@ + + + + File Browser + 1.1 + Sparkle + filebrowser + + + menu.json + + diff --git a/filebrowser/filebrowser b/filebrowser/filebrowser new file mode 100644 index 0000000..abf17d6 Binary files /dev/null and b/filebrowser/filebrowser differ diff --git a/filebrowser/menu.json b/filebrowser/menu.json new file mode 100644 index 0000000..4538d7d --- /dev/null +++ b/filebrowser/menu.json @@ -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 + } + ] + } + ] +} diff --git a/filebrowser/show_status.sh b/filebrowser/show_status.sh new file mode 100644 index 0000000..615bcc8 --- /dev/null +++ b/filebrowser/show_status.sh @@ -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" \ No newline at end of file diff --git a/filebrowser/start.sh b/filebrowser/start.sh new file mode 100644 index 0000000..1037b22 --- /dev/null +++ b/filebrowser/start.sh @@ -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 diff --git a/filebrowser/start_auth.sh b/filebrowser/start_auth.sh new file mode 100644 index 0000000..7581cd1 --- /dev/null +++ b/filebrowser/start_auth.sh @@ -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