🐶 Sync 2023-03-21 01:42:35

This commit is contained in:
github-actions[bot] 2023-03-21 01:42:35 +08:00
parent feee444f83
commit ba42649c0d
30 changed files with 839 additions and 712 deletions

59
alac/Makefile Normal file
View File

@ -0,0 +1,59 @@
# SPDX-Identifier-License: GPL-3.0-only
#
# Copyright (C) 2020 Lean <coolsnowwolf@gmail.com>
# Copyright (C) 2021 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=alac
PKG_VERSION:=0.0.7
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/mikebrady/alac.git
PKG_SOURCE_DATE:=2019-02-13
PKG_SOURCE_VERSION:=96dd59d17b776a7dc94ed9b2c2b4a37177feb3c4
PKG_MIRROR_HASH:=skip
PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
PKG_FIXUP:=autoreconf
PKG_REMOVE_FILES:=autogen.sh
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/libalac
SECTION:=libs
CATEGORY:=Libraries
TITLE:=The Apple Lossless Audio Codec Library
URL:=https://github.com/mikebrady/alac
DEPENDS:=+libstdcpp
endef
define Package/libalac/description
The Apple Lossless Audio Codec (ALAC) is an audio codec developed by
Apple and supported on iPhone, iPad, most iPods, Mac and iTunes.
ALAC is a data compression method which reduces the size of audio
files with no loss of information. A decoded ALAC stream is
bit-for-bit identical to the original uncompressed audio file.
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libalac.so* $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/alac.pc $(1)/usr/lib/pkgconfig/
$(INSTALL_DIR) $(1)/usr/include
$(CP) $(PKG_INSTALL_DIR)/usr/include/alac $(1)/usr/include/
endef
define Package/libalac/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libalac.so* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,libalac))

52
bitsrunlogin-go/Makefile Normal file
View File

@ -0,0 +1,52 @@
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2021-2022 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=BitSrunLoginGo
PKG_VERSION:=3.7
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/Mmx233/BitSrunLoginGo/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=skip
PKG_LICENSE:=AGPL-3.0-only
PKG_LICENSE_FILES:=LICENSE
PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
GO_PKG:=github.com/Mmx233/BitSrunLoginGo
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
define Package/bitsrunlogin-go
SECTION:=net
CATEGORY:=Network
SUBMENU:=Campus Network
TITLE:=Bit Srun auto login tool
URL:=https://github.com/Mmx233/BitSrunLoginGo
DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle
endef
define Package/bitsrunlogin-go/conffiles
/etc/config/bitsrunlogin-go
endef
define Package/bitsrunlogin-go/install
$(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
$(INSTALL_DIR) $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/BitSrunLoginGo $(1)/usr/bin/bitsrunlogin-go
$(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d
$(INSTALL_CONF) $(CURDIR)/files/bitsrunlogin-go.config $(1)/etc/config/bitsrunlogin-go
$(INSTALL_BIN) $(CURDIR)/files/bitsrunlogin-go.init $(1)/etc/init.d/bitsrunlogin-go
endef
$(eval $(call GoBinPackage,bitsrunlogin-go))
$(eval $(call BuildPackage,bitsrunlogin-go))

View File

@ -0,0 +1,26 @@
config bitsrunlogin-go 'config'
option 'enabled' '0'
option 'domain' ''
# ISP type, see https://github.com/Mmx233/BitSrunLoginGo for details
option 'usertype' 'cmcc'
option 'username' ''
option 'password' ''
option 'acid' '5'
option 'enable_https' '0'
option 'skip_cert_verify' '0'
# Maximum time allowed for connection
option 'timeout' '5'
# Network check interval
option 'duration' '3600'
# Interface name in regex, e.g. "eth0\.[2-3]"
# Multi-interfaces mode will be enabled if not empty
option 'interfaces' ''
# Use interface ip for authentication in multi-interfaces mode
option use_dhcp_ip '0'
# Enable debug log
option 'debug' '0'

View File

@ -0,0 +1,96 @@
#!/bin/sh /etc/rc.common
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2022 Tianling Shen <cnsztl@immortalwrt.org>
USE_PROCD=1
START=99
STOP=10
CONF="bitsrunlogin-go"
PROG="/usr/bin/bitsrunlogin-go"
RUN_DIR="/var/run/$CONF"
start_service() {
config_load "$CONF"
local enabled
config_get_bool enabled "config" "enabled" "0"
[ "$enabled" -eq "1" ] || return 1
local domain usertype username password acid
local enable_https skip_cert_verify timeout duration
local interfaces use_dhcp_ip debug
config_get domain "config" "domain"
config_get usertype "config" "usertype"
config_get username "config" "username"
config_get password "config" "password"
config_get acid "config" "acid" "5"
config_get_bool enable_https "config" "enable_https" "0"
config_get_bool skip_cert_verify "config" "skip_cert_verify" "0"
config_get timeout "config" "timeout" "5"
config_get duration "config" "duration" "3600"
config_get interfaces "config" "interfaces"
config_get_bool use_dhcp_ip "config" "use_dhcp_ip" "0"
config_get_bool debug "config" "debug" "0"
mkdir -p "$RUN_DIR"
json_init
json_add_object "form"
json_add_string "domain" "$domain"
json_add_string "usertype" "$usertype"
json_add_string "username" "$username"
json_add_string "password" "$password"
json_close_object
json_add_object "meta"
json_add_string "n" "200"
json_add_string "type" "1"
json_add_string "acid" "$acid"
json_add_string "enc" "srun_bx1"
json_close_object
json_add_object "settings"
json_add_object "basic"
json_add_boolean "https" "$enable_https"
json_add_boolean "skip_cert_verify" "$skip_cert_verify"
json_add_int "timeout" "$timeout"
[ -z "$interfaces" ] || json_add_string "interfaces" "$interfaces"
[ -z "$interfaces" ] || json_add_boolean "use_dhcp_ip" "$use_dhcp_ip"
json_close_object
json_add_object "guardian"
json_add_boolean "enable" 1
json_add_int "duration" "$duration"
json_close_object
json_add_object "daemon"
json_add_boolean "enable" 0
json_add_string "path" "$RUN_DIR/.BitSrun"
json_close_object
json_add_object "log"
json_add_boolean "debug_level" "$debug"
json_add_boolean "write_file" 1
json_add_string "log_path" "$RUN_DIR"
json_add_string "log_name" "$CONF.log"
json_close_object
json_close_object
json_dump > "$RUN_DIR/$CONF.json"
procd_open_instance
procd_set_param command "$PROG"
procd_append_param command -config "$RUN_DIR/$CONF.json"
procd_set_param respawn
procd_close_instance
}
stop_service() {
rm -rf "$RUN_DIR"
}
reload_service() {
stop
start
}
service_triggers() {
procd_add_reload_trigger "$CONF"
}

44
cxxopts/Makefile Normal file
View File

@ -0,0 +1,44 @@
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2021 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=cxxopts
PKG_VERSION:=3.1.1
PKG_RELEASE:=9
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/jarro2783/cxxopts/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=skip
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
PKG_BUILD_PARALLEL:=1
CMAKE_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
CMAKE_OPTIONS+= \
-DCXXOPTS_ENABLE_INSTALL=ON \
-DCXXOPTS_BUILD_EXAMPLES=OFF \
-DCXXOPTS_BUILD_TESTS=OFF
define Package/cxxopts
SECTION:=lib
CATEGORY:=Libraries
URL:=https://github.com/jarro2783/cxxopts
TITLE:=Lightweight C++ command line option parser
DEPENDS:=+libc
BUILDONLY:=1
endef
define Package/cxxopts/description
This is a lightweight C++ option parser library, supporting the
standard GNU style syntax for options.
endef
$(eval $(call BuildPackage,cxxopts))

48
gallery-dl/Makefile Normal file
View File

@ -0,0 +1,48 @@
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2021-2022 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=gallery-dl
PKG_VERSION:=1.24.2
PKG_RELEASE:=1
PYPI_NAME:=gallery_dl
PKG_HASH:=skip
PKG_LICENSE:=GPL-2.0-only
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
include $(TOPDIR)/feeds/packages/lang/python/pypi.mk
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/python/python3-package.mk
define Package/gallery-dl
SECTION:=multimedia
CATEGORY:=Multimedia
TITLE:=Command-line program to download image galleries and collections
URL:=https://github.com/mikf/gallery-dl
DEPENDS:= \
+ca-bundle \
+python3 \
+python3-codecs \
+python3-ctypes \
+python3-email \
+python3-requests \
+python3-setuptools \
+python3-xml
endef
define Package/gallery-dl/description
gallery-dl is a command-line program to download image galleries
and collections from several image hosting sites.
It is a cross-platform tool with many configuration options and
powerful filenaming capabilities.
endef
$(eval $(call Py3Package,gallery-dl))
$(eval $(call BuildPackage,gallery-dl))
$(eval $(call BuildPackage,gallery-dl-src))

43
go-nats/Makefile Normal file
View File

@ -0,0 +1,43 @@
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2021 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=go-nats
PKG_VERSION:=0.0.1
PKG_RELEASE:=6
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/enobufs/go-nats.git
PKG_SOURCE_DATE:=2019-09-23
PKG_SOURCE_VERSION:=4effc32e0f4006da0636b24f4468cf32ce494d71
PKG_MIRROR_HASH:=skip
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
GO_PKG:=github.com/enobufs/go-nats
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
define Package/go-nats
SECTION:=net
CATEGORY:=Network
TITLE:=A NAT type discovery tool
URL:=https://github.com/enobufs/go-nats
DEPENDS:=$(GO_ARCH_DEPENDS)
endef
define Package/go-nats/description
A NAT type discovery tool using STUN.
endef
$(eval $(call GoBinPackage,go-nats))
$(eval $(call BuildPackage,go-nats))

56
go-rice/Makefile Normal file
View File

@ -0,0 +1,56 @@
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2021 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=go.rice
PKG_VERSION:=1.0.2
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/GeertJohan/go.rice/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=skip
PKG_LICENSE:=BSD-2-Clause
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
HOST_BUILD_DEPENDS:=golang/host
HOST_BUILD_PARALLEL:=1
PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
GO_PKG:=github.com/GeertJohan/go.rice
GO_PKG_BUILD_PKG:=$(GO_PKG)/rice
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/golang/golang-host-build.mk
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
define Package/go-rice
SECTION:=devel
CATEGORY:=Development
TITLE:=A Go package that makes working with resources
URL:=https://github.com/GeertJohan/go.rice
DEPENDS:=$(GO_ARCH_DEPENDS)
endef
define Package/go-rice/description
go.rice is a Go package that makes working with resources such as
html,js,css,images and templates easy.
During development go.rice will load required files directly from disk.
Upon deployment it's easy to add all resource files to a executable
using the rice tool without changing the source code for your package.
go.rice provides methods to add resources to a binary in different scenarios.
endef
$(eval $(call GoBinHostBuild))
$(eval $(call HostBuild))
$(eval $(call GoBinPackage,go-rice))
$(eval $(call BuildPackage,go-rice))

44
go-wol/Makefile Normal file
View File

@ -0,0 +1,44 @@
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2021 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=go-wol
PKG_VERSION:=2.0.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/sabhiram/go-wol/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=skip
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
GO_PKG:=github.com/sabhiram/go-wol/cmd/wol
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
define Package/go-wol
SECTION:=net
CATEGORY:=Network
TITLE:=Simple wake on LAN magic packet generator for golang
URL:=https://github.com/sabhiram/go-wol
DEPENDS:=$(GO_ARCH_DEPENDS)
endef
define Package/go-wol/install
$(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
$(INSTALL_DIR) $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/wol $(1)/usr/bin/go-wol
endef
$(eval $(call GoBinPackage,go-wol))
$(eval $(call BuildPackage,go-wol))

42
gotop/Makefile Normal file
View File

@ -0,0 +1,42 @@
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2021 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=gotop
PKG_VERSION:=4.2.0
PKG_RELEASE:=15
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/xxxserxxx/gotop/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=skip
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
GO_PKG:=github.com/xxxserxxx/gotop
GO_PKG_LDFLAGS_X:=main.Version=$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
define Package/gotop
SECTION:=admin
CATEGORY:=Administration
TITLE:=A terminal based graphical activity monitor
URL:=https://github.com/xxxserxxx/gotop
DEPENDS:=$(GO_ARCH_DEPENDS)
endef
define Package/gotop/description
Another terminal based graphical activity monitor.
endef
$(eval $(call GoBinPackage,gotop))
$(eval $(call BuildPackage,gotop))

42
joker/Makefile Normal file
View File

@ -0,0 +1,42 @@
# SPDX-Identifier-License: GPL-3.0-only
#
# Copyright (C) 2021 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=joker
PKG_VERSION:=20230101
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/txthinking/joker/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=skip
PKG_LICENSE:=GPL-3.0
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
include $(INCLUDE_DIR)/package.mk
define Package/joker
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Run command as daemon
URL:=https://github.com/txthinking/joker
DEPENDS:=+libc
endef
define Package/joker/description
Joker can turn process into daemon. Zero-Configuration.
endef
define Build/Compile
$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) \
$(PKG_BUILD_DIR)/{main,run}.c -o $(PKG_BUILD_DIR)/joker
endef
define Package/joker/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/joker $(1)/usr/bin/
endef
$(eval $(call BuildPackage,joker))

View File

@ -0,0 +1,38 @@
From 3a29d4961d525a6048f10844c56db228cf711957 Mon Sep 17 00:00:00 2001
From: Mcdull <30206217+McDull-GitHub@users.noreply.github.com>
Date: Tue, 6 Apr 2021 20:32:14 +0800
Subject: [PATCH] joker stop
---
main.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
--- a/main.c
+++ b/main.c
@@ -54,6 +54,26 @@ int main(int argc, char *argv[])
i = system("s=`ps -e -o command | grep joker | grep -v grep | grep -v \"joker list\"`; if [ -n \"$s\" ]; then ps -x | grep -F \"`echo \"$s\" | cut -d' ' -f2-`\" | grep -v joker | grep -v grep; fi;");
return i;
}
+ if(argc == 2 && strcmp(argv[1], "stop") == 0){
+ int i;
+ int pid = 0;
+ i = system("s=`ps -e -o command | grep joker | grep -v grep | grep -v \"joker list\"`; if [ -n \"$s\" ]; then ps -x | grep -F \"`echo \"$s\" | cut -d' ' -f2-`\" | grep -v joker | grep -v grep; fi;");
+ if (i != 0){
+ printf("error: joker is not running!\n");
+ return i;
+ }
+ printf("\nPid of the process you want to terminate -> ");
+ scanf("%d", &pid);
+ if(pid == 0){
+ return 0;
+ }
+ i = kill(pid, SIGTERM);
+ if(i != 0){
+ printf("stop failed\n");
+ return i;
+ }
+ return 0;
+ }
if(argc == 3 && strcmp(argv[1], "stop") == 0){
int pid = atoi(argv[2]);
if(pid == 0){

View File

@ -28,6 +28,7 @@ return view.extend({
_("Enable or disable the OpenWISP service."));
o.value('disabled', _('Disabled'));
o.value('monitoring', _('Enabled'));
o.default = 'monitoring'
o = s.taboption('general', form.Value, 'url', _('Server URL'), _('The URL to the OpenWISP server. Example: https://openwisp2.mynetwork.com'))
o.placeholder = 'https://openwisp2.mynetwork.com'
@ -37,49 +38,60 @@ return view.extend({
o = s.taboption('general', form.Value, 'interval', _('Update Interval'), 'How often to check in with the OpenWISP server. Expressed in seconds.')
o.placeholder = '120'
o.rmempty = true
o.datatype = 'uinteger';
// Advanced settings
o = s.taboption('advanced', form.Flag, 'verify_ssl', _('Verify SSL'), _('Verify the server SSL certificate.'))
o.rmempty = false
o.rmempty = true
o.default = true
o = s.taboption('advanced', form.Flag, 'consistent_key', _('Consistent Key'), _('When using Automatic registration, this feature allows devices to keep the same configuration even if reset or re-flashed. This feature is enabled by default, but must be enabled also in the controller application in order to work.'))
o.rmempty = false
o.rmempty = true
o.default = true
o = s.taboption('advanced', widgets.DeviceSelect, 'mac_interface', _('MAC Interface'), _('The interface to use for getting the MAC for this device.'))
o.rmempty = false
o.default = 'eth0'
o = s.taboption('advanced', widgets.NetworkSelect, 'management_interface', _('Management Interface'), _('The interface to use for management and control.'))
o.rmempty = false
o.placeholder = 'tun0'
o.rmempty = true
o = s.taboption('advanced', form.Flag, 'merge_config', _('Merge Config'), _('If selected, in the event a config item is present in both the remote and local configuration, the remote configuration takes precedence over local configuration.'))
o.rmempty = false
o.rmempty = true
o.default = true
o = s.taboption('advanced', form.DynamicList, 'tags', _('Tags'), _('Tags applied to this device.'))
o = s.taboption('advanced', form.Flag, 'test_config', _('Test Config'), _('If the agent is unable to reach the controller after applying the downloaded config it will be reverted.'))
o.default = true
o.rmempty = true
o = s.taboption('advanced', form.Value, 'test_script', _('Test Script'), 'Path to a custom test script if the default Test Config script does not meet your needs.')
o.depends({ test_config: '1' })
o.datatype = "file"
o = s.taboption('advanced', form.Flag, 'hardware_id_key', _('Hardware ID Key'), _('Use a unique hardware ID for device identification, for example a serial number.'))
o.rmempty = false
o.default = false
o.rmempty = true
o = s.taboption('advanced', form.Value, 'hardware_id_script', _('Hardware ID Script'), 'Path to the script used to return the value of the hardware key.')
o.depends({ hardware_id_key: '1' })
o.datatype = "file"
o = s.taboption('advanced', form.Value, 'bootup_delay', _('Boot Delay'), 'Maximum value of the delay after boot before starting OpenWISP service. Expressed in seconds.')
o.placeholder = '0'
o.placeholder = '10'
o.rmempty = true
o.datatype = 'uinteger';
o = s.taboption('advanced', form.Value, 'connect_timeout', _('Connect Timeout'), 'Value passed to curl --connect-timeout argument, defaults to 15. Expressed in seconds.')
o.placeholder = '15'
o.rmempty = true
o.datatype = 'uinteger';
o = s.taboption('advanced', form.Value, 'max_time', _('Max Time'), _('Value passed to curl --max-time argument, defaults to 30. Expressed in seconds.'))
o.placeholder = '30'
o.rmempty = true
o.datatype = 'uinteger';
o = s.taboption('advanced', form.Value, 'capath', _('CA Path'), _('Use the specified certificate file to verify the peer. The file may contain multiple CA certificates. The certificate(s) must be in PEM format.'))

View File

@ -1,8 +1,8 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"PO-Revision-Date: 2022-01-29 08:19+0000\n"
"Last-Translator: Franco Castillo <castillofrancodamian@gmail.com>\n"
"PO-Revision-Date: 2023-03-04 13:09+0000\n"
"Last-Translator: gallegonovato <fran-carro@hotmail.es>\n"
"Language-Team: Spanish <https://hosted.weblate.org/projects/openwrt/"
"luciapplicationsopenwisp/es/>\n"
"Language: es\n"
@ -10,16 +10,15 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.11-dev\n"
"X-Generator: Weblate 4.16.2-dev\n"
#: applications/luci-app-openwisp/htdocs/luci-static/resources/view/openwisp.js:17
msgid "Advanced Settings"
msgstr "Configuración avanzada"
#: applications/luci-app-openwisp/htdocs/luci-static/resources/view/openwisp.js:73
#, fuzzy
msgid "Boot Delay"
msgstr "Retardo de arranque"
msgstr "Retraso en el arranque"
#: applications/luci-app-openwisp/htdocs/luci-static/resources/view/openwisp.js:88
msgid "CA Cert"
@ -30,7 +29,6 @@ msgid "CA Path"
msgstr "Ruta CA"
#: applications/luci-app-openwisp/htdocs/luci-static/resources/view/openwisp.js:12
#, fuzzy
msgid ""
"Configure, start and stop the OpenWISP agent on this device. Read more about "
"configuration values: <a target='_blank' rel='noopener noreferrer' "
@ -40,7 +38,7 @@ msgstr ""
"Configure, inicie y detenga el agente OpenWISP en este dispositivo. Lea más "
"sobre los valores de configuración: <a target='_blank' rel='noopener "
"noreferrer' href='https://github.com/openwisp/openwisp-config'>https://github"
".com/openwisp/openwisp-config</a>"
".com/openwisp/openwisp-config </a>"
#: applications/luci-app-openwisp/htdocs/luci-static/resources/view/openwisp.js:77
msgid "Connect Timeout"
@ -109,18 +107,16 @@ msgid "MAC Interface"
msgstr "Interfaz MAC"
#: applications/luci-app-openwisp/htdocs/luci-static/resources/view/openwisp.js:52
#, fuzzy
msgid "Management Interface"
msgstr "Interfaz de gestión"
msgstr "Interfaz de dirección"
#: applications/luci-app-openwisp/htdocs/luci-static/resources/view/openwisp.js:81
msgid "Max Time"
msgstr "Tiempo máximo"
#: applications/luci-app-openwisp/htdocs/luci-static/resources/view/openwisp.js:55
#, fuzzy
msgid "Merge Config"
msgstr "Combinar configuración"
msgstr "Combinar la configuración"
#: applications/luci-app-openwisp/htdocs/luci-static/resources/view/openwisp.js:11
#: applications/luci-app-openwisp/root/usr/share/luci/menu.d/luci-app-openwisp.json:3
@ -128,7 +124,6 @@ msgid "OpenWISP"
msgstr "OpenWISP"
#: applications/luci-app-openwisp/htdocs/luci-static/resources/view/openwisp.js:95
#, fuzzy
msgid ""
"Path to post reload hook script. The hook is not called if the path does not "
"point to an executable script file. This hook is called each time openwisp-"

39
lux/Makefile Normal file
View File

@ -0,0 +1,39 @@
# SPDX-Identifier-License: GPL-3.0-only
#
# Copyright (C) 2021 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=lux
PKG_VERSION:=0.17.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/iawia002/lux/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=skip
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
GO_PKG:=github.com/iawia002/lux
GO_PKG_BUILD_PKG:=$$(GO_PKG)
GO_PKG_LDFLAGS:=-s -w
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
define Package/lux
SECTION:=multimedia
CATEGORY:=Multimedia
TITLE:=A fast, simple and clean video downloader
URL:=https://github.com/iawia002/lux
DEPENDS:=$(GO_ARCH_DEPENDS) +ffmpeg
endef
$(eval $(call GoBinPackage,lux))
$(eval $(call BuildPackage,lux))

45
simple-torrent/Makefile Normal file
View File

@ -0,0 +1,45 @@
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2021 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=simple-torrent
PKG_VERSION:=1.3.9
PKG_RELEASE:=13
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/boypt/simple-torrent/tar.gz/$(PKG_VERSION)?
PKG_HASH:=skip
PKG_LICENSE:=AGPL-3.0
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
GO_PKG:=github.com/boypt/simple-torrent
GO_PKG_LDFLAGS_X:=main.VERSION=$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
define Package/simple-torrent
SECTION:=net
CATEGORY:=Network
SUBMENU:=BitTorrent
TITLE:=A self-hosted remote torrent client
URL:=https://github.com/boypt/simple-torrent
DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle +libstdcpp
endef
define Package/simple-torrent/description
SimpleTorrent is a a self-hosted remote torrent client, written in Go (golang).
Started torrents remotely, download sets of files on the local disk of the server,
which are then retrievable or streamable via HTTP.
endef
$(eval $(call GoBinPackage,simple-torrent))
$(eval $(call BuildPackage,simple-torrent))

38
transfer/Makefile Normal file
View File

@ -0,0 +1,38 @@
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2021 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=transfer
PKG_VERSION:=0.4.17
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/Mikubill/transfer/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=skip
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
GO_PKG:=github.com/Mikubill/transfer
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
define Package/transfer
SECTION:=net
CATEGORY:=Network
SUBMENU:=File Transfer
TITLE:=Large file transfer tool with multiple file transfer services support
URL:=https://github.com/Mikubill/transfer
DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle
endef
$(eval $(call GoBinPackage,transfer))
$(eval $(call BuildPackage,transfer))

View File

@ -5,8 +5,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=v2rayA
PKG_VERSION:=1.5.9.1698.1
PKG_RELEASE:=62
PKG_VERSION:=2.0.4
PKG_RELEASE:=63
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/v2rayA/v2rayA/tar.gz/v$(PKG_VERSION)?
@ -22,7 +22,9 @@ PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
GO_PKG:=github.com/v2rayA/v2rayA
GO_PKG_LDFLAGS_X:=$(GO_PKG)/conf.Version=$(PKG_VERSION)
GO_PKG_LDFLAGS_X:= \
$(GO_PKG)/conf.Version=$(PKG_VERSION) \
$(GO_PKG)/core/iptables.TproxyNotSkipBr=true
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
@ -37,11 +39,7 @@ define Package/v2raya
SUBMENU:=Web Servers/Proxies
DEPENDS:=$(GO_ARCH_DEPENDS) \
+ca-bundle \
+iptables-mod-conntrack-extra \
+iptables-mod-extra \
+iptables-mod-filter \
+iptables-mod-tproxy \
+kmod-ipt-nat6 \
+kmod-nft-tproxy \
+xray-core
URL:=https://v2raya.org
endef
@ -61,7 +59,7 @@ define Download/v2raya-web
URL:=https://codeload.github.com/v2rayA/v2raya-web/tar.gz/v$(PKG_VERSION)?
URL_FILE:=$(WEB_FILE)
FILE:=$(WEB_FILE)
HASH:=149097a42c3e5fa6f5c3cd46d1bf7ec4546e79ad37c1446b759539e700bd75e2
HASH:=39eacb70753b309a0f44ede282ad01b5c6a13d51bed72d0f5563574de9bea0b7
endef
define Build/Prepare

View File

@ -12,6 +12,10 @@ config v2raya 'config'
# Optional values: auto, on, off.
option ipv6_support 'auto'
# Experimental feature. Make sure you have installed nftables.
# Optional values: auto, on, off.
option nftables_support 'auto'
# Optional values: trace, debug, info, warn or error
option log_level 'info'
@ -44,7 +48,3 @@ config v2raya 'config'
# v2rayA will pass in the --stage (pre-start, post-start, pre-stop, post-stop) argument.
option plugin_manager ''
# Specify the certification path instead of automatically generating a self-signed certificate.
# Example: /etc/v2raya/grpc_certificate.crt,/etc/v2raya/grpc_private.key
option vless_grpc_inbound_cert_key ''

View File

@ -43,6 +43,7 @@ start_service() {
append_env_arg "config" "address" "0.0.0.0:2017"
append_env_arg "config" "config" "/etc/v2raya"
append_env_arg "config" "ipv6_support" "auto"
append_env_arg "config" "nftables_support" "auto"
append_env_arg "config" "log_level" "info"
append_env_arg "config" "log_file" "/var/log/v2raya/v2raya.log"
append_env_arg "config" "log_max_days" "3"
@ -51,7 +52,6 @@ start_service() {
append_env_arg "config" "transparent_hook"
append_env_arg "config" "core_hook"
append_env_arg "config" "plugin_manager"
append_env_arg "config" "vless_grpc_inbound_cert_key"
append_env_bool "config" "log_disable_color"
append_env_bool "config" "log_disable_timestamp"

View File

@ -1,38 +0,0 @@
From ca6a05273284daa04856a840e64f3936f700b7c3 Mon Sep 17 00:00:00 2001
From: mzz2017 <mzz@tuta.io>
Date: Fri, 16 Sep 2022 15:13:11 +0800
Subject: [PATCH] fix: we should skip interface ppp+ to avoid to break net
---
service/core/iptables/tproxy.go | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- a/core/iptables/tproxy.go
+++ b/core/iptables/tproxy.go
@@ -16,7 +16,7 @@ var Tproxy tproxy
func (t *tproxy) AddIPWhitelist(cidr string) {
// avoid duplication
t.RemoveIPWhitelist(cidr)
- pos := 5
+ pos := 7
if configure.GetSettingNotNil().AntiPollution != configure.AntipollutionClosed {
pos += 3
}
@@ -68,6 +68,8 @@ iptables -w 2 -t mangle -A TP_RULE -m ma
iptables -w 2 -t mangle -A TP_RULE -i br-+ -j RETURN
iptables -w 2 -t mangle -A TP_RULE -i docker+ -j RETURN
iptables -w 2 -t mangle -A TP_RULE -i veth+ -j RETURN
+iptables -w 2 -t mangle -A TP_RULE -i ppp+ -j RETURN
+iptables -w 2 -t mangle -A TP_RULE -i dn42-+ -j RETURN
`
if configure.GetSettingNotNil().AntiPollution != configure.AntipollutionClosed {
commands += `
@@ -127,6 +129,8 @@ ip6tables -w 2 -t mangle -A TP_RULE -m m
ip6tables -w 2 -t mangle -A TP_RULE -i br-+ -j RETURN
ip6tables -w 2 -t mangle -A TP_RULE -i docker+ -j RETURN
ip6tables -w 2 -t mangle -A TP_RULE -i veth+ -j RETURN
+ip6tables -w 2 -t mangle -A TP_RULE -i ppp+ -j RETURN
+ip6tables -w 2 -t mangle -A TP_RULE -i dn42-+ -j RETURN
`
if configure.GetSettingNotNil().AntiPollution != configure.AntipollutionClosed {
commands += `

View File

@ -1,105 +0,0 @@
From 5db722b22b39642280572a62b149d4e1efa21ce3 Mon Sep 17 00:00:00 2001
From: mzz2017 <mzz@tuta.io>
Date: Mon, 8 Aug 2022 22:30:36 +0800
Subject: [PATCH] fix: seed cannot be read from vless sharing-link and add
missing sni field. #616
---
service/core/serverObj/v2ray.go | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
--- a/core/serverObj/v2ray.go
+++ b/core/serverObj/v2ray.go
@@ -12,7 +12,6 @@ import (
"time"
jsoniter "github.com/json-iterator/go"
- "github.com/tidwall/gjson"
"github.com/v2rayA/v2rayA/common"
"github.com/v2rayA/v2rayA/core/coreObj"
"github.com/v2rayA/v2rayA/core/v2ray/service"
@@ -39,6 +38,7 @@ type V2Ray struct {
Net string `json:"net"`
Type string `json:"type"`
Host string `json:"host"`
+ SNI string `json:"sni"`
Path string `json:"path"`
TLS string `json:"tls"`
Flow string `json:"flow,omitempty"`
@@ -69,7 +69,8 @@ func ParseVlessURL(vless string) (data *
ID: u.User.String(),
Net: u.Query().Get("type"),
Type: u.Query().Get("headerType"),
- Host: u.Query().Get("sni"),
+ Host: u.Query().Get("host"),
+ SNI: u.Query().Get("sni"),
Path: u.Query().Get("path"),
TLS: u.Query().Get("security"),
Flow: u.Query().Get("flow"),
@@ -86,16 +87,13 @@ func ParseVlessURL(vless string) (data *
if data.Type == "" {
data.Type = "none"
}
- if data.Host == "" {
- data.Host = u.Query().Get("host")
- }
if data.TLS == "" {
data.TLS = "none"
}
if data.Flow == "" {
data.Flow = "xtls-rprx-direct"
}
- if data.Type == "mkcp" || data.Type == "kcp" {
+ if data.Net == "mkcp" || data.Net == "kcp" {
data.Path = u.Query().Get("seed")
}
return data, nil
@@ -145,6 +143,7 @@ func ParseVmessURL(vmess string) (data *
if aid == "" {
aid = q.Get("aid")
}
+ sni := q.Get("sni")
info = V2Ray{
ID: subMatch[1],
Add: subMatch[2],
@@ -152,6 +151,7 @@ func ParseVmessURL(vmess string) (data *
Ps: ps,
Host: obfsParam,
Path: path,
+ SNI: sni,
Net: obfs,
Aid: aid,
TLS: map[string]string{"1": "tls"}[q.Get("tls")],
@@ -165,12 +165,6 @@ func ParseVmessURL(vmess string) (data *
if err != nil {
return
}
- if info.Host == "" {
- sni := gjson.Get(raw, "sni")
- if sni.Exists() {
- info.Host = sni.String()
- }
- }
}
// correct the wrong vmess as much as possible
if strings.HasPrefix(info.Host, "/") && info.Path == "" {
@@ -328,7 +322,9 @@ func (v *V2Ray) Configuration(info Prior
core.StreamSettings.TLSSettings.AllowInsecure = true
}
// SNI
- if v.Host != "" {
+ if v.SNI != "" {
+ core.StreamSettings.TLSSettings.ServerName = v.SNI
+ } else if v.Host != "" {
core.StreamSettings.TLSSettings.ServerName = v.Host
}
// Alpn
@@ -345,6 +341,8 @@ func (v *V2Ray) Configuration(info Prior
// SNI
if v.Host != "" {
core.StreamSettings.XTLSSettings.ServerName = v.Host
+ } else if v.Host != "" {
+ core.StreamSettings.TLSSettings.ServerName = v.Host
}
if v.AllowInsecure {
core.StreamSettings.XTLSSettings.AllowInsecure = true

View File

@ -1,100 +0,0 @@
From 3f78422f81f3abc2668fc3938b31d213bfe4dfff Mon Sep 17 00:00:00 2001
From: mzz2017 <mzz@tuta.io>
Date: Sun, 28 Aug 2022 17:54:36 +0800
Subject: [PATCH] fix: a problem that supervisor cannot exit normally
---
service/core/specialMode/infra/handle.go | 11 ++++++----
service/core/specialMode/infra/supervisor.go | 22 ++++++++------------
2 files changed, 16 insertions(+), 17 deletions(-)
--- a/core/specialMode/infra/handle.go
+++ b/core/specialMode/infra/handle.go
@@ -127,10 +127,13 @@ func (interfaceHandle *handle) handleRec
return results, msg
}
-func packetFilter(portCache *portCache, pPacket *gopacket.Packet, whitelistDnsServers *v2router.GeoIPMatcher) (m *dnsmessage.Message, pSAddr, pSPort, pDAddr, pDPort *gopacket.Endpoint) {
- packet := *pPacket
- trans := packet.TransportLayer()
+func packetFilter(portCache *portCache, packet gopacket.Packet, whitelistDnsServers *v2router.GeoIPMatcher) (m *dnsmessage.Message, pSAddr, pSPort, pDAddr, pDPort *gopacket.Endpoint) {
+ //跳过非网络层的包
+ if packet.NetworkLayer() == nil {
+ return
+ }
//跳过非传输层的包
+ trans := packet.TransportLayer()
if trans == nil {
return
}
@@ -180,7 +183,7 @@ func packetFilter(portCache *portCache,
}
func (interfaceHandle *handle) handlePacket(packet gopacket.Packet, ifname string, whitelistDnsServers *v2router.GeoIPMatcher, whitelistDomains *strmatcher.MatcherGroup) {
- m, sAddr, sPort, dAddr, dPort := packetFilter(interfaceHandle.portCache, &packet, whitelistDnsServers)
+ m, sAddr, sPort, dAddr, dPort := packetFilter(interfaceHandle.portCache, packet, whitelistDnsServers)
if m == nil {
return
}
--- a/core/specialMode/infra/supervisor.go
+++ b/core/specialMode/infra/supervisor.go
@@ -9,7 +9,6 @@ import (
v2router "github.com/v2rayA/v2ray-lib/router"
"github.com/v2rayA/v2rayA/pkg/util/log"
"sync"
- "time"
)
type DnsSupervisor struct {
@@ -70,7 +69,7 @@ func (d *DnsSupervisor) DeleteHandles(if
}
close(d.handles[ifname].done)
delete(d.handles, ifname)
- log.Trace("DnsSupervisor:%v closed", ifname)
+ log.Trace("DnsSupervisor:%v deleted", ifname)
return
}
@@ -81,28 +80,24 @@ func (d *DnsSupervisor) Run(ifname strin
d.inner.Lock()
handle, ok := d.handles[ifname]
if !ok {
+ d.inner.Unlock()
return fmt.Errorf("Run: %v not exsits", ifname)
}
if handle.running {
+ d.inner.Unlock()
return fmt.Errorf("Run: %v is running", ifname)
}
handle.running = true
log.Trace("[DnsSupervisor] " + ifname + ": running")
- pkgsrc := gopacket.NewPacketSource(handle, layers.LayerTypeEthernet)
+ // we only decode UDP packets
+ pkgsrc := gopacket.NewPacketSource(handle, layers.LayerTypeDNS)
pkgsrc.NoCopy = true
+ //pkgsrc.Lazy = true
d.inner.Unlock()
packets := pkgsrc.Packets()
go func() {
- for {
- //心跳包,防止内存泄漏
- packets <- gopacket.NewPacket(nil, layers.LinkTypeEthernet, gopacket.DecodeOptions{})
- select {
- case <-handle.done:
- return
- default:
- time.Sleep(2 * time.Second)
- }
- }
+ <-handle.done
+ packets <- gopacket.NewPacket(nil, layers.LinkTypeEthernet, pkgsrc.DecodeOptions)
}()
out:
for packet := range packets {
@@ -113,5 +108,6 @@ out:
}
go handle.handlePacket(packet, ifname, whitelistDnsServers, whitelistDomains)
}
+ log.Trace("DnsSupervisor:%v closed", ifname)
return
}

View File

@ -1,52 +0,0 @@
From 153b72ed623876ad73b731c2ec2344e9057d3c35 Mon Sep 17 00:00:00 2001
From: mzz2017 <mzz@tuta.io>
Date: Wed, 21 Sep 2022 16:50:24 +0800
Subject: [PATCH] fix: unexpected exit does not apply stop steps
---
service/core/v2ray/process.go | 4 ++--
service/core/v2ray/processManager.go | 8 +++-----
2 files changed, 5 insertions(+), 7 deletions(-)
--- a/core/v2ray/process.go
+++ b/core/v2ray/process.go
@@ -35,7 +35,7 @@ type Process struct {
tag2WhichIndex map[string]int
}
-func NewProcess(tmpl *Template, prestart func() error, poststart func() error) (process *Process, err error) {
+func NewProcess(tmpl *Template, prestart func() error, poststart func() error, stopfunc func(p *Process)) (process *Process, err error) {
process = &Process{
template: tmpl,
}
@@ -111,7 +111,7 @@ func NewProcess(tmpl *Template, prestart
// canceled by v2rayA
return
}
- defer ProcessManager.Stop(false)
+ defer stopfunc(process)
var t []string
if p != nil {
if p.Success() {
--- a/core/v2ray/processManager.go
+++ b/core/v2ray/processManager.go
@@ -245,16 +245,14 @@ func (m *CoreProcessManager) Start(t *Te
return m.beforeStart(t)
}, func() error {
return m.afterStart(t)
+ }, func(p *Process) {
+ m.p = p
+ ProcessManager.Stop(false)
})
if err != nil {
return err
}
m.p = process
- defer func() {
- if err != nil {
- m.stop(true)
- }
- }()
configure.SetRunning(true)
return nil

View File

@ -1,336 +0,0 @@
From 00366b224b2e28861b80f677e8aa604c5d08dae3 Mon Sep 17 00:00:00 2001
From: Kelo <meetkelo@outlook.com>
Date: Sat, 29 Oct 2022 16:27:26 +0800
Subject: [PATCH] optimize: reduce disk writes
---
service/db/boltdb.go | 43 +++++++++++++++++++++++++++++++----
service/db/listOp.go | 48 +++++++++++++++++++++------------------
service/db/plainOp.go | 52 ++++++++++++++++++++++++-------------------
service/db/setOp.go | 20 +++++++++--------
4 files changed, 105 insertions(+), 58 deletions(-)
--- a/db/boltdb.go
+++ b/db/boltdb.go
@@ -1,13 +1,14 @@
package db
import (
- "go.etcd.io/bbolt"
- "github.com/v2rayA/v2rayA/conf"
- "github.com/v2rayA/v2rayA/pkg/util/copyfile"
- "github.com/v2rayA/v2rayA/pkg/util/log"
"os"
"path/filepath"
"sync"
+
+ "github.com/v2rayA/v2rayA/conf"
+ "github.com/v2rayA/v2rayA/pkg/util/copyfile"
+ "github.com/v2rayA/v2rayA/pkg/util/log"
+ "go.etcd.io/bbolt"
)
var once sync.Once
@@ -46,3 +47,37 @@ func DB() *bbolt.DB {
once.Do(initDB)
return db
}
+
+// The function should return a dirty flag.
+// If the dirty flag is true and there is no error then the transaction is commited.
+// Otherwise, the transaction is rolled back.
+func Transaction(db *bbolt.DB, fn func(*bbolt.Tx) (bool, error)) error {
+ tx, err := db.Begin(true)
+ if err != nil {
+ return err
+ }
+ defer tx.Rollback()
+ dirty, err := fn(tx)
+ if err != nil {
+ _ = tx.Rollback()
+ return err
+ }
+ if !dirty {
+ return nil
+ }
+ return tx.Commit()
+}
+
+// If the bucket does not exist, the dirty flag is setted
+func CreateBucketIfNotExists(tx *bbolt.Tx, name []byte, dirty *bool) (*bbolt.Bucket, error) {
+ bkt := tx.Bucket(name)
+ if bkt != nil {
+ return bkt, nil
+ }
+ bkt, err := tx.CreateBucket(name)
+ if err != nil {
+ return nil, err
+ }
+ *dirty = true
+ return bkt, nil
+}
--- a/db/listOp.go
+++ b/db/listOp.go
@@ -2,13 +2,14 @@ package db
import (
"fmt"
- "go.etcd.io/bbolt"
- jsoniter "github.com/json-iterator/go"
- "github.com/tidwall/gjson"
- "github.com/tidwall/sjson"
"reflect"
"sort"
"strconv"
+
+ jsoniter "github.com/json-iterator/go"
+ "github.com/tidwall/gjson"
+ "github.com/tidwall/sjson"
+ "go.etcd.io/bbolt"
)
func ListSet(bucket string, key string, index int, val interface{}) (err error) {
@@ -31,20 +32,21 @@ func ListSet(bucket string, key string,
}
func ListGet(bucket string, key string, index int) (b []byte, err error) {
- err = DB().Update(func(tx *bbolt.Tx) error {
- if bkt, err := tx.CreateBucketIfNotExists([]byte(bucket)); err != nil {
- return err
+ err = Transaction(DB(), func(tx *bbolt.Tx) (bool, error) {
+ dirty := false
+ if bkt, err := CreateBucketIfNotExists(tx, []byte(bucket), &dirty); err != nil {
+ return dirty, err
} else {
v := bkt.Get([]byte(key))
if v == nil {
- return fmt.Errorf("ListGet: can't get element from an empty list")
+ return dirty, fmt.Errorf("ListGet: can't get element from an empty list")
}
r := gjson.GetBytes(v, strconv.Itoa(index))
if r.Exists() {
b = []byte(r.Raw)
- return nil
+ return dirty, nil
} else {
- return fmt.Errorf("ListGet: no such element")
+ return dirty, fmt.Errorf("ListGet: no such element")
}
}
})
@@ -79,24 +81,25 @@ func ListAppend(bucket string, key strin
}
func ListGetAll(bucket string, key string) (list [][]byte, err error) {
- err = DB().Update(func(tx *bbolt.Tx) error {
- if bkt, err := tx.CreateBucketIfNotExists([]byte(bucket)); err != nil {
- return err
+ err = Transaction(DB(), func(tx *bbolt.Tx) (bool, error) {
+ dirty := false
+ if bkt, err := CreateBucketIfNotExists(tx, []byte(bucket), &dirty); err != nil {
+ return dirty, err
} else {
b := bkt.Get([]byte(key))
if b == nil {
- return nil
+ return dirty, nil
}
parsed := gjson.ParseBytes(b)
if !parsed.IsArray() {
- return fmt.Errorf("ListGetAll: is not array")
+ return dirty, fmt.Errorf("ListGetAll: is not array")
}
results := parsed.Array()
for _, r := range results {
list = append(list, []byte(r.Raw))
}
}
- return nil
+ return dirty, nil
})
return list, err
}
@@ -143,21 +146,22 @@ func ListRemove(bucket, key string, inde
}
func ListLen(bucket string, key string) (length int, err error) {
- err = DB().Update(func(tx *bbolt.Tx) error {
- if bkt, err := tx.CreateBucketIfNotExists([]byte(bucket)); err != nil {
- return err
+ err = Transaction(DB(), func(tx *bbolt.Tx) (bool, error) {
+ dirty := false
+ if bkt, err := CreateBucketIfNotExists(tx, []byte(bucket), &dirty); err != nil {
+ return dirty, err
} else {
b := bkt.Get([]byte(key))
if b == nil {
- return nil
+ return dirty, nil
}
parsed := gjson.ParseBytes(b)
if !parsed.IsArray() {
- return fmt.Errorf("ListLen: is not array")
+ return dirty, fmt.Errorf("ListLen: is not array")
}
length = len(parsed.Array())
}
- return nil
+ return dirty, nil
})
return length, err
}
--- a/db/plainOp.go
+++ b/db/plainOp.go
@@ -2,50 +2,54 @@ package db
import (
"fmt"
- "go.etcd.io/bbolt"
+
jsoniter "github.com/json-iterator/go"
"github.com/v2rayA/v2rayA/common"
"github.com/v2rayA/v2rayA/pkg/util/log"
+ "go.etcd.io/bbolt"
)
func Get(bucket string, key string, val interface{}) (err error) {
- return DB().Update(func(tx *bbolt.Tx) error {
- if bkt, err := tx.CreateBucketIfNotExists([]byte(bucket)); err != nil {
- return err
+ return Transaction(DB(), func(tx *bbolt.Tx) (bool, error) {
+ dirty := false
+ if bkt, err := CreateBucketIfNotExists(tx, []byte(bucket), &dirty); err != nil {
+ return dirty, err
} else {
if v := bkt.Get([]byte(key)); v == nil {
- return fmt.Errorf("Get: key is not found")
+ return dirty, fmt.Errorf("Get: key is not found")
} else {
- return jsoniter.Unmarshal(v, val)
+ return dirty, jsoniter.Unmarshal(v, val)
}
}
})
}
func GetRaw(bucket string, key string) (b []byte, err error) {
- err = DB().Update(func(tx *bbolt.Tx) error {
- if bkt, err := tx.CreateBucketIfNotExists([]byte(bucket)); err != nil {
- return err
+ err = Transaction(DB(), func(tx *bbolt.Tx) (bool, error) {
+ dirty := false
+ if bkt, err := CreateBucketIfNotExists(tx, []byte(bucket), &dirty); err != nil {
+ return dirty, err
} else {
v := bkt.Get([]byte(key))
if v == nil {
- return fmt.Errorf("GetRaw: key is not found")
+ return dirty, fmt.Errorf("GetRaw: key is not found")
}
b = common.BytesCopy(v)
- return nil
+ return dirty, nil
}
})
return b, err
}
func Exists(bucket string, key string) (exists bool) {
- if err := DB().Update(func(tx *bbolt.Tx) error {
- if bkt, err := tx.CreateBucketIfNotExists([]byte(bucket)); err != nil {
- return err
+ if err := Transaction(DB(), func(tx *bbolt.Tx) (bool, error) {
+ dirty := false
+ if bkt, err := CreateBucketIfNotExists(tx, []byte(bucket), &dirty); err != nil {
+ return dirty, err
} else {
v := bkt.Get([]byte(key))
exists = v != nil
- return nil
+ return dirty, nil
}
}); err != nil {
log.Warn("%v", err)
@@ -55,23 +59,25 @@ func Exists(bucket string, key string) (
}
func GetBucketLen(bucket string) (length int, err error) {
- err = DB().Update(func(tx *bbolt.Tx) error {
- if bkt, err := tx.CreateBucketIfNotExists([]byte(bucket)); err != nil {
- return err
+ err = Transaction(DB(), func(tx *bbolt.Tx) (bool, error) {
+ dirty := false
+ if bkt, err := CreateBucketIfNotExists(tx, []byte(bucket), &dirty); err != nil {
+ return dirty, err
} else {
length = bkt.Stats().KeyN
}
- return nil
+ return dirty, nil
})
return length, err
}
func GetBucketKeys(bucket string) (keys []string, err error) {
- err = DB().Update(func(tx *bbolt.Tx) error {
- if bkt, err := tx.CreateBucketIfNotExists([]byte(bucket)); err != nil {
- return err
+ err = Transaction(DB(), func(tx *bbolt.Tx) (bool, error) {
+ dirty := false
+ if bkt, err := CreateBucketIfNotExists(tx, []byte(bucket), &dirty); err != nil {
+ return dirty, err
} else {
- return bkt.ForEach(func(k, v []byte) error {
+ return dirty, bkt.ForEach(func(k, v []byte) error {
keys = append(keys, string(k))
return nil
})
--- a/db/setOp.go
+++ b/db/setOp.go
@@ -4,8 +4,9 @@ import (
"bytes"
"crypto/sha256"
"encoding/gob"
- "go.etcd.io/bbolt"
+
"github.com/v2rayA/v2rayA/common"
+ "go.etcd.io/bbolt"
)
type set map[[32]byte]interface{}
@@ -28,26 +29,27 @@ func toSha256(val interface{}) (hash [32
}
func setOp(bucket string, key string, f func(m set) (readonly bool, err error)) (err error) {
- return DB().Update(func(tx *bbolt.Tx) error {
- if bkt, err := tx.CreateBucketIfNotExists([]byte(bucket)); err != nil {
- return err
+ return Transaction(DB(), func(tx *bbolt.Tx) (bool, error) {
+ dirty := false
+ if bkt, err := CreateBucketIfNotExists(tx, []byte(bucket), &dirty); err != nil {
+ return dirty, err
} else {
var m set
v := bkt.Get([]byte(key))
if v == nil {
m = make(set)
} else if err := gob.NewDecoder(bytes.NewReader(v)).Decode(&m); err != nil {
- return err
+ return dirty, err
}
if readonly, err := f(m); err != nil {
- return err
+ return dirty, err
} else if readonly {
- return nil
+ return dirty, nil
}
if b, err := common.ToBytes(m); err != nil {
- return err
+ return dirty, err
} else {
- return bkt.Put([]byte(key), b)
+ return true, bkt.Put([]byte(key), b)
}
}
})

View File

@ -1,27 +0,0 @@
From 451912074ba1ba4000c66874876bc0a6b64cb5da Mon Sep 17 00:00:00 2001
From: Kelo <meetkelo@outlook.com>
Date: Sun, 30 Oct 2022 16:49:22 +0800
Subject: [PATCH] fix: do not rollback closed transaction
---
service/db/boltdb.go | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- a/db/boltdb.go
+++ b/db/boltdb.go
@@ -56,14 +56,13 @@ func Transaction(db *bbolt.DB, fn func(*
if err != nil {
return err
}
- defer tx.Rollback()
dirty, err := fn(tx)
if err != nil {
_ = tx.Rollback()
return err
}
if !dirty {
- return nil
+ return tx.Rollback()
}
return tx.Commit()
}

View File

@ -1,21 +0,0 @@
--- a/core/v2ray/process.go
+++ b/core/v2ray/process.go
@@ -226,6 +226,7 @@ func StartCoreProcess(ctx context.Contex
dir := path.Dir(v2rayBinPath)
var arguments = []string{
v2rayBinPath,
+ "run",
"--config=" + asset.GetV2rayConfigPath(),
}
if confdir := asset.GetV2rayConfigDirPath(); confdir != "" {
--- a/core/v2ray/where/where.go
+++ b/core/v2ray/where/where.go
@@ -41,7 +41,7 @@ func GetV2rayServiceVersion() (variant V
if err != nil || len(v2rayPath) <= 0 {
return Unknown, "", fmt.Errorf("cannot find v2ray executable binary")
}
- out, err := exec.Command(v2rayPath, "-version").Output()
+ out, err := exec.Command(v2rayPath, "version").Output()
var fields []string
if fields = strings.Fields(strings.TrimSpace(string(out))); len(fields) < 2 {
return Unknown, "", fmt.Errorf("cannot parse version of v2ray")

3
v2raya/test.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
v2raya --version | grep "$PKG_VERSION"

40
ykdl/Makefile Normal file
View File

@ -0,0 +1,40 @@
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2020-2021 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=ykdl
PKG_VERSION:=1.8.1.post1
PKG_RELEASE:=1
PYPI_NAME:=ykdl
PKG_HASH:=skip
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE.txt
include $(TOPDIR)/feeds/packages/lang/python/pypi.mk
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/python/python3-package.mk
define Package/ykdl
SECTION:=multimedia
CATEGORY:=Multimedia
TITLE:=a video downloader focus on China mainland video sites
URL:=https://github.com/SeaHOH/ykdl
DEPENDS:= \
+ca-bundle \
+ffmpeg \
+python3 \
+python3-email \
+python3-xml \
+python3-codecs \
+python3-ctypes \
+python3-setuptools
endef
$(eval $(call Py3Package,ykdl))
$(eval $(call BuildPackage,ykdl))
$(eval $(call BuildPackage,ykdl-src))

46
you-get/Makefile Normal file
View File

@ -0,0 +1,46 @@
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2020-2021 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=you-get
PKG_VERSION:=0.4.1650
PKG_RELEASE:=1
PYPI_NAME:=you-get
PKG_HASH:=skip
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
include $(TOPDIR)/feeds/packages/lang/python/pypi.mk
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/python/python3-package.mk
define Package/you-get
SECTION:=multimedia
CATEGORY:=Multimedia
TITLE:=Dumb downloader that scrapes the web
URL:=https://you-get.org
DEPENDS:= \
+ca-bundle \
+ffmpeg \
+python3 \
+python3-email \
+python3-xml \
+python3-codecs \
+python3-ctypes \
+python3-setuptools
endef
define Package/you-get/description
You-Get is a tiny command-line utility to download
media contents (videos, audios, images) from the Web,
in case there is no other handy way to do it.
endef
$(eval $(call Py3Package,you-get))
$(eval $(call BuildPackage,you-get))
$(eval $(call BuildPackage,you-get-src))