Skip to content

Commit 18d5646

Browse files
authored
preset password & disable authentication
Fixes #7 NOTE: THIS DISABLES AUTHENTICATION. Do NOT enable the Filebrowser server on public networks. I don't know how to add gui settings to change options, and haven't bothered reading the current ssh.koplugin code to learn yet. 😅
1 parent 8f4aa39 commit 18d5646

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

main.lua

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ local Filebrowser = WidgetContainer:extend {
3434

3535
function Filebrowser:init()
3636
self.filebrowser_port = G_reader_settings:readSetting("filebrowser_port") or "80"
37+
self.filebrowser_password_hash = G_reader_settings:readSetting("filebrowser_password") or "$2a$10$x9hMP5e/71oPI/KCE9vqj.eUQqciNhFFNDzoC4idO.aNehTPlZJnK" -- admin
3738
self.ui.menu:registerToMainMenu(self)
3839
self:onDispatcherRegisterActions()
3940
end
@@ -53,18 +54,20 @@ function Filebrowser:start()
5354
-- and a log file.
5455
local cmd = string.format(
5556
"start-stop-daemon -S "
56-
.. "-m -p %s " -- pidFilePath
57+
.. "-m -p %s " -- %s: pidFilePath
5758
.. "-o "
5859
.. "-b "
59-
.. "-x %s " -- binPath
60-
.. "-- "
61-
.. "-a 0.0.0.0 "
62-
.. "-r %s " -- dataPath
63-
.. "-p %s " -- filebrowser_port
64-
.. "-l %s", -- logPath
60+
.. "-x %s " -- %s: binPath
61+
.. "-- " -- filebrowser arguments follow
62+
.. "--noauth " -- disable authentication
63+
.. "--password %s " -- %s: self.filebrowser_password: set password hash to admin
64+
.. "-a 0.0.0.0 " -- ip to bind to (0.0.0.0 means all interfaces)
65+
.. "-r %s " -- %s: dataPath
66+
.. "-p %s " -- %s: filebrowser_port
67+
.. "-l %s", -- %s: logPath
6568
pidFilePath,
6669
binPath,
67-
70+
self.filebrowser_password,
6871
dataPath,
6972
self.filebrowser_port,
7073
logPath

0 commit comments

Comments
 (0)