diff --git a/package/cnsztl/BaiduPCS-Web/Makefile b/package/cnsztl/BaiduPCS-Web/Makefile new file mode 100644 index 0000000000..65668dfb98 --- /dev/null +++ b/package/cnsztl/BaiduPCS-Web/Makefile @@ -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))) diff --git a/package/cnsztl/BaiduPCS-Web/files/arm b/package/cnsztl/BaiduPCS-Web/files/arm new file mode 100755 index 0000000000..8e4fc58ae5 Binary files /dev/null and b/package/cnsztl/BaiduPCS-Web/files/arm differ diff --git a/package/cnsztl/BaiduPCS-Web/files/arm64 b/package/cnsztl/BaiduPCS-Web/files/arm64 new file mode 100755 index 0000000000..f7d976f749 Binary files /dev/null and b/package/cnsztl/BaiduPCS-Web/files/arm64 differ diff --git a/package/cnsztl/BaiduPCS-Web/files/i386 b/package/cnsztl/BaiduPCS-Web/files/i386 new file mode 100755 index 0000000000..db1465572a Binary files /dev/null and b/package/cnsztl/BaiduPCS-Web/files/i386 differ diff --git a/package/cnsztl/BaiduPCS-Web/files/mipsel b/package/cnsztl/BaiduPCS-Web/files/mipsel new file mode 100755 index 0000000000..1fc21985fc Binary files /dev/null and b/package/cnsztl/BaiduPCS-Web/files/mipsel differ diff --git a/package/cnsztl/BaiduPCS-Web/files/x86_64 b/package/cnsztl/BaiduPCS-Web/files/x86_64 new file mode 100755 index 0000000000..1fa8011a38 Binary files /dev/null and b/package/cnsztl/BaiduPCS-Web/files/x86_64 differ diff --git a/package/cnsztl/luci-app-baidupcs-mipsle/Makefile b/package/cnsztl/luci-app-baidupcs-mipsle/Makefile deleted file mode 100755 index 9d9ac9c603..0000000000 --- a/package/cnsztl/luci-app-baidupcs-mipsle/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -# -# Copyright (C) 2016-2017 WindTech -# -# 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 - -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))) \ No newline at end of file diff --git a/package/cnsztl/luci-app-baidupcs-mipsle/files/etc/config/baidupcs b/package/cnsztl/luci-app-baidupcs-mipsle/files/etc/config/baidupcs deleted file mode 100755 index 5aa924e6f8..0000000000 --- a/package/cnsztl/luci-app-baidupcs-mipsle/files/etc/config/baidupcs +++ /dev/null @@ -1,6 +0,0 @@ - -config baidupcs 'config' - option port '5299' - option enabled '0' - option path '/mnt/sda1/baidupcs' - diff --git a/package/cnsztl/luci-app-baidupcs-mipsle/files/etc/init.d/baidupcs b/package/cnsztl/luci-app-baidupcs-mipsle/files/etc/init.d/baidupcs deleted file mode 100755 index 88e5788c19..0000000000 --- a/package/cnsztl/luci-app-baidupcs-mipsle/files/etc/init.d/baidupcs +++ /dev/null @@ -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 & -} diff --git a/package/cnsztl/luci-app-baidupcs-mipsle/files/etc/uci-defaults/luci-baidupcs b/package/cnsztl/luci-app-baidupcs-mipsle/files/etc/uci-defaults/luci-baidupcs deleted file mode 100755 index 097aec8e00..0000000000 --- a/package/cnsztl/luci-app-baidupcs-mipsle/files/etc/uci-defaults/luci-baidupcs +++ /dev/null @@ -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 \ No newline at end of file diff --git a/package/cnsztl/luci-app-baidupcs-mipsle/files/luci/controller/baidupcs.lua b/package/cnsztl/luci-app-baidupcs-mipsle/files/luci/controller/baidupcs.lua deleted file mode 100755 index 15a7ea1abd..0000000000 --- a/package/cnsztl/luci-app-baidupcs-mipsle/files/luci/controller/baidupcs.lua +++ /dev/null @@ -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 diff --git a/package/cnsztl/luci-app-baidupcs-mipsle/files/luci/i18n/baidupcs.zh-cn.lmo b/package/cnsztl/luci-app-baidupcs-mipsle/files/luci/i18n/baidupcs.zh-cn.lmo deleted file mode 100755 index 4ccebe8da5..0000000000 Binary files a/package/cnsztl/luci-app-baidupcs-mipsle/files/luci/i18n/baidupcs.zh-cn.lmo and /dev/null differ diff --git a/package/cnsztl/luci-app-baidupcs-mipsle/files/luci/model/cbi/baidupcs.lua b/package/cnsztl/luci-app-baidupcs-mipsle/files/luci/model/cbi/baidupcs.lua deleted file mode 100755 index 2f6a65655f..0000000000 --- a/package/cnsztl/luci-app-baidupcs-mipsle/files/luci/model/cbi/baidupcs.lua +++ /dev/null @@ -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 = "      " -end - -if running then - state_msg = "" .. translate("Baidupcs running") .. "" -else - state_msg = "" .. translate("Baidupcs not running") .. "" -end - -m = Map("baidupcs", translate("Baidupcs"), translate("Baidupcs is a simple web base baidu netdisk, here you can configure the settings.") .. button - .. "

" .. translate("Baidupcs Run Status").. " : " .. state_msg .. "
") - -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 diff --git a/package/cnsztl/luci-app-baidupcs-web/Makefile b/package/cnsztl/luci-app-baidupcs-web/Makefile new file mode 100644 index 0000000000..34202f98d1 --- /dev/null +++ b/package/cnsztl/luci-app-baidupcs-web/Makefile @@ -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))) diff --git a/package/cnsztl/luci-app-baidupcs-web/files/etc/config/baidupcs-web b/package/cnsztl/luci-app-baidupcs-web/files/etc/config/baidupcs-web new file mode 100644 index 0000000000..4e493e763a --- /dev/null +++ b/package/cnsztl/luci-app-baidupcs-web/files/etc/config/baidupcs-web @@ -0,0 +1,6 @@ + +config baidupcs-web 'config' + option port '5299' + option enabled '0' + option dl_dir '/etc/baidupcsweb-download' + diff --git a/package/cnsztl/luci-app-baidupcs-web/files/etc/init.d/baidupcs-web b/package/cnsztl/luci-app-baidupcs-web/files/etc/init.d/baidupcs-web new file mode 100755 index 0000000000..e4c6a8cf87 --- /dev/null +++ b/package/cnsztl/luci-app-baidupcs-web/files/etc/init.d/baidupcs-web @@ -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 +} diff --git a/package/cnsztl/luci-app-baidupcs-web/files/etc/uci-defaults/luci-baidupcs-web b/package/cnsztl/luci-app-baidupcs-web/files/etc/uci-defaults/luci-baidupcs-web new file mode 100755 index 0000000000..e72523b798 --- /dev/null +++ b/package/cnsztl/luci-app-baidupcs-web/files/etc/uci-defaults/luci-baidupcs-web @@ -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 diff --git a/package/cnsztl/luci-app-baidupcs-web/files/luci/controller/baidupcs-web.lua b/package/cnsztl/luci-app-baidupcs-web/files/luci/controller/baidupcs-web.lua new file mode 100644 index 0000000000..9d87b3a0e0 --- /dev/null +++ b/package/cnsztl/luci-app-baidupcs-web/files/luci/controller/baidupcs-web.lua @@ -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 diff --git a/package/cnsztl/luci-app-baidupcs-web/files/luci/model/cbi/baidupcs-web.lua b/package/cnsztl/luci-app-baidupcs-web/files/luci/model/cbi/baidupcs-web.lua new file mode 100644 index 0000000000..b127460f16 --- /dev/null +++ b/package/cnsztl/luci-app-baidupcs-web/files/luci/model/cbi/baidupcs-web.lua @@ -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 = "      " +end + +if running then + state_msg = "" .. translate("BaiduPCS-Web 运行中") .. "" +else + state_msg = "" .. translate("BaiduPCS-Web 未运行") .. "" +end + +m = Map("baidupcs-web", translate("百度网盘管理"), translate("基于BaiduPCS-Web,让你高效的使用百度云。") .. button + .. "

" .. translate("BaiduPCS-Web运行状态").. " : " .. state_msg .. "
") + +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