]> _ Git - songbook.git/commitdiff
.
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 4 Oct 2022 11:19:44 +0000 (13:19 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 4 Oct 2022 11:19:44 +0000 (13:19 +0200)
app/Http/Controllers/FrontController.php
resources/css/app.sass
resources/views/song.blade.php
webpack.mix.js

index 3ee070a9688f38becd1a8273cc098dce04dc02d5..6fee32f47e32f5a3e4866b7fca326e2a705dafb9 100644 (file)
@@ -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('<style', '<style scoped', $lyrics_html);
         }
         return view('song', ['menu' => true, 'lyrics_html' => $lyrics_html, 'song' => $song, 'collection' => $collection, 'partition' => $partition, 'collection_songs' => $this->_getSongsOfCollection($collection->id, $lists), 'collection_lists' => $lists]);
     }
index 282b93900dc28d053d33569c52190ad211974f56..31ae6fa41da927b6ad7bdcbaeaece8512e0b9b23 100644 (file)
@@ -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
index dff659cfa3cb05390d7686a4fce03824bb365ae5..eec7f34e8f968a753649a38bf0433ebfd1e4f994 100644 (file)
@@ -9,7 +9,7 @@
     @include('header',['title'=>$song->title,'subtitle'=>$song->artist])
     <article class="song" data-tone="{{$song->key}}" data-mode="{{$song->mode}}">
         @if($lyrics_html!=='')
-            <section class="fromdoc">{{$lyrics_html}}</section>
+            <section class="fromdoc">{!! $lyrics_html !!}</section>
         @endif
         @foreach($song->lyrics as $part)
             @php
index 668d3f9fa55d87eee48f843d17cc22bda7a171e5..c242eb70ddf06a1f02bed2b5f6b3f91af5c59af2 100644 (file)
@@ -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,