このリポジトリは2023-09-09にアーカイブされています。 ファイルの閲覧とクローンは可能ですが、プッシュ、イシューの作成、プルリクエストはできません。
076server/app/Http/Controllers/Peertube/Watch.php

43 行
1.1 KiB
PHP
Raw 通常表示 履歴

<?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 Watch extends Common {
private $common;
public function __construct () {
$this->common = new Common;
}
public function index ($id) {
2021-12-16 01:25:29 +09:00
$res = [
'page' => 'watch',
'userinfo' => $this->common->user,
];
$res['detail'] = $this->getDetail($id);
$res['comment'] = $this->getComment($id);
$res['recommend'] = $this->getRecommend($res['detail']->tags);
return view('pages.peertube.w', ['res' => $res]);
}
function getDetail ($id) {
2021-12-15 10:39:11 +09:00
return $this->ptapi_get('/api/v1/videos/'.$id);
}
2021-12-15 18:42:38 +09:00
function getRecommend ($tags) {
$tag = '';
foreach ($tags as $t) {
$tag .= 'tagsOneOf='.urlencode($t).'&';
}
2021-12-15 10:39:11 +09:00
return $this->ptapi_get('/api/v1/search/videos?start=0&count=6&nsfw=both&'.$tag.'sort=-publishedAt&searchTarget=local');
}
2021-12-15 18:42:38 +09:00
function getComment ($id) {
2021-12-15 10:39:11 +09:00
return $this->ptapi_get('/api/v1/videos/'.$id.'/comment-threads');
}
}