Ver Fonte

Added ability to request links and import them into DB

procodergw há 2 anos atrás
pai
commit
36b9405603

+ 152 - 2
app/Http/Controllers/Orion/LinksController.php

@@ -4,9 +4,12 @@ namespace App\Http\Controllers\Orion;
 
 use App\Http\Controllers\Controller;
 use App\Http\Requests\Orion\GetLinkRequest;
+use App\Http\Requests\Orion\GetShowsLinks;
 use App\Http\Requests\Orion\GetStreamUrl;
+use App\Http\Requests\Orion\RequestLink;
 use App\Http\Services\OrionService;
 use Illuminate\Http\Request;
+use Illuminate\Support\Facades\DB;
 
 class LinksController extends Controller
 {
@@ -24,16 +27,40 @@ class LinksController extends Controller
             'data' => $response->data
         ])->render();
 
-        ray($html);
+        return response()->json([
+            'status' => $response->status,
+            'result' => $response->result,
+            'html' => $html
+        ]);
+    }
+
+    public function getShowsLinks(GetShowsLinks $request)  {
+        ray()->clearAll();
+        ray($request->all());
+
+        $orion = new OrionService();
+        $orion->tvdbid = (string) $request->tmbd_id;
+        $orion->tmdbid = (string) $request->tmdb_id;
+        $orion->imdbid = (string) $request->imdb_id;
+        $orion->type = (string) $request->searchType;
+        $orion->queryString = (string) $request->queryString;
+        $orion->seasonNumber = (string) $request->season_number;
+        $orion->episodeNumber = (string) $request->episode_number;
+
+        $response = $orion->getLinks();
+
+        $html = view('components.orion-link-data', [
+            'data' => $response->data
+        ])->render();
 
         return response()->json([
             'status' => $response->status,
+            'result' => $response->result,
             'html' => $html
         ]);
     }
 
     public function getStreamLink(GetStreamUrl $request) {
-        ray()->clearAll();
         $orion = new OrionService();
         $orion->orionId = $request->orionId;
         $orion->streamId = $request->streamId;
@@ -42,7 +69,130 @@ class LinksController extends Controller
 
         return response()->json([
             'status' => "success",
+            'result' => $response->result,
             'data' => $response
         ]);
     }
+
+    public function requestLink(RequestLink $request) {
+        $exists = $this->checkExists($request);
+
+        if ($exists === true) {
+            return response()->json([
+                'status' => 'failed',
+                'message' => 'A request for this link already exists.'
+            ], 200);
+        }
+
+        ray($request->type);
+
+        if ($request->type === "movie") {
+            $response = $this->addMovieToDb( $request);
+            return response()->json($response, 200);
+        }
+
+        if ($request->type === "show") {
+            $response = $this->addShowToDb( $request);
+            return response()->json($response, 200);
+        }
+
+    }
+
+    private function checkMovieExists(RequestLink $request) {
+        $exists = false;
+
+        $importExists = DB::table('vod_import')->where('imdb_id', '=',  $request->imdbid)->first();
+        $masterExists = DB::table('vod_master')->where('imdb_id', '=',  $request->imdbid)->first();
+
+        // Check if exists in vod_import first
+        if (!is_null($importExists) || !is_null($masterExists)) {
+            $exists = true;
+        }
+
+        return $exists;
+    }
+
+    private function checkShowExists(RequestLink $request)
+    {
+        $exists = false;
+
+        $importExists = DB::table('episodes_import')->where('imdb', '=',  $request->imdbid)->first();
+        $masterExists = DB::table('episodes_master')->where('imdb', '=',  $request->imdbid)->first();
+
+        // Check if exists in vod_import first
+        if (!is_null($importExists) || !is_null($masterExists)) {
+            $exists = true;
+        }
+
+        return $exists;
+    }
+
+    private function checkExists(RequestLink $request)
+    {
+        $exists = false;
+
+        if ($request->type === "movie") {
+            $exists = $this->checkMovieExists($request);
+        }
+
+        if ($request->type === "show") {
+            $exists = $this->checkShowExists($request);
+        }
+
+        return $exists;
+    }
+
+    private function addMovieToDb(RequestLink $request) {
+        try {
+            DB::beginTransaction();
+            DB::table('vod_import')->insert([
+                'imdb_id' => $request->imdbid,
+                'tmdb_id' => $request->tmdbid,
+                'media_url' => $request->magnet
+            ]);
+            DB::commit();
+
+            return [
+                'status' => "success",
+                'message' => 'Request for this title has been accepted.'
+            ];
+        } catch (\Exception $e) {
+            DB::rollBack();
+            return [
+                'status' => 'failed',
+                'reason' => $e->getMessage(),
+            ];
+        }
+    }
+
+    private function addShowToDb(RequestLink $request) {
+        try {
+            ray($request->all());
+            DB::beginTransaction();
+            $x = DB::table('episodes_import')->insert([
+                'imdb' => $request->imdbid,
+                'tmdb' => $request->tmdbid,
+                'tvdb' => $request->tvbdid,
+                'episode' => $request->episode_number,
+                'season' => $request->season_number,
+                'media_url' => $request->magnet
+            ]);
+
+            ray($x);
+
+            DB::commit();
+            ray('commited');
+            return [
+                'status' => "success",
+                'message' => 'Request for this title has been accepted.'
+            ];
+        } catch (\Exception $e) {
+            ray($e);
+            DB::rollBack();
+            return [
+                'status' => 'failed',
+                'reason' => $e->getMessage(),
+            ];
+        }
+    }
 }

+ 4 - 6
app/Http/Controllers/Orion/SearchController.php

@@ -13,10 +13,6 @@ use Illuminate\Support\Facades\Validator;
 
 class SearchController extends Controller
 {
-    public function __construct() {
-
-    }
-
     public function index() {
         return view('search');
     }
@@ -32,12 +28,14 @@ class SearchController extends Controller
                 'html' => view('components.search-result-card', [
                     "results" => collect($response->data)
                 ])->render(),
+                'result' => $response->result,
                 'status' => $response->status
             ]);
         }
 
         return response()->json([
             'status' => $response->status,
+            'result' => $response->result,
             'error' => 'Unable to get search results at this time'
         ]);
     }
@@ -59,15 +57,15 @@ class SearchController extends Controller
                 'html' => view('components.search-result-card', [
                     "results" => collect($response->data)
                 ])->render(),
+                'result' => $response->result,
                 'status' => $response->status
             ]);
         }
 
         return response()->json([
             'status' => $response->status,
+            'result' => $response->result,
             'error' => 'Unable to get search results at this time'
         ]);
     }
-
-
 }

+ 35 - 0
app/Http/Requests/Orion/GetShowsLinks.php

@@ -0,0 +1,35 @@
+<?php
+
+namespace App\Http\Requests\Orion;
+
+use Illuminate\Foundation\Http\FormRequest;
+
+class GetShowsLinks extends FormRequest
+{
+    /**
+     * Determine if the user is authorized to make this request.
+     *
+     * @return bool
+     */
+    public function authorize()
+    {
+        return auth()->check();
+    }
+
+    /**
+     * Get the validation rules that apply to the request.
+     *
+     * @return array<string, mixed>
+     */
+    public function rules()
+    {
+        return [
+            "season_number" => 'required|min:1|numeric',
+            "episode_number" => "required|min:1|numeric",
+            "imdb_id" => "required|string",
+            "tmdb_id" => "nullable|string",
+            "tvdb_id" => "nullable|string",
+            "searchType" => "required|in:show|string",
+        ];
+    }
+}

+ 36 - 0
app/Http/Requests/Orion/RequestLink.php

@@ -0,0 +1,36 @@
+<?php
+
+namespace App\Http\Requests\Orion;
+
+use Illuminate\Foundation\Http\FormRequest;
+
+class RequestLink extends FormRequest
+{
+    /**
+     * Determine if the user is authorized to make this request.
+     *
+     * @return bool
+     */
+    public function authorize()
+    {
+        return auth()->check();
+    }
+
+    /**
+     * Get the validation rules that apply to the request.
+     *
+     * @return array<string, mixed>
+     */
+    public function rules()
+    {
+        return [
+            'type' => 'required|string',
+            'imdbid' => 'required|string|starts_with:tt',
+            'tmdbid' => 'nullable|string',
+            'tvdbid' => 'nullable|string',
+            'episode_number' => 'required_if:type,show|numeric',
+            'season_number' => 'required_if:type,show|numeric',
+            'magnet' => 'required|starts_with:magnet'
+        ];
+    }
+}

+ 14 - 5
app/Http/Services/OrionService.php

@@ -14,6 +14,8 @@ class OrionService
     public string $tvdbid;
     public string $orionId;
     public string $streamId;
+    public string $seasonNumber;
+    public string $episodeNumber;
     public string $type; // movie or show
     public string|null $queryString; // blank "". null or provided string
     public string $category; // list or provided string
@@ -42,7 +44,6 @@ class OrionService
         }
         $response = Http::get($url);
         $response = json_decode($response->body(), false, 512, JSON_THROW_ON_ERROR);
-        ray($response);
         return $this->handleResponse($response);
     }
 
@@ -62,15 +63,23 @@ class OrionService
     {
         $url = $this->searchWithTokens . '&debridlookup=realdebrid&imdb=' . $this->imdbid . '&tmdb=' . $this->tmdbid .
                 '&query=' . $this->queryString . '&type=' . $this->type;
-        $response = Http::get($url);
+
+        if ($this->type !== "movie") {
+            $url .= '&season='. $this->seasonNumber .'&episode='.$this->episodeNumber;
+        }
+
+        ray($url);
+
+        $response = Http::post($url);
         $response = json_decode($response->body(), false, 512, JSON_THROW_ON_ERROR);
+        ray($response);
         return $this->handleResponse($response);
     }
 
     public function getStreamUrl(): object|array
     {
         $url = $this->getStream . '&iditem='. $this->orionId .'&idstream='. $this->streamId;
-        $response = HTTP::timeout(300)->post($url);
+        $response = HTTP::timeout(60)->post($url);
         $response = json_decode($response->body(), false, 512, JSON_THROW_ON_ERROR);
         return $this->handleResponse($response);
 
@@ -92,8 +101,6 @@ class OrionService
             $types .= is_null($types) ? 'episode' : ',episode';
         }
 
-        ray($types);
-
         $this->types = $types;
     }
 
@@ -103,12 +110,14 @@ class OrionService
         if ($response->result->status === "success") {
             return (object) [
                 'data' => $response->data,
+                'result' => $response->result,
                 'status' => $response->result->status
             ];
         }
 
         return (object) [
             "error" => "Unable to get search results at this time.",
+            'result' => $response->result,
             "status" => $response->result->status
         ];
     }

+ 4 - 13
config/orion.php

@@ -2,19 +2,10 @@
 
 return [
     'base_url' => env('ORION_API_URL', null),
-    'search_no_tokens'          => '?mode=stream&action=search&category=search&keyapp='.env('ORION_API_KEY_APP', null).
-                                    '&keyuser=' .env('ORION_API_KEY_USER', null).'
-                                    &count=20',
-    'search_no_tokens_filtered' => '?mode=stream&action=search&keyapp='.env('ORION_API_KEY_APP', null).
-                                    '&keyuser=' .env('ORION_API_KEY_USER', null).'
-                                    &count=20',
-    'search_using_tokens'       => '?mode=stream&action=retrieve&keyapp='.env('ORION_API_KEY_APP', null).
-                                    '&keyuser=' .env('ORION_API_KEY_USER', null).'&count=10
-                                    &protocoltorrent=magnet&sort=best&order=descending&streamtype=+torrent,+usenet,+hoster
-                                    &lookup=true&videoQuality=+hd4k,+hd1080,+hd720,+scr1080,+scr720,+scr1080,+scr720',
-    'get_stream_link'           => '?action=resolve&keyapp='.env('ORION_API_KEY_APP', null). '&keyuser=' .env('ORION_API_KEY_USER', null).
-                                    '&mode=debrid&type=realdebrid',
-
+    'search_no_tokens'          => '?mode=stream&action=search&category=search&keyapp='.env('ORION_API_KEY_APP', null).'&keyuser='.env('ORION_API_KEY_USER', null).'&count=20',
+    'search_no_tokens_filtered' => '?mode=stream&action=search&keyapp='.env('ORION_API_KEY_APP', null).'&keyuser='.env('ORION_API_KEY_USER', null).'&count=20',
+    'search_using_tokens'       => '?mode=stream&action=retrieve&keyapp='.env('ORION_API_KEY_APP', null).'&keyuser='.env('ORION_API_KEY_USER', null).'&count=10&protocoltorrent=magnet&sort=best&order=descending&streamtype=+torrent,+usenet,+hoster&lookup=true', ///&videoQuality=+hd4k,+hd1080,+hd720,+scr1080,+scr720,+scr1080,+scr720',
+    'get_stream_link'           => '?action=resolve&keyapp='.env('ORION_API_KEY_APP', null). '&keyuser=' .env('ORION_API_KEY_USER', null).'&mode=debrid&type=realdebrid',
     'keyapp'    => env('ORION_API_KEY_APP', null),
     'keyuser'   => env('ORION_API_KEY_USER', null)
 ];

+ 31 - 5
resources/views/components/orion-link-data.blade.php

@@ -6,6 +6,7 @@
 					<table class="min-w-full divide-y divide-gray-300">
 						<thead class="bg-gray-700">
 						<tr>
+							<th></th>
 							<th scope="col" class="px-3 py-3.5 text-center text-white text-sm font-semibold">Type</th>
 							<th scope="col" class="px-3 py-3.5 text-center text-white text-sm font-semibold">Info</th>
 							<th scope="col" class="px-3 py-3.5 text-center text-white text-sm font-semibold">Actions</th>
@@ -17,10 +18,31 @@
 						</thead>
 
 						<tbody>
+						@ray($data)
 						@foreach ($data->streams as $streams)
 							<tr data-key="{{ $streams->id }}" class="even:bg-gray-300 odd:bg-white">
+								<td>
+									<form id="{{ $streams->id }}">
+										@ray($data)
+										@if($data->type ==="movie")
+											<input type="hidden" name="imdbid" value="tt{{ $data->movie->id->imdb }}">
+											<input type="hidden" name="tmdbid" value="{{ $data->movie->id->tmdb }}">
+											<input type="hidden" name="type" value="{{ $data->type }}">
+											<input type="hidden" name="magnet" value="{{ $streams->links[0] }}">
+										@else
+											<input type="hidden" name="imdbid" value="tt{{ $data->episode->id->imdb }}">
+											<input type="hidden" name="tmdbid" value="{{ $data->episode->id->tmdb }}">
+											<input type="hidden" name="tvdbid" value="{{ $data->episode->id->tvdb }}">
+											<input type="hidden" name="type" value="{{ $data->type }}">
+											<input type="hidden" name="episode_number" value="{{ $data->episode->number->episode }}">
+											<input type="hidden" name="season_number"  value="{{ $data->episode->number->season }}">
+											<input type="hidden" name="magnet" value="{{ $streams->links[0] }}">
+										@endif
+										<button type="button" class="p-2 bg-blue-500 rounded-lg ml-2 text-white shadow-lg whitespace-nowrap hover:bg-green-400 hover:text-black" onclick="requestLink(event)">Request {{ $data->type }}</button>
+									</form>
+								</td>
 								<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-6">{{ $streams->stream->type }}</td>
-								<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
+								<td class="whitespace break-normal px-3 py-4 text-sm text-gray-500">
 									{{ $streams->file->name }}<br/>
 									<span class="text-sm italic">
 										{{ $streams->stream->origin }} |
@@ -30,12 +52,16 @@
 									</span>
 								</td>
 								<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
-									<button data-href="{{ route("get.stream.url") }}" data-streamId="{{ $data->movie->id->orion }}" onclick="getStreamSample(event)">Preview Trailer</button>
-									<br/>
-									<a href="{{ $streams->links[0] }}">Download Magnet</a>
+									@if ($streams->access->realdebrid === true && $data->type === "movie")
+										<button data-href="{{ route("get.stream.url") }}" data-streamId="{{ $data->movie->id->orion }}" onclick="getStreamSample(event)">Preview Trailer</button>
+									@elseif ($streams->access->realdebrid === true && $data->type === "show")
+										<button data-href="{{ route("get.stream.url") }}" data-streamId="{{ $data->episode->id->orion }}" onclick="getStreamSample(event)">Preview Trailer</button>
+									@else
+										No Preview Available
+									@endif
 								</td>
 								<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
-									@if ($streams->access->realdebrid === true && $streams->access->realdebrid === true)
+									@if ($streams->access->realdebrid === true)
 										Cached
 									@else
 										Not Cached

+ 8 - 2
resources/views/components/orion-links-modal.blade.php

@@ -40,8 +40,14 @@
 
                     </div>
                 </div>
-                <div class="mt-5 sm:mt-6 sm:grid sm:grid-flow-row-dense sm:grid-cols-2 sm:gap-3">
-                    <button type="button" class="inline-flex w-full justify-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-base font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 sm:col-start-2 sm:text-sm">Close</button>
+                <div class="flex mt-5 sm:mt-6 sm:grid sm:grid-flow-row-dense sm:grid-cols-2 sm:gap-3">
+                    <button
+                        type="button"
+                        style="margin-right: 30px;"
+                        class="inline-flex justify-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-base font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 sm:col-start-2 sm:text-sm"
+                        onclick="document.getElementById('orion-links-modal').classList.add('hidden')"
+                    >Close</button>
+
                 </div>
             </div>
         </div>

+ 7 - 10
resources/views/components/search-result-card.blade.php

@@ -26,11 +26,7 @@
     <div>
         <div class="-mt-px flex">
             <div class="flex w-0 flex-1">
-                <button onclick="getLinks(event)" data-formid="movie_form_{{ $loop->index }}" data-type="{{ $result->type === "movie" ? "movie" : "show" }}" class="relative -mr-px inline-flex w-0 flex-1 items-center justify-center rounded-bl-lg border border-transparent py-4 text-sm font-medium text-gray-700 hover:bg-gray-200 hover:text-gray-500">
-                    <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6 text-gray-300">
-                        <path stroke-linecap="round" stroke-linejoin="round" d="M13.19 8.688a4.5 4.5 0 011.242 7.244l-4.5 4.5a4.5 4.5 0 01-6.364-6.364l1.757-1.757m13.35-.622l1.757-1.757a4.5 4.5 0 00-6.364-6.364l-4.5 4.5a4.5 4.5 0 001.242 7.244" />
-                    </svg>
-
+                <button onclick="getLinks(event)" data-formid="{{ $result->type === "movie" ? "movie" : "show" }}_form_{{ $loop->index }}" data-type="{{ $result->type === "movie" ? "movie" : "show" }}" class="relative p-6 -mr-px inline-flex w-0 flex-1  rounded-bl-lg border border-transparent py-4 text-sm font-medium text-gray-700 hover:bg-gray-200 hover:text-gray-500">
                     @if ($result->type === "movie")
                         <form id="movie_form_{{ $loop->index }}">
                             <input type="hidden" name="queryString" value="{{ $result->meta->title }} {{ $result->meta->year }}">
@@ -40,19 +36,20 @@
                         </form>
                         <span class="ml-3">Show Links</span>
                     @else
-                        <div class="flex">
-                            <form id="series_form">
+                        <div class="flex left-0">
+                            <form id="show_form_{{ $loop->index }}">
                                 <label for="season_{{ $loop->index }}">
-                                    Season: <input type="text" placeholder="1" id="season_{{ $loop->index }}" name="season_number">
+                                    Season: <input type="text" class="w-2/12 text-center rounded mr-2 text-sm" value="1" id="season_{{ $loop->index }}" name="season_number">
                                 </label>
                                 <label for="episode_{{ $loop->index }}">
-                                    Episode: <input type="text" placeholder="1" id="episode_{{ $loop->index }}" name="episode_number">
+                                    Episode: <input type="text" class="w-2/12 text-center rounded text-sm" value="1" id="episode_{{ $loop->index }}" name="episode_number">
                                 </label>
-
                                 <input type="hidden" name="imdb_id" value="{{ $result->id->imdb }}">
                                 <input type="hidden" name="tmdb_id" value="{{ $result->id->tmdb }}">
                                 <input type="hidden" name="tvdb_id" value="{{ $result->id->tvdb }}">
+                                <input type="hidden" name="searchType" value="show">
                             </form>
+                            <span class="">Get Links</span>
                         </div>
                     @endif
                 </button>

+ 71 - 14
resources/views/search.blade.php

@@ -291,7 +291,6 @@
             .then((data) => {
                 document.getElementById('searchsubmit').disabled = false;
                 toggleSpinner()
-                console.log(data)
                 if (data.status === 'success') {
                     searchResults.innerHTML = data.html;
                 }
@@ -320,7 +319,6 @@
             .then((data) => {
                 document.querySelectorAll('.orion-filter').disabled = false;
                 toggleSpinner();
-                console.log(data)
                 if (data.status === 'success') {
                     searchResults.innerHTML = data.html;
                 }
@@ -387,24 +385,25 @@
             })
             .then((response) => response.json())
             .then((data) => {
-                console.log(data)
-                if (data.status === 'success') {
+                if (data.result.type === "debridbusy" && data.result.description === "Download Busy") {
+                    toggleSpinner();
+                    alert('Preview Video for this Link is not available.')
+                } else if (data.status === 'success') {
                     let container = document.getElementById('video-container')
                     let video = document.createElement('video');
-                        video.setAttribute('id', 'video-content');
-                        video.setAttribute('src', data.data.data.files[0].original.link)
-                        video.setAttribute('type', 'video/' + data.data.data.files[0].original.extension)
-                        video.setAttribute('controls', null)
-                        video.classList.add('mx-auto', 'aspect-video', 'h-96');
-                        container.appendChild(video)
+                    video.setAttribute('id', 'video-content');
+                    video.setAttribute('src', data.data.data.files[0].original.link)
+                    video.setAttribute('type', 'video/' + data.data.data.files[0].original.extension)
+                    video.setAttribute('controls', null)
+                    video.classList.add('mx-auto', 'aspect-video', 'h-96');
+                    container.appendChild(video)
 
                     toggleSpinner()
                 }
             })
             .catch((error) => {
                 toggleSpinner()
-                alert('An Error Has Occurred')
-                console.error("Looks like there was an Error: " + error)
+                alert('An Error Has Occurred: ' + error)
             })
         }
 
@@ -422,12 +421,13 @@
 
         function getLinks(event) {
             event.preventDefault();
-
             let button = "";
+
             if (event.target.nodeName === "BUTTON") {
                 button = event.target;
             }
-            if (event.target.nodeName === "SPAN") {
+
+            if (event.target.nodeName === "SPAN" || event.target.nodeName === "span") {
                 button = event.target.closest('button');
             }
 
@@ -436,8 +436,65 @@
                 toggleSpinner()
                 return getMovieLinks(formId);
             }
+
+            if (button.dataset.type === "show") {
+                let formId = button.dataset.formid
+                toggleSpinner()
+                return getShowLinks(formId);
+            }
+        }
+
+        function getShowLinks(formId) {
+            let form = document.getElementById(formId);
+
+            fetch('links/shows/get', {
+                method: 'POST',
+                mode: 'same-origin',
+                headers:{
+                    'Content-Type': 'application/json',
+                    "X-CSRF-Token": document.head.querySelector('meta[name="csrf-token"]').content,
+                },
+                body: JSON.stringify(serializeForm(form)),
+            })
+            .then((response) => response.json())
+            .then((data) => {
+                toggleSpinner()
+                if (data.status === 'success') {
+                    document.getElementById('links-content').innerHTML = data.html;
+                    document.getElementById('orion-links-modal').classList.remove('hidden')
+                }
+            })
+            .catch((error) => {
+                toggleSpinner()
+                alert('An Error Has Occurred')
+                console.error("Looks like there was an Error: " + error)
+            })
+        }
+
+        function requestLink(event) {
+            event.preventDefault()
+            let form = event.target.closest('form')
+
+            fetch('links/request', {
+                method: 'POST',
+                mode: 'same-origin',
+                headers: {
+                    'Content-Type': 'application/json',
+                    "X-CSRF-Token": document.head.querySelector('meta[name="csrf-token"]').content,
+                },
+                body: JSON.stringify(serializeForm(form))
+            })
+            .then((response) => response.json())
+            .then((data) => {
+                alert(data.message)
+            })
+            .catch((error) => {
+                alert(data.message)
+            })
         }
 
+
+
     </script>
     @endsection('scripts')
 </x-app-layout>

+ 6 - 4
routes/auth.php

@@ -46,11 +46,13 @@ Route::middleware('auth')->group(function () {
     Route::post('logout', [AuthenticatedSessionController::class, 'destroy'])->name('logout');
 
     Route::get('search', [SearchController::class, 'index'])->name('search');
-    Route::post('search', [SearchController::class, 'searchWithoutToken'])->name('search');
-    Route::post('search-filtered', [SearchController::class, 'searchTypeGenreNoToken'])->name('search.filtered');
+    Route::post('search', [SearchController::class, 'searchWithoutToken']);
+    Route::post('search-filtered', [SearchController::class, 'searchTypeGenreNoToken']);
 
-    Route::post('links/movie/get', [LinksController::class, 'getMovieLinks'])->name('get.movie.links');
+    Route::post('links/movie/get', [LinksController::class, 'getMovieLinks']);
+    Route::post('links/shows/get', [LinksController::class, 'getShowsLinks']);
     Route::post('links/stream/get', [LinksController::class, 'getStreamLink'])->name('get.stream.url');
+    Route::post('links/request', [LinksController::class, 'requestLink']);
 
-    Route::post('movie/show', [RequestVodController::class, 'showMovie'])->name('showMovie');
+    Route::post('movie/show', [RequestVodController::class, 'showMovie']);
 });