0
0
mirror of https://github.com/openwrt/luci.git synced 2025-07-01 14:17:10 +00:00
Files
Hosted Weblate 2e5de8d0d4 Translated using Weblate (Portuguese (Brazil))
Currently translated at 2.7% (7 of 254 strings)

Translation: OpenWrt/LuCI/applications/keepalived
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationskeepalived/pt_BR/

Translated using Weblate (Portuguese (Brazil))

Currently translated at 50.0% (1 of 2 strings)

Translated using Weblate (Portuguese (Brazil))

Currently translated at 5.0% (9 of 178 strings)

Translation: OpenWrt/LuCI/applications/lldpd
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationslldpd/pt_BR/

Translated using Weblate (Portuguese (Brazil))

Currently translated at 33.3% (11 of 33 strings)

Translation: OpenWrt/LuCI/applications/v2raya
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsv2raya/pt_BR/

Translated using Weblate (Portuguese (Brazil))

Currently translated at 7.7% (6 of 77 strings)

Translation: OpenWrt/LuCI/applications/xinetd
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsxinetd/pt_BR/

Translated using Weblate (Portuguese (Brazil))

Currently translated at 6.6% (1 of 15 strings)

Translation: OpenWrt/LuCI/applications/snmpd
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationssnmpd/pt_BR/

Translated using Weblate (Portuguese (Brazil))

Currently translated at 8.3% (4 of 48 strings)

Translation: OpenWrt/LuCI/applications/openwisp
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsopenwisp/pt_BR/

Translated using Weblate (Portuguese (Brazil))

Currently translated at 8.6% (4 of 46 strings)

Translation: OpenWrt/LuCI/applications/xfrpc
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsxfrpc/pt_BR/

Translated using Weblate (Portuguese (Brazil))

Currently translated at 11.7% (2 of 17 strings)

Translation: OpenWrt/LuCI/applications/eoip
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationseoip/pt_BR/

Translated using Weblate (Portuguese (Brazil))

Currently translated at 2.5% (1 of 40 strings)

Translation: OpenWrt/LuCI/applications/example
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsexample/pt_BR/

Translated using Weblate (Portuguese (Brazil))

Currently translated at 3.1% (4 of 128 strings)

Translation: OpenWrt/LuCI/applications/usteer
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsusteer/pt_BR/

Translated using Weblate (Portuguese (Brazil))

Currently translated at 7.5% (5 of 66 strings)

Translation: OpenWrt/LuCI/applications/sshtunnel
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationssshtunnel/pt_BR/

Translated using Weblate (Portuguese (Brazil))

Currently translated at 3.4% (3 of 88 strings)

Translation: OpenWrt/LuCI/applications/mosquitto
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsmosquitto/pt_BR/

Translated using Weblate (Portuguese (Brazil))

Currently translated at 8.6% (7 of 81 strings)

Translation: OpenWrt/LuCI/applications/email
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsemail/pt_BR/

Translated using Weblate (Portuguese (Brazil))

Currently translated at 100.0% (21 of 21 strings)

Translation: OpenWrt/LuCI/applications/tor
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationstor/pt_BR/

Translated using Weblate (Portuguese (Brazil))

Currently translated at 100.0% (198 of 198 strings)

Translation: OpenWrt/LuCI/applications/smartdns
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationssmartdns/pt_BR/

Translated using Weblate (Portuguese (Brazil))

Currently translated at 100.0% (61 of 61 strings)

Translation: OpenWrt/LuCI/applications/acme
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsacme/pt_BR/

Translated using Weblate (Russian)

Currently translated at 100.0% (150 of 150 strings)

Translation: OpenWrt/LuCI/applications/https-dns-proxy
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationshttps-dns-proxy/ru/

Translated using Weblate (Portuguese (Brazil))

Currently translated at 43.7% (7 of 16 strings)

Translation: OpenWrt/LuCI/applications/squid
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationssquid/pt_BR/

Translated using Weblate (Portuguese (Brazil))

Currently translated at 100.0% (124 of 124 strings)

Translation: OpenWrt/LuCI/applications/nlbwmon
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsnlbwmon/pt_BR/

Translated using Weblate (Portuguese (Brazil))

Currently translated at 60.0% (174 of 290 strings)

Translation: OpenWrt/LuCI/applications/banip
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsbanip/pt_BR/

Translated using Weblate (Portuguese (Brazil))

Currently translated at 100.0% (49 of 49 strings)

Translation: OpenWrt/LuCI/applications/mjpg-streamer
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsmjpg-streamer/pt_BR/

Translated using Weblate (Russian)

Currently translated at 100.0% (93 of 93 strings)

Translation: OpenWrt/LuCI/applications/clamav
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsclamav/ru/

Translated using Weblate (Portuguese (Brazil))

Currently translated at 97.9% (192 of 196 strings)

Translation: OpenWrt/LuCI/applications/ddns
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsddns/pt_BR/

Translated using Weblate (Portuguese (Brazil))

Currently translated at 100.0% (113 of 113 strings)

Translated using Weblate (Portuguese (Brazil))

Currently translated at 97.8% (135 of 138 strings)

Translated using Weblate (Portuguese (Brazil))

Currently translated at 100.0% (46 of 46 strings)

Translated using Weblate (Portuguese (Brazil))

Currently translated at 100.0% (53 of 53 strings)

Translated using Weblate (Russian)

Currently translated at 100.0% (165 of 165 strings)

Translated using Weblate (Portuguese (Brazil))

Currently translated at 17.5% (29 of 165 strings)

Translated using Weblate (Portuguese (Brazil))

Currently translated at 100.0% (183 of 183 strings)

Translated using Weblate (Portuguese (Brazil))

Currently translated at 100.0% (62 of 62 strings)

Translated using Weblate (Portuguese (Brazil))

Currently translated at 100.0% (284 of 284 strings)

Translated using Weblate (Portuguese (Brazil))

Currently translated at 100.0% (25 of 25 strings)

Translated using Weblate (Portuguese (Brazil))

Currently translated at 25.0% (10 of 40 strings)

Translated using Weblate (Russian)

Currently translated at 100.0% (2560 of 2560 strings)

Translation: OpenWrt/LuCI/modules/luci-base
Translate-URL: https://hosted.weblate.org/projects/openwrt/luci/ru/

Translated using Weblate (Portuguese (Brazil))

Currently translated at 90.0% (2305 of 2560 strings)

Translation: OpenWrt/LuCI/modules/luci-base
Translate-URL: https://hosted.weblate.org/projects/openwrt/luci/pt_BR/

Translated using Weblate (Lithuanian)

Currently translated at 96.0% (2458 of 2560 strings)

Translation: OpenWrt/LuCI/modules/luci-base
Translate-URL: https://hosted.weblate.org/projects/openwrt/luci/lt/

Translated using Weblate (French)

Currently translated at 25.1% (37 of 147 strings)

Translation: OpenWrt/LuCI/applications/privoxy
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsprivoxy/fr/

Translated using Weblate (Portuguese)

Currently translated at 51.0% (75 of 147 strings)

Translation: OpenWrt/LuCI/applications/privoxy
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsprivoxy/pt/

Translated using Weblate (Spanish)

Currently translated at 99.9% (2559 of 2560 strings)

Translation: OpenWrt/LuCI/modules/luci-base
Translate-URL: https://hosted.weblate.org/projects/openwrt/luci/es/

Co-authored-by: Didier Martin <dm.martin@free.fr>
Co-authored-by: Douglas Garda <douglasgarda@gmail.com>
Co-authored-by: Džiugas Januševičius <dziugas1959@hotmail.com>
Co-authored-by: Franco Castillo <castillofrancodamian@gmail.com>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Maksim_220 Кабанов <law820314@gmail.com>
Co-authored-by: lbiscuola <lbiscuola@gmail.com>
Signed-off-by: Didier Martin <dm.martin@free.fr>
Signed-off-by: Douglas Garda <douglasgarda@gmail.com>
Signed-off-by: Džiugas Januševičius <dziugas1959@hotmail.com>
Signed-off-by: Franco Castillo <castillofrancodamian@gmail.com>
Signed-off-by: Maksim_220 Кабанов <law820314@gmail.com>
Signed-off-by: lbiscuola <lbiscuola@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationscommands/pt_BR/
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationscoovachilli/pt_BR/
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationscoovachilli/ru/
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsfilebrowser/pt_BR/
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsfirewall/pt_BR/
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsminidlna/pt_BR/
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsnut/pt_BR/
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsolsr/pt_BR/
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsp910nd/pt_BR/
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsradicale2/pt_BR/
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsuhttpd/pt_BR/
Translate-URL: https://hosted.weblate.org/projects/openwrt/luciapplicationsupnp/pt_BR/
Translation: OpenWrt/LuCI/applications/commands
Translation: OpenWrt/LuCI/applications/coovachilli
Translation: OpenWrt/LuCI/applications/filebrowser
Translation: OpenWrt/LuCI/applications/firewall
Translation: OpenWrt/LuCI/applications/minidlna
Translation: OpenWrt/LuCI/applications/nut
Translation: OpenWrt/LuCI/applications/olsr
Translation: OpenWrt/LuCI/applications/p910nd
Translation: OpenWrt/LuCI/applications/radicale2
Translation: OpenWrt/LuCI/applications/uhttpd
Translation: OpenWrt/LuCI/applications/upnp
2025-06-25 21:49:01 +03:00
..
2024-10-23 22:29:09 +02:00
2024-12-03 16:25:21 +01:00

Example app for js based Luci

This app is meant to be a starting point for developing new LuCI apps using the modern JavaScript client-rendered approach. Previously the LuCI used a Lua server-side render approach which is deprecated now.

Installation

In all cases, you'll want to log out of the web interface and back in to force a cache refresh after installing the new package.

From git

To install the luci-app-example to your OpenWrt instance (assuming your OpenWRT instance is on 192.168.1.1):

scp -r root/* root@192.168.1.1:/
scp -r htdocs/* root@192.168.1.1:/www/
# execute the UCI defaults script to create the /etc/config/example
ssh root@192.168.1.1 "sh /etc/uci-defaults/80_example"

From packages

Install the app on your OpenWrt installation. This can be an actual router/device, or something like a QEMU virtual machine.

opkg install luci-app-example

Visit the web UI for the device/virtual machine where the package was installed. Log in to OpenWrt, and Example should be present in the navigation menu.

Application structure

See structure.md for details on how to lay out a LuCI application.

Code format

The LuCI Javascript code should be indented with tabs. js-beautify/jsbeautifier can help with this. The examples in this application were formatted with:

js-beautify -t -a -j -w 110 -r <filename>

Editing the code

You can either do direct editing on the device/virtual machine, or use something like sshfs to have remote access from your development computer.

By default, the code is minified by the build process, which makes editing it non-trivial. You can either change the build process, or just copy the file content from the git repository and replace the content on disk.

Javascript code can be found on the device/virtual machine in /www/luci-static/resources/view/example/.

form.js

This is a JS view that uses the form.Map approach to providing a form that can change the configuration. It relies on UCI access, and the relevant ACL declarations are in root/usr/share/rpcd/acl.d/luci-app-example.json.

The declarations are luci-app-example > read > uci and luci-app-example > write > uci. Note that for both permissions, the node name "example" is provided as a list argument to the interface type (uci); this maps to /etc/config/example.

Since form.Map and form.JSONMap create Promises, you cannot embed them inside a E()-built structure.

htmlview.js

This is a read-only view that uses E() to create DOM nodes.

Data is fetched via the function defined in load() - these loads are done as Promises, with the promise results stored in an array. Multiple load functions results are available in the array, and can be accessed via a single argument passed to the render() function.

This code relies on the same ACL grants as form.js.

The signature for E() is E(node_type, {node attributes}, [child nodes]).

rpc.js

The RPC JS page is read-only, and demonstrates using RPC calls to get data. It also demonstrates using the JSONMap form object for mapping a configuration to a form, but makes the form read-only for display purposes.

The configuration is stored in /etc/config/example. The file must exist and created on device boot by UCI defaults script in /root/etc/uci-defaults/80_example. The developer guide has more details about UCI defaults.

The RPCd script is stored as /usr/libexec/rpcd/luci.example, and can be called via ubus.

It relies on RPC access, and the relevant ACL declarations are in root/usr/share/rpcd/acl.d/luci-app-example.json.

The declaration is luci-app-example > read > ubus > luci.example; the list of names under this key is the list of APIs that can be called.

ACLs

ACLs are global for the entire web UI - the declaration of luci-app-example in a file called acl.d/luci-app-example is just a naming convention. Nothing enforces that only the code in luci-app-example is mutating /etc/config/example. Once the ACL is defined to allow reads/writes to a UCI node, any code running from the web UI can make changes to that node.

YAML

You may wish to work with YAML data. See YAML.md for details on how to integrate YAML read support.

Translations

For a real world application (or changes to this example one that you wish to submit upstream), translations should be kept up to date.

To rebuild the translations file, from the root of the repository execute ./build/i18n-scan.pl applications/luci-app-example > applications/luci-app-example/po/templates/example.pot

If the scan command fails with an error about being unable to open/find msguniq, install the GNU gettext package for your operating system.