From b02faa7adbe49790df30548b2e3e0a3c1d9e1f9d Mon Sep 17 00:00:00 2001 From: Tobias Mueller Date: Mon, 16 Oct 2023 16:36:33 +0200 Subject: [PATCH] web: stab at a Web UI for SIM swap --- .../luci-static/resources/view/blue-merle.js | 51 ++++++++++++++++--- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/files/www/luci-static/resources/view/blue-merle.js b/files/www/luci-static/resources/view/blue-merle.js index 1ee57a1..bd93d33 100644 --- a/files/www/luci-static/resources/view/blue-merle.js +++ b/files/www/luci-static/resources/view/blue-merle.js @@ -829,7 +829,42 @@ function handleSimSwap(ev) { _('Shutting down modem…') ) ] - ) + ); + callBlueMerle("shutdown-modem").then( + function(res) { + dlg.appendChild( + E('pre', { 'class': 'result'}, + res + ) + ); + dlg.appendChild( + E('p', { 'class': 'text'}, + _("Generating Random IMEI") + ) + ); + callBlueMerle("random-imei").then( + function(res) { + E('p', { 'class': 'text'}, + _("IMEI set:") + " " + res + ), + E('p', { 'class': 'text'}, + _("Please shutdown the device and go to another place before booting") + ) + } + ).catch( + function(err) { + } + ); + } + ).catch( + function(err) { + dlg.appendChild( + E('p',{'class': 'error'}, + _('Error! ') + err + ) + ) + } + ); } function handleOpkg(ev) @@ -974,14 +1009,14 @@ return view.extend({ E('button', { 'class': 'btn cbi-button', 'click': handleReset }, [ _('Clear') ]) ]) ]), + ]), - E('div', {}, [ - E('label', {}, _('Actions') + ':'), ' ', - E('span', { 'class': 'control-group' }, [ - E('button', { 'class': 'btn cbi-button-positive', 'data-command': 'update', 'click': handleSimSwap, 'disabled': isReadonlyView }, [ _('SIM swap…') ]), ' ', - E('button', { 'class': 'btn cbi-button-action', 'click': handleUpload, 'disabled': isReadonlyView }, [ _('IMEI change…') ]), ' ', - E('button', { 'class': 'btn cbi-button-neutral', 'click': handleConfig }, [ _('Shred config…') ]) - ]) + E('div', {}, [ + E('label', {}, _('Actions') + ':'), ' ', + E('span', { 'class': 'control-group' }, [ + E('button', { 'class': 'btn cbi-button-positive', 'data-command': 'update', 'click': handleSimSwap, 'disabled': isReadonlyView }, [ _('SIM swap…') ]), ' ', + E('button', { 'class': 'btn cbi-button-action', 'click': handleUpload, 'disabled': isReadonlyView }, [ _('IMEI change…') ]), ' ', + E('button', { 'class': 'btn cbi-button-neutral', 'click': handleConfig }, [ _('Shred config…') ]) ]) ])