アカウントページ

このコミットが含まれているのは:
守矢諏訪子 2021-12-15 12:53:09 +09:00
コミット 261c0af987
9個のファイルの変更199行の追加0行の削除

42
app/Http/Controllers/Peertube/Account.php ノーマルファイル
ファイルの表示

@ -0,0 +1,42 @@
<?php
namespace App\Http\Controllers\Peertube;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Http\Controllers\Peertube\Common;
// use Illuminate\Support\Facades\Log;
class Account extends Common {
private $common;
public function __construct () {
$this->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');
}
}

5
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

ファイルの表示

@ -0,0 +1,9 @@
<div id="content" tabindex="-1" class="main-col">
<div class="main-row">
<div class="root ng-star-inserted">
@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')
</div>
</div>
</div>

ファイルの表示

@ -0,0 +1,14 @@
<my-account-video-channels class="ng-star-inserted">
<div class="margin-content">
<div class="channels">
@foreach ($res['channel']->data as $ch)
<?php $fullchan = $ch->name.($ch->host != 'video.076.ne.jp' ? '@'.$ch->host : ''); ?>
<div class="channel ng-star-inserted">
@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')
</div>
@endforeach
</div>
</div>
</my-account-video-channels>

ファイルの表示

@ -0,0 +1,16 @@
<div class="channel-avatar-row">
<my-actor-avatar title="この動画チャンネルを見る">
<a title="この動画チャンネルを見る" href="/peertube/c/{{ $fullchan }}" class="ng-star-inserted">
<img class="avatar channel ng-star-inserted" src="https://video.076.ne.jp{{ $ch->avatar->path }}" alt="チャンネルのアバター">
</a>
</my-actor-avatar>
<h2>
<a title="この動画チャンネルを見る" href="/peertube/c/{{ $fullchan }}"> {{ $ch->displayName }} </a>
</h2>
<div class="actor-counters">
<div class="followers">{{ $ch->followersCount }}人登録者</div><span class="videos-count ng-star-inserted"> {{ $ch->video->total }}枚動画 </span>
</div>
<div class="description-html">
<p>ダンスパフォーマンスユニット「{{ $ch->displayName }}」の非公式チャンネルです。</p>
</div>
</div>

ファイルの表示

@ -0,0 +1,54 @@
<div class="videos">
@foreach ($ch->video->data as $v)
<my-video-miniature class="ng-star-inserted">
<div class="video-miniature">
<my-video-thumbnail>
<a class="video-thumbnail ng-star-inserted" href="/peertube/w/{{ $v->shortUUID }}">
<img alt="" aria-label="{{ $v->name }}" src="https://video.076.ne.jp/{{ $v->thumbnailPath }}" class="ng-star-inserted">
<div class="video-thumbnail-label-overlay warning ng-star-inserted"></div>
<div class="video-thumbnail-label-overlay danger ng-star-inserted"></div>
@php
$seconds = $v->duration;
$hours = floor($seconds / 3600);
$seconds -= $hours * 3600;
$minutes = floor($seconds / 60);
$seconds -= $minutes * 60;
@endphp
<div class="video-thumbnail-duration-overlay ng-star-inserted">{{ $hours != 0 ? $hours.':' : '' }}{{ $minutes != 0 ? $minutes.':' : '0:' }}{{ $seconds }}</div>
<div class="play-overlay ng-star-inserted">
<div class="icon"></div>
</div>
<div class="progress-bar ng-star-inserted">
<div style="width: 100%;"></div>
</div>
</a>
</my-video-thumbnail>
<div class="video-bottom">
<div class="video-miniature-information">
<div class="d-flex video-miniature-meta">
<div class="w-100 d-flex flex-column">
<my-link tabindex="-1" class="video-miniature-name" style="max-height: 3em;">
<a tabindex="-1" title="{{ $v->name }}" href="/peertube/w/{{ $v->shortUUID }}" class="ng-star-inserted"> {{ $v->name }} </a>
</my-link>
<span class="video-miniature-created-at-views">
<my-date-toggle class="ng-star-inserted">
<span class="date-toggle" title="{{ date('Y/m/d', strtotime($v->publishedAt)) }}"> {{ date('Y/m/d', strtotime($v->publishedAt)) }} </span>
</my-date-toggle>
<span class="views" title="">
<my-video-views-counter class="ng-star-inserted">
<span title=""> {{ $v->views }} 回視聴</span>
</my-video-views-counter>
</span>
</span>
</div>
</div>
</div>
</div>
</div>
</my-video-miniature>
@endforeach
<div class="miniature-show-channel ng-star-inserted">
<a href="/peertube/c/{{ $fullchan }}">このチャンネルを表示&gt;</a>
</div>
</div>

ファイルの表示

@ -0,0 +1,36 @@
<div class="account-info">
<div class="account-avatar-row">
<my-actor-avatar class="main-avatar">
<img class="account avatar ng-star-inserted" src="https://video.076.ne.jp{{ $res['owner']->avatar->path }}" alt="アカウントのアバター">
</my-actor-avatar>
<div>
<div class="section-label">アカウント</div>
<div class="actor-info">
<div>
<div class="actor-display-name">
<h1 title="Created on {{ date('Y/m/d', strtotime($res['owner']->createdAt)) }}">{{ $res['owner']->displayName }}</h1>
</div>
<div class="actor-handle">
<span>{{ '@'.$res['owner']->name }}{{ $res['owner']->host != 'video.076.ne.jp' ? '@'.$res['owner']->host : '' }}</span>
<button title="Copy account handle" class="btn btn-outline-secondary btn-sm copy-button">
<span class="glyphicon glyphicon-duplicate"></span>
</button>
</div>
<div class="actor-counters">
<span>{{ $res['owner']->followersCount }}人登録者</span><span class="videos-count ng-star-inserted"> {{ $res['owner']->totalVideo }}枚動画 </span>
</div>
</div>
</div>
</div>
</div>
<div class="description">
<div class="description-html">
<p>
{{ $res['owner']->description }}
</p>
</div>
</div>
<div class="buttons">
@include('theme.'.env('THEME').'.component.peertube.parts.common.subscribe')
</div>
</div>

ファイルの表示

@ -0,0 +1,22 @@
<div class="links on-channel-page">
<my-list-overflow>
<div class="d-flex align-items-center text-nowrap w-100 list-overflow-parent">
<span id="pe_0" class="ng-star-inserted" style="visibility: inherit;">
<a routerlinkactive="active" class="title-page ng-star-inserted active" href="/a/world_order/video-channels">チャンネル</a>
</span>
<span id="pe_1" class="ng-star-inserted" style="visibility: inherit;">
<a routerlinkactive="active" class="title-page ng-star-inserted" href="/a/world_order/videos">動画</a>
</span>
</div>
</my-list-overflow>
<my-simple-search-input name="search-videos" icon-title="Search account videos" placeholder="アカウントの動画を検索する">
<div class="root" style="display: flex;">
<div class="input-group has-feedback has-clear">
<input type="text" placeholder="アカウントの動画を検索する" class="ng-untouched ng-pristine ng-valid">
</div>
<my-global-icon class="myglobalicon-alt" iconname="search" aria-label="Search" role="button" title="検索">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>
</my-global-icon>
</div>
</my-simple-search-input>
</div>

ファイルの表示

@ -1,5 +1,6 @@
<?php
Route::group(['prefix' => 'peertube'], function () {
Route::any('/a/{id}', 'Peertube\Account@index');
Route::any('/w/{id}', 'Peertube\Watch@index');
});