Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
rern committed Jan 26, 2024
1 parent b587a5b commit fae95f0
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions WiFi_profile/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@
<script>
var V = {}
var default_v = {
dhcp : { SSID: '', PASSPHRASE: '', HIDDEN: false }
, static : { SSID: '', PASSPHRASE: '', ADDRESS: '', GATEWAY: '', HIDDEN: false }
dhcp : { ESSID: '', KEY: '', SECURITY: false, HIDDEN: false }
, static : { ESSID: '', KEY: '', ADDRESS: '', GATEWAY: '', SECURITY: false, HIDDEN: false }
}
var list = [
[ 'SSID', 'text' ]
, [ 'Password', 'password' ]
, [ 'IP', 'text' ]
, [ 'Gateway', 'text' ]
, [ 'WEP', 'checkbox' ]
, [ 'Hidden SSID', 'checkbox' ]
];
var icon = 'wifi';
Expand All @@ -63,34 +64,34 @@
, checkblank : [ 0 ]
, checkip : dhcp ? '' : [ 2, 3 ]
, ok : () => {
var val = infoVal();
var name = val.SSID +'.psk';
var data = '';
if ( val.PASSPHRASE ) {
data += '\n[Security]'
+'\nPassphrase="'+ val.PASSPHRASE +'"\n';
var val = infoVal();
var data = 'Interface=wlan0'
+'\nConnection=wireless'
+'\nESSID="'+ val.ESSID +'"';
if ( val.KEY ) {
data += '\nKey="'+ val.KEY +'"'
+'\nSecurity="'+ ( val.SECURITY ? 'wep' : 'wpa' ) +'"';
}
if ( val.ADDRESS ) {
data += '\nIP=static'
+'\nAddress='+ val.ADDRESS +'/24'
+'\nGateway='+ val.GATEWAY;
} else {
name = name.replace( /.psk$/, '.open' );
data += '\nIP=dhcp'
}
if ( val.HIDDEN ) {
data += '\n[Settings]'
+'\nHidden=true\n';
}
if ( val.GATEWAY ) {
data += '\n[IPv4]'
+'\nAddress='+ val.ADDRESS
+'\nGateway='+ val.GATEWAY;
data += '\nHidden=yes';
}
var blob = new Blob( [ data ], { type: 'application/text;charset=utf-8' } );
var a = document.createElement( 'a' );
a.setAttribute( 'download', name );
a.setAttribute( 'download', 'wifi' );
a.setAttribute( 'href', window.URL.createObjectURL( blob ) );
a.click();
info( {
icon : icon
, title : title
, message : '<pre>'+ data +'</pre>'
+'<br><p><i class="i-file"></i>Profile <c>'+ name +'</c> downloaded.'
+'<br><p><i class="i-file"></i>File <c>wifi</c> downloaded.'
+'<br><br><i class="i-copy"></i>Copy to SD<i class="i-backup"></i><c>/boot</c></p>'
, okno : true
} );
Expand Down

0 comments on commit fae95f0

Please sign in to comment.