feat: remove dependency on luci-lib-fs (#10)

This commit is contained in:
James Yean
2024-11-03 19:24:22 +08:00
committed by GitHub
parent df7b9b4b47
commit 040614affa
2 changed files with 4 additions and 5 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
# luci-app-easytier
依赖`kmod-tun``luci-lib-fs`需要先在系统软件包里安装好
依赖`kmod-tun`需要先在系统软件包里安装好
### 快速开始
```bash
右上角Fork克隆本项目,去actions手动触发自动编译流程,2分钟后就能获取最新ipk压缩包`luci-app-easytier.zip`解压上传到Openwrt软路由安装即可
+3 -4
View File
@@ -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"