From b8aa78bb7fd3f7ac625090e0e3a1c62094cd4dbd Mon Sep 17 00:00:00 2001 From: rern Date: Fri, 3 Feb 2023 18:51:25 +0700 Subject: [PATCH 01/13] Update networks.sh --- srv/http/bash/settings/networks.sh | 35 +++++++++++++++--------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/srv/http/bash/settings/networks.sh b/srv/http/bash/settings/networks.sh index f8877a8e0..7616d2e60 100644 --- a/srv/http/bash/settings/networks.sh +++ b/srv/http/bash/settings/networks.sh @@ -130,26 +130,25 @@ disconnect ) editlan ) ip=${args[1]} gw=${args[2]} - lan0="\ -[Match] -Name=$lan -[Network] -DNSSEC=no -" - if [[ ! $ip ]];then - lan0+="\ -DHCP=yes -" - else + if [[ $ip ]]; then 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 + + 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 pushRefresh ;; From 8d6e8d2c3e4de3a42fd3299eb1e86e2dd66d2abe Mon Sep 17 00:00:00 2001 From: rern Date: Fri, 3 Feb 2023 18:57:54 +0700 Subject: [PATCH 02/13] u --- srv/http/assets/js/networks.js | 2 +- srv/http/bash/settings/networks.sh | 50 +++++++++++++++--------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/srv/http/assets/js/networks.js b/srv/http/assets/js/networks.js index 7d985c6e1..c4431d738 100644 --- a/srv/http/assets/js/networks.js +++ b/srv/http/assets/js/networks.js @@ -304,7 +304,7 @@ 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 ) { info( { icon : 'lan' diff --git a/srv/http/bash/settings/networks.sh b/srv/http/bash/settings/networks.sh index 7616d2e60..452725c52 100644 --- a/srv/http/bash/settings/networks.sh +++ b/srv/http/bash/settings/networks.sh @@ -127,31 +127,6 @@ disconnect ) ifconfig $wlandev up $dirsettings/networks-data.sh pushwl ;; -editlan ) - 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 - pushRefresh - ;; hostapd ) echo $dirsettings/features.sh "$1" ;; @@ -178,6 +153,31 @@ iwlist ) echo '# iw list' 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 + pushRefresh + ;; profileconnect ) wlandev=$( < $dirshm/wlan ) if systemctl -q is-active hostapd; then From c9b408c26e91d44687c8cfd9af62c3f7453fab50 Mon Sep 17 00:00:00 2001 From: rern Date: Fri, 3 Feb 2023 21:03:47 +0700 Subject: [PATCH 03/13] u --- srv/http/assets/js/networks.js | 24 +++++++++++++++++------- srv/http/bash/settings/networks.sh | 9 +++++++-- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/srv/http/assets/js/networks.js b/srv/http/assets/js/networks.js index c4431d738..4ba1f7f94 100644 --- a/srv/http/assets/js/networks.js +++ b/srv/http/assets/js/networks.js @@ -292,10 +292,9 @@ 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() ) } ); @@ -303,20 +302,31 @@ function editLAN() { function editLANSet( values ) { var ip = values[ 0 ]; var gateway = values[ 1 ]; - notify( 'lan', 'IP Address', 'Set ...' ); bash( [ 'lanedit', ip, gateway ], avail => { if ( avail == -1 ) { + clearInterval( V.interval ); + clearTimeout( V.timeout ); + bannerHide(); info( { icon : 'lan' , title : 'Duplicate IP' , message : 'IP '+ ip +' already in use.' , ok : editLAN } ); - } else { - location.href = 'http://'+ ip +'/settings.php?p=networks'; } - bannerHide(); } ); + editReconnect( ip, 3 ); +} +function editReconnect( ip, delay ) { + notify( 'lan', 'IP Address', 'Change to '+ ip +' in '+ delay +'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' ); diff --git a/srv/http/bash/settings/networks.sh b/srv/http/bash/settings/networks.sh index 452725c52..95aec71de 100644 --- a/srv/http/bash/settings/networks.sh +++ b/srv/http/bash/settings/networks.sh @@ -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 ) @@ -176,7 +181,7 @@ Gateway='$gw $file sed -i '/^DNSSEC/ i\DHCP=yes' $file fi systemctl restart systemd-networkd - pushRefresh + avahi-daemon --kill # flush cache and restart ;; profileconnect ) wlandev=$( < $dirshm/wlan ) From 25d6717cb335c1b4e925f000c5122a58e6e9305e Mon Sep 17 00:00:00 2001 From: rern Date: Fri, 3 Feb 2023 21:09:42 +0700 Subject: [PATCH 04/13] Update networks.js --- srv/http/assets/js/networks.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/srv/http/assets/js/networks.js b/srv/http/assets/js/networks.js index 4ba1f7f94..3bac43656 100644 --- a/srv/http/assets/js/networks.js +++ b/srv/http/assets/js/networks.js @@ -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' @@ -292,7 +293,6 @@ function editLAN() { } , buttonlabel : ! static ? '' : ico( 'undo' ) +'DHCP' , button : ! static ? '' : () => { - loader(); bash( [ 'lanedit' ] ); editReconnect( S.hostname +'.local', 10 ); } @@ -318,6 +318,7 @@ function editLANSet( values ) { editReconnect( ip, 3 ); } function editReconnect( ip, delay ) { + loader(); notify( 'lan', 'IP Address', 'Change to '+ ip +' in '+ delay +'s ...' ); var i = delay; V.interval = setInterval( () => { From 4aefddc11beeaaeba9576d87e8c818e68f8cf425 Mon Sep 17 00:00:00 2001 From: rern Date: Sat, 4 Feb 2023 07:18:18 +0700 Subject: [PATCH 05/13] u --- srv/http/assets/css/main.css | 2 +- srv/http/assets/js/function.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/srv/http/assets/css/main.css b/srv/http/assets/css/main.css index 947f5deca..2188482e3 100644 --- a/srv/http/assets/css/main.css +++ b/srv/http/assets/css/main.css @@ -2084,7 +2084,7 @@ li.active .li2 bl { #page-playback { padding: 40px 0 !important; } #page-playback.barsalways { padding: 60px 0 60px !important } #page-playback { - transform-origin: 0 0; + transform-origin: top; transform: scale( var( --scale ) ); width: calc( 100% / var( --scale ) ); height: calc( 100% / var( --scale ) ); diff --git a/srv/http/assets/js/function.js b/srv/http/assets/js/function.js index a9c6f327b..5594120ca 100644 --- a/srv/http/assets/js/function.js +++ b/srv/http/assets/js/function.js @@ -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 = ''; @@ -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' ); From 9cfda209baa105522f074f9024cb3dc860f421ce Mon Sep 17 00:00:00 2001 From: rern Date: Sat, 4 Feb 2023 21:01:58 +0700 Subject: [PATCH 06/13] Update main.css --- srv/http/assets/css/main.css | 1 - 1 file changed, 1 deletion(-) diff --git a/srv/http/assets/css/main.css b/srv/http/assets/css/main.css index 2188482e3..c3bb4b65b 100644 --- a/srv/http/assets/css/main.css +++ b/srv/http/assets/css/main.css @@ -321,7 +321,6 @@ i.map.disabled, .map.disabled i { white-space: nowrap; } #divtitle { - height: 34px; height: 34px; line-height: 34px; font-size: 30px; From 3c98abca398f1592eab012f3dbea934e852a4ad0 Mon Sep 17 00:00:00 2001 From: rern Date: Sat, 4 Feb 2023 21:08:48 +0700 Subject: [PATCH 07/13] u --- srv/http/assets/css/common.css | 1 - srv/http/assets/css/main.css | 5 ----- 2 files changed, 6 deletions(-) diff --git a/srv/http/assets/css/common.css b/srv/http/assets/css/common.css index 8bcab1b72..e3e8b3e33 100644 --- a/srv/http/assets/css/common.css +++ b/srv/http/assets/css/common.css @@ -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; diff --git a/srv/http/assets/css/main.css b/srv/http/assets/css/main.css index c3bb4b65b..23a56df59 100644 --- a/srv/http/assets/css/main.css +++ b/srv/http/assets/css/main.css @@ -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; } @@ -2085,7 +2081,6 @@ li.active .li2 bl { #page-playback { transform-origin: top; transform: scale( var( --scale ) ); - width: calc( 100% / var( --scale ) ); height: calc( 100% / var( --scale ) ); } } From 9e27e6dae2e05b5d2d6b82b670d7a1fabfcf8a06 Mon Sep 17 00:00:00 2001 From: rern Date: Sat, 4 Feb 2023 21:24:45 +0700 Subject: [PATCH 08/13] Update main.css --- srv/http/assets/css/main.css | 1 - 1 file changed, 1 deletion(-) diff --git a/srv/http/assets/css/main.css b/srv/http/assets/css/main.css index 23a56df59..f2793db9b 100644 --- a/srv/http/assets/css/main.css +++ b/srv/http/assets/css/main.css @@ -2081,7 +2081,6 @@ li.active .li2 bl { #page-playback { transform-origin: top; transform: scale( var( --scale ) ); - height: calc( 100% / var( --scale ) ); } } @media ( max-height: 440px ) { From 5b7c64336728f0431ff046295614078d180aa17c Mon Sep 17 00:00:00 2001 From: rern Date: Sat, 4 Feb 2023 21:25:22 +0700 Subject: [PATCH 09/13] Revert "Update main.css" This reverts commit 9e27e6dae2e05b5d2d6b82b670d7a1fabfcf8a06. --- srv/http/assets/css/main.css | 1 + 1 file changed, 1 insertion(+) diff --git a/srv/http/assets/css/main.css b/srv/http/assets/css/main.css index f2793db9b..23a56df59 100644 --- a/srv/http/assets/css/main.css +++ b/srv/http/assets/css/main.css @@ -2081,6 +2081,7 @@ li.active .li2 bl { #page-playback { transform-origin: top; transform: scale( var( --scale ) ); + height: calc( 100% / var( --scale ) ); } } @media ( max-height: 440px ) { From fb7bc98ced491caf87dddfd27480ad69073236fe Mon Sep 17 00:00:00 2001 From: rern Date: Sat, 4 Feb 2023 21:29:00 +0700 Subject: [PATCH 10/13] Update main.css --- srv/http/assets/css/main.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/srv/http/assets/css/main.css b/srv/http/assets/css/main.css index 23a56df59..61312bce6 100644 --- a/srv/http/assets/css/main.css +++ b/srv/http/assets/css/main.css @@ -2079,8 +2079,9 @@ li.active .li2 bl { #page-playback { padding: 40px 0 !important; } #page-playback.barsalways { padding: 60px 0 60px !important } #page-playback { - transform-origin: top; + transform-origin: 0 0; transform: scale( var( --scale ) ); + width: calc( 100% / var( --scale ) ); height: calc( 100% / var( --scale ) ); } } From 2f7770f1a79b64cd428edb6c80af1b39562d506b Mon Sep 17 00:00:00 2001 From: rern Date: Sun, 5 Feb 2023 13:49:46 +0700 Subject: [PATCH 11/13] u --- srv/http/mpdlibrary.php | 7 +++---- srv/http/mpdplaylist.php | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/srv/http/mpdlibrary.php b/srv/http/mpdlibrary.php index 66dc526be..100f439b2 100644 --- a/srv/http/mpdlibrary.php +++ b/srv/http/mpdlibrary.php @@ -452,8 +452,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; } @@ -464,9 +464,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", '$1', $liname ) : $liname; $html .= ' diff --git a/srv/http/mpdplaylist.php b/srv/http/mpdplaylist.php index f1785de27..b9e85c416 100644 --- a/srv/http/mpdplaylist.php +++ b/srv/http/mpdplaylist.php @@ -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; From 3003ddf2c9dfdae264f49be0530ed4cc06fe0803 Mon Sep 17 00:00:00 2001 From: rern Date: Sun, 5 Feb 2023 13:51:46 +0700 Subject: [PATCH 12/13] Update mpdlibrary.php --- srv/http/mpdlibrary.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srv/http/mpdlibrary.php b/srv/http/mpdlibrary.php index 100f439b2..f7ef80a60 100644 --- a/srv/http/mpdlibrary.php +++ b/srv/http/mpdlibrary.php @@ -437,7 +437,7 @@ function htmlRadio( $subdirs, $files, $dir ) { $indexes[] = $index; $html .= '
  • '; } - $thumbsrc = rawurlencode( "/data/$gmode/$subdir/thumb.jpg" ); + $thumbsrc = '/data/'.$gmode.'/'.$subdir.'/thumb.jpg'; $html .= ' '.imgIcon( $thumbsrc, 'wrdir' ).' '.$path.$subdir.' From 46c23ab37acfb41882c7008fe2ff1981c83fe755 Mon Sep 17 00:00:00 2001 From: rern Date: Sun, 5 Feb 2023 13:53:47 +0700 Subject: [PATCH 13/13] Update mpdlibrary.php --- srv/http/mpdlibrary.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/srv/http/mpdlibrary.php b/srv/http/mpdlibrary.php index f7ef80a60..2f84390ed 100644 --- a/srv/http/mpdlibrary.php +++ b/srv/http/mpdlibrary.php @@ -437,9 +437,8 @@ function htmlRadio( $subdirs, $files, $dir ) { $indexes[] = $index; $html .= '
  • '; } - $thumbsrc = '/data/'.$gmode.'/'.$subdir.'/thumb.jpg'; $html .= ' - '.imgIcon( $thumbsrc, 'wrdir' ).' + '.imgIcon( '/data/'.$gmode.'/'.$subdir.'/thumb.jpg', 'wrdir' ).' '.$path.$subdir.' '.$subdir.'
  • ';