🌴 Sync 2026-03-05 23:51:42

This commit is contained in:
github-actions[bot] committed 2026-03-05 23:51:42 +08:00
1 parent 0d155c70be
commit 32600acc60
14258 files changed
+3954570

No files matched your search

+145
View File
@@ -0,0 +1,145 @@
# Makefile build Torrserver MatriX for OpenWrt SDK
# add node repository in feeds.conf.default for build OpenWrt current branch: e.g 24.10
# src-git node https://github.com/nxhack/openwrt-node-packages.git;openwrt-24.10
# and optional for compress binary via upx
# src-git upx https://github.com/kuoruan/openwrt-upx.git
# Copyright (c) Konstantine Shevlakov 2025 at <shevlakov@132lan.ru>
include $(TOPDIR)/rules.mk
PKG_NAME:=torrserver
PKG_VERSION:=MatriX.141
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/YouROK/TorrServer.git
PKG_SOURCE_VERSION:=d266990face0a530880a19a3e39666d21931aed9
PKG_MIRROR_HASH:=skip
PKG_MAINTAINER:=Konstantine Shevlakov <shevlakov@132lan.ru>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_BUILD_DEPENDS:=golang/host node/host node-yarn/host upx/host
PKG_BUILD_PARALLEL:=1
PKG_BUILD_FLAGS:=no-mips16
include $(INCLUDE_DIR)/package.mk
GO_ARCH:=
ifeq ($(ARCH),aarch64)
GO_ARCH:=arm64
else ifeq ($(ARCH),arm)
GO_ARCH:=arm
else ifeq ($(ARCH),i386)
GO_ARCH:=386
else ifeq ($(ARCH),i686)
GO_ARCH:=386
else ifeq ($(ARCH),x86_64)
GO_ARCH:=amd64
else ifeq ($(ARCH),mips)
GO_ARCH:=mips
else ifeq ($(ARCH),mipsel)
GO_ARCH:=mipsle
else ifeq ($(ARCH),mips64)
GO_ARCH:=mips64
else ifeq ($(ARCH),mips64el)
GO_ARCH:=mips64le
else ifeq ($(ARCH),loongarch64)
GO_ARCH:=loong64
else ifeq ($(ARCH),riscv64)
GO_ARCH:=riscv64
else ifeq ($(ARCH),riscv32)
GO_ARCH:=riscv
else ifeq ($(ARCH),powerpc)
GO_ARCH:=ppc
else ifeq ($(ARCH),powerpc64)
GO_ARCH:=ppc64
else ifeq ($(ARCH),powerpc64le)
GO_ARCH:=ppc64le
else
GO_ARCH:=$(ARCH)
endif
define Package/$(PKG_NAME)
SECTION:=multimedia
CATEGORY:=Multimedia
TITLE:=TorrServer - stream torrent files
URL:=https://github.com/YouROK/TorrServer
DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle
endef
define Package/$(PKG_NAME)/description
TorrServer is a tool for streaming torrent files.
endef
GO_HOST:=$(STAGING_DIR_HOSTPKG)/bin/go
UPX:=$(STAGING_DIR_HOST)/bin/upx
UPX_AVAILABLE:=$(shell [ -x "$(UPX)" ] && echo yes || echo no)
TARGET_CC:=$(TARGET_CROSS)gcc
TARGET_CXX:=$(TARGET_CROSS)g++
ifeq ($(UPX_AVAILABLE),yes)
define upxcompress
@echo "Compressing $(PKG_NAME) with UPX..."
$(UPX) --lzma --best $(1)
endef
else
define upxcompress
@echo "UPX not found at $(UPX)"
@echo "Skipping compression of $(PKG_NAME)"
endef
endif
define Build/Prepare
$(call Build/Prepare/Default)
cd $(PKG_BUILD_DIR) && \
ln -sf server/go.mod go.mod && \
ln -sf server/go.sum go.sum
endef
define Build/Compile
# Build Application WEB Interface
cd $(PKG_BUILD_DIR) && \
export PATH=$(STAGING_DIR_HOSTPKG)/bin:$$PATH && \
NODE_OPTIONS=--openssl-legacy-provider \
$(GO_HOST) run gen_web.go
# Prepare Build Application
cd $(PKG_BUILD_DIR)/server && \
$(GO_HOST) clean -i -r -cache && \
$(GO_HOST) mod tidy
# Build main Application
cd $(PKG_BUILD_DIR)/server && \
GOOS=linux \
GOARCH=$(GO_ARCH) \
$(if $(filter arm,$(ARCH)),GOARM=$(if $(filter bcm53xx kirkwood,$(BOARD)),5,7)) \
$(if $(filter mips mipsel,$(ARCH)),GOMIPS=softfloat) \
$(if $(filter mips64 mips64el,$(ARCH)),GOMIPS64=softfloat) \
CGO_ENABLED=0 \
$(GO_HOST) build \
-trimpath \
-ldflags="-s -w -checklinkname=0 -extldflags=-static" \
-tags=nosqlite \
-o $(PKG_INSTALL_DIR)/$(PKG_NAME) \
./cmd
$(call upxcompress,$(PKG_INSTALL_DIR)/$(PKG_NAME))
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/$(PKG_NAME) $(1)/usr/bin/
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/torrserver.config $(1)/etc/config/torrserver
$(INSTALL_DIR) $(1)/usr/share/torrserver
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/torrserver.init $(1)/etc/init.d/torrserver
endef
$(eval $(call BuildPackage,$(PKG_NAME)))
+6
View File
@@ -0,0 +1,6 @@
config torrserver
option enabled '0'
option port '8090'
option ssl '0'
option ssl_port '8091'
option path '/usr/share/torrserver'
+50
View File
@@ -0,0 +1,50 @@
#!/bin/sh /etc/rc.common
# Simple proc.d init script by koshev-msk
# <shevlakov@132lan.ru> 2025
USE_PROCD=1
START=99
STOP=01
NAME=torrserver
BINDIR=/usr/bin
start_service() {
config_load torrserver
config_get enabled "$CONFIG_SECTION" enabled
config_get port "$CONFIG_SECTION" port
config_get address "$CONFIG_SECTION" address
config_get ssl "$CONFIG_SECTION" ssl
config_get ssl_port "$CONFIG_SECTION" ssl_port
config_get ssl_key "$CONFIG_SECTION" ssl_key
config_get ssl_cert "$CONFIG_SECTION" ssl_cert
config_get path "$CONFIG_SECTION" path
[ "$enabled" != "1" ] && return 1
[ ! -d "$path" ] && mkdir -p $path
procd_open_instance
procd_set_param command ${BINDIR}/${NAME}
procd_set_param respawn 300 5 5
procd_set_param limits nofile="unlimited"
[ $address ] && procd_append_param command -i $address
procd_append_param command -d "$path"
procd_append_param command -p "$port"
[ "$ssl" = "1" ] && {
procd_append_param command --ssl
procd_append_param command --sslport "$ssl_port"
[ -f "$ssl_key" ] && procd_append_param command --sslkey "$ssl_key"
[ -f "$ssl_cert" ] && procd_append_param command --sslcert "$ssl_cert"
}
procd_set_param env GIN_MODE=release
procd_set_param stdout 1
procd_set_param pidfile /var/run/${NAME}.pid
procd_close_instance
}
service_triggers() {
procd_add_reload_trigger "torrserver"
}