1
1
mirror of https://github.com/OpenVoiceOS/OpenVoiceOS synced 2025-06-05 22:19:21 +02:00

MycroftOS: Migrating to new wifi-connect system.

This commit is contained in:
j1nx
2020-07-21 09:24:45 +02:00
parent 6b92a68a3e
commit 2beaab7a25
17 changed files with 0 additions and 61 deletions

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,65 @@
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/** @license React v0.19.1
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v16.13.1
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v16.13.1
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license URI.js v4.2.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */

View File

@@ -0,0 +1 @@
(this["webpackJsonpwifi-connect-ui"]=this["webpackJsonpwifi-connect-ui"]||[]).push([[0],{1006:function(e,t,n){"use strict";n.r(t);var a=n(0),i=n.n(a),r=n(36),o=n.n(r),s=(n(450),n(451),n(453),n(93)),c=n(423),l=n.n(c),u=n(1012),m=n(1010),d=n(443),f=n(63),h=n(1007),p=n(429),w=function(e){var t;return{type:"object",properties:{ssid:{title:"SSID",type:"string",default:null===(t=e[0])||void 0===t?void 0:t.ssid,oneOf:e.map((function(e){return{const:e.ssid,title:e.ssid}}))},identity:{title:"User",type:"string",default:""},passphrase:{title:"Passphrase",type:"string"}},required:["ssid"]}},g=function(e){var t,n=e.availableNetworks,i=e.onSubmit,r=a.useState({}),o=Object(s.a)(r,2),c=o[0],l=o[1],u=function(e,t){var n=e.filter((function(e){return t===e.ssid}))[0];return!!n&&"enterprise"===n.security}(n,c.ssid);return a.createElement(f.a,{flexDirection:"column",alignItems:"center",justifyContent:"center",m:4,mt:5},a.createElement(h.a.h3,{align:"center",mb:4},"Hi! Please choose your WiFi from the list"),a.createElement(p.Form,{width:["100%","80%","60%","40%"],onFormChange:function(e){var t=e.formData;l(t)},onFormSubmit:function(e){var t=e.formData;return i(t)},value:c,schema:w(n),uiSchema:(t=u,{ssid:{"ui:placeholder":"Select SSID","ui:options":{emphasized:!0}},identity:{"ui:options":{emphasized:!0},"ui:widget":t?void 0:"hidden"},passphrase:{"ui:widget":"password","ui:options":{emphasized:!0}}}),submitButtonProps:{width:"60%",mx:"20%",mt:3,disabled:n.length<=0},submitButtonText:"Connect"}))},b=n(1011),E=n(58),v=function(e){var t=e.hasAvailableNetworks,n=e.attemptedConnect,i=e.error;return a.createElement(a.Fragment,null,n&&a.createElement(b.a,{m:2,info:!0},a.createElement(E.d.span,null,"Applying changes... "),a.createElement(E.d.span,null,"Your device will soon be online. If connection is unsuccessful, the Access Point will be back up in a few minutes, and reloading this page will allow you to try again.")),!t&&a.createElement(b.a,{m:2,warning:!0},a.createElement(E.d.span,null,"No wifi networks available.\xa0"),a.createElement(E.d.span,null,"Please ensure there is a network within range and reboot the device.")),!!i&&a.createElement(b.a,{m:2,danger:!0},a.createElement(E.d.span,null,i)))},y=function(){var e=i.a.useState(!1),t=Object(s.a)(e,2),n=t[0],a=t[1],r=i.a.useState(!0),o=Object(s.a)(r,2),c=o[0],f=o[1],h=i.a.useState(""),p=Object(s.a)(h,2),w=p[0],b=p[1],E=i.a.useState([]),y=Object(s.a)(E,2),S=y[0],k=y[1];i.a.useEffect((function(){fetch("/networks").then((function(e){if(200!==e.status)throw new Error(e.statusText);return e.json()})).then(k).catch((function(e){b("Failed to fetch available networks. ".concat(e.message||e))})).finally((function(){f(!1)}))}),[]);return i.a.createElement(u.a,null,i.a.createElement(m.a,{brand:i.a.createElement("img",{src:l.a,style:{height:30},alt:"logo"})}),i.a.createElement(d.a,null,i.a.createElement(v,{attemptedConnect:n,hasAvailableNetworks:c||S.length>0,error:w}),i.a.createElement(g,{availableNetworks:S,onSubmit:function(e){a(!0),b(""),fetch("/connect",{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json"}}).then((function(e){if(200!==e.status)throw new Error(e.statusText)})).catch((function(e){b("Failed to connect to the network. ".concat(e.message||e))}))}})))};o.a.render(i.a.createElement(y,null),document.getElementById("root"))},423:function(e,t,n){e.exports=n.p+"static/media/logo.69120045.svg"},445:function(e,t,n){e.exports=n(1006)},453:function(e,t,n){}},[[445,1,2]]]);

View File

@@ -0,0 +1 @@
!function(e){function t(t){for(var n,i,f=t[0],l=t[1],c=t[2],p=0,s=[];p<f.length;p++)i=f[p],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&s.push(o[i][0]),o[i]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n]);for(a&&a(t);s.length;)s.shift()();return u.push.apply(u,c||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,f=1;f<r.length;f++){var l=r[f];0!==o[l]&&(n=!1)}n&&(u.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={1:0},u=[];function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/";var f=this["webpackJsonpwifi-connect-ui"]=this["webpackJsonpwifi-connect-ui"]||[],l=f.push.bind(f);f.push=t,f=f.slice();for(var c=0;c<f.length;c++)t(f[c]);var a=l;r()}([]);