Skip to content

Commit

Permalink
Merge pull request #1226 from rern/UPDATE
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
rern authored Feb 5, 2023
2 parents ef0f75a + 46c23ab commit b2dea87
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 54 deletions.
1 change: 0 additions & 1 deletion srv/http/assets/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ html {
padding : env( safe-area-inset ); /* disable iPhone X rounded corner padding */
}
body {
display : flex; /* allow children height:100% = body height/min-height */
position : relative;
min-height : 100%;
margin : 0;
Expand Down
5 changes: 0 additions & 5 deletions srv/http/assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,6 @@ i.map.disabled, .map.disabled i {
background: var( --cm ) !important;
}
/* ---------------------- middle window ----------------------*/
.page {
flex: 1; /* force children height:100% = body height */
touch-action: manipulation; /* fix: Unable to preventDefault inside passive event listener */
}
#page-playback {
padding: 120px 0 60px;
}
Expand All @@ -321,7 +317,6 @@ i.map.disabled, .map.disabled i {
white-space: nowrap;
}
#divtitle {
height: 34px;
height: 34px;
line-height: 34px;
font-size: 30px;
Expand Down
4 changes: 2 additions & 2 deletions srv/http/assets/js/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ function renderPlaylist( data ) { // current playlist
$( '#savedpl-path' ).addClass( 'hide' );
$( '#pl-path' ).removeClass( 'hide' );
$( '#pl-search-close' ).click();
$( '#button-pl-back, #pl-savedlist, #pl-index' ).addClass( 'hide' );
$( '#button-pl-back, #pl-savedlist, #pl-index, #pl-index1' ).addClass( 'hide' );
$( '#button-pl-playlists' ).toggleClass( 'disabled', C.playlists === 0 );
if ( data == -1 ) {
V.playlisthtml = '';
Expand Down Expand Up @@ -1262,7 +1262,7 @@ function renderPlaylistList( data ) { // list of saved playlists
$( '#savedpl-path' )
.html( data.counthtml )
.removeClass( 'hide' );
$( '#button-pl-back, #pl-savedlist, #pl-index' ).removeClass( 'hide' );
$( '#button-pl-back, #pl-savedlist, #pl-index, #pl-index1' ).removeClass( 'hide' );
$( '.emptyadd' ).addClass( 'hide' );
$( '#button-pl-back' ).toggleClass( 'back-left', D.backonleft );
var barvisible = $bartop.is( ':visible' );
Expand Down
35 changes: 23 additions & 12 deletions srv/http/assets/js/networks.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,16 +251,17 @@ function connectWiFi( data ) { // { add:..., gw:..., hidden:..., ip:..., passwor
if ( $( '#listlan li' ).length ) {
notify( icon, ssid, 'Change ...' );
} else {
loader();
location.href = 'http://'+ ip +'/settings.php?p=networks';
notify( icon, ssid, 'Change URL to '+ ip );
editReconnect( ip, 5 );
}
} else {
notify( icon, ssid, S.connectedwl ? 'Change ...' : 'Connect ...' );
}
bash( [ 'connect', JSON.stringify( data ) ], connected => {
if ( connected == -1 ) {
clearInterval( V.interval );
clearTimeout( V.timeout );
S.wlconnected = '';
bannerHide();
info( {
icon : icon
, title : 'Wi-Fi'
Expand Down Expand Up @@ -292,31 +293,41 @@ function editLAN() {
}
, buttonlabel : ! static ? '' : ico( 'undo' ) +'DHCP'
, button : ! static ? '' : () => {
notify( icon, title, 'Change URL to '+ S.hostname +'.local ...' );
loader();
location.href = 'http://'+ S.hostname +'.local/settings.php?p=networks';
bash( [ 'editlan' ] );
bash( [ 'lanedit' ] );
editReconnect( S.hostname +'.local', 10 );
}
, ok : () => editLANSet( infoVal() )
} );
}
function editLANSet( values ) {
var ip = values[ 0 ];
var gateway = values[ 1 ];
notify( 'lan', 'IP Address', 'Set ...' );
bash( [ 'editlan', ip, gateway ], avail => {
bash( [ 'lanedit', ip, gateway ], avail => {
if ( avail == -1 ) {
clearInterval( V.interval );
clearTimeout( V.timeout );
bannerHide();
info( {
icon : 'lan'
, title : 'Duplicate IP'
, message : 'IP <wh>'+ ip +'</wh> already in use.'
, ok : editLAN
} );
} else {
location.href = 'http://'+ ip +'/settings.php?p=networks';
}
bannerHide();
} );
editReconnect( ip, 3 );
}
function editReconnect( ip, delay ) {
loader();
notify( 'lan', 'IP Address', 'Change to '+ ip +' in <a>'+ delay +'</a>s ...' );
var i = delay;
V.interval = setInterval( () => {
i--
i > 0 ? $( '#bannerMessage a' ).text( i ) : clearInterval( V.interval );
}, 1000 );
V.timeout = setTimeout( () => {
location.href = 'http://'+ ip +'/settings.php?p=networks';
}, delay * 1000 );
}
function editWiFi() {
bash( [ 'profileget', V.li.data( 'ssid' ) ], values => infoWiFi( values ), 'json' );
Expand Down
58 changes: 31 additions & 27 deletions srv/http/bash/settings/networks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,12 @@ Gateway=$( jq -r .Gateway <<< $data )
fi

echo "$profile" > "/etc/netctl/$ESSID"
[[ $( jq -r .add <<< $data ) == true ]] && netctlSwitch "$ESSID" || pushRefresh
if [[ $( jq -r .add <<< $data ) == true ]]; then
netctlSwitch "$ESSID"
avahi-daemon --kill # flush cache and restart
else
pushRefresh
fi
;;
disconnect )
wlandev=$( < $dirshm/wlan )
Expand All @@ -127,32 +132,6 @@ disconnect )
ifconfig $wlandev up
$dirsettings/networks-data.sh pushwl
;;
editlan )
ip=${args[1]}
gw=${args[2]}
lan0="\
[Match]
Name=$lan
[Network]
DNSSEC=no
"
if [[ ! $ip ]];then
lan0+="\
DHCP=yes
"
else
ping -c 1 -w 1 $ip &> /dev/null && echo -1 && exit

lan0+="\
Address=$ip/24
Gateway=$gw
"
fi
file=$( ls -1 /etc/systemd/network/* | head -1 ) # en.network > eth.network > eth0.network
echo "$lan0" > $file
systemctl restart systemd-networkd
pushRefresh
;;
hostapd )
echo $dirsettings/features.sh "$1"
;;
Expand All @@ -179,6 +158,31 @@ iwlist )
echo '<bll># iw list</bll>'
iw list
;;
lanedit )
ip=${args[1]}
gw=${args[2]}
if [[ $ip ]]; then
ping -c 1 -w 1 $ip &> /dev/null && echo -1 && exit
fi

file=/etc/systemd/network/en.network
if [[ -e $file ]]; then
lan=en*
else
lan=eth0
file=/etc/systemd/network/eth0.network
fi
sed -E -i '/^DHCP|^Address|^Gateway/ d' $file
if [[ $ip ]]; then
sed -i '/^DNSSEC/ i\
Address='$ip'/24\
Gateway='$gw $file
else
sed -i '/^DNSSEC/ i\DHCP=yes' $file
fi
systemctl restart systemd-networkd
avahi-daemon --kill # flush cache and restart
;;
profileconnect )
wlandev=$( < $dirshm/wlan )
if systemctl -q is-active hostapd; then
Expand Down
10 changes: 4 additions & 6 deletions srv/http/mpdlibrary.php
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,8 @@ function htmlRadio( $subdirs, $files, $dir ) {
$indexes[] = $index;
$html .= '<li class="dir" data-index="'.$index.'">';
}
$thumbsrc = rawurlencode( "/data/$gmode/$subdir/thumb.jpg" );
$html .= '
'.imgIcon( $thumbsrc, 'wrdir' ).'
'.imgIcon( '/data/'.$gmode.'/'.$subdir.'/thumb.jpg', 'wrdir' ).'
<a class="lipath">'.$path.$subdir.'</a>
<span class="single">'.$subdir.'</span>
</li>';
Expand All @@ -452,8 +451,8 @@ function htmlRadio( $subdirs, $files, $dir ) {
$data = file( "$dir/$file", FILE_IGNORE_NEW_LINES );
$name = $data[ 0 ];
$each->charset = $data[ 2 ] ?? '';
$each->file = $file;
$each->name = $name;
$each->url = str_replace( '|', '/', $file );
$each->sort = stripSort( $name );
$array[] = $each;
}
Expand All @@ -464,9 +463,8 @@ function htmlRadio( $subdirs, $files, $dir ) {
$index = strtoupper( mb_substr( $each->sort, 0, 1, 'UTF-8' ) );
$indexes[] = $index;
$datacharset = $each->charset ? ' data-charset="'.$each->charset.'"' : '';
$url = $each->url;
$urlname = str_replace( '/', '|', $url );
$thumbsrc = '/data/'.$gmode.'/img/'.rawurlencode( $urlname ).'-thumb.jpg';
$url = str_replace( '|', '/', $each->file );
$thumbsrc = '/data/'.$gmode.'/img/'.$each->file.'-thumb.jpg';
$liname = $each->name;
$name = $searchmode ? preg_replace( "/($string)/i", '<bl>$1</bl>', $liname ) : $liname;
$html .= '
Expand Down
2 changes: 1 addition & 1 deletion srv/http/mpdplaylist.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ function htmlTrack( $lists, $plname = '' ) {
}
if ( $stationname !== '' ) {
$notsaved = 0;
$thumbsrc = '/data/'.$type.'/img/'.rawurlencode( $urlname ).'-thumb.jpg';
$thumbsrc = '/data/'.$type.'/img/'.$urlname.'-thumb.jpg';
$icon = imgIcon( $thumbsrc, 'filesavedpl', 'webradio' );
} else {
$notsaved = 1;
Expand Down

0 comments on commit b2dea87

Please sign in to comment.