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 @@ +
+
+
+ @include('theme.'.env('THEME').'.component.peertube.parts.a.info') + @include('theme.'.env('THEME').'.component.peertube.parts.a.links') + @include('theme.'.env('THEME').'.component.peertube.parts.a.channels') +
+
+
\ No newline at end of file diff --git a/resources/views/theme/techsuwa/component/peertube/parts/a/channels.blade.php b/resources/views/theme/techsuwa/component/peertube/parts/a/channels.blade.php new file mode 100644 index 0000000..00c6f22 --- /dev/null +++ b/resources/views/theme/techsuwa/component/peertube/parts/a/channels.blade.php @@ -0,0 +1,14 @@ + +
+
+ @foreach ($res['channel']->data as $ch) + name.($ch->host != 'video.076.ne.jp' ? '@'.$ch->host : ''); ?> +
+ @include('theme.'.env('THEME').'.component.peertube.parts.a.channels.avatar') + @include('theme.'.env('THEME').'.component.peertube.parts.common.subscribe') + @include('theme.'.env('THEME').'.component.peertube.parts.a.channels.videos') +
+ @endforeach +
+
+
\ No newline at end of file diff --git a/resources/views/theme/techsuwa/component/peertube/parts/a/channels/avatar.blade.php b/resources/views/theme/techsuwa/component/peertube/parts/a/channels/avatar.blade.php new file mode 100644 index 0000000..9be89dc --- /dev/null +++ b/resources/views/theme/techsuwa/component/peertube/parts/a/channels/avatar.blade.php @@ -0,0 +1,16 @@ +
+ + + チャンネルのアバター + + +

+ {{ $ch->displayName }} +

+
+
{{ $ch->followersCount }}人登録者
{{ $ch->video->total }}枚動画 +
+
+

ダンスパフォーマンスユニット「{{ $ch->displayName }}」の非公式チャンネルです。

+
+
\ No newline at end of file diff --git a/resources/views/theme/techsuwa/component/peertube/parts/a/channels/videos.blade.php b/resources/views/theme/techsuwa/component/peertube/parts/a/channels/videos.blade.php new file mode 100644 index 0000000..cbd554e --- /dev/null +++ b/resources/views/theme/techsuwa/component/peertube/parts/a/channels/videos.blade.php @@ -0,0 +1,54 @@ +
+ @foreach ($ch->video->data as $v) + + + + @endforeach + +
+ このチャンネルを表示> +
+
\ No newline at end of file diff --git a/resources/views/theme/techsuwa/component/peertube/parts/a/info.blade.php b/resources/views/theme/techsuwa/component/peertube/parts/a/info.blade.php new file mode 100644 index 0000000..93d2ab3 --- /dev/null +++ b/resources/views/theme/techsuwa/component/peertube/parts/a/info.blade.php @@ -0,0 +1,36 @@ +
+
+ + + +
+ +
+
+
+

{{ $res['owner']->displayName }}

+
+
+ {{ '@'.$res['owner']->name }}{{ $res['owner']->host != 'video.076.ne.jp' ? '@'.$res['owner']->host : '' }} + +
+
+ {{ $res['owner']->followersCount }}人登録者 {{ $res['owner']->totalVideo }}枚動画 +
+
+
+
+
+
+
+

+ {{ $res['owner']->description }} +

+
+
+
+ @include('theme.'.env('THEME').'.component.peertube.parts.common.subscribe') +
+
\ No newline at end of file diff --git a/resources/views/theme/techsuwa/component/peertube/parts/a/links.blade.php b/resources/views/theme/techsuwa/component/peertube/parts/a/links.blade.php new file mode 100644 index 0000000..0982a54 --- /dev/null +++ b/resources/views/theme/techsuwa/component/peertube/parts/a/links.blade.php @@ -0,0 +1,22 @@ + \ No newline at end of file diff --git a/routes/view/peertube.php b/routes/view/peertube.php index 6ae604d..7b541a4 100644 --- a/routes/view/peertube.php +++ b/routes/view/peertube.php @@ -1,5 +1,6 @@ 'peertube'], function () { + Route::any('/a/{id}', 'Peertube\Account@index'); Route::any('/w/{id}', 'Peertube\Watch@index'); });