diff --git a/app/Http/Controllers/Peertube/Account.php b/app/Http/Controllers/Peertube/Account.php new file mode 100644 index 0000000..09553e5 --- /dev/null +++ b/app/Http/Controllers/Peertube/Account.php @@ -0,0 +1,42 @@ +common = new Common; + } + + public function index ($id) { + $res = []; + $res['page'] = 'account'; + $res['owner'] = $this->getOwner($id); + if (!empty($res['owner'])) $res['owner']->totalVideo = 0; + $res['channel'] = $this->getChannel($id); + if (!empty($res['owner'])) { + foreach ($res['channel']->data as $k => $v) { + $res['channel']->data[$k]->video = $this->getVideo($v->name); + $res['owner']->totalVideo += $res['channel']->data[$k]->video->total; + } + } + return view('pages.peertube.a', ['res' => $res]); + } + + function getOwner ($id) { + return $this->ptapi_get('/api/v1/accounts/'.$id); + } + + function getChannel ($id) { + return $this->ptapi_get('/api/v1/accounts/'.$id.'/video-channels?start=0&count=20&sort=-updatedAt&withStats=false'); + } + + public function getVideo ($id) { + return $this->ptapi_get('/api/v1/video-channels/'.$id.'/videos?start=0&count=5&sort=-publishedAt&nsfw=both'); + } +} diff --git a/resources/views/pages/peertube/a.blade.php b/resources/views/pages/peertube/a.blade.php new file mode 100644 index 0000000..7ba8c12 --- /dev/null +++ b/resources/views/pages/peertube/a.blade.php @@ -0,0 +1,5 @@ +@extends('theme.'.env('THEME').'.peertube') + +@section('content') + @include('theme.'.env('THEME').'.component.peertube.a') +@endsection diff --git a/resources/views/theme/techsuwa/component/peertube/a.blade.php b/resources/views/theme/techsuwa/component/peertube/a.blade.php new file mode 100644 index 0000000..b08c10a --- /dev/null +++ b/resources/views/theme/techsuwa/component/peertube/a.blade.php @@ -0,0 +1,9 @@ +
ダンスパフォーマンスユニット「{{ $ch->displayName }}」の非公式チャンネルです。
++ {{ $res['owner']->description }} +
+