Adding a file browser, file text editor and tty command shell for LuCI OpenWrt 您所在的位置:网站首页 openwrt ttyd Adding a file browser, file text editor and tty command shell for LuCI OpenWrt

Adding a file browser, file text editor and tty command shell for LuCI OpenWrt

#Adding a file browser, file text editor and tty command shell for LuCI OpenWrt| 来源: 网络整理| 查看: 265

This thread is initially about adding file browser, text editor and a console to openwrt's web interface.

Adding a uci configurator would be a nice to have, but already covered by having a functionnal console in the web interface.

And making this discussion about the metadata of the validator of the uci configurator of the web interface, sounds to me like a derailment.

But sure, I can answer that

So the metadata, it's in the wiki already, and it's really nicely formatted. A simple trip to chatgpt and it can be turned into machine readable code.

Here for example the fstab config

image image858×677 35.4 KB

Here is what it looks like out of uci

image

So anyway, the wiki data is already so clean we can somewhat easily turn it into machine readable metadata using a large language model like chatgpt

I did a few of the config.sections in this file

Pastebin [fstab.swap]device = {type = "string", required = "no", default = "-", descrip...

Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.

Tried to get chatgpt to spit out a script to read it but I just did my first lua hello world a few minutes ago and this doesn't work out of the box

local uci_metadata_file = "uci.metadata" local function get_metadata(section, option, property) local metadata = {} for line in io.lines(uci_metadata_file) do local s = line:match("^%s*%[(.-)%]") -- section if s and s == section then local opt, optdata = line:match("^%s*(%S+)%s*=%s*(%b{})") if opt and opt == option then optdata = optdata:gsub("[{}%s\"]", ""):gsub(",", "\n") for k, v in optdata:gmatch("([%w_]+)%s*=%s*([^%s]+)") do metadata[k] = v end break end end end return metadata[property] end -- example usage local section = arg[1] local option = arg[2] local property = arg[3] local value = get_metadata(section, option, property) print(value)

but it's probably close to working

root@router:~# lua read.uci.metadata.lua dropbear.dropbear verbose description Set to 1 to enable verbose output by the start script.

This metadata database would weight in at something like 250kb uncompressed

While opkg update downloads

3 -rw-r--r-- 1 root root 3.4K Mar 24 19:55 Packages.gz 88 -rw-r--r-- 1 root root 87.7K Jan 4 23:19 Packages.gz.1 88 -rw-r--r-- 1 root root 87.7K Jan 4 23:19 Packages.gz.2 61 -rw-r--r-- 1 root root 61.1K Mar 21 20:38 Packages.gz.3 176 -rw-r--r-- 1 root root 176.0K Mar 21 20:38 Packages.gz.4 453 -rw-r--r-- 1 root root 453.4K Mar 21 20:39 Packages.gz.5 12 -rw-r--r-- 1 root root 12.0K Mar 21 20:40 Packages.gz.6 57 -rw-r--r-- 1 root root 57.2K Mar 21 20:40 Packages.gz.7

So that's not something too crazy to download each time a user would use the uci configurator, which presumably would be far less often than how often a user runs opkg update.

And if there's enough free space on the device, you just leave it there



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有