diff --git a/app/Http/Controllers/Peertube/Channel.php b/app/Http/Controllers/Peertube/Channel.php index b0386f0..bd2f2fd 100644 --- a/app/Http/Controllers/Peertube/Channel.php +++ b/app/Http/Controllers/Peertube/Channel.php @@ -20,10 +20,12 @@ class Channel extends Common { 'page' => 'channel', 'cat' => $cat, 'paginate' => $page, + 'pagetotal' => 500, 'userinfo' => $this->common->user, ]; $res['channel'] = $this->getChannel($id); $res['video'] = $this->getVideo($id, ($page*$this->count), $this->count); + $res['pagetotal'] = $res['video']->total; return view('pages.peertube.c', ['res' => $res]); } diff --git a/app/Http/Controllers/Peertube/Videos/Local.php b/app/Http/Controllers/Peertube/Videos/Local.php index cf49cce..fe72a8c 100644 --- a/app/Http/Controllers/Peertube/Videos/Local.php +++ b/app/Http/Controllers/Peertube/Videos/Local.php @@ -8,22 +8,26 @@ use App\Http\Controllers\Peertube\Common; class Local extends Common { private $common; + private $count; public function __construct () { $this->common = new Common; + $this->count = 50; } - public function index () { + public function index ($page=0) { $res = [ 'page' => 'videoslist', + 'paginate' => $page, + 'pagetotal' => 500, 'userinfo' => $this->common->user, ]; - $res['video'] = $this->getVideo(); + $res['video'] = $this->getVideo(($page*$this->count), $this->count); return view('pages.peertube.videos.local', ['res' => $res]); } - function getVideo () { - $get = $this->ptapi_get('/api/v1/videos/?start=0&count=50&sort=-publishedAt&filter=local&skipCount=true&nsfw=both'); + function getVideo ($start, $count) { + $get = $this->ptapi_get('/api/v1/videos/?start='.$start.'&count='.$count.'&sort=-publishedAt&filter=local&skipCount=true&nsfw=both'); return $this->vidlist($get); } } diff --git a/app/Http/Controllers/Peertube/Videos/Recentlyadded.php b/app/Http/Controllers/Peertube/Videos/Recentlyadded.php index e769820..23feb58 100644 --- a/app/Http/Controllers/Peertube/Videos/Recentlyadded.php +++ b/app/Http/Controllers/Peertube/Videos/Recentlyadded.php @@ -8,22 +8,26 @@ use App\Http\Controllers\Peertube\Common; class Recentlyadded extends Common { private $common; + private $count; public function __construct () { $this->common = new Common; + $this->count = 25; } - public function index () { + public function index ($page=0) { $res = [ 'page' => 'videoslist', + 'paginate' => $page, + 'pagetotal' => 500, 'userinfo' => $this->common->user, ]; - $res['video'] = $this->getVideo(); + $res['video'] = $this->getVideo(($page*$this->count), $this->count); return view('pages.peertube.videos.recentlyadded', ['res' => $res]); } - function getVideo () { - $get = $this->ptapi_get('/api/v1/videos/?start=0&count=25&sort=-publishedAt&skipCount=true&nsfw=both'); + function getVideo ($start, $count) { + $get = $this->ptapi_get('/api/v1/videos/?start='.$start.'&count='.$count.'&sort=-publishedAt&skipCount=true&nsfw=both'); return $this->vidlist($get); } } diff --git a/resources/views/theme/techsuwa/component/peertube/parts/c/videos.blade.php b/resources/views/theme/techsuwa/component/peertube/parts/c/videos.blade.php index 42a78f6..8a0c99a 100644 --- a/resources/views/theme/techsuwa/component/peertube/parts/c/videos.blade.php +++ b/resources/views/theme/techsuwa/component/peertube/parts/c/videos.blade.php @@ -19,9 +19,9 @@ @include('theme.'.env('THEME').'.component.peertube.parts.common.videominature') @endforeach + @include('theme.'.env('THEME').'.component.peertube.parts.common.paginate', [ + 'root' => '/peertube/c/'.$res['channel']->name.($res['channel']->host != 'video.076.ne.jp' ? '@'.$res['channel']->host : '').'/'.$res['cat'] + ]) - - -@if ($res['paginate'] != 0) 戻り @endif -@if (($res['paginate']*25) < $res['video']->total) @endif \ No newline at end of file + \ No newline at end of file diff --git a/resources/views/theme/techsuwa/component/peertube/parts/common/paginate.blade.php b/resources/views/theme/techsuwa/component/peertube/parts/common/paginate.blade.php new file mode 100644 index 0000000..c70e127 --- /dev/null +++ b/resources/views/theme/techsuwa/component/peertube/parts/common/paginate.blade.php @@ -0,0 +1,2 @@ +@if ($res['paginate'] != 0) 戻り @endif +@if (($res['paginate']*25) < $res['pagetotal']) @endif \ No newline at end of file diff --git a/resources/views/theme/techsuwa/component/peertube/videos/local.blade.php b/resources/views/theme/techsuwa/component/peertube/videos/local.blade.php index 217f8a4..b70c534 100644 --- a/resources/views/theme/techsuwa/component/peertube/videos/local.blade.php +++ b/resources/views/theme/techsuwa/component/peertube/videos/local.blade.php @@ -19,6 +19,9 @@
@include('theme.'.env('THEME').'.component.peertube.parts.common.videosbydate') + @include('theme.'.env('THEME').'.component.peertube.parts.common.paginate', [ + 'root' => '/peertube/videos/local' + ]) diff --git a/resources/views/theme/techsuwa/component/peertube/videos/recentlyadded.blade.php b/resources/views/theme/techsuwa/component/peertube/videos/recentlyadded.blade.php index a947336..3618d56 100644 --- a/resources/views/theme/techsuwa/component/peertube/videos/recentlyadded.blade.php +++ b/resources/views/theme/techsuwa/component/peertube/videos/recentlyadded.blade.php @@ -19,6 +19,9 @@
@include('theme.'.env('THEME').'.component.peertube.parts.common.videosbydate') + @include('theme.'.env('THEME').'.component.peertube.parts.common.paginate', [ + 'root' => '/peertube/videos/recently-added' + ])