Commit graph

14 commits

Author SHA1 Message Date
Paul Spooren
65266c490a luci-app-attendedsysupgrade: fix missing efi path
If running on a non EFI system, the file `/sys/firmware/efi` is not
available and therefore results in an error of `fs.stat`. Wrap it with
`L.resolveDefault` to avoid the error message and make it work on
non-EFI devices again.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2022-03-09 11:31:25 +01:00
Paul Spooren
de3e0bbffd luci-app-attendedsysupgrade: LuCIfy codebase
This should make the code a bit more readable and LuCI like instead of
using plain JavaScript.

Handle the filesystem correctly to avoid installing suqashfs images on
ext4 devices and the other way around, also recognize systems running
efi.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2022-03-02 10:48:31 +01:00
Paul Spooren
641bfe3967 luci-app-attendedsysupgrade: use correct linter settings
The previous settings would use spaces which messed up things since LuCI
uses tabs everywhere.

Also removed a stray console.log

Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-09-05 22:44:19 -10:00
Paul Spooren
f799d550b6 luci-app-attendedsysupgrade: support revision checks
SNAPSHOTS are not real releases and therefore the app always offers an
upgrade, even if running the latest build. To prevent that all SNAPSHOTS
now check for the running revision and if a newer one is available.

Also do a bunch of refactoring based on JavaScript I learned over the
last week.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-08-30 10:20:12 -10:00
Paul Spooren
2a29911121 luci-app-attendedsysupgrade: use detail not message
The new API unifies all human readable responses in the `detail` field
to follow the newly used framework.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-08-22 00:07:20 -10:00
Paul Spooren
a672875402 luci-app-attendedsysupgrade: use latest.json
The content is the same response as for `/api/latest.json` but
statically hosted by a webserver rather than Python generated.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-08-16 14:58:03 -10:00
Paul Spooren
53ff7ca676 luci-app-attendedsysupgrade: show position in queue
The server provides a queue_position argument, show it.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-08-16 14:58:03 -10:00
Paul Spooren
ff24b78c80 luci-app-attendedsysupgrade: add timeout and catch
If the upgrade server API does not respond, show an error message.
Fix #5222

While at it, minimal code linting

Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-08-09 10:04:05 -10:00
Paul Spooren
7f5becc69e luci-app-attendedsysupgrade: fix empty array condition
In JavaScript (other than in Python) an empty array is considered `true`
within if statements. Fix this by checking for the array length rather
than its existence.

This fixes the issue of an empty dropdown menu in case the user is
running the latest release.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-07-26 00:36:19 +02:00
Paul Spooren
cef330a1c8 luci-app-attendedsysupgrade: fix typo
Suggested-by: Jo-Philipp Wich <jo@mein.io>
Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-07-05 10:29:23 -10:00
Paul Spooren
85e9ee3123 luci-app-attendedsysupgrade: fix branch detection
The running branch determines which upgrades are suggested. A jump to a
newer branch (e.g. 19.07.8 to 21.02.1) is only suggested if the advanced
mode is enable, since it may break the router.

OpenWrt versions end in either `-SNAPSHOT`, `.X-rcY` or `.x`. All these
suffixes are removed, resulting in the branch name.

Previously the `-SNAPSHOT` suffix wasn't removed resulting in wrong
branch names.

Also clean up some log spam.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-05-05 06:14:32 -10:00
Paul Spooren
9184721fab luci-app-attendedsysupgrade: hide branch update
Branch updates (e.g. 19.07 to 21.02) are risky and shouldn't be
suggested by default. Hide those unless the advanced mode is enabled.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-04-29 10:56:23 -10:00
Paul Spooren
c6b4d4ab5a luci-app-attendedsysupgrade: add target in reuqest
The updated ASU api requires `target` within reuqests since the
`profile` or `board_name` is never truely unique. This is especially a
problem for x86 devices which mostly use `generic` as profile name.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-04-26 11:57:34 -10:00
Paul Spooren
25df4114ec luci-app-attendedsysupgrade: Render on client
Use new LuCI JavaScript code instead of a mix of Lua and JS.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-03-07 23:17:06 -10:00