-
Notifications
You must be signed in to change notification settings - Fork 2.9k
luci-mod-system: derive factory-reset LAN IP from board.json #8912
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,17 @@ const callSystemValidateFirmwareImage = rpc.declare({ | |
| expect: { '': { valid: false, forceable: true } } | ||
| }); | ||
|
|
||
| const callGetBoardJSON = rpc.declare({ | ||
| object: 'luci-rpc', | ||
| method: 'getBoardJSON', | ||
| expect: { '': {} } | ||
| }); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing ACL grant. Generated by Claude Code |
||
|
|
||
| /* Cached factory-reset LAN IP, prefetched in load() so it can be passed | ||
| * synchronously to ui.awaitReconnect() before firstboot/sysupgrade wipe | ||
| * the device and rpcd disappears. */ | ||
| let factoryLanIP = '192.168.1.1'; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: the PR description still describes the pre-force-push revision and now contradicts the commit message on two facts: it says the change introduces "a small Generated by Claude Code |
||
|
|
||
| function findStorageSize(procmtd, procpart) { | ||
| let kernsize = 0, rootsize = 0, wholesize = 0; | ||
|
|
||
|
|
@@ -71,7 +82,11 @@ return view.extend({ | |
| fs.trimmed('/proc/sys/kernel/hostname'), | ||
| fs.trimmed('/proc/mtd'), | ||
| fs.trimmed('/proc/partitions'), | ||
| fs.trimmed('/proc/mounts') | ||
| fs.trimmed('/proc/mounts'), | ||
| L.resolveDefault(callGetBoardJSON(), {}).then(bj => { | ||
| factoryLanIP = bj?.network?.lan?.ipaddr ?? '192.168.1.1'; | ||
| return factoryLanIP; | ||
| }) | ||
| ]; | ||
|
|
||
| return Promise.all(tasks); | ||
|
|
@@ -101,7 +116,7 @@ return view.extend({ | |
| /* Currently the sysupgrade rpc call will not return, hence no promise handling */ | ||
| fs.exec('/sbin/firstboot', [ '-r', '-y' ]); | ||
|
|
||
| ui.awaitReconnect('192.168.1.1', 'openwrt.lan'); | ||
| ui.awaitReconnect(factoryLanIP, 'openwrt.lan'); | ||
| }, | ||
|
|
||
| handleRestore(ev) { | ||
|
|
@@ -163,7 +178,7 @@ return view.extend({ | |
| E('p', { 'class': 'spinning' }, _('The system is rebooting now. If the restored configuration changed the current LAN IP address, you might need to reconnect manually.')) | ||
| ]); | ||
|
|
||
| ui.awaitReconnect(window.location.host, '192.168.1.1', 'openwrt.lan'); | ||
| ui.awaitReconnect(window.location.host, factoryLanIP, 'openwrt.lan'); | ||
| }, this)) | ||
| .catch(function(e) { ui.addNotification(null, E('p', e.message)) }) | ||
| .finally(function() { btn.firstChild.data = _('Upload archive...') }); | ||
|
|
@@ -337,7 +352,7 @@ return view.extend({ | |
| if (opts['keep'][0].checked) | ||
| ui.awaitReconnect(window.location.host); | ||
| else | ||
| ui.awaitReconnect(window.location.host, '192.168.1.1', 'openwrt.lan'); | ||
| ui.awaitReconnect(window.location.host, factoryLanIP, '192.168.1.1', 'openwrt.lan'); | ||
| }, | ||
|
|
||
| handleBackupList(ev) { | ||
|
|
||
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.
nit: the PR description sync described in the last comment did not land — as of
208df8fthe body still reads "Introduce a smallfactoryLanIP()helper backed by the existingluci.getBoardJSONrpc method" (it is a module-scoped string, and the object isluci-rpcper this line) and "Behaviour for stock upstream builds is unchanged (board.jsonstill contains'192.168.1.1')", the premise the rewritten commit message correctly drops. Possibly an unsaved edit in the GitHub description box; worth re-applying so the body matches the commit message.Generated by Claude Code