Skip to content

Commit

Permalink
Merge pull request #1595 from rern/UPDATE
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
rern authored Feb 12, 2024
2 parents d826bc7 + 5788ea7 commit c42caea
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 45 deletions.
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ alias=r1

. /srv/http/bash/settings/addons.sh

# 20240210
# 20240212
[[ ! -e /usr/bin/mmc ]] && pacman -Sy --noconfirm mmc-utils

# 20240121
Expand Down
4 changes: 1 addition & 3 deletions srv/http/assets/js/camilla.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,6 @@ function renderPage() { // common from settings.js
wscamilla && wscamilla.readyState === 1 ? common.wsGetConfig() : common.webSocket();
}
function psOnClose() {
if ( V.off ) return

clearInterval( V.intervalvu );
if ( wscamilla ) wscamilla.close();
}
function psVolume( data ) {
Expand Down Expand Up @@ -1795,6 +1792,7 @@ var common = {
websocketReady( wscamilla );
}
wscamilla.onclose = () => {
wscamilla = null;
render.vuClear();
clearInterval( V.intervalstatus );
}
Expand Down
20 changes: 13 additions & 7 deletions srv/http/assets/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -1129,14 +1129,18 @@ function selectText2Html( pattern ) {

// page visibility -----------------------------------------------------------------
function pageActive() {
if ( V.local || V.off ) return // V.local from select2
if ( V.pageactive || V.local || V.off ) return // V.local from select2

V.pageactive = true;
V.pageinactive = false;
websocketConnect();
page ? setTimeout( refreshData, 300 ) : refreshData();
}
function pageInactive() {
if ( V.local || V.debug ) return // V.local from select2
if ( V.pageinactive || V.local || V.debug ) return // V.local from select2

V.pageactive = false;
V.pageinactive = true;
if ( typeof psOnClose === 'function' ) psOnClose();
// ws.send( 'clientremove' ); // 'clientremove' = missing 1st message on pageActive
}
Expand All @@ -1147,7 +1151,8 @@ window.onpagehide = pageInactive;
window.onpageshow = pageActive;

// websocket
var ws, wsvolume;
var ws = null;
var wsvolume = null;
function volumeMuteToggle() {
S.volumemute ? volumePush( S.volumemute, 'unmute' ) : volumePush( S.volume, 'mute' );
volumeSet( S.volumemute, 'toggle' );
Expand Down Expand Up @@ -1195,7 +1200,7 @@ function websocketConnect() {
}
}
function websocketOk( socket ) {
return socket !== null && typeof socket === 'object' && socket.readyState === 1
return socket && socket.readyState === 1
}
function websocketReady( socket ) {
var interval = setTimeout( () => {
Expand All @@ -1205,8 +1210,9 @@ function websocketReady( socket ) {
}
}, 100 );
}
function websocketReconnect() {
fetch( '/data/shm/startup' )
function websocketReconnect( ip ) {
var url = ip ? 'http://'+ ip : '';
fetch( url +'/data/shm/startup' )
.then( response => {
response.ok ? websocketConnect() : setTimeout( websocketReconnect, 1000 );
} );
Expand Down Expand Up @@ -1241,7 +1247,7 @@ function psPower( data ) {
V[ data.type ] = true;
banner( data.type +' blink', 'Power', V.off ? 'Off ...' : 'Reboot ...', -1 );
ws.close();
if ( typeof wsvolume === 'object' ) wsvolume.close();
if ( wsvolume ) wsvolume.close();
if ( V.off ) {
$( '#loader' ).css( 'background', '#000000' );
setTimeout( () => {
Expand Down
4 changes: 1 addition & 3 deletions srv/http/assets/js/networks.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,7 @@ function psOnClose() {
function reconnect( ssid, ip ) {
loader();
notify( 'wifi', ssid, 'Connect ...' );
setTimeout( () => {
location.href = 'http://'+ ip +'/settings.php?p=networks';
}, 5000 );
websocketReconnect( ip );
}
function renderBluetooth() {
if ( ! $( '#divbluetooth' ).hasClass( 'hide' ) ) $( '#divbluetooth .back' ).trigger( 'click' );
Expand Down
2 changes: 1 addition & 1 deletion srv/http/assets/js/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ $( '#menu a' ).on( 'click', function() {
case 'info':
var $code = $( '#codehddinfo' );
if ( $code.hasClass( 'hide' ) ) {
bash( [ 'deviceinfo', source, 'CMD DEV' ], data => {
bash( [ 'storageinfo', source, 'CMD DEV' ], data => {
$code
.html( data )
.removeClass( 'hide' );
Expand Down
2 changes: 1 addition & 1 deletion srv/http/bash/cmd-list.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ ${tags[0]}^^$albumartist^^${tags[2]}^^$dir"
done
fi
fi
albumignore=$( getContent $dirmpd/albumignore ' ' )
albumignore=$( getContent $dirmpd/albumignore )
readarray -t lines <<< $albumlist
for line in "${lines[@]}"; do
readarray -t tags <<< $( echo -e "${line//^^/\\n}" )
Expand Down
4 changes: 2 additions & 2 deletions srv/http/bash/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ exists() {
getContent() {
if [[ -e "$1" ]]; then
cat "$1"
else
[[ $2 ]] && echo $2 || echo false
elif [[ $2 ]]; then
echo $2
fi
}
getVar(){
Expand Down
2 changes: 1 addition & 1 deletion srv/http/bash/settings/features.sh
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ spotifyoutput )
if [[ ${current:0:3} == hw: ]]; then
current=Default
else
current=$( getContent $dirsystem/spotifyoutput ' ' )
current=$( getContent $dirsystem/spotifyoutput )
fi
echo '{
"current" : "'$current'"
Expand Down
2 changes: 1 addition & 1 deletion srv/http/bash/settings/networks-scan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if [[ $1 == wlan ]]; then

# ESSID:"NAME"
# Encryption key:on
# Quality=37/70 Signal level=-73 dBm --- Quality=0/100 Signal level=25/100
# Quality=37/70 Signal level=-73 dBm || Quality=0/100 Signal level=25/100
# IE: IEEE 802.11i/WPA2 Version 1
# IE: WPA Version 1
scan=$( iwlist $wlandev scan )
Expand Down
6 changes: 3 additions & 3 deletions srv/http/bash/settings/networks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
args2var "$1"

netctlSwitch() {
local active connected ssid wlandev
local active current ssid wlandev
ssid=$1
wlandev=$( < $dirshm/wlan )
connected=$( iwgetid -r )
current=$( iwgetid -r )
ip link set $wlandev down
netctl switch-to "$ssid"
for i in {1..10}; do
Expand All @@ -21,7 +21,7 @@ netctlSwitch() {
done

echo -1
[[ $connected ]] && netctl switch-to "$connected"
[[ $current ]] && netctl switch-to "$current"
}
wlanDevice() {
local iplinkw wlandev
Expand Down
2 changes: 1 addition & 1 deletion srv/http/bash/settings/player-asound.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ defaults.ctl.card $asoundcard
else
[[ -e $dirsystem/camilladsp ]] && $dirsettings/features.sh camilladsp
fi
bluetooth=$( getContent $dirshm/btreceiver ' ' )
bluetooth=$( getContent $dirshm/btreceiver )
if [[ -e $dirsystem/camilladsp ]]; then
camilladsp=1
modprobe snd_aloop
Expand Down
42 changes: 21 additions & 21 deletions srv/http/bash/settings/system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,27 +140,6 @@ bluetoothstart )
bluetoothctl discoverable-timeout 0 &> /dev/null
bluetoothctl pairable yes &> /dev/null
;;
deviceinfo )
if [[ ${DEV:5:3} == mmc ]]; then
dev=/sys/block/${DEV:5:-2}/device
cmd="<bll># mmc cid read $dev</bll>"
echo "\
$cmd
$( mmc cid read $dev )
${cmd/cid/csd}
$( mmc csd read $dev )
${cmd/cid/src}
$( mmc scr read $dev )
"
else
echo -n "\
<bll># hdparm -I $DEV</bll>
$( hdparm -I $DEV | sed '1,3 d' )
"
fi
;;
hddsleep )
if [[ $ON ]]; then
devs=$( mount | grep .*USB/ | cut -d' ' -f1 )
Expand Down Expand Up @@ -547,6 +526,27 @@ statuswlan )
echo '<bll># iw list</bll>'
iw list
;;
storageinfo )
if [[ ${DEV:0:8} == /dev/mmc ]]; then
dev=/sys/block/${DEV:5:-2}/device
cmd="<bll># mmc cid read $dev</bll>"
echo "\
$cmd
$( mmc cid read $dev )
${cmd/cid/csd}
$( mmc csd read $dev )
${cmd/cid/src}
$( mmc scr read $dev )
"
else
echo -n "\
<bll># hdparm -I $DEV</bll>
$( hdparm -I $DEV | sed '1,3 d' )
"
fi
;;
tft )
config=$( grep -Ev 'hdmi_force_hotplug|:rotate=' /boot/config.txt )
sed -i 's/ fbcon=map:10 fbcon=font:ProFont6x11//' /boot/cmdline.txt
Expand Down

0 comments on commit c42caea

Please sign in to comment.