From 412605be5ba73bfd189cef230fc4a75030dc7f0d Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 4 Oct 2022 13:19:44 +0200 Subject: [PATCH] . --- app/Http/Controllers/FrontController.php | 14 ++++++++------ resources/css/app.sass | 11 +++++++++++ resources/views/song.blade.php | 2 +- webpack.mix.js | 4 +++- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/FrontController.php b/app/Http/Controllers/FrontController.php index 3ee070a..6fee32f 100644 --- a/app/Http/Controllers/FrontController.php +++ b/app/Http/Controllers/FrontController.php @@ -71,16 +71,18 @@ class FrontController extends Controller if ($partition) { $partition = $partition->getUrl(); } - $lyrics_html = ';)'; $lyrics_doc = $song->getFirstMediaInField('lyrics_doc'); if ($lyrics_doc) { - $path = $lyrics_doc->getPath(); - $html_path = $path . '.html'; - if (!file_exists($html_path)) { - `libreoffice --convert-to HTML:HTML --outdir $html_path $path`; + $path = new \SplFileInfo($lyrics_doc->getPath()); + $html_path = $path->getPath() . '/html'; + $htmlFile = $html_path . '/' . $path->getBasename('.' . $path->getExtension()) . '.HTML'; + if (!file_exists($htmlFile)) { + $cmd = "export HOME=/tmp;/usr/bin/libreoffice --convert-to HTML:HTML --outdir $html_path --headless $path"; + `$cmd`; } - $lyrics_html = file_get_contents($html_path); + $lyrics_html = file_get_contents($htmlFile); + //$lyrics_html = str_replace(' true, 'lyrics_html' => $lyrics_html, 'song' => $song, 'collection' => $collection, 'partition' => $partition, 'collection_songs' => $this->_getSongsOfCollection($collection->id, $lists), 'collection_lists' => $lists]); } diff --git a/resources/css/app.sass b/resources/css/app.sass index 282b939..31ae6fa 100644 --- a/resources/css/app.sass +++ b/resources/css/app.sass @@ -124,6 +124,15 @@ article.song section position: relative + &.fromdoc + padding: 20px 0 + p + font-family: $slab !important + color: #000 !important + @media (prefers-color-scheme: dark) + color: #fff !important + + &.lyrics .lyrics display: block @@ -441,6 +450,8 @@ header opacity: 0 z-index: 1 cursor: pointer + padding: 30px + font-size: 25px #audioplayers height: 70px diff --git a/resources/views/song.blade.php b/resources/views/song.blade.php index dff659c..eec7f34 100644 --- a/resources/views/song.blade.php +++ b/resources/views/song.blade.php @@ -9,7 +9,7 @@ @include('header',['title'=>$song->title,'subtitle'=>$song->artist])
@if($lyrics_html!=='') -
{{$lyrics_html}}
+
{!! $lyrics_html !!}
@endif @foreach($song->lyrics as $part) @php diff --git a/webpack.mix.js b/webpack.mix.js index 668d3f9..c242eb7 100644 --- a/webpack.mix.js +++ b/webpack.mix.js @@ -40,7 +40,9 @@ mix.js('resources/js/app.js', 'public/js') cacheName: 'home', matchOptions: {ignoreVary: true}, }, }, { - urlPattern: /^https:\/\/songbook.enhydra.fr\/(.*).html$/, handler: 'StaleWhileRevalidate', options: { + urlPattern: /^https:\/\/songbook.enhydra.fr\/(.*).html$/, + handler: /*'StaleWhileRevalidate'*/"NetworkFirst", + options: { cacheName: 'songs', matchOptions: {ignoreVary: true}, }, },], skipWaiting: true, -- 2.39.5