]> _ Git - psq.git/commitdiff
wip #7734 @2.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 12 Sep 2025 15:20:05 +0000 (17:20 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 12 Sep 2025 15:20:05 +0000 (17:20 +0200)
app/Console/Commands/Migration.php
app/Console/Commands/UpdateDemoFluidbook.php [new file with mode: 0644]
app/Http/Controllers/Admin/SettingController.php
app/Http/Controllers/FluidbookController.php
app/Providers/AppServiceProvider.php
resources/views/admin/settings/strings.blade.php
resources/views/layouts/app.blade.php

index 60900b621dfda9b4d47f122d78a42fe63fb7acde..7a19580f4ff44b1e4d76448400f8f2bd1eef2d15 100644 (file)
@@ -5,6 +5,7 @@ namespace App\Console\Commands;
 use Cubist\Util\CommandLine;
 use Cubist\Util\Files\Files;
 use Illuminate\Console\Command;
+use Illuminate\Support\Facades\Artisan;
 
 class Migration extends Command
 {
@@ -66,5 +67,7 @@ class Migration extends Command
         // Sync S3
         `rclone sync olds3:prescription-sante s3:presquot`;
         `rclone sync olds3:prescription-sante/flowpaper/ /application/storage/app/flowpaper/`;
+
+        Artisan::call('psq:fluidbook:archives');
     }
 }
diff --git a/app/Console/Commands/UpdateDemoFluidbook.php b/app/Console/Commands/UpdateDemoFluidbook.php
new file mode 100644 (file)
index 0000000..61e0ee6
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+
+namespace App\Console\Commands;
+
+use A17\Twill\Repositories\SettingRepository;
+use App\PdfFile;
+use Fluidbook\ToolboxApiClient\Client;
+use Illuminate\Console\Command;
+
+class UpdateDemoFluidbook extends Command
+{
+    protected $signature = 'psq:fluidbook:updatedemo';
+
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+
+    public function handle()
+    {
+        $client = new Client(config('fluidbook.api_token'));
+        foreach (PdfFile::where('created_at', '<', now()->subDays(30))->orderBy('created_at', 'desc')->get() as $pdf) {
+            $fluidbook = $client->getFluidbookByReference($pdf->slug);
+            if ($fluidbook->pages <= 3) {
+                continue;
+            }
+
+            /** @var SettingRepository $sr */
+            $sr = app(SettingRepository::class);
+            dd($sr->where('key', 'fluidbook_demo_ref')->with('translations')->first()->forceFill(['value'=> $pdf->slug])->save());
+            break;
+        }
+    }
+}
index eb6ac09dde5a67678346f6309eb6f7ff5fcb88bb..864955fa114163b654868dd929c1886ccf91078a 100644 (file)
@@ -11,10 +11,4 @@ class SettingController extends Base
         return $this->index('strings');
     }
 
-    public function podcasts()
-    {
-        return $this->index('podcasts');
-    }
-
-
 }
index 832de9bca830610c5a242b11715567f56de82a5e..99f259fc26e6d3c74a554098a262de76f6f0623a 100644 (file)
@@ -11,8 +11,6 @@ use Illuminate\View\View;
 
 class FluidbookController extends Controller
 {
-
-
     /**
      * @param PdfFile $file
      * @param Request $request
@@ -22,6 +20,7 @@ class FluidbookController extends Controller
      */
     public function view(PdfFile $file, string $path = '')
     {
+        $this->authorize('view', $file);
         // Add trailing slash if needed
         $request = request();
         if ($request->getPathInfo() === '/view/' . $file->slug) {
@@ -73,19 +72,4 @@ class FluidbookController extends Controller
         }
         return $file->view();
     }
-
-    /**
-     * @param PdfFile $file
-     * @param Request $request
-     * @return \Symfony\Component\HttpFoundation\StreamedResponse
-     */
-    public function download(PdfFile $file, Request $request)
-    {
-        if (!$request->hasValidSignature()) {
-            abort(401);
-        }
-        return $file->getFinalVersion()->downloadFile();
-    }
-
-
 }
index 4212657cf596461214c06d81a1f2e5f9e650444b..352342d1ac94af48c91ab2d6958d91784550231e 100644 (file)
@@ -33,25 +33,12 @@ class AppServiceProvider extends ServiceProvider
     public function register()
     {
 
-        $this->app->singleton(Mailgun::class, function ($app) {
-            return Mailgun::create(config('mail.mailgun.api_key'), 'https://api.eu.mailgun.net');
-        });
-
-        $this->app->singleton(Client::class, function ($app) {
-            return Client::prepare(
-                env('TIKA_HOST', 'localhost'),
-                env('TIKA_PORT', 9998)
-            );
-        });
-
         $this->app->bind(HtmlConverter::class, function ($app) {
             return new HtmlConverter(['header_style' => 'atx']);
         });
 
         Stripe::setApiKey(config('cashier.secret'));
         Paginator::useBootstrap();
-
-
     }
 
 
@@ -77,17 +64,6 @@ class AppServiceProvider extends ServiceProvider
         PdfFile::observe(PdfFileObserver::class);
         User::observe(UserObserver::class);
 
-        Blade::if('fuckIE', function () {
-            if (!array_key_exists('HTTP_USER_AGENT', $_SERVER)) {
-                return true;
-            }
-
-            $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
-
-            return preg_match('~MSIE|Internet Explorer~i', $HTTP_USER_AGENT) ||
-                preg_match('~Trident/7.0(.*)?; rv:11.0~', $HTTP_USER_AGENT);
-        });
-
         \View::share('theme', 'logo-blue');
 
     }
index b8b71e66bf6a69fe01832f0d4c4caf7901e7eada..d507beda064a4aebeb0c2e630232c70d5dcb29ee 100644 (file)
         'required' => true,
     ])
 
+    @formField('input',[
+        'label'=>'Fluidbook de démo',
+        'name'=>'fluidbook_demo_ref',
+        'maxlength'=>30,
+        'required'=>true,
+    ])
+
     <h2>Mentions légales</h2>
 
     @formField('wysiwyg', [
index 8a3eae369f2469d1964bbf6445e87007f7e9e2cf..cd3a32a690f187c9add3c7d8829ead46eaf7a5d4 100644 (file)
             </div>
         </header>
 
-        @fuckIE
-            <div class="container">
-
-                <div class="alert alert-danger" style="font-size: larger;">
-                    Attention ! Nous avons remarqué que vous utilisez un navigateur obsolète. Pour une expérience optimale,
-                    merci d'utiliser un navigateur récent tel que Chrome, Edge, Firefox ou Safari.
-                </div>
-            </div>
-
-        @endif
-
         <main class="{{ in_array(Route::currentRouteName(), ["login","register","account.index","password.request"]) ? 'bg-white-to-blue' : '' }} pill-box-theme-{{$theme ?? 'logo-blue'}}">
             @yield('content')
         </main>