CURLは一致に

このコミットが含まれているのは:
守矢諏訪子 2021-12-15 10:39:11 +09:00
コミット 5cf61e1df6
7個のファイルの変更53行の追加86行の削除

ファイルの表示

@ -17,42 +17,20 @@ class Common extends Engine {
}
public function getLocal () {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, env('PEER_URI').'/api/v1/oauth-clients/local');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$get = curl_exec($ch);
$err = curl_error($ch);
curl_close($ch);
if (!$get) return $err;
$get = json_decode($get);
if (isset($get->status) && $get->status == 404) return [];
return $get;
return $this->ptapi_get('/api/v1/oauth-clients/local');
}
public function getMe () {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, env('PEER_URI').'/api/v1/users/me');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$get = curl_exec($ch);
$err = curl_error($ch);
curl_close($ch);
if (!$get) return $err;
$get = json_decode($get);
if (isset($get->status) && $get->status == 404) return [];
return $get;
return $this->ptapi_get('/api/v1/users/me');
}
public function getNotify () {
return $this->ptapi_get('/api/v1/users/me/notifications?start=0&count=0&unread=true');
}
public function ptapi_get ($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, env('PEER_URI').'/api/v1/users/me/notifications?start=0&count=0&unread=true');
curl_setopt($ch, CURLOPT_URL, env('PEER_URI').$url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

ファイルの表示

@ -15,6 +15,7 @@ class Watch extends Common {
public function index ($id) {
$res = [];
$res['page'] = 'watch';
$res['detail'] = $this->getDetail($id);
$res['comment'] = $this->getComment($id);
$res['recommend'] = $this->getRecommend($res['detail']->tags);
@ -22,57 +23,18 @@ class Watch extends Common {
}
function getDetail ($id) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, env('PEER_URI').'/api/v1/videos/'.$id);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$get = curl_exec($ch);
$err = curl_error($ch);
curl_close($ch);
if (!$get) return $err;
$get = json_decode($get);
return $get;
return $this->ptapi_get('/api/v1/videos/'.$id);
}
public function getRecommend ($tags) {
$ch = curl_init();
$tag = '';
foreach ($tags as $t) {
$tag .= 'tagsOneOf='.urlencode($t).'&';
}
curl_setopt($ch, CURLOPT_URL, env('PEER_URI').'/api/v1/search/videos?start=0&count=6&nsfw=both&'.$tag.'sort=-publishedAt&searchTarget=local');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$get = curl_exec($ch);
$err = curl_error($ch);
curl_close($ch);
if (!$get) return $err;
$get = json_decode($get);
if (isset($get->status) && $get->status == 404) return [];
return $get;
return $this->ptapi_get('/api/v1/search/videos?start=0&count=6&nsfw=both&'.$tag.'sort=-publishedAt&searchTarget=local');
}
public function getComment ($id) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, env('PEER_URI').'/api/v1/videos/'.$id.'/comment-threads');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$get = curl_exec($ch);
$err = curl_error($ch);
curl_close($ch);
if (!$get) return $err;
$get = json_decode($get);
if (isset($get->status) && $get->status == 404) return [];
return $get;
return $this->ptapi_get('/api/v1/videos/'.$id.'/comment-threads');
}
}

ファイルの表示

@ -1,13 +1,5 @@
@extends('theme.'.env('THEME').'.peertube')
@section('content')
<div class="peertube-container user-logged-in">
@include('theme.'.env('THEME').'.component.peertube.parts.header')
<div class="sub-header-container">
@include('theme.'.env('THEME').'.component.peertube.parts.menu')
@include('theme.'.env('THEME').'.component.peertube.w')
</div>
</div>
@include('theme.'.env('THEME').'.component.peertube.w')
@endsection

ファイルの表示

@ -1,3 +1,12 @@
<?php
$name = '';
if (isset($res['page'])) {
if ($res['page'] == 'watch') $name = $res['detail']->name;
else if ($res['page'] == 'account') $name = $res['owner']->displayName.'さんのチャンネル一覧';
}
?>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
@ -12,5 +21,7 @@
<base href="{{ env('APP_URL') }}/peertube/client/ja-JP/">
<title>{{ $res['detail']->name }} - 076動画</title>
<title>
{{ $name }} - 076動画
</title>
<meta name="description" content="テクニカル諏訪子様の動画サイト" />

ファイルの表示

@ -1,6 +1,15 @@
<?php
$name = '';
if (isset($res['page'])) {
if ($res['page'] == 'watch') $name = $res['detail']->name;
else if ($res['page'] == 'account') $name = $res['owner']->displayName.'さんのチャンネル一覧';
}
?>
<meta property="og:type" content="video" />
<meta property="og:site_name" content="076動画" />
<meta property="og:title" content="{{ $res['detail']->name }}" />
<meta property="og:title" content="{{ $name }}" />
<meta property="og:image" content="https://video.076.ne.jp/lazy-static/previews/8d97cbd1-50bb-4de3-9eb6-914027346996.jpg" />
<meta property="og:url" content="{{ env('APP_URL') }}/peertube/w/b8oKB37kqyCdt7gBtPWeWV" />
<meta property="og:description" content="" />
@ -9,11 +18,11 @@
<meta property="og:video:type" content="text/html" />
<meta property="og:video:width" content="560" />
<meta property="og:video:height" content="315" />
<meta property="name" content="{{ $res['detail']->name }}" />
<meta property="name" content="{{ $name }}" />
<meta property="description" content="" />
<meta property="image" content="https://video.076.ne.jp/lazy-static/previews/8d97cbd1-50bb-4de3-9eb6-914027346996.jpg" />
<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:site" content="@TechnicalSuwako" />
<meta property="twitter:title" content="{{ $res['detail']->name }}" />
<meta property="twitter:title" content="{{ $name }}" />
<meta property="twitter:description" content="" />
<meta property="twitter:image" content="https://video.076.ne.jp/lazy-static/previews/8d97cbd1-50bb-4de3-9eb6-914027346996.jpg" />

ファイルの表示

@ -1,4 +1,13 @@
<link rel="alternate" type="application/json+oembed" href="https://video.076.ne.jp/services/oembed?url=https%3A%2F%2Fvideo.076.ne.jp%2Fw%2Fb8oKB37kqyCdt7gBtPWeWV" title="{{ $res['detail']->name }}" />
<?php
$name = '';
if (isset($res['page'])) {
if ($res['page'] == 'watch') $name = $res['detail']->name;
else if ($res['page'] == 'account') $name = $res['owner']->displayName.'さんのチャンネル一覧';
}
?>
<link rel="alternate" type="application/json+oembed" href="https://video.076.ne.jp/services/oembed?url=https%3A%2F%2Fvideo.076.ne.jp%2Fw%2Fb8oKB37kqyCdt7gBtPWeWV" title="{{ $name }}" />
<link rel="canonical" href="https://video.076.ne.jp/videos/watch/52039d41-8b56-4690-b6fa-25dedfedd5c5" />
<link rel="stylesheet" href="https://video.076.ne.jp/styles.b0a7806028b73e54111d.css" media="print" onload="this.media='all'">

ファイルの表示

@ -8,6 +8,12 @@
</head>
<body id="custom-css">
@yield('content')
<div class="peertube-container user-logged-in">
@include('theme.'.env('THEME').'.component.peertube.parts.header')
<div class="sub-header-container">
@include('theme.'.env('THEME').'.component.peertube.parts.menu')
@yield('content')
</div>
</div>
</body>
</html>