first commit
commit
9850326f67
@ -0,0 +1,51 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-qbittorrent
|
||||
PKG_VERSION:=1.0.7
|
||||
PKG_RELEASE:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=luci
|
||||
CATEGORY:=LuCI
|
||||
SUBMENU:=3. Applications
|
||||
TITLE:=qBittorrent Luci Application bundled with specific Qbittorrent x86 dependencies
|
||||
DEPENDS:=+libstdcpp +luci-compat +libQt6Xml +libQt6Sql +libQt6Network +libQt6Core +libopenssl +boost-system +boost +zlib +rblibtorrent +qt6-plugin-libqsqlite +qt6-plugin-libqopensslbackend +qBittorrent +libpcre
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
qBittorrent Luci is an all-in-one installer for Qbittorrent on x86 with custom dependencies
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
$(foreach ipk,$(wildcard $(CURDIR)/files/*.ipk),$(CP) $(ipk) $(PKG_BUILD_DIR);)
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_DIR) $(1)/tmp
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/qbittorrent
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d/
|
||||
|
||||
$(INSTALL_BIN) ./files/etc/config/qbittorrent $(1)/etc/config/qbittorrent
|
||||
$(INSTALL_BIN) ./files/etc/init.d/qbittorrent $(1)/etc/init.d/qbittorrent
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/80_qbittorrent $(1)/etc/uci-defaults/80_qbittorrent
|
||||
$(INSTALL_DATA) ./files/usr/lib/lua/luci/model/cbi/qbittorrent.lua $(1)/usr/lib/lua/luci/model/cbi/qbittorrent.lua
|
||||
$(INSTALL_DATA) ./files/usr/lib/lua/luci/controller/qbittorrent.lua $(1)/usr/lib/lua/luci/controller/qbittorrent.lua
|
||||
$(INSTALL_DATA) ./files/usr/share/rpcd/acl.d/luci-app-qbittorrent.json $(1)/usr/share/rpcd/acl.d/luci-app-qbittorrent.json
|
||||
$(INSTALL_DATA) ./files/usr/lib/lua/luci/view/qbittorrent/qbittorrent_status.htm $(1)/usr/lib/lua/luci/view/qbittorrent/qbittorrent_status.htm
|
||||
|
||||
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
@ -0,0 +1,10 @@
|
||||
|
||||
config qbittorrent
|
||||
option profile_dir '/etc'
|
||||
option download_dir '/mnt/download'
|
||||
option port '8081'
|
||||
option enable '0'
|
||||
option socks5_server 'proxy.torguard.org'
|
||||
option socks5_port '1085'
|
||||
option socks5_user 'username'
|
||||
option socks5_pass 'password'
|
@ -0,0 +1,108 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
START=99
|
||||
|
||||
get_config()
|
||||
{
|
||||
config_get_bool enable "$1" enable 0
|
||||
}
|
||||
|
||||
config_qbittorrent()
|
||||
{
|
||||
local download_dir
|
||||
local profile_dir
|
||||
local port
|
||||
local socks5_server
|
||||
local socks5_port
|
||||
local socks5_user
|
||||
local socks5_pass
|
||||
config_get download_dir "$1" "download_dir"
|
||||
config_get port "$1" "port"
|
||||
config_get socks5_server "$1" "socks5_server"
|
||||
config_get socks5_port "$1" "socks5_port"
|
||||
config_get socks5_user "$1" "socks5_user"
|
||||
config_get socks5_pass "$1" "socks5_pass"
|
||||
config_get profile_dir "$1" "profile_dir"
|
||||
mkdir -p "$download_dir"
|
||||
mkdir -p "$2" "$2/qBittorrent" "$2/qBittorrent/config"
|
||||
{ [ "$2" != "/etc" ] && [ "$2" != "/etc/" ]; } && ln -sf "/etc/qBittorrent/ipfilter.dat" "$2/qBittorrent/ipfilter.dat"
|
||||
if [ -f "$2/qBittorrent/config/qBittorrent.conf" ]; then
|
||||
sed -i 's/WebUI\\Port=[0-9]*/WebUI\\Port='"$port"'/g' "$2/qBittorrent/config/qBittorrent.conf"
|
||||
sed -i "/Downloads\\\SavePath/c\Downloads\\\SavePath=$download_dir" "$2/qBittorrent/config/qBittorrent.conf"
|
||||
sed -i "/Proxy\\\IP/c\Proxy\\\IP=$socks5_server" "$2/qBittorrent/config/qBittorrent.conf"
|
||||
sed -i "/Proxy\\\Port/c\Proxy\\\Port=$socks5_port" "$2/qBittorrent/config/qBittorrent.conf"
|
||||
sed -i "/Proxy\\\Username/c\Proxy\\\Username=$socks5_user" "$2/qBittorrent/config/qBittorrent.conf"
|
||||
sed -i "/Proxy\\\Password/c\Proxy\\\Password=$socks5_pass" "$2/qBittorrent/config/qBittorrent.conf"
|
||||
else
|
||||
cat >"$2/qBittorrent/config/qBittorrent.conf"<<EOF
|
||||
[AutoRun]
|
||||
enabled=false
|
||||
program=
|
||||
|
||||
[BitTorrent]
|
||||
Session\DefaultSavePath=/mnt/download
|
||||
Session\IPFilter=/.config/qBittorrent/ipfilter.dat
|
||||
Session\IPFilteringEnabled=false
|
||||
Session\Port=15935
|
||||
Session\ProxyPeerConnections=true
|
||||
Session\QueueingSystemEnabled=true
|
||||
Session\TrackerFilteringEnabled=false
|
||||
|
||||
[LegalNotice]
|
||||
Accepted=true
|
||||
|
||||
[Network]
|
||||
Cookies=@Invalid()
|
||||
Proxy\IP=${socks5_server}
|
||||
Proxy\OnlyForTorrents=true
|
||||
Proxy\Password=${socks5_pass}
|
||||
Proxy\Port=${socks5_port}
|
||||
Proxy\Type=SOCKS5_PW
|
||||
Proxy\Username=${socks5_user}
|
||||
|
||||
[Preferences]
|
||||
Advanced\AutoBanUnknownPeer=true
|
||||
Bittorrent\AutoUpdateTrackers=true
|
||||
Bittorrent\CustomizeTrackersListUrl=https://trackerslist.com/all.txt
|
||||
Downloads\SavePath=${download_dir}
|
||||
General\Locale=en
|
||||
IPFilter\Enabled=false
|
||||
IPFilter\File=$2/qBittorrent/ipfilter.dat
|
||||
IPFilter\FilterTracker=false
|
||||
WebUI\CSRFProtection=false
|
||||
WebUI\Port=${port}
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
run_qbittorrent()
|
||||
{
|
||||
local enable
|
||||
config_get_bool enable "$1" enable
|
||||
|
||||
if [ $enable ]; then
|
||||
local profile_dir
|
||||
config_get profile_dir "$1" profile_dir
|
||||
config_foreach config_qbittorrent "qbittorrent" "$profile_dir"
|
||||
if [ "$profile_dir" != "" ]; then
|
||||
qbittorrent-nox -d --profile="$profile_dir"
|
||||
else
|
||||
echo "No profile_dir found, stop!"
|
||||
fi
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
stop
|
||||
local profile_path
|
||||
config_load "qbittorrent"
|
||||
config_foreach get_config "qbittorrent"
|
||||
[ $enable -eq 0 ] && exit 0
|
||||
config_foreach run_qbittorrent "qbittorrent"
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
killall "qbittorrent-nox" >/dev/null 2>&1
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@qbittorrent[-1]
|
||||
add ucitrack qbittorrent
|
||||
set ucitrack.@qbittorrent[-1].init=qbittorrent
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
touch /etc/config/qbittorrent
|
||||
chmod +x /etc/init.d/qbittorrent
|
||||
|
||||
/etc/init.d/qbittorrent start
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
@ -0,0 +1,22 @@
|
||||
|
||||
module("luci.controller.qbittorrent", package.seeall)
|
||||
|
||||
function index()
|
||||
entry({"admin", "nas"}, firstchild(), _("NAS") , 45).dependent = false
|
||||
if not nixio.fs.access("/etc/config/qbittorrent") then
|
||||
return
|
||||
end
|
||||
|
||||
local page = entry({"admin", "nas", "qbittorrent"}, cbi("qbittorrent"), _("qBittorrent"))
|
||||
page.order = 10
|
||||
page.dependent = true
|
||||
page.acl_depends = { "luci-app-qbittorrent" }
|
||||
entry({"admin","nas","qbittorrent","status"},call("act_status")).leaf=true
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e={}
|
||||
e.running=luci.sys.call("pgrep qbittorrent-nox >/dev/null")==0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
@ -0,0 +1,56 @@
|
||||
m = Map("qbittorrent", translate("qBittorrent"), translate("qBittorrent is a cross-platform free and open-source BitTorrent client.").."<br/>"..translate("Default login username: admin, password: adminadmin."))
|
||||
|
||||
m:section(SimpleSection).template="qbittorrent/qbittorrent_status"
|
||||
|
||||
s = m:section(TypedSection, "qbittorrent")
|
||||
s.anonymous=true
|
||||
|
||||
enable = s:option(Flag, "enable", translate("Enable"))
|
||||
enable.rmempty = false
|
||||
enable.write = enable.write
|
||||
|
||||
port = s:option(Value,"port",translate("Port"),translate("WebUI listening port"))
|
||||
port.default = "8080"
|
||||
port.placeholder = "8080"
|
||||
port.rmempty = false
|
||||
|
||||
profile_dir = s:option(Value,"profile_dir",translate("Profile Dir"),translate("Store configuration files in the Path"))
|
||||
profile_dir.default = "/etc"
|
||||
profile_dir.placeholder = "/etc"
|
||||
profile_dir.rmempty = false
|
||||
|
||||
download_dir = s:option(Value,"download_dir",translate("Download Dir"),translate("Store download files in the Path"))
|
||||
download_dir.default = "/mnt/download"
|
||||
download_dir.placeholder = "/mnt/download"
|
||||
download_dir.rmempty = false
|
||||
|
||||
download_dir = s:option(Value,"socks5_server",translate("Socks5 Server"),translate("Set your sock5 proxy server"))
|
||||
download_dir.default = "proxy.torguard.org"
|
||||
download_dir.placeholder = "proxy.torguard.org"
|
||||
download_dir.rmempty = false
|
||||
|
||||
download_dir = s:option(Value,"socks5_port",translate("Socks5 Port"),translate("Set your sock5 port number"))
|
||||
download_dir.default = "1085"
|
||||
download_dir.placeholder = "1085"
|
||||
download_dir.rmempty = false
|
||||
|
||||
download_dir = s:option(Value,"socks5_user",translate("Socks5 Username"),translate("Set your sock5 username"))
|
||||
download_dir.default = "username"
|
||||
download_dir.placeholder = "username"
|
||||
download_dir.rmempty = false
|
||||
|
||||
download_dir = s:option(Value,"socks5_pass",translate("Socks5 Password"),translate("Set your sock5 password"))
|
||||
download_dir.default = "password"
|
||||
download_dir.placeholder = "password"
|
||||
download_dir.rmempty = false
|
||||
|
||||
function enable.write(self, section, value)
|
||||
Flag.write(self, section, value)
|
||||
if value == "1" then
|
||||
luci.sys.call("/etc/init.d/qbittorrent start >/dev/null 2>&1")
|
||||
else
|
||||
luci.sys.call("/etc/init.d/qbittorrent stop >/dev/null 2>&1")
|
||||
end
|
||||
end
|
||||
|
||||
return m
|
@ -0,0 +1,27 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[nas]], [[qBittorrent]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('qBittorrent_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><b><font color=green>qBittorrent <%:RUNNING%></font></b></em><input class="cbi-button mar-10" type="button" value="<%:Open Web Interface%>" onclick="openwebui();" />';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red>qBittorrent <%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
function openwebui(){
|
||||
var url = window.location.host+":<%=luci.sys.exec("uci -q get qbittorrent.@qbittorrent[0].port"):gsub("^%s*(.-)%s*$", "%1")%>";
|
||||
window.open('http://'+url,'target','');
|
||||
};
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="qBittorrent_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
@ -0,0 +1,11 @@
|
||||
{
|
||||
"luci-app-qbittorrent": {
|
||||
"description": "Grant UCI access for luci-app-qbittorrent",
|
||||
"read": {
|
||||
"uci": [ "qbittorrent" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "qbittorrent" ]
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
@ -0,0 +1,2 @@
|
||||
$(CP) $(PKG_BUILD_DIR)/*.ipk $(1)/tmp/
|
||||
$(INSTALL_BIN) ./files/install_dependencies.sh $(1)/usr/bin/install_dependencies.sh
|
Loading…
Reference in New Issue