add luci-app-baidupcs-web

This commit is contained in:
CN_SZTL 2019-07-26 05:28:55 +08:00
parent d523c0aafa
commit 974d64cea4
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
19 changed files with 218 additions and 160 deletions

View File

@ -0,0 +1,59 @@
#
# 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:=BaiduPCS-Web
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 BaiduPCS-Web.
URL:=https://github.com/liuzhuoling2011/baidupcs-web
endef
define Package/$(PKG_NAME)/description
LuCI Support for BaiduPCS-Web.
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/baidupcs-web
endif
ifeq ($(ARCH),x86_64)
$(INSTALL_BIN) ./files/x86_64 $(1)/usr/bin/baidupcs-web
endif
ifeq ($(ARCH),arm)
$(INSTALL_BIN) ./files/arm $(1)/usr/bin/baidupcs-web
endif
ifeq ($(ARCH),arm64)
$(INSTALL_BIN) ./files/arm64 $(1)/usr/bin/baidupcs-web
endif
ifeq ($(ARCH),mipsel)
$(INSTALL_BIN) ./files/mipsel $(1)/usr/bin/baidupcs-web
endif
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,70 +0,0 @@
#
# Copyright (C) 2016-2017 WindTech <admin@windtech.top>
#
# This is free software, licensed under the GNU General Public License v3.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-baidupcs-mipsle
PKG_VERSION:=1.0.0
PKG_RELEASE:=1
PKG_LICENSE:=GPLv3
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=WindTech <admin@windtech.top>
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=3. Applications
TITLE:=LuCI Support for BaiduPCS-Go FOR MIPSLE ONLY
PKGARCH:=all
# DEPENDS:=+baidupcs-go
DEPENDS:=+wget +openssl-util
endef
define Package/$(PKG_NAME)/description
LuCI Support for BaiduPCS-Go FOR MIPSLE ONLY.
endef
define Build/Prepare
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/$(PKG_NAME)/postinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
( . /etc/uci-defaults/luci-baidupcs ) && rm -f /etc/uci-defaults/luci-baidupcs
fi
exit 0
endef
define Package/$(PKG_NAME)/conffiles
/etc/config/baidupcs
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
$(INSTALL_DATA) ./files/luci/i18n/baidupcs.zh-cn.lmo $(1)/usr/lib/lua/luci/i18n/baidupcs.zh-cn.lmo
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller
$(INSTALL_DATA) ./files/luci/controller/baidupcs.lua $(1)/usr/lib/lua/luci/controller/baidupcs.lua
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/baidupcs
$(INSTALL_DATA) ./files/luci/model/cbi/baidupcs.lua $(1)/usr/lib/lua/luci/model/cbi/baidupcs.lua
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/etc/config/baidupcs $(1)/etc/config/baidupcs
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/etc/init.d/baidupcs $(1)/etc/init.d/baidupcs
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/etc/uci-defaults/luci-baidupcs $(1)/etc/uci-defaults/luci-baidupcs
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

View File

@ -1,6 +0,0 @@
config baidupcs 'config'
option port '5299'
option enabled '0'
option path '/mnt/sda1/baidupcs'

View File

@ -1,25 +0,0 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2015 By Wind
START=90
STOP=90
start() {
config_load baidupcs
enabled=$(uci get baidupcs.config.enabled)
port=$(uci get baidupcs.config.port)
path=$(uci get baidupcs.config.path)
[ "$enabled" == "1" ] || return
if [ ! -f "$path/baidupcs" ];then
mkdir -p $path
wget -O $path/baidupcs https://mirror.router.ctcgfw.generalcdn.top/download/mipsle/baidupcs-go && cd $path && ./baidupcs web --port $port --access >/dev/null 2>&1 &
else
$path/baidupcs web --port $port --access >/dev/null 2>&1 &
fi
}
stop() {
killall baidupcs >/dev/null 2>&1 &
}

View File

@ -1,11 +0,0 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@baidupcs[-1]
add ucitrack baidupcs
set ucitrack.@baidupcs[-1].init=baidupcs
commit ucitrack
EOF
rm -f /tmp/luci-indexcache
exit 0

View File

@ -1,11 +0,0 @@
module("luci.controller.baidupcs", package.seeall)
function index()
if not nixio.fs.access("/etc/config/baidupcs") then
return
end
local page
page = entry({"admin", "services", "baidupcs"}, cbi("baidupcs"), _("Baidupcs Setting"), 100)
page.i18n = "baidupcs"
page.dependent = true
end

View File

@ -1,37 +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 baidupcs > /dev/null") == 0)
local button = ""
local state_msg = ""
local trport = uci:get_first("baidupcs", "config", "port") or 5299
if running then
button = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"button\" value=\" " .. translate("Open Baidupcs Web Interface") .. " \" onclick=\"window.open('http://'+window.location.hostname+':" .. trport .. "')\"/>"
end
if running then
state_msg = "<b><font color=\"green\">" .. translate("Baidupcs running") .. "</font></b>"
else
state_msg = "<b><font color=\"red\">" .. translate("Baidupcs not running") .. "</font></b>"
end
m = Map("baidupcs", translate("Baidupcs"), translate("Baidupcs is a simple web base baidu netdisk, here you can configure the settings.") .. button
.. "<br/><br/>" .. translate("Baidupcs Run Status").. " : " .. state_msg .. "<br/>")
s = m:section(TypedSection, "baidupcs", "")
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"))
return m

View File

@ -0,0 +1,65 @@
#
# This is free software, licensed under the GNU General Public License v3.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-baidupcs-web
PKG_VERSION:=1.0.0
PKG_RELEASE:=1
PKG_LICENSE:=GPLv3
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=[CTCGFW] Project OpenWRT
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=3. Applications
TITLE:=LuCI Support for BaiduPCS-Web.
PKGARCH:=all
DEPENDS:=+BaiduPCS-Web +wget +openssl-util
endef
define Package/$(PKG_NAME)/description
LuCI Support for BaiduPCS-Web.
endef
define Build/Prepare
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/$(PKG_NAME)/postinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
( . /etc/uci-defaults/luci-baidupcs-web ) && rm -f /etc/uci-defaults/luci-baidupcs-web
fi
exit 0
endef
define Package/$(PKG_NAME)/conffiles
/etc/config/baidupcs-web
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller
$(INSTALL_DATA) ./files/luci/controller/baidupcs-web.lua $(1)/usr/lib/lua/luci/controller/baidupcs-web.lua
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi
$(INSTALL_DATA) ./files/luci/model/cbi/baidupcs-web.lua $(1)/usr/lib/lua/luci/model/cbi/baidupcs-web.lua
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/etc/config/baidupcs-web $(1)/etc/config/baidupcs-web
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/etc/init.d/baidupcs-web $(1)/etc/init.d/baidupcs-web
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/etc/uci-defaults/luci-baidupcs-web $(1)/etc/uci-defaults/luci-baidupcs-web
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

View File

@ -0,0 +1,6 @@
config baidupcs-web 'config'
option port '5299'
option enabled '0'
option dl_dir '/etc/baidupcsweb-download'

View File

@ -0,0 +1,21 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2019 By [CTCGFW] Project OpenWRT
START=90
STOP=10
enabled="$(uci get baidupcs-web.config.enabled)"
port="$(uci get baidupcs-web.config.port)"
dl_dir="$(uci get baidupcs-web.config.dl_dir)"
start() {
stop
[ "$enabled" == "1" ] || exit 0
mkdir -p "${dl_dir}"
baidupcs-web config set -savedir="${dl_dir}" >/dev/null 2>&1
baidupcs-web web --port "${port}" --access >/dev/null 2>&1 &
}
stop() {
killall baidupcs-web >/dev/null 2>&1
}

View File

@ -0,0 +1,11 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@baidupcs-web[-1]
add ucitrack baidupcs-web
set ucitrack.@baidupcs-web[-1].init=baidupcs-web
commit ucitrack
EOF
rm -f /tmp/luci-indexcache
exit 0

View File

@ -0,0 +1,10 @@
module("luci.controller.baidupcs-web", package.seeall)
function index()
if not nixio.fs.access("/etc/config/baidupcs-web") then
return
end
local page
page = entry({"admin", "services", "baidupcs-web"}, cbi("baidupcs-web"), _("百度网盘管理"), 100)
page.dependent = true
end

View File

@ -0,0 +1,46 @@
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 baidupcs-web > /dev/null") == 0)
local button = ""
local state_msg = ""
local trport = uci:get("baidupcs-web", "config", "port")
if running then
button = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"button\" value=\" " .. translate("打开BaiduPCS-Web管理界面") .. " \" onclick=\"window.open('http://'+window.location.hostname+':" .. trport .. "')\"/>"
end
if running then
state_msg = "<b><font color=\"green\">" .. translate("BaiduPCS-Web 运行中") .. "</font></b>"
else
state_msg = "<b><font color=\"red\">" .. translate("BaiduPCS-Web 未运行") .. "</font></b>"
end
m = Map("baidupcs-web", translate("百度网盘管理"), translate("基于BaiduPCS-Web让你高效的使用百度云。") .. button
.. "<br/><br/>" .. translate("BaiduPCS-Web运行状态").. " : " .. state_msg .. "<br/>")
s = m:section(TypedSection, "baidupcs-web", "")
s.addremove = false
s.anonymous = true
enable = s:option(Flag, "enabled", translate("启用"))
enable.rmempty = false
o = s:option(Value, "port", translate("监听端口"))
o.placeholder = 5299
o.default = 5299
o.datatype = "port"
o.rmempty = false
o = s:option(Value, "dl_dir", translate("下载目录"))
o.placeholder = "/etc/baidupcsweb-download"
o.default = "/etc/baidupcsweb-download"
o.rmempty = false
return m