From 040614affa5ebacc1ee2dc8149fc47e1aa2467c9 Mon Sep 17 00:00:00 2001 From: James Yean Date: Sun, 3 Nov 2024 19:24:22 +0800 Subject: [PATCH] feat: remove dependency on luci-lib-fs (#10) --- README.md | 2 +- luasrc/model/cbi/easytier.lua | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 18c5645..38c601c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # luci-app-easytier -依赖`kmod-tun``luci-lib-fs`需要先在系统软件包里安装好 +依赖`kmod-tun`需要先在系统软件包里安装好 ### 快速开始 ```bash 右上角Fork克隆本项目,去actions手动触发自动编译流程,2分钟后就能获取最新ipk压缩包`luci-app-easytier.zip`解压上传到Openwrt软路由安装即可 diff --git a/luasrc/model/cbi/easytier.lua b/luasrc/model/cbi/easytier.lua index bbe919c..a3efc53 100644 --- a/luasrc/model/cbi/easytier.lua +++ b/luasrc/model/cbi/easytier.lua @@ -1,4 +1,3 @@ -local fs = require "luci.fs" local http = luci.http local nixio = require "nixio" @@ -50,7 +49,7 @@ et_config.write = function(self, section, value) if not nixio.fs.access(dir) then nixio.fs.mkdir(dir) end - fs.writefile(file, value:gsub("\r\n", "\n")) + nixio.fs.writefile(file, value:gsub("\r\n", "\n")) end network_name = s:taboption("general", Value, "network_name", translate("网络名称"), @@ -145,8 +144,8 @@ wg_port.datatype = "range(1,65535)" wg_port.placeholder = "11011" wg_port:depends("listenermode", "ON") -local model = fs.readfile("/proc/device-tree/model") or "" -local hostname = fs.readfile("/proc/sys/kernel/hostname") or "" +local model = nixio.fs.readfile("/proc/device-tree/model") or "" +local hostname = nixio.fs.readfile("/proc/sys/kernel/hostname") or "" model = model:gsub("\n", "") hostname = hostname:gsub("\n", "") local device_name = (model ~= "" and model) or (hostname ~= "" and hostname) or "OpenWrt"