包详细信息

luci-rpc

AlchemillaHQ23GPL-3.0-or-later1.0.5

A package that helps communicate with the luci-mod-rpc interface

luci, openwrt, rpc

自述文件

luci-rpc

A simple RPC communication library for the JSON LUCI RPC API.

Example

const { LUCI } = require('luci-rpc')

async function main() {
    const luci = new LUCI('https://192.168.1.2', 'root', 'x')

    await luci.init()
    let updateInterval = 1000 * 60 * 30
    luci.autoUpdateToken(updateInterval);

    console.log(await luci.getAll("network"))
    console.log(await luci.get(["network", "@device[0]", "ports"]))

    await luci.set(["network", "lan", "ipaddr", "192.168.1.1"])
    console.log(await luci.getChangedSections())
    console.log(await luci.getChanges())
    console.log(await luci.commit("network"))
    console.log(await luci.commitSpecific(["network", "lan"]))
}

main()

LICENSE

GPL-3.0