Skip to content

Commit

Permalink
Merge pull request #1154 from rern/UPDATE
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
rern authored Dec 21, 2022
2 parents c763b34 + ab3a2fb commit 2a07245
Show file tree
Hide file tree
Showing 40 changed files with 1,755 additions and 1,778 deletions.
7 changes: 6 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ dirshm=$dirdata/shm
dirsystem=$dirdata/system
dirwebradio=/srv/http/data/webradio

# 20221218
[[ -L $dirdata/playlists ]] && chown -h mpd:audio $dirdata/playlists

# 20221208
if [[ -e /srv/http/assets/css/desktop.css ]]; then
rm -f /srv/http/main.php
Expand All @@ -22,7 +25,7 @@ if [[ -e /srv/http/assets/css/desktop.css ]]; then
rm -f /srv/http/assets/js/plugin/{jquery.selectric,simple-}*
fi

readarray -t bookmarks <<< $( ls -1 /srv/http/data/bookmarks/* )
readarray -t bookmarks <<< $( ls -1 /srv/http/data/bookmarks/* 2> /dev/null )
if [[ $bookmarks ]]; then
for file in "${bookmarks[@]}"; do
if [[ $( sed -n 2p "$file" ) ]]; then
Expand Down Expand Up @@ -102,6 +105,8 @@ fi
#-------------------------------------------------------------------------------
installstart "$1"

rm -rf /srv/http/assets/{css,js}

getinstallzip

chmod +x $dirsettings/system.sh
Expand Down
2 changes: 1 addition & 1 deletion srv/http/assets/css/common.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@font-face {
font-family : rern;
src : url( '/assets/fonts/rern.woff2?v.2022121800' ) format( 'woff2' );
src : url( '/assets/fonts/rern.woff2?v.2022121600' ) format( 'woff2' );
font-display : block;
font-style : normal;
font-weight : normal;
Expand Down
20 changes: 13 additions & 7 deletions srv/http/assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -1047,11 +1047,18 @@ i.map.disabled, .map.disabled i {
#biocontent .close-root,
#biocontent .bioback {
float: right;
margin-top: 0;
width: 40px;
line-height: 40px;
margin-top: 5px;
margin-right: -8px;
font-size: 24px;
text-align: center;
color: var( --cm ) !important;
z-index: 5;
}
#biocontent .bioback {
margin-top: -10px;
}
#biocontent .genre {
text-transform: capitalize;
}
Expand Down Expand Up @@ -1315,6 +1322,7 @@ i.map.disabled, .map.disabled i {
}
.coveredit {
position: absolute;
right: 0;
bottom: 0;
width: 34px;
height: 34px;
Expand All @@ -1324,20 +1332,17 @@ i.map.disabled, .map.disabled i {
left: 0;
}
.coveredit.cover-save i {
width: 30px;
width: 30px !important;
height: 30px;
margin-left: 2px;
font-size: 24px;
line-height: 30px;
line-height: 30px !important;
text-align: center;
color: #000000;
color: var( --cgd ) !important;
background: var( --cw );
border-radius: 50%;
box-shadow: -1px 1px 2px #000000;
}
.coveredit.cover {
right: 0;
}
#bannerIcon .iconcover {
margin: 3px;
}
Expand All @@ -1346,6 +1351,7 @@ i.map.disabled, .map.disabled i {
width: 28px !important;
}
.infoimgname {
line-height: 25px;
clear: both;
margin: 0;
}
Expand Down
7 changes: 5 additions & 2 deletions srv/http/assets/css/settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ heading i.fa-status {
heading.status i.fa-status {
display: inline-block;
}
heading i.fa-help {
heading i.help {
float: right;
width: 40px;
font-size: 22px;
Expand Down Expand Up @@ -507,7 +507,7 @@ input.disabled + .switchlabel:after {
text-align: center;
}
.col-r {
width: calc( 100% - 170px );
width: calc( 100% - 165px );
padding-right: 0;
padding-left: 0 !important;
font-weight: normal;
Expand Down Expand Up @@ -560,6 +560,9 @@ input.disabled + .switchlabel:after {
.head {
padding-right: 0 !important;
}
heading i.help {
margin-right: -10px;
}
wide {
display: none;
}
Expand Down
Binary file modified srv/http/assets/fonts/rern.woff2
Binary file not shown.
75 changes: 27 additions & 48 deletions srv/http/assets/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ info(), infoPower(), infoPowerCommand(), infoPowerNfs(),
loader(), local(), $.fn.press(), pushstream, selectSet()
*/

G = {}
var page = location.search.replace( '?p=', '' );
var iconwarning = '<i class="fa fa-warning fa-lg yl"></i>&ensp;';

// ----------------------------------------------------------------------
function banner( icon, title, message, delay ) {
clearTimeout( G.timeoutbanner );
clearTimeout( I.timeoutbanner );
var iconhtml = icon && icon.slice( 0, 1 ) === '<'
? icon
: icon ? '<i class="fa fa-'+ ( icon ) +'"></i>' : '';
Expand All @@ -19,19 +18,11 @@ function banner( icon, title, message, delay ) {
<div id="bannerTitle">${ title }</div>
<div id="bannerMessage">${ message }</div>
` ).removeClass( 'hide' );
if ( delay !== -1 ) G.timeoutbanner = setTimeout( bannerHide, delay || 3000 );
if ( delay !== -1 ) I.timeoutbanner = setTimeout( bannerHide, delay || 3000 );
}
function bannerHide() {
if ( $( '#banner' ).hasClass( 'hide' ) ) return
if ( G.bannerhold ) {
setTimeout( () => {
G.bannerhold = 0;
bannerHide();
}, G.bannerhold );
return
}

clearTimeout( G.timeoutbanner );
$( '#banner' )
.addClass( 'hide' )
.empty();
Expand Down Expand Up @@ -611,8 +602,8 @@ function infoCheckSet() {
}
function infoFileImage() {
delete I.infofilegif;
G.timeoutfile = setTimeout( () => banner( 'refresh blink', 'Change Image', 'Load ...', -1 ), 1000 );
G.rotate = 0;
I.timeoutfile = setTimeout( () => banner( 'refresh blink', 'Change Image', 'Load ...', -1 ), 1000 );
I.rotate = 0;
$( '.infoimgname' ).addClass( 'hide' );
$( '.infoimgnew, .infoimgwh' ).remove();
if ( I.infofile.name.slice( -3 ) !== 'gif' ) {
Expand All @@ -633,7 +624,7 @@ function infoFileImage() {
var imgH = img.height;
var resize = infoFileImageResize( 'gif', imgW, imgH );
infoFileImageRender( img.src, imgW +' x '+ imgH, resize ? resize.wxh : '' );
clearTimeout( G.timeoutfile );
clearTimeout( I.timeoutfile );
bannerHide();
}
} else {
Expand All @@ -643,7 +634,7 @@ function infoFileImage() {
}
}
function infoFileImageReader() {
var maxsize = ( G.library && ! G.librarylist ) ? 200 : 1000;
var maxsize = ( V.library && ! V.librarylist ) ? 200 : 1000;
var reader = new FileReader();
reader.onload = function( e ) {
var img = new Image();
Expand All @@ -667,7 +658,7 @@ function infoFileImageReader() {
} else {
infoFileImageRender( filecanvas.toDataURL( 'image/jpeg' ), imgW +' x '+ imgH );
}
clearTimeout( G.timeoutfile );
clearTimeout( I.timeoutfile );
bannerHide();
}
}
Expand All @@ -677,8 +668,8 @@ function infoFileImageReader() {
.on( 'click', '.infoimgnew', function() {
if ( ! $( '.infomessage .rotate' ).length ) return

G.rotate += 90;
if ( G.rotate === 360 ) G.rotate = 0;
I.rotate += 90;
if ( I.rotate === 360 ) I.rotate = 0;
var canvas = document.createElement( 'canvas' );
var ctx = canvas.getContext( '2d' );
var image = $( this )[ 0 ];
Expand Down Expand Up @@ -713,7 +704,7 @@ function infoFileImageRender( src, original, resize ) {
);
}
function infoFileImageResize( ext, imgW, imgH ) {
var maxsize = ( G.library && ! G.librarylist ) ? 200 : ( ext === 'gif' ? 600 : 1000 );
var maxsize = ( V.library && ! V.librarylist ) ? 200 : ( ext === 'gif' ? 600 : 1000 );
if ( imgW > maxsize || imgH > maxsize ) {
var w = imgW > imgH ? maxsize : Math.round( imgW / imgH * maxsize );
var h = imgW > imgH ? Math.round( imgH / imgW * maxsize ) : maxsize;
Expand Down Expand Up @@ -877,8 +868,8 @@ function loaderHide() {

// ----------------------------------------------------------------------
function local( delay ) {
G.local = 1;
setTimeout( () => G.local = 0, delay || 300 );
V.local = 1;
setTimeout( () => V.local = 0, delay || 300 );
}

// ----------------------------------------------------------------------
Expand All @@ -905,12 +896,12 @@ $.fn.press = function( arg1, arg2 ) {
}
this.on( 'touchstart mousedown', delegate, function( e ) {
timeout = setTimeout( () => {
G.press = 1;
V.press = 1;
callback( e );
}, 1000 );
} ).on( 'touchend mouseup mouseleave', delegate, function( e ) {
clearTimeout( timeout );
setTimeout( () => G.press = 0, 300 ); // needed for mouse events
setTimeout( () => V.press = 0, 300 ); // needed for mouse events
} );
return this // allow chain
}
Expand All @@ -927,36 +918,25 @@ if ( ! [ 'addons', 'addons-progress', 'guide' ].includes( page ) ) {
}
function pushstreamPower( message ) {
var type = message.split( ' ' )[ 0 ].toLowerCase();
G[ type ] = 1;
var ready = type === 'ready';
if ( G.display.logout ) {
if ( ready ) location.reload();

$( 'body > div, pre' ).not( '#banner, #loader' ).remove();
loader();
} else {
if ( ready ) {
if ( page === 'system' ) getStatus();
loaderHide();
} else {
loader();
}
}
V[ type ] = 1;
loader();
}
pushstream.onstatuschange = status => { // 0 - disconnected; 1 - reconnect; 2 - connected
if ( status === 2 ) { // connected
if ( G.reboot ) {
delete G.reboot;
banner( 'raudio', 'rAudio', 'Ready', 6000 );
if ( V.reboot ) {
if ( S.login ) {
location.href = '/';
return
}

delete V.reboot;
loaderHide();
page === 'system' ? refreshData() : bash( [ 'autoplaystatus' ] );
} else {
refreshData();
bannerHide();
}
refreshData();
bannerHide();
} else if ( status === 0 ) { // disconnected
pushstreamDisconnect();
if ( G.off ) {
if ( V.off ) {
pushstream.disconnect();
$( '#loader' ).css( 'background', '#000000' );
setTimeout( () => {
Expand All @@ -971,7 +951,7 @@ if ( ! [ 'addons', 'addons-progress', 'guide' ].includes( page ) ) {
var active = 1; // fix: multiple firings
var select2 = 0; // fix: closing > blur > disconnect
function connect() {
if ( active || G.off ) return
if ( active || V.off ) return

active = 1;
pushstream.connect();
Expand All @@ -981,7 +961,6 @@ if ( ! [ 'addons', 'addons-progress', 'guide' ].includes( page ) ) {

active = 0;
pushstream.disconnect();
console.log('disconnect')
}
document.onvisibilitychange = () => document.hidden ? disconnect() : connect();
window.onpagehide = disconnect;
Expand Down
Loading

0 comments on commit 2a07245

Please sign in to comment.