Commit graph

125 commits

Author SHA1 Message Date
Jo-Philipp Wich
16853bcd2e luci-base: convert menu nodes to JSON
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-16 18:07:17 +01:00
Jo-Philipp Wich
392ba53eff luci-base, luci-mod-network: migrate getDUIDHints method to C plugin
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-08 10:25:30 +01:00
Jo-Philipp Wich
9e57fbb2c3 luci-base, luci-app-firewall: port custom rules to client side view
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-03 20:34:57 +01:00
Jo-Philipp Wich
a43b1c6468 luci-base, luci-mod-status: convert process status to client side view
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-03 20:07:58 +01:00
Jo-Philipp Wich
8d512f13ec luci-base: add luci/getProcessList RPC method
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-03 20:03:25 +01:00
Jo-Philipp Wich
f16a47042c luci-base, luci-mod-network: invoke ifdown directly in interface overview
Replace the `iface_down` endpoint with a direct invocation of `/sbin/ifdown`
and replace the interface connectivity check with a call to the new
`remote_addr` endpoint.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-03 17:56:58 +01:00
Jo-Philipp Wich
cfb5af89e1 luci-base, luci-mod-status: convert realtime stats to client side views
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-03 17:56:58 +01:00
Jo-Philipp Wich
a2f43983b6 luci-base: add luci/getRealtimeStats and luci/getConntrackList rpc methods
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-03 17:56:58 +01:00
Richard Yu
c360cdd1f0 luci-app-opkg: add ipk upload feature
Signed-off-by: Richard Yu <yurichard3839@gmail.com>
[fix duplicate upload errors, remove temporary file, tweak style]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-01 12:03:33 +01:00
Jo-Philipp Wich
c72c78bed9 luci-mod-network: interfaces.js: issue iface restart via file/exec rpc call
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-01 12:03:33 +01:00
Jo-Philipp Wich
6aa4b83f24 luci-mod-network: wireless.js: issue wifi restart via file/exec rpc call
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-01 12:03:33 +01:00
Jo-Philipp Wich
c85af3d761 luci-mod-status: reimplement index status page as client side view
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-01 12:03:33 +01:00
Jo-Philipp Wich
5ce16764ad luci-base, luci-mod-system: replace luci/setUmount with fs.exec calls
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-01 12:03:33 +01:00
Jo-Philipp Wich
c67d2ddc2c luci-base, luci-mod-system: replace luci/setReboot with fs.exec
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-01 12:03:33 +01:00
Jo-Philipp Wich
6e633b3ed2 luci-base: consolidate network.js data acquisition
The new luci-rpc/getNetworkDevices procedure offers netdev enumeration
with included IPv4 and IPv6 address information as well as 64bit traffic
counters, so we can remove the calls to network.device/status and
luci/getIfaddrs now as we're able to obtain all info from a single source.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-01 12:03:33 +01:00
Jo-Philipp Wich
cc1cbdaf32 luci-base: migrate luci/getNetworkDevices to C plugin
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-01 12:03:33 +01:00
Jo-Philipp Wich
a96e7a664f luci-base: migrate luci/getWirelessDevices to C plugin
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-01 12:03:33 +01:00
Jo-Philipp Wich
37b6092aef luci-base, luci-mod-network, luci-app-firewall: migrate luci/getHostHints
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-01 12:03:33 +01:00
Jo-Philipp Wich
5ff35d8be4 luci-base, luci-mod-network: migrate luci/getDHCPLeases to C plugin
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-01 12:03:33 +01:00
Jo-Philipp Wich
d21ebcfbbc luci-base: migrate luci/getBoardJSON to C plugin
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-01 12:03:33 +01:00
Jo-Philipp Wich
3d11af11a7
Merge pull request #3145 from ptpt52/refine-flash-reset
luci-mod-system: refine flash reset
2019-10-16 21:31:26 +02:00
Richard Yu
02a0291d14
luci-base: widgets.js: add user and group select
Signed-off-by: Richard Yu <yurichard3839@gmail.com>
2019-10-11 01:05:08 +08:00
Chen Minqiang
29aad47121 luci-mod-system: refine flash reset
We determine flash reset capability by checking overlayfs in /proc/mounts

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
2019-10-07 23:37:35 +08:00
Jo-Philipp Wich
1d68853cce luci-base: add reboot rpc call
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-07 11:53:39 +02:00
Jo-Philipp Wich
020ac1e08d luci-mod-system: flash.js: fix "rootfs_data" partition detection
The `/sys/devices/virtual/mtd/` information is not available on all
devices so rely on the contents of `/proc/mtd` instead to check for
the existence of the `rootfs_data` partition.

Fixes: #3136
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-02 13:02:04 +02:00
Rafał Miłecki
7c108683c6 luci-mod-system: use "system" new "validate_firmware_image" ubus method
This new ubus method provides more properly-formatted details about
firmware file. Use it to check if uploaded image is valid.

The old "sysupgrade --test" method is left for now to provide stderr
output.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
[Added missing ACL, add default value for the ubus failure case]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-02 09:46:18 +02:00
Jo-Philipp Wich
2a5c5f47f9 luci-mod-system: reimplement flashops as client side view
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-24 14:21:08 +02:00
Jo-Philipp Wich
71e265a7f0 luci-mod-system: remplement fstab settings as client side view
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-21 18:36:31 +02:00
Jo-Philipp Wich
54cab2f26b luci-base: add rpc methods for mount management
This commit introduces the new methods luci/getBlockDevices,
luci/setBlockDetect, luci/getMountPoints, luci/setUmount in
preparation for the reworked mount point management.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-21 18:30:34 +02:00
Jo-Philipp Wich
9ae9657a85 luci-mod-system: remplement password change as client side view
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-16 07:54:25 +02:00
Jo-Philipp Wich
a31d1d10e0 luci-mod-system: reimplement SSH key mgmt as client side view
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-15 20:00:36 +02:00
Jo-Philipp Wich
3e1cf14ad1 luci-base: add luci/setPassword rpc method, dropbear feature flag
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-16 07:49:05 +02:00
Jo-Philipp Wich
0e5be0d68a luci-mod-system: reimplent system/crontab as client side view
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-12 18:48:58 +02:00
Jo-Philipp Wich
8178ac15b6 luci-base: whitelist file/write actions on /etc/rc.local
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-12 14:42:12 +02:00
Jo-Philipp Wich
5fd21bc9ef luci-base: add luci/getSwconfigFeatures and luci/getSwconfigPortState
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-12 11:09:57 +02:00
Jo-Philipp Wich
5dc61be746 luci-base: replace luci/getHostname with generic file/read rpc operation
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-10 15:29:15 +02:00
Jo-Philipp Wich
9cae3b9e67 protocols: replace luci/getTTYDevices calls with generic file/list ones
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-10 15:29:04 +02:00
Jo-Philipp Wich
5697ebbef5 luci-base: add hostapd/wpa_supplicant cli feature flags
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-10 15:28:16 +02:00
Jo-Philipp Wich
963b7636b4 luci-mod-network: switch to client side wifi configuration pages
Rewrite the wireless network management views in client side JS using ubus
rpc calls for the router communication.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-10 15:28:16 +02:00
Jo-Philipp Wich
3f93650901 luci-base: use cgi-io and rpcd-mod-file to handle file upload and browsing
Remove the old server side support for file browsing and file uploading
and switch to a client side widget instead which uses XMLHTTPRequests to
upload files via cgi-io and RPC calls for file listing and status queries.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-10 15:28:16 +02:00
Jo-Philipp Wich
93af8a3af8 luci-base: network.js: fix, rework and improve wireless state handling
- Use new getWirelessDevices rpc method to optimize data fetching
 - Implement further getters to access iwinfo information
 - Implement assoc- and scan list functions
 - Simplify internal data model

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-10 15:28:16 +02:00
Jo-Philipp Wich
8cd40eb1e6 luci-base: add getWirelessDevices() rpc method
The getWirelessDevices() method merges the results of the
network.wireless/status call with corresponding per-radio and
per-network iwinfo data.

This allows to simplify the client side network state model
implementation and saves extraneous rpc roundtrips to fetch
iwinfo data after discovering the wireless devices.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-10 15:28:16 +02:00
Jo-Philipp Wich
0674fc2041 luci-base: rpcd: add getHostname and getTTYDevices calls
Also add IPv6 feature indication.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-10 15:28:16 +02:00
Jo-Philipp Wich
438d4b95c3 luci-base: add rpc feature tests for sysntpd and zram
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-15 16:10:42 +02:00
Jo-Philipp Wich
ed8f1c4c1c luci-app-firewall: honour global default policies in per-zone settings
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
167ad7bb12 luci-base: rpc: drop offload_support call
It is superseded by the more generic getFeatures method.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
a4621c9520 luci-base: luci.js: introduce hasSystemFeature() api
The new function allows querying the presence of certain system features
such as dnsmasq or firewall availability or the compile time features
of hostapd and wpa_supplicant.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
d528a96947 luci-base: network.js: support dynamically loaded protocol classes
Port the existing server side protocol support framework to the client
side network.js.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
1fe45a9344 luci-base: index.html: add extend cache-control directive
Fixes: #2942
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-01 15:43:35 +02:00
Jo-Philipp Wich
f5919a990f luci-base: remove accidentally committed code
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-22 16:48:35 +02:00
Jo-Philipp Wich
b2aada6c82 luci-base: add conntrack_helpers ubus procedure
Also move firewall specific ACLs into separate group.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-22 16:35:58 +02:00
Jo-Philipp Wich
acbc031a6d luci-base,luci-mod-system: split ubus localtime into get and set call
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-08 17:07:11 +02:00
Jo-Philipp Wich
abee9138de luci-base: add rpcd ACL rules
Add required ACL rules to allow access to the native ubus HTTP
interface directly.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-08 16:25:30 +02:00
Jo-Philipp Wich
2f79aa1c35 luci-base: implement further ubus calls
Implement new ubus rpcd backend calls for later use in the frontend:

 - netdevs: dump information about Linux network devices present
 - boardjson: dump /etc/board.json if present
 - offload_support: query whether netfilter offloading is supported

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:25 +02:00
Jo-Philipp Wich
bfae09e574 luci-base: implement lease status ubus call
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:25 +02:00
Jo-Philipp Wich
6665a1d78c luci-base: add rpcd backend plugin
Add an rpcd executable plugin containing procedures required by client
side views.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:24 +02:00
xiongjie
fd3d2b468f luci-base: redirect root path to /cgi-bin/luci/
Fix openwrt/luci#1062
Signed-off-by: MonwF <boluo2@gmail.com>
2018-10-10 13:04:17 +08:00
Jo-Philipp Wich
f4dd2e6dfb
Merge pull request #952 from cshore-history/pull-request-fstab-avoid-block-umount-on-apply
luci-base: Avoid block umount on fstab apply
2018-07-16 22:12:38 +02:00
Jo-Philipp Wich
828202ef52
Merge pull request #1769 from jow-/master
UCI apply/rollback workflow
2018-05-18 16:44:33 +02:00
Florian Eckert
6f3007980b luci-base: reload log on uci system change
If log configuration get changed in uci system no new values are applied
until reboot. Add /etc/init.d/log reload to exec option will solve this
issue.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-05-07 14:37:35 +08:00
Jo-Philipp Wich
9f796fad3a luci-base: add transitional /etc/init.d/ucitrack
Ship an /etc/init.d/ucitrack for spawning a virtual service with the sole
purpose to track the configurations and dependencies formerly handled by
luci-reload.

Once all LuCI supported services ship with procd compatible init scripts,
the uci track support can be dropped.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-05-05 23:11:23 +02:00
Jo-Philipp Wich
8deb949551 treewide: rework uci apply workflow
Switch to rpcd based uci apply/rollback workflow which helps to avoid soft-
bricking devices by requiring an explicit confirmation call after config
apply.

When a user now clicks "Save & Apply", LuCI first issues a call to uci apply
which commits and reloads configuration, then goes into a polling countdown
mode where it repeatedly attempts to call uci confirm.

If the committed configuration is sane, the confirm call will go through and
cancel rpcd's pending rollback timer.

If the configuration change leads to a loss of connectivity (e.g. due to bad
firewall rules or similar), the rollback mechanism will kick in after the
timeout and revert configuration files and pending changes to the pre-apply
state.

In order to cover such rare cases where a lost of connectivity is expected
and desired, the user is offered an "unchecked" apply option after timing
out, which allows committing and applying the changes anyway, without the
extra safety checks.

As a consequence of this change, the luci-reload mechanism is now completely
unsused since rpcd uses ubus config reload signals to reload affected
services, which means that only procd-enabled services will receive proper
reload treatment with the new workflow.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-05-05 23:11:23 +02:00
Jo-Philipp Wich
628048772d luci-base: ship rpcd uci access ACL
Ship an ACL definition for granting full read/write access to uci
configuration files via ubus rpc. This is a precondition for enabling
uci session isolation later on.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-21 14:59:41 +02:00
Florian Eckert
a72d90faac luci-base: add dhcp to system ucitrack
If hostname get changed in "/etc/config/system" dnsmasq should reloaded
his config to be reached again under the URL [HOSTNAME].lan

Signed-off-by: Florian Eckert <Eckert.Florian@googlemail.com>
2017-02-21 10:18:53 +01:00
Daniel Dickinson
33b279c475 luci-base: Avoid block umount on fstab apply
Default behaviour of changes to fstab (Mount Points) was
to use /etc/init.d/fstab restart, however this unmounts
filesystems via block umount which can cause the device
to fail, so replace the initscript call with an exec
of 'block mount'.

Signed-off-by: Daniel Dickinson <lede@cshore.thecshore.com>
2017-01-15 21:41:18 -05:00
Jo-Philipp Wich
e06c60a0d6 luci-base: remove default diag host from /etc/config/luci
Now that luci-mod-admin-full figures out the proper diagnostics host
during postinstall we can remove the UCI section from the default
configuration file.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2016-10-06 17:14:46 +02:00
Florian Eckert
8b07a65117 luci-mod-admin-full: make diagnostics url customizable
Signed-off-by: Florian Eckert <Eckert.Florian@googlemail.com>
2016-07-29 08:21:23 +02:00
Hannu Nyman
e336dbed39 luci-base: remove deprecated 6relayd from ucitrack
Cleanup /etc/config/ucitrack by removing '6relayd' item,
as the whole 6relayd package was removed in 2014.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2016-05-25 22:26:36 +03:00
Jo-Philipp Wich
81e80c4b87 luci-base: properly handle ubus connections for non-root (#570, #571)
Instead of relying on the connect-before-setuid hack, ship a proper
acl definition file whitelisting the procedures that LuCI requires
on its non-root pages.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2016-01-11 15:21:46 +01:00
Daniel Dickinson
403b939acd modules/luci-base: Move LuCI FileUpload directory to /etc/luci-uploads and save across sysupgrade
/lib/uci/upload is a rather odd place for configuration files

Also the files were not saved across sysupgrade, which is somewhat
counter-productive for configuration files.

Signed-off By: Daniel Dickinson <openwrt@daniel.thecshore.com>
2015-12-12 22:45:29 -05:00
Hannu Nyman
b6fe9a70e6 luci-base: change index.html to be more like current themes
Change index.html that is visible for a second when entering Luci:
* Black text on white background (instead of white on black)
* Specify font as Arial/Helvetica

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2015-09-29 11:44:53 +03:00
Hannu Nyman
1209ab6ba6 luci-base: set default mediaurlbase to bootstrap (current default theme)
The mediaurlbase option in the default /etc/config/luci still points
to the old openwrt.org theme that is not installed by default.
The discrepancy was noted in the commit message for 55ab4e4ce2

After 55ab4e4ce2 the installed theme's uci-defaults script will correct
the setting at first boot, but we should not have a deprecated theme as
the default value. Set the default value to the default theme 'bootstrap'.

Related old discussion at #302

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2015-09-18 16:00:06 +03:00
Jo-Philipp Wich
03610cee3a luci-base: rename .gitignore to .placeholder
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-05-26 16:27:05 +02:00
nightcoffee
08a38a0493 luci-base: Add cache control in index.html
Signed-off-by: Night Coffee <ydkf@qq.com>
2015-05-18 20:05:02 +08:00
Jo-Philipp Wich
1bb4822dca Rework LuCI build system
* Rename subdirectories to their repective OpenWrt package names
 * Make each LuCI module its own standalone package
 * Deploy a shared luci.mk which is used by each module Makefile

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-01-08 16:26:20 +01:00