Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vlmcsd: add UCI support for vlmcsd #1475

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AutoCONFIG
Copy link
Contributor

@AutoCONFIG AutoCONFIG commented Feb 4, 2025

原本的vlmcsd以及luci-app-vlmcsd比较混乱,特别是init文件和uci支持是通过luci应用来实现的,而非后端程序。
所以重做调整,并使用js重写其luci应用

  1. init文件主要源于luci-app-vlmcsd,进行了修改,正在重新修改luci-app-vlmcsd源代码来适配(测试后会提交pr)
  2. 删除了0.0.0.0:1688监听选项,因为使用[::]:1688即可完成ipv4和ipv6的双栈监听
  3. 添加允许互联网访问的选项,让用户自行决定是否将服务提供到互联网
  4. 修改init文件以符合openwrt init文件的开发建议样式

net/vlmcsd/files/vlmcsd.init Outdated Show resolved Hide resolved
net/vlmcsd/files/vlmcsd.init Outdated Show resolved Hide resolved
net/vlmcsd/files/vlmcsd.init Outdated Show resolved Hide resolved
net/vlmcsd/files/vlmcsd.init Outdated Show resolved Hide resolved
net/vlmcsd/files/vlmcsd.init Outdated Show resolved Hide resolved
- Derived from luci-app-vlmcsd with some modifications. The source code
  of luci-app-vlmcsd needs to be re-modified for adaptation.
- Removed the listening option for 0.0.0.0:1688 because [::]:1688 can
  achieve dual-stack listening for both IPv4 and IPv6.
- Added an option to allow Internet access, enabling users to decide
  whether to expose the service to the Internet on their own.
- Modified the init file to meet the standards of OpenWrt init files.

Signed-off-by: Yun Wang <[email protected]>
@AutoCONFIG
Copy link
Contributor Author

AutoCONFIG commented Feb 9, 2025

已更正:

  1. 支持新版本openwrt的dnsmasq.d conf-dir目录
  2. 日志输出至系统日志,移出了本地临时目录的输出
  3. 完善取消使能或者stop服务时的dnsmasq.d文件的回收逻辑(经过测试,对于已经开启后,再取消使能的,系统不会去调用stop_service函数(调用后无法再次自动开启服务),所以需要额外加入取消使能时的回收逻辑)

config_get_bool internet_access "config" "internet_access" "0"

if [ "$enabled" -eq "0" ];then
if [ -f "$DNSMASQ_VLMCSD" ];then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里没必要,可以用

reload_service() {
	stop
	start
}

这样 reload 的时候就会执行 stop_service 函数。

Comment on lines +30 to +31
HOSTNAME=$(uci get system.@system[0].hostname)
echo "srv-host=_vlmcs._tcp,$HOSTNAME,1688,0,100" > $DNSMASQ_VLMCSD
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
HOSTNAME=$(uci get system.@system[0].hostname)
echo "srv-host=_vlmcs._tcp,$HOSTNAME,1688,0,100" > $DNSMASQ_VLMCSD
hostname="$(uci -q get system.@system[0].hostname)"
echo "srv-host=_vlmcs._tcp,$hostname,1688,0,100" > "$DNSMASQ_VLMCSD"

非全局变量建议用小写。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants