add luci-app-filebrowser
This commit is contained in:
parent
20ef376809
commit
2362093bd0
62
package/cnsztl/FileBrowser/Makefile
Normal file
62
package/cnsztl/FileBrowser/Makefile
Normal file
@ -0,0 +1,62 @@
|
||||
#
|
||||
# Copyright (C) 2014-2018 OpenWrt-dist
|
||||
# Copyright (C) 2019 [CTCGFW] Project OpenWRT
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=FileBrowser
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=GPLv3
|
||||
PKG_MAINTAINER:=[CTCGFW] Project OpenWRT
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=LuCI Support for FileBrowser.
|
||||
URL:=https://github.com/filebrowser/filebrowser
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
LuCI Support for FileBrowser.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
ifeq ($(ARCH),i386)
|
||||
$(INSTALL_BIN) ./files/i386 $(1)/usr/bin/filebrowser
|
||||
endif
|
||||
ifeq ($(ARCH),x86_64)
|
||||
$(INSTALL_BIN) ./files/x86_64 $(1)/usr/bin/filebrowser
|
||||
endif
|
||||
ifeq ($(ARCH),arm)
|
||||
$(INSTALL_BIN) ./files/arm $(1)/usr/bin/filebrowser
|
||||
endif
|
||||
ifeq ($(ARCH),arm64)
|
||||
$(INSTALL_BIN) ./files/arm64 $(1)/usr/bin/filebrowser
|
||||
endif
|
||||
ifeq ($(ARCH),mips)
|
||||
$(INSTALL_BIN) ./files/mips $(1)/usr/bin/filebrowser
|
||||
endif
|
||||
ifeq ($(ARCH),mipsel)
|
||||
$(INSTALL_BIN) ./files/mipsel $(1)/usr/bin/filebrowser
|
||||
endif
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
BIN
package/cnsztl/FileBrowser/files/arm
Executable file
BIN
package/cnsztl/FileBrowser/files/arm
Executable file
Binary file not shown.
BIN
package/cnsztl/FileBrowser/files/arm64
Executable file
BIN
package/cnsztl/FileBrowser/files/arm64
Executable file
Binary file not shown.
BIN
package/cnsztl/FileBrowser/files/i386
Executable file
BIN
package/cnsztl/FileBrowser/files/i386
Executable file
Binary file not shown.
BIN
package/cnsztl/FileBrowser/files/mips
Executable file
BIN
package/cnsztl/FileBrowser/files/mips
Executable file
Binary file not shown.
BIN
package/cnsztl/FileBrowser/files/mipsel
Executable file
BIN
package/cnsztl/FileBrowser/files/mipsel
Executable file
Binary file not shown.
BIN
package/cnsztl/FileBrowser/files/x86_64
Executable file
BIN
package/cnsztl/FileBrowser/files/x86_64
Executable file
Binary file not shown.
@ -1,7 +0,0 @@
|
||||
|
||||
config filebrowser 'config'
|
||||
option enabled '0'
|
||||
option port '8989'
|
||||
option scope '/'
|
||||
option path '/mnt/sda1/filebrowser'
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2015 By Wind
|
||||
|
||||
START=91
|
||||
STOP=91
|
||||
|
||||
start() {
|
||||
config_load filebrowser
|
||||
enabled=$(uci get filebrowser.config.enabled)
|
||||
port=$(uci get filebrowser.config.port)
|
||||
path=$(uci get filebrowser.config.path)
|
||||
scope=$(uci get filebrowser.config.scope)
|
||||
|
||||
[ "$enabled" == "1" ] || return
|
||||
|
||||
if [ ! -f "$path/filebrowser" ];then
|
||||
mkdir -p $path
|
||||
wget -O $path/filebrowser https://mirror.router.ctcgfw.generalcdn.top/download/mipsle/filebrowser && cd $path && chmod +x $path/filebrowser && ./filebrowser --port $port --scope $scope >/dev/null 2>&1 &
|
||||
else
|
||||
cd $path && chmod +x $path/filebrowser && ./filebrowser --port $port --scope $scope >/dev/null 2>&1 &
|
||||
fi
|
||||
}
|
||||
|
||||
stop() {
|
||||
killall filebrowser >/dev/null 2>&1 &
|
||||
}
|
||||
Binary file not shown.
@ -1,38 +0,0 @@
|
||||
require("luci.sys")
|
||||
require("luci.util")
|
||||
require("luci.model.ipkg")
|
||||
local fs = require "nixio.fs"
|
||||
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
|
||||
local m, s
|
||||
|
||||
local running=(luci.sys.call("pidof filebrowser > /dev/null") == 0)
|
||||
|
||||
local button = ""
|
||||
local state_msg = ""
|
||||
local trport = uci:get_first("filebrowser", "config", "port") or 8989
|
||||
if running then
|
||||
button = " <input type=\"button\" value=\" " .. translate("Open FileBrowser Web Interface") .. " \" onclick=\"window.open('http://'+window.location.hostname+':" .. trport .. "')\"/>"
|
||||
end
|
||||
|
||||
if running then
|
||||
state_msg = "<b><font color=\"green\">" .. translate("FileBrowser running") .. "</font></b>"
|
||||
else
|
||||
state_msg = "<b><font color=\"red\">" .. translate("FileBrowser not running") .. "</font></b>"
|
||||
end
|
||||
|
||||
m = Map("filebrowser", translate("FileBrowser"), translate("FileBrowser is a simple web base file browser, here you can configure the settings.") .. button
|
||||
.. "<br/><br/>" .. translate("FileBrowser Run Status").. " : " .. state_msg .. "<br/>")
|
||||
|
||||
s = m:section(TypedSection, "filebrowser", "")
|
||||
s.addremove = false
|
||||
s.anonymous = true
|
||||
|
||||
enable = s:option(Flag, "enabled", translate("Enable"))
|
||||
enable.rmempty = false
|
||||
|
||||
port=s:option(Value, "port", translate("listen port"))
|
||||
path=s:option(Value, "path", translate("path"))
|
||||
scope_dir=s:option(Value, "scope", translate("scope dir"))
|
||||
return m
|
||||
18
package/cnsztl/luci-app-filebrowser-mipsle/Makefile → package/cnsztl/luci-app-filebrowser/Makefile
Executable file → Normal file
18
package/cnsztl/luci-app-filebrowser-mipsle/Makefile → package/cnsztl/luci-app-filebrowser/Makefile
Executable file → Normal file
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2016-2017 WindTech <admin@windtech.top>
|
||||
# Copyright (C) 2019 [CTCGFW] Project OpenWRT
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
@ -7,13 +7,12 @@
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-filebrowser-mipsle
|
||||
PKG_NAME:=luci-app-filebrowser
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=GPLv3
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_MAINTAINER:=WindTech <admin@windtech.top>
|
||||
PKG_MAINTAINER:=[CTCGFW] Project OpenWRT
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
@ -21,14 +20,13 @@ define Package/$(PKG_NAME)
|
||||
SECTION:=luci
|
||||
CATEGORY:=LuCI
|
||||
SUBMENU:=3. Applications
|
||||
TITLE:=LuCI Support for FileBrowser FOR MIPSLE ONLY
|
||||
TITLE:=LuCI Support for FileBrowser
|
||||
PKGARCH:=all
|
||||
# DEPENDS:=+filebrowser
|
||||
DEPENDS:=+wget +openssl-util
|
||||
DEPENDS:=+FileBrowser +wget +openssl-util
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
LuCI Support for FileBrowser FOR MIPSLE ONLY.
|
||||
LuCI Support for FileBrowser.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
@ -53,8 +51,6 @@ define Package/$(PKG_NAME)/conffiles
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
|
||||
$(INSTALL_DATA) ./files/luci/i18n/filebrowser.zh-cn.lmo $(1)/usr/lib/lua/luci/i18n/filebrowser.zh-cn.lmo
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller
|
||||
$(INSTALL_DATA) ./files/luci/controller/filebrowser.lua $(1)/usr/lib/lua/luci/controller/filebrowser.lua
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/filebrowser
|
||||
@ -67,4 +63,4 @@ define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/luci-filebrowser $(1)/etc/uci-defaults/luci-filebrowser
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
@ -0,0 +1,10 @@
|
||||
|
||||
config filebrowser 'config'
|
||||
option addr_type 'lan'
|
||||
option db_dir '/etc'
|
||||
option db_name 'filebrowser.db'
|
||||
option enabled '0'
|
||||
option port '8989'
|
||||
option root_dir '/'
|
||||
option username 'admin'
|
||||
option password 'admin'
|
||||
35
package/cnsztl/luci-app-filebrowser/files/etc/init.d/filebrowser
Executable file
35
package/cnsztl/luci-app-filebrowser/files/etc/init.d/filebrowser
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2019 [CTCGFW] Project OpenWRT
|
||||
|
||||
START=90
|
||||
STOP=10
|
||||
|
||||
addr_type="$(uci get filebrowser.config.addr_type)"
|
||||
db_dir="$(uci get filebrowser.config.db_dir)"
|
||||
[ "${db_dir}" == "/" ] || db_dir="${db_dir%*/}"
|
||||
db_name="$(uci get filebrowser.config.db_name| sed 's#/##g')"
|
||||
enabled="$(uci get filebrowser.config.enabled)"
|
||||
port="$(uci get filebrowser.config.port)"
|
||||
root_dir="$(uci get filebrowser.config.root_dir)"
|
||||
username="$(uci get filebrowser.config.username)"
|
||||
password="$(filebrowser hash "$(uci get filebrowser.config.password)"| sed 's/$/\$/g')"
|
||||
|
||||
if [ "${addr_type}" == "local" ];then
|
||||
addr="127.0.0.1"
|
||||
elif [ "${addr_type}" == "lan" ];then
|
||||
addr="$(uci get network.lan.ipaddr)"
|
||||
elif [ "${addr_type}" == "wan" ];then
|
||||
addr="0.0.0.0"
|
||||
fi
|
||||
|
||||
start() {
|
||||
stop
|
||||
[ "$enabled" == "1" ] || exit 0
|
||||
mkdir -p "${root_dir}"
|
||||
mkdir -p "${db_dir}"
|
||||
filebrowser -a "${addr}" -d "${db_dir}/${db_name}" -p "${port}" -r "${root_dir}" --username "${username}" --password "${password}" >/dev/null 2>&1 &
|
||||
}
|
||||
|
||||
stop() {
|
||||
killall filebrowser >/dev/null 2>&1
|
||||
}
|
||||
@ -5,7 +5,6 @@ function index()
|
||||
return
|
||||
end
|
||||
local page
|
||||
page = entry({"admin", "services", "filebrowser"}, cbi("filebrowser"), _("FileBrowser"), 100)
|
||||
page.i18n = "filebrowser"
|
||||
page = entry({"admin", "services", "filebrowser"}, cbi("filebrowser"), _("文件管理器"), 100)
|
||||
page.dependent = true
|
||||
end
|
||||
@ -0,0 +1,76 @@
|
||||
require("luci.sys")
|
||||
require("luci.util")
|
||||
require("luci.model.ipkg")
|
||||
local fs = require "nixio.fs"
|
||||
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
|
||||
local m, s
|
||||
|
||||
local running=(luci.sys.call("pidof filebrowser > /dev/null") == 0)
|
||||
|
||||
local button = ""
|
||||
local state_msg = ""
|
||||
local trport = uci:get("filebrowser", "config", "port")
|
||||
if running then
|
||||
button = " <input type=\"button\" value=\" " .. translate("打开管理界面") .. " \" onclick=\"window.open('http://'+window.location.hostname+':" .. trport .. "')\"/>"
|
||||
end
|
||||
|
||||
if running then
|
||||
state_msg = "<b><font color=\"green\">" .. translate("FileBrowser运行中") .. "</font></b>"
|
||||
else
|
||||
state_msg = "<b><font color=\"red\">" .. translate("FileBrowser未运行") .. "</font></b>"
|
||||
end
|
||||
|
||||
m = Map("filebrowser", translate("文件管理器"), translate("FileBrowser是一个基于Go的在线文件管理器,助您方便的管理设备上的文件。") .. button
|
||||
.. "<br/><br/>" .. translate("FileBrowser运行状态").. " : " .. state_msg .. "<br/>")
|
||||
|
||||
s = m:section(TypedSection, "filebrowser", "")
|
||||
s.addremove = false
|
||||
s.anonymous = true
|
||||
|
||||
enable = s:option(Flag, "enabled", translate("启用"))
|
||||
enable.rmempty = false
|
||||
|
||||
o = s:option(ListValue, "addr_type", translate("监听地址"))
|
||||
o:value("local", translate("监听本机地址"))
|
||||
o:value("lan", translate("监听局域网地址"))
|
||||
o:value("wan", translate("监听全部地址"))
|
||||
o.default = "lan"
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, "port", translate("监听端口"))
|
||||
o.placeholder = 8989
|
||||
o.default = 8989
|
||||
o.datatype = "port"
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, "root_dir", translate("开放目录"))
|
||||
o.placeholder = "/"
|
||||
o.default = "/"
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, "username", translate("管理员用户名"))
|
||||
o.placeholder = "admin"
|
||||
o.default = "admin"
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, "password", translate("管理员密码"))
|
||||
o.password = true
|
||||
o.placeholder = "admin"
|
||||
o.default = "admin"
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, "db_dir", translate("数据库目录"))
|
||||
o.placeholder = "/etc"
|
||||
o.default = "/etc"
|
||||
o.rmempty = false
|
||||
o.description = translate("普通用户请勿随意更改")
|
||||
|
||||
o = s:option(Value, "db_name", translate("数据库名"))
|
||||
o.placeholder = "filebrowser.db"
|
||||
o.default = "filebrowser.db"
|
||||
o.rmempty = false
|
||||
o.description = translate("普通用户请勿随意更改")
|
||||
|
||||
return m
|
||||
Loading…
Reference in New Issue
Block a user