Commit graph

289 commits

Author SHA1 Message Date
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
Daniel F. Dickinson
58d97b5e27 modules: Split luci-mod-full
Move some common elements to luci-base, and otherwise make three
packages out of status, system, and network.  They were mostly
separated already, but there were some shared elements between
status and network that are now in luci-base.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2018-09-19 20:08:19 +02:00
Daniel F. Dickinson
6ec0353201 modules: Make luci-base sufficient to use luci apps
Per the discussion in https://github.com/openwrt/luci/issues/869, make
luci-base sufficient to login, logout, and review and apply or revert
uci changes.  This allows most luci-app-xxx to work without having
luci-mod-admin-full installed.

It has been tested with some apps and not luci-mod-admin-full, as well
as with luci-mod-admin-full (to make sure the usual case doesn't break).

Instead of creating a new module namespace (e.g. 'Base') we reduce the
opportunities for breakage by having luci-base take over the 'shell' of
the 'Administration' (admin/....) namespace.

Since admin is assumed by all current building LuCI components (including
Freifunk), this doesn't introduce the 'Administration' tab into any
situation where it would not already be present (but includes it where it
was before).

We also add a "Component not installed" page to avoid fatal errors and
backtrace when e.g. luci-mod-admin-full is not installed.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2018-09-19 20:08:19 +02:00
Jo-Philipp Wich
1a0316bbba
Merge pull request #2140 from kristrev/multiple-upstream-interfaces-status
luci-base: Show multiple upstream interface
2018-09-19 11:36:30 +02:00
Kristian Evensen
a13748d414 luci-base: Show multiple upstream interface
Several devices have multiple upstream interfaces, for example a fixed
and a mobile broadband connection. Currently, only one upstream
interface is shown per address family in Luci. So in my example, one of
the interfaces would not appear on the Status-page.

This PR introduces support for showing multiple upstream interfaces on
the Status-page. The code is not very complicated. get_status_by_route()
has been extended to return a list of all routes, and
get_wannet()/get_wan6net() now returns all upstream interfaces.

I could not find any other (active) users of these three functions than
calls triggered from the Status-page, so changing the default behavior
should be fine. get_wandev()/get_wan6dev() called get_status_by_route(),
but I could not find any place where those functions were called. I
removed the dev-functions instead of keeping the old
get_status_by_route().

On the status page, the wan/wan6-variables have been replaced with
arrays. When populating the html, we now iterate through these arrays
and create one element for each interface.

I have tested the code with different interface types, v4, v6, as well as
disconnecting and connecting interfaces. The status is updated and the
correct interfaces (or sometimes none at all) are shown.

Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
2018-09-19 11:01:38 +02:00
Jo-Philipp Wich
9142a71469 luci-mod-admin-full: fix diagnostic page glitch
Slightly restructure markup to avoid inconsistent button rendering.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-09-18 18:45:19 +02:00
Jo-Philipp Wich
e11980b150
Merge pull request #2121 from jokdarius/feature/0001-performace-fix
luci-mod-admin-full: performance fix
2018-09-18 17:18:23 +02:00
Rosy Song
9840d310e2 modules: add backup module for mtdblock devices
Signed-off-by: Rosy Song <rosysong@rosinson.com>
2018-09-08 15:07:01 +08:00
Darius
7222bdabd4 luci-mod-admin-full: performance fix
*	uci:get replaced with direct access of value (functions has 3x better performance in that way)

Signed-off-by: Darius Joksas <jok.darius@gmail.com>
2018-08-31 10:54:35 +03:00
Dirk Brenken
53b90e3c8c luci-mod-admin-full: fix forced upgrade
* fix logical glitch in forced upgrade logic

Signed-off-by: Dirk Brenken <dev@brenken.org>
2018-08-20 21:36:11 +02:00
Dirk Brenken
89486bd66f luci-mod-admin-full: allow forced upgrade (revised)
* allow 'forced' firmware upgrades, even if the image format check
fails. Useful where flashing back to the OEM versions or switching
between ar71xx and ath79 builds
* option is only visible after first/failed image check
* added warning info (see screenshots below)

Signed-off-by: Dirk Brenken <dev@brenken.org>
2018-08-17 12:52:36 +02:00
Ansuel Smith
442ece768d
luci-mod-admin-full: applyreboot doesn't reload page
The applyreboot page doesn't reload the page onload of the loding gif. This adds the right function.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2018-08-13 10:57:21 +02:00
Jo-Philipp Wich
849d153851 treewide: rework uci change display
- Use native rpcd uci changes format instead of incompletely converting
   back and forth between the old and the new format
 - Rework uci changelog template to print the equivalent uci commands
   for the various changes
 - Rework theme headers to properly count the uncomitted changes
 - Rework theme CSS to properly style new changelog

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-08-13 09:23:22 +02:00
Ansuel Smith
327e284b74
luci-mod-admin-full: fix broken applyreboot page
This improve applyreboot page and fix problem with luci-nginx that doesn't refresh the page when the router reboot.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2018-08-08 10:11:12 +02:00
Alan Swanson
4b3d20cda4 luci-mod-admin-full: Fix DSL Stats display of dB statistics
Line attenuation, signal attenuation, noise margin and aggregate transmit power really need to show
decimal digits. Fixes commit 88713f6 from issue #2003 due to excess changes from %s to %d.
2018-08-04 12:36:49 +01:00
Jo-Philipp Wich
88713f6456 luci-mod-admin-full: rework DSL Status display
Fixes #2003.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-29 21:12:30 +02:00
Jo-Philipp Wich
a0b4d2adb6 luci-mod-admin-full: fix style glitch on packages page
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-28 14:41:34 +02:00
Jo-Philipp Wich
e5a1ac0228 treewide: rework rollback/apply workflow
Rework the apply confirmation mechanism to be session agnostic in order to
circumvent cross domain restrictions which prevent the JS code from issuing
apply confirm requests in some cases, e.g. when changing the LAN IP.

Confirmation calls may now be done from unauthenticated pages, as long as a
matching confirmation token is sent along with the request.

The reasoning behind this is that there is little security impact in
confirming pending apply sessions, especially since those sessions can only
be initiated while being authenticated.

After this change, LuCI will now launch a confirmation process on every
rendered page when a rollback is pending. The confirmation will happen
regardless of whether the user is logged in or not, or if the current page
is a CBI form or static template.

A confirmation request now also requires a random one-time token which is
rendered along with the confirmation JavaScript code in order to succeed.

This token is not meant to provide security but to ensure that the confirm
was triggered from an interactive browser session and not some background
HTTP requests that happened to end up in the admin ui.

As a consequence, the different apply/confirm/rollback code paths in CBI
maps and the UCI change/revert pages have been consolidated into one common
implementation residing in the common global theme agnostic footer template.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-27 14:07:23 +02:00
Jo-Philipp Wich
8a1bc1814f luci-mod-admin-full: abbreviate "MAC-Address" as "MAC" to align with rest
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-26 19:20:39 +02:00
Jo-Philipp Wich
80706cbafb luci-mod-admin-full: fix wifi overview display when no networks are defined
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-26 19:15:42 +02:00
Jo-Philipp Wich
4105c78ff9 luci-mod-admin-full: unify "Alias interface" and "Alias Interface" strings
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-22 18:25:04 +02:00
Jo-Philipp Wich
e4a86478e6 luci-mod-admin-full: fix check for traceroute6
Since busybox has moved traceroute6 from /usr/bin/ to /bin/, we need to
check both locations.

Fixes #1973.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-21 14:19:41 +02:00
Ansuel Smith
39cabc0361 luci-admin-full: add further wifi options
This commit adds option to disable scan for 40mhz channel, permit to tweak
beacon interval and other advanced settings.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
[fix whitespace, add range constraint to dtim_period, add dtim_period
 to local vars, reword commit message]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-18 18:48:37 +02:00
Jo-Philipp Wich
a37c1342f6
Merge pull request #1961 from Ansuel/dnsmasq
luci-admin-full: add dnsmasq allservers option
2018-07-18 18:45:31 +02:00
Ansuel Smith
7ff8d15e24
luci-admin-full: add dnsmasq allservers option
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2018-07-18 18:03:52 +02:00
Jo-Philipp Wich
9b4efaefa1 luci-mod-admin-full: use incremental background scanning for wireless join
The previous approach of synchroneously scanning while building the result
page was suboptimal since it frequently led to connection resets when
accessing LuCI via wireless.

It also exhibited problems when accessed via SSL on recent Firefox versions
where the page were only loaded partially.

Rework the wireless scanning to gather scan results in a background process
and put them into the ubus session data area where they can be readily
accessed without causing network interruptions.

Subsequently rebuild the wireless join page to use XHR polling to
incrementally fetch updated scan results.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-18 14:43:27 +02:00
Jo-Philipp Wich
90f9c59a2d luci-mod-admin-full: properly reset internal device form field
In some cases the hidden internal device field was not reset, e.g. after
aborting a wifi scan and using the browser back buttons to navigate to the
overview page again.

In such a case, the previous device hidden field was still present and a new
one getting created, causing further wireless scan attempts to get invoked
with multiple radio names as parameter which fails.

Fix this issue by using the new generic cbi_submit() helper any by dropping
the faulty wifi_action() function.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-18 12:05:05 +02:00
Jo-Philipp Wich
9bdd097f53 luci-mod-admin-full: offer "Cancel" button in iface add dialog
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-18 12:05:05 +02:00
Jo-Philipp Wich
4f0b755241 luci-mod-admin-full: fix changing alias interface ifnames
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-15 17:29:01 +02:00
Jo-Philipp Wich
a48a142599 luci-mod-admin-full: improve interface overview display
Remove the guessing of primary interfaces for now as we cannot yet properly
track parent / child interface relations.

Instead, add tooltips to the interface icons displaying detailed physical
layer information per netdev.

For dynamic or true alias interfaces (using "@" notation), skip the
reporting of MAC and traffic stats.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-15 16:23:19 +02:00
Jo-Philipp Wich
f6ffc3d739 luci-mod-admin-full: fix wifi add and scan actions
Due to conversion to CBI, the inline forms are now nested and thus do not
work anymore.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-15 13:14:24 +02:00
Jo-Philipp Wich
aef1c2fca0 luci-mod-admin-full: differentiate between disabled and not associated wireless
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-13 14:08:38 +02:00
Jo-Philipp Wich
4f0dfb6ab0 luci-mod-admin-full: tweak interface and wireless overview markup
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-13 09:37:53 +02:00
Jo-Philipp Wich
777ffa9487 luci-mod-admin-full: small wifi overview markup fix
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-12 18:58:11 +02:00
Jo-Philipp Wich
b7bf164fea luci-mod-admin-full: produce valid JSON in status/realtime/connections_status
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-12 18:55:16 +02:00
Jo-Philipp Wich
c4dca36795 luci-mod-admin-full: rework interface overview page
Convert interface enable, disable and delete actions to proper cbi
operations so that we can benefit from the apply/rollback workflow
when performing critical interface operations.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-12 18:10:10 +02:00
Jo-Philipp Wich
54c9a77bd3 luci-mod-admin-full: expose errors, description and up state in net status
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-12 18:10:10 +02:00
Jo-Philipp Wich
be2b83c9f5 luci-mod-admin-full: reimplement wireless overview page as cbi model
This will offer apply/rollback workflow for tasks like deleting or shutting
down wireless networks.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-12 18:10:10 +02:00
Jo-Philipp Wich
6f773999ac luci-mod-admin-full: improve text contrast in realtime graphs
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-11 08:07:23 +02:00
Jo-Philipp Wich
8e10118843 luci-mod-admin-full: rework connection status table handling
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-09 11:51:43 +02:00
Jo-Philipp Wich
c0de036b31 treewide: always include cbi.js
Include cbi.js in the main header template like it is done for xhr.js and
remove the page specific includes.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-09 11:51:43 +02:00
Jo-Philipp Wich
069c0c93e1 luci-mod-admin-full: use sans-serif fonts for realtime graph legends
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-09 11:51:43 +02:00
Jo-Philipp Wich
7c404d72ea luci-mod-admin-full: small markup fixes for placeholder texts
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-09 11:51:43 +02:00
Jo-Philipp Wich
ecedfe5dcc luci-mod-admin-full: style and script fixes for realtime bandwidth graph
- add Math.log2() polyfill for IE 11
 - use sans-serif font for time axis

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-09 11:51:43 +02:00
Jo-Philipp Wich
e489a82ac3 luci-mod-admin-full: rework flashops page markup
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-03 18:03:30 +02:00
Florian Eckert
50b88a435f luci-mod-admin-full: fix flashops url generation for config tab
If a firmware image is not valid then url generation for the config tab
is wrong. To fix this use the luci.dispatcher.build_url function.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-07-03 17:45:35 +02:00
Florian Eckert
65ba4b8b8a luci-mod-admin-full: check backup.tar.gz on apply
If an uploaded backup.tar.gz is not valid we will not get a respond from
LuCI. The system will perform a reboot without applying the "tar.gz"
even though the backup import failed.

To fix this check if the backup archive is valid with the command
"gunzip -t <archive>" and if the validation fails render the flashops page
with a hint. On the other hand apply the backup archive and perform a
reboot as before.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-07-03 17:45:12 +02:00
Ansuel Smith
ddbde3caaa luci-mod-admin-full: improve reboot page
This fix problem with empty controller, the check function will never stop to
check if the device finish to reboot and we set more tries to wait the router
for a longer times.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
[reworked markup, simplified logic, removed superfluous alert]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-03 17:34:10 +02:00
Jo-Philipp Wich
7b43e67219 luci-mod-admin-full: improve Y-axis scaling in bandwidth graph
Calculate a peak that causes the vertical scale to use even values.

Fixes #1424.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-03 10:58:14 +02:00
Jo-Philipp Wich
4097a63330 luci-mod-admin-full: fix uci revert success message
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-02 09:43:08 +02:00