Skip to content

Commit

Permalink
Merge pull request #1059 from rern/UPDATE
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
rern authored Oct 11, 2022
2 parents d92961b + c15a716 commit 199c5b6
Show file tree
Hide file tree
Showing 22 changed files with 312 additions and 306 deletions.
22 changes: 13 additions & 9 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

alias=r1

# 20221005
[[ -e /srv/http/data/system/hddspindown ]] && mv /srv/http/data/system/{hddspindown,apm}
. /srv/http/bash/addons.sh

# 20221007
grep -q hard,intr /etc/fstab && sed -i '/hard,intr/soft/' /etc/fstab

[[ -e $dirsystem/hddspindown ]] && mv $dirsystem/{hddspindown,apm}

if [[ ! -e /boot/kernel.img ]]; then
dir=/etc/systemd/system
Expand Down Expand Up @@ -43,11 +47,10 @@ fi
systemctl daemon-reload

# 20220916
dirmpd=/srv/http/data/mpd
if (( $( cat $dirmpd/counts | wc -l ) == 1 )); then
echo '{
"playlists" : '$( ls -1 /srv/http/data/playlists | wc -l )'
, "webradio" : '$( find -L /srv/http/data/webradio -type f ! -path '*/img/*' | wc -l )'
"playlists" : '$( ls -1 $dirplaylists | wc -l )'
, "webradio" : '$( find -L $dirwebradio -type f ! -path '*/img/*' | wc -l )'
}' > $dirmpd/counts
fi

Expand All @@ -58,15 +61,16 @@ fi
rm /srv/http/bash/{camilladsp*,features*,networks*,player*,relays*,system*} &> /dev/null

#-------------------------------------------------------------------------------
. /srv/http/bash/addons.sh

installstart "$1"

getinstallzip

chmod +x $dirbash/cmd.sh
$dirbash/cmd.sh dirpermissions
chmod +x $dirbash/settings/system.sh
$dirbash/settings/system.sh dirpermissions
[[ -e $dirsystem/color ]] && $dirbash/cmd.sh color

installfinish
#-------------------------------------------------------------------------------

# 20221010
[[ -e /srv/http/shareddata ]] && echo -e "$info Shared Data must be disabled and setup again."
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.2022100300.woff2' ) format( 'woff2' );
src: url( '/assets/fonts/rern.2022101100.woff2' ) format( 'woff2' );
font-display: block;
font-style: normal;
font-weight: normal;
Expand Down
Binary file modified srv/http/assets/fonts/rern.woff2
Binary file not shown.
8 changes: 4 additions & 4 deletions srv/http/assets/js/context.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
function addReplace( cmd, command, title, msg ) {
if ( cmd === 'addplay' || cmd === 'replaceplay' || cmd === 'replace' ) $( '#stop' ).click();
var play = cmd === 'addplay' || cmd === 'replaceplay';
if ( play || cmd === 'replace' ) $( '#stop' ).click();
bash( command, function() {
if ( !G.display.playbackswitch ) return

if ( cmd === 'addplay' || cmd === 'replaceplay' ) $( '#playback' ).click();
if ( G.display.playbackswitch && play ) $( '#playback' ).click();
} );
banner( title, msg, 'playlist' );
}
Expand Down Expand Up @@ -780,6 +779,7 @@ $( '.contextmenu a, .contextmenu .submenu' ).click( function() {
}
if ( !mpccmd ) mpccmd = [];
var sleep = G.mode.slice( -5 ) === 'radio' ? 1 : 0.2;
if ( G.status.state === 'play' && G.status.webradio ) sleep += 1;
var contextCommand = {
add : mpccmd
, playnext : mpccmd
Expand Down
1 change: 1 addition & 0 deletions srv/http/assets/js/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ $( '#nfsserver' ).click( function() {
, title : 'Server rAudio'
, message : $this.prev().html()
} );
$this.prop( 'checked', G.nfsserver );
return
}

Expand Down
8 changes: 3 additions & 5 deletions srv/http/assets/js/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -573,8 +573,8 @@ function getPlaybackStatus( withdisplay ) {
if ( G.playback ) {
displayPlayback();
} else if ( G.library ) {
if ( !$( '#lib-search-close' ).text() && !G.librarylist ) {
$.post( 'index-body.php', { modelist: 1 }, function( html ) {
if ( !G.librarylist ) {
$.post( 'mpdlibrary.php', { query: 'home' }, function( html ) {
$( '#lib-mode-list' ).html( html );
renderLibrary();
} );
Expand Down Expand Up @@ -1248,9 +1248,7 @@ function renderPlaylist( data ) {
setPlaylistScroll();
} else {
G.htmlplaylist = data.html;
var timestamp = Math.floor( Date.now() / 1000 );
var html = data.html.replaceAll( 'thumb.jpg', 'thumb.'+ timestamp +'.jpg' );
$( '#pl-list' ).html( html +'<p></p>' ).promise().done( function() {
$( '#pl-list' ).html( data.html +'<p></p>' ).promise().done( function() {
G.status.pllength = $( '#pl-list li' ).length;
setPlaylistScroll();
imageLoad( 'pl-list' );
Expand Down
64 changes: 29 additions & 35 deletions srv/http/assets/js/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,34 +163,34 @@ info( { // default
order : [ TYPE, ... ] // (sequence) (order of *** inputs)
values : [ 'VALUE', ... ] // (none) (default values - in layout order)
checkchanged : 1 // (none) (check values changed)
checkblank : 1 or [ i, ... ] // (none) (check values not blank / [ partial ] )
checklength : { i: N, . } // (none) (required N characters in i)
checklength : { i: [ N, 'COND' ], ... } // (none) (required N: characters; COND: min, max; in i)
beforeshow : FUNCTION // (none) (function after values set)
noreload : 1 // (none) (do not reset content - for update value)
filelabel : 'LABEL' // *** (browse button label)
fileoklabel : 'LABEL' // 'OK' (upload button label)
filetype : '.EXT, ...' // (none) (filter and verify filetype (with 'dot' - 'image/*' for all image types)
buttonlabel : [ 'LABEL', ... ] // *** (label array)
buttonlabel : [ 'LABEL', ... ] // *** (extra buttons - label array)
button : [ FUNCTION, ... ] // (none) (function array)
buttoncolor : [ 'COLOR', ... ] // 'var( --cm )' (color array)
buttonfit : 1 // (none) (fit buttons width to label)
buttonnoreset : 1 // (none) (do not hide/reset content on button clicked)
okno : 1 // (show) (no ok button)
oklabel : 'LABEL' // ('OK') (ok button label)
okcolor : 'COLOR' // var( --cm ) (ok button color)
ok : FUNCTION // (reset) (ok click function)
buttonnoreset : 1 // (none) (do not hide/reset content on button clicked) - player.js
cancellabel : 'LABEL' // *** (cancel button label)
cancelcolor : 'COLOR' // var( --cg ) (cancel button color)
cancelshow : 1 // (hide) (show cancel button)
cancel : FUNCTION // (reset) (cancel click function)
values : [ 'VALUE', ... ] // (none) (default values - in layout order)
checkchanged : 1 // (none) (check values changed)
checkblank : 1 or [ i, ... ] // (none) (check values not blank / [ partial ] )
checklength : { i: N, . } // (none) (required N characters in i)
checklength : { i: [ N, 'COND' ], ... } // (none) (required N: characters; COND: min, max; in i)
beforeshow : FUNCTION // (none) (function after values set)
noreload : 1 // (none) (do not reset content - for update value)
okno : 1 // (show) (no ok button)
oklabel : 'LABEL' // ('OK') (ok button label)
okcolor : 'COLOR' // var( --cm ) (ok button color)
ok : FUNCTION // (reset) (ok click function)
} );
Get values: infoVal()
Expand All @@ -201,12 +201,13 @@ Note:
- Single value/function - no need to be array
` );
}
function infoReset() {
function infoReset( fn ) {
if ( O.infoscroll ) $( 'html, body' ).scrollTop( O.infoscroll );
$( '#infoOverlay' )
.addClass( 'hide' )
.empty();
O = {}
if ( !O.buttonnoreset ) $( '#infoOverlay' ).addClass( 'hide' );
setTimeout( function() {
if ( typeof fn === 'function' ) fn();
$( '#infoOverlay' ).empty();
}, 0 );
}

O = {}
Expand All @@ -222,15 +223,14 @@ function info( json ) {
</div>
` );
O.infoscroll = $( window ).scrollTop();
// simple use as info( 'message' )
setTimeout( function() { // allow consecutive infos
//////////////////////////////////////////////////////////////////////////

/* $( '#infoOverlay' ).on( 'mousedown touchstart', function( e ) {
if ( e.target.id === 'infoOverlay' ) $( '#infoX' ).click();
} );*/

$( '#infoX' ).click( function() {
if ( O.cancel ) O.cancel();
infoReset();
delete O.buttonnoreset;
infoReset( O.cancel );
} );
if ( typeof O !== 'object' ) {
$( '#infoIcon' ).addClass( 'fa fa-info-circle' );
Expand Down Expand Up @@ -286,18 +286,14 @@ function info( json ) {
if ( O.button ) {
if ( typeof O.button !== 'object' ) O.button = [ O.button ];
$( '#infoButtons' ).on( 'click', '.extrabtn', function() {
var fn = O.button[ $( this ).index( '.extrabtn' ) ];
if ( fn ) fn();
if ( !O.buttonnoreset ) infoReset();
infoReset( O.button[ $( this ).index( '.extrabtn' ) ] );
} );
}
$( '#infoCancel' ).one( 'click', function() {
if ( typeof O.cancel === 'function' ) O.cancel();
infoReset();
infoReset( O.cancel );
} );
$( '#infoOk' ).one( 'click', function() {
if ( typeof O.ok === 'function' ) O.ok();
if ( !O.buttonnoreset ) infoReset();
infoReset( O.ok );
} );
if ( O.fileoklabel ) {
var htmlfile = '<div id="infoFile">'
Expand Down Expand Up @@ -568,8 +564,6 @@ function info( json ) {
O.nochange = O.values && O.checkchanged ? true : false;
$( '#infoOk' ).toggleClass( 'disabled', O.blank || O.short || O.nochange ); // initial check
infoCheckSet();
//////////////////////////////////////////////////////////////////////////
}, 0 );
}

function checkBlank() {
Expand Down
34 changes: 17 additions & 17 deletions srv/http/assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ var G = {
, apikeylastfm : 'd666cd06ec4fcf84c3b86279831a1c8e'
, sharedsecret : '390372d3a1f60d4030e2a612260060e0'
, bioartist : []
, bookmarkedit : 0
, coverart : '/assets/img/coverart.svg'
, coversave : 0
, covervu : '/assets/img/vu.svg'
Expand Down Expand Up @@ -438,15 +437,18 @@ $( '#addons' ).click( function () {
loader();
} );
$( '#library, #button-library' ).click( function() {
$( '#lib-path span' ).removeClass( 'hide' );
if ( !$( '#lib-search-input' ).val() ) $( '#lib-search-close' ).empty();
if ( G.library ) {
if ( G.librarylist ) G.scrolltop[ $( '#lib-path .lipath' ).text() ] = $( window ).scrollTop();
renderLibrary();
} else {
switchPage( 'library' );
if ( G.status.updating_db ) banner( 'Library Database', 'Update ...', 'refresh-library blink' );
}
$.post( 'mpdlibrary.php', { query: 'home' }, function( html ) {
$( '#lib-mode-list' ).html( html );
$( '#lib-path span' ).removeClass( 'hide' );
if ( !$( '#lib-search-input' ).val() ) $( '#lib-search-close' ).empty();
if ( G.library ) {
if ( G.librarylist ) G.scrolltop[ $( '#lib-path .lipath' ).text() ] = $( window ).scrollTop();
renderLibrary();
} else {
switchPage( 'library' );
if ( G.status.updating_db ) banner( 'Library Database', 'Update ...', 'refresh-library blink' );
}
} );
} );
$( '#playback' ).click( function() {
if ( G.playback && ( G.wH - $( '#coverart' )[ 0 ].getBoundingClientRect().bottom ) < 30 ) {
Expand Down Expand Up @@ -1314,7 +1316,9 @@ $( '#button-lib-back' ).click( function() {
}
}
} );
$( '.mode' ).click( function() {
$( '#lib-mode-list' ).click( function( e ) {
if ( !G.press && $( '.bkedit' ).length && !$( e.target ).hasClass( 'bkedit' ) ) setBookmarkEdit();
} ).on( 'click', '.mode', function() {
var $this = $( this );
G.mode = $this.data( 'mode' );
$( '#lib-search-close' ).click();
Expand Down Expand Up @@ -1386,11 +1390,7 @@ $( '.mode' ).click( function() {
query.path = G.mode.slice( -5 ) === 'radio' ? '' : path;
query.modetitle = path;
if ( query.query !== 'ls' ) G.query.push( query );
} );
$( '#lib-mode-list' ).click( function( e ) {
if ( !G.press && $( '.bkedit' ).length && !$( e.target ).hasClass( 'bkedit' ) ) setBookmarkEdit();
} );
$( '#lib-mode-list' ).on( 'click', '.mode-bookmark', function( e ) { // delegate - id changed on renamed
} ).on( 'click', '.mode-bookmark', function( e ) { // delegate - id changed on renamed
$( '#lib-search-close' ).click();
if ( G.press || $( '.bkedit' ).length ) return

Expand Down Expand Up @@ -1503,7 +1503,7 @@ $( '#lib-mode-list' ).on( 'click', '.mode-bookmark', function( e ) { // delegate
}
} );
} )
$( '.mode-bookmark' ).press( setBookmarkEdit );
$( '#lib-mode-list' ).press( '.mode-bookmark', setBookmarkEdit );
new Sortable( document.getElementById( 'lib-mode-list' ), {
// onChoose > onClone > onStart > onMove > onChange > onUnchoose > onUpdate > onSort > onEnd
ghostClass : 'lib-sortable-ghost'
Expand Down
48 changes: 23 additions & 25 deletions srv/http/assets/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ function bash( command, callback, json ) {
if ( typeof command === 'string' ) {
var args = { cmd: 'bash', bash : command }
} else {
if ( command[ 0 ] === 'cmd' ) {
var cmd0 = command[ 0 ];
if ( cmd0 === 'cmd' ) {
var filesh = 'cmd';
command.shift();
} else if ( cmd0 === 'pkgstatus' || cmd0 === 'rebootlist' ) {
var filesh = 'settings/system';
} else {
var filesh = 'settings/'+ page;
}
Expand Down Expand Up @@ -67,7 +70,7 @@ function currentStatus( id, refresh ) {
notify( 'Get Data', id, page );
}, 1000 );
}
var command = services.includes( id ) ? [ 'cmd', 'pkgstatus', id ] : cmd[ id ]+' 2> /dev/null';
var command = services.includes( id ) ? [ 'pkgstatus', id ] : cmd[ id ]+' 2> /dev/null';
bash( command, function( status ) {
clearTimeout( timeoutGet );
$el.html( status ).promise().done( function() {
Expand Down Expand Up @@ -413,32 +416,27 @@ $( '.container' ).on( 'click', '.status', function( e ) {
if ( !$this.hasClass( 'single' ) ) currentStatus( $this.data( 'status' ) );
} );
$( '.close' ).click( function() {
if ( page === 'networks' ) {
clearTimeout( G.timeoutScan );
bash( 'killall networks-scan.sh &> /dev/null' );
}
bash( [ 'cmd', 'rebootlist' ], function( list ) {
bash( [ 'rebootlist' ], function( list ) {
if ( !list ) {
location.href = '/';
} else {
var list = list.replace( /\^/s, '\n' );
info( {
icon : page
, title : 'System Setting'
, message : `\
Reboot required for:
<wh>${ list }</wh>`
, cancel : function() {
bash( 'rm -f /srv/http/data/shm/reboot /srv/http/data/tmp/backup.*' );
location.href = '/';
}
, okcolor : orange
, oklabel : '<i class="fa fa-reboot"></i>Reboot'
, ok : function() {
bash( [ 'cmd', 'power', 'reboot' ] );
}
} );
return
}

info( {
icon : page
, title : 'System Setting'
, message : 'Reboot required for:<br><br>'
+'<pre><wh>'+ list +'</wh></pre>'
, cancel : function() {
bash( 'rm -f /srv/http/data/shm/reboot /srv/http/data/tmp/backup.*' );
location.href = '/';
}
, okcolor : orange
, oklabel : '<i class="fa fa-reboot"></i>Reboot'
, ok : function() {
bash( [ 'cmd', 'power', 'reboot' ] );
}
} );
} );
} );
$( '#button-data' ).click( function() {
Expand Down
Loading

0 comments on commit 199c5b6

Please sign in to comment.