diff --git a/app/Http/Controllers/Peertube/Account.php b/app/Http/Controllers/Peertube/Account.php
index aa53ac5..58af309 100644
--- a/app/Http/Controllers/Peertube/Account.php
+++ b/app/Http/Controllers/Peertube/Account.php
@@ -8,39 +8,59 @@ use App\Http\Controllers\Peertube\Common;
class Account extends Common {
private $common;
+ private $count;
public function __construct () {
$this->common = new Common;
+ $this->count = 25;
}
- public function index ($id, $cat='video-channels') {
+ public function index ($id, $cat='video-channels', $page=0) {
$res = [
'page' => 'account',
'style' => 'account',
'cat' => $cat,
+ 'paginate' => $page,
+ 'pagetotal' => 500,
'userinfo' => $this->common->user,
];
+
$res['owner'] = $this->getOwner($id);
if (!empty($res['owner'])) $res['owner']->totalVideo = 0;
- $res['channel'] = $this->getChannel($id);
+ $res['channel'] = $this->getChannel($id, $cat, ($page*$this->count), $this->count);
if (!empty($res['owner'])) {
- foreach ($res['channel']->data as $k => $v) {
- $res['channel']->data[$k]->video = $this->getVideo($v->name.'@'.$v->host);
- $res['owner']->totalVideo += $res['channel']->data[$k]->video->total;
+ if ($cat == 'video-channels') {
+ $stats = $this->ptapi('/api/v1/accounts/'.$id.'/videos?start=0&count=0&skipCount=false&nsfw=both');
+ $res['owner']->totalVideo = $stats->total;
+ foreach ($res['channel']->data as $k => $v) {
+ $res['channel']->data[$k]->video = $this->getVideo($v->name.'@'.$v->host);
+ $res['owner']->followersCount += $v->followersCount;
+ }
+ }
+ else {
+ $stats = $this->ptapi('/api/v1/accounts/'.$id.'/video-channels?start=0&count=20');
+ $res['owner']->totalVideo = $res['channel']->total;
+ foreach ($stats->data as $k => $v) {
+ $res['channel']->data[$k]->video = $this->getVideo($v->name.'@'.$v->host);
+ $res['owner']->followersCount += $v->followersCount;
+ }
}
}
- return view('pages.peertube.a', ['res' => $res]);
+
+ return view('pages.peertube.a', ['res' => $res, 'cat' => $cat]);
}
function getOwner ($id) {
return $this->ptapi('/api/v1/accounts/'.$id);
}
- function getChannel ($id) {
- return $this->ptapi('/api/v1/accounts/'.$id.'/video-channels?start=0&count=20&sort=-updatedAt&withStats=false');
+ function getChannel ($id, $cat, $start, $count) {
+ if ($cat == 'video-channels') $count = 5;
+ $sort = $cat == 'video-channels' ? '-updatedAt&withStats=false' : '-publishedAt&skipCount=false&nsfw=both';
+ return $this->ptapi('/api/v1/accounts/'.$id.'/'.$cat.'?start='.$start.'&count='.$count.'&sort='.$sort);
}
function getVideo ($id) {
- return $this->ptapi('/api/v1/video-channels/'.$id.'/videos?start=0&count=5&sort=-publishedAt&nsfw=both');
+ return $this->ptapi('/api/v1/video-channels/'.$id.'/videos?start=0&count=5&sort=-publishedAt&skipCount=false&nsfw=both');
}
}
diff --git a/resources/views/layout/component/a/links.blade.php b/resources/views/layout/component/a/links.blade.php
index 6299017..7f6b0f3 100644
--- a/resources/views/layout/component/a/links.blade.php
+++ b/resources/views/layout/component/a/links.blade.php
@@ -2,10 +2,10 @@