-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add firmware upgrade notification to status page #7597
base: master
Are you sure you want to change the base?
Conversation
This allows each include to perform an action a single time but don't run it on each poll. The function receives all data loaded via the `load` function. Signed-off-by: Paul Spooren <[email protected]>
If the UCI luci core section contain the option `check_firmware_version` then a load of the status page checks if the download server offers a new firmware compatible with the currently running device. Signed-off-by: Paul Spooren <[email protected]>
&& boardinfo.release.version > data.stable_version | ||
&& data.upcoming_version > boardinfo.release.version | ||
&& checkDeviceAvailable(boardinfo, data.upcoming_version)) { | ||
showUpgradeModal("upcomming", boardinfo.release.version, data.upcoming_version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
upcoming
(or just new
?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe "release candidate"? since I think that's the only thing ever to populate the upcoming_release
field in .versions.json...
oneshot: function(data) { | ||
var boardinfo = data[0]; | ||
var check_upgrades = uci.get_first('luci', 'core', 'check_firmware_version') || false; | ||
console.log(check_upgrades) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drop
} | ||
}) | ||
.catch(error => { | ||
console.error('Failed to fetch profile information:', error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider adding more context to the error. A user who doesn't know about this feature might be confused by this err string, even though it's a console message.
Consider using // ui.addNotification(a, message, timeout, severity)
ui.addNotification(null, E('p', _('A new firmware is available.')), 60000, 'info'); |
]); | ||
}, | ||
|
||
oneshot: function(data) { | ||
var boardinfo = data[0]; | ||
var check_upgrades = uci.get_first('luci', 'core', 'check_firmware_version') || false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure but I think that should be 'main'
and not 'core'
, assuming the js versions work like the cli tool:
$ uci show luci.core
uci: Entry not found
$ uci show luci.main
luci.main=core
luci.main.lang='auto'
luci.main.mediaurlbase='/luci-static/openwrt2020'
luci.main.resourcebase='/luci-static/resources'
luci.main.ubuspath='/ubus/'
Is this forced to all users? Also for those who regularly build their own builds every few days... I am wondering if this should either
In many OEM firmwares that I have seen, the upgrade check/notice is in a system admin menu, not on the front page. (And hopefully the data is not polled by every 5 seconds) |
At most once a week is optimistic, once a month preferred (cronjob trigger?). But that's probably why the function is a oneshot. I suppose it could have a counter, and disable itself after a few tries, only to be activated after the next upgrade / reboot. |
It runs every time you open the status page and does nothing in the background, why should it anyway. It's not enabled by default but could be if users want that. A modal could open once and ask the user if they want to automatically check for upgrades when opening the web interface. Additionally we could add a button somewhere to manually switch. |
Putting a "Don't show me again" button right on the modal dialog would probably be pretty easy, it could just do |
I feel that any automatic call-to-home should be opt-in, not something to be opted out. By default, the OpenWrt routers are currently not contacting OpenWrt servers before the user selects some action like opkg/APK that triggers the contact. That "no automatic call-home" was the OpenWrt stance a few years ago, when there was discussion about collecting usage stats, device counts etc. |
This is out of the question, it'd always be an opt in feature. I'll see how to implement that and update this PR accordingly |
It's already opt-in. The value for |
This is likely not cleanly implemented, I'm unfamiliar with the LuCI tricks and JavaScript in general.
The core idea is to show a notification whenever a new firmware is available.
Right now it's just a notification, this could be extended to include the luci-app-attendedsysupgrade functionality or a slimmed down version.
@jow- please have a look
Signed-off-by: <[email protected]>
row (viagit commit --signoff
)<package name>: title
first line subject for packagesPKG_VERSION
in the Makefile