diff --git a/fediembedi-client.php b/fediembedi-client.php
index 7c3f26c..e6c5a35 100644
--- a/fediembedi-client.php
+++ b/fediembedi-client.php
@@ -138,14 +138,28 @@ class FediClient
return $response;
}
- public function getVideos($account_id, $is_channel) {
-
+ public function getVideos($account_id, $is_channel, $count, $nsfw = false) {
+ //https://docs.joinpeertube.org/api-rest-reference.html#tag/Video
$headers = array();
+ $query = http_build_query(array(
+ //'categoryOneOf' => $categoryID,
+ 'count' => $count,
+ //'filter' => $filter,
+ //'languageOneOf' => $lang,
+ //'licenceOneOf' => $licence,
+ 'nsfw' => $nsfw,
+ //'skipCount' => $skipCount,
+ //'sort' => $sort,
+ //'start' => $offset,
+ //'tagsAllOf' => $tagsAllOf,//videos where all tags are present
+ //'tagsOneOf' => $tags
+ ));
+
if(!is_null($is_channel)){
- $response = $this->_get("/api/v1/video-channels/{$account_id}/videos", null, $headers);
+ $response = $this->_get("/api/v1/video-channels/{$account_id}/videos?{$query}", null, $headers);
} else {
- $response = $this->_get("/api/v1/accounts/{$account_id}/videos", null, $headers);
+ $response = $this->_get("/api/v1/accounts/{$account_id}/videos?{$query}", null, $headers);
}
return $response;
diff --git a/fediembedi-peertube-widget.php b/fediembedi-peertube-widget.php
index 5801662..c8be9d1 100644
--- a/fediembedi-peertube-widget.php
+++ b/fediembedi-peertube-widget.php
@@ -37,7 +37,8 @@ class FediEmbedi_PeerTube extends WP_Widget {
//widget options
$show_header = (!empty($instance['show_header'])) ? $instance['show_header'] : null;
- $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
+ $count = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
+ $nsfw = isset( $instance['nsfw'] ) ? $instance['nsfw'] : false;
$height = isset( $instance['height'] ) ? esc_attr( $instance['height'] ) : '100%';
echo $args['before_widget'];
@@ -46,13 +47,13 @@ class FediEmbedi_PeerTube extends WP_Widget {
};
//getVideos from remote instance
- $status = $client->getVideos($actor, $is_channel);
+ $status = $client->getVideos($actor, $is_channel, $count, $nsfw);
if(!is_null($is_channel)){
$account = $status->data[0]->channel;
} else {
$account = $status->data[0]->account;
}
-
+
include(plugin_dir_path(__FILE__) . 'templates/peertube.tpl.php' );
echo $args['after_widget'];
@@ -79,6 +80,7 @@ class FediEmbedi_PeerTube extends WP_Widget {
$exclude_replies = (!empty($instance['exclude_replies'])) ? $instance['exclude_replies'] : NULL;
$exclude_reblogs = (!empty($instance['exclude_reblogs'])) ? $instance['exclude_reblogs'] : NULL;
$number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
+ $nsfw = isset( $instance['nsfw'] ) ? $instance['nsfw'] : false;
$height = isset( $instance['height'] ) ? esc_attr( $instance['height'] ) : '';
?>
@@ -126,6 +128,17 @@ class FediEmbedi_PeerTube extends WP_Widget {
+
+
+