diff --git a/assets/mastodon.css b/assets/mastodon.css
index 6bcdc95..77910b1 100644
--- a/assets/mastodon.css
+++ b/assets/mastodon.css
@@ -86,8 +86,9 @@
}
.account__header__tabs__buttons .button {
margin: 0 8px;
- color: #fff;
+ border: 1px solid;
border-radius: 4px;
+ color: #fff;
padding: 0px 16px;
height: 36px;
line-height: 36px;
diff --git a/fediembedi-client.php b/fediembedi-client.php
index 7c3f26c..d551839 100644
--- a/fediembedi-client.php
+++ b/fediembedi-client.php
@@ -76,7 +76,7 @@ class FediClient
$response = $this->_get('/api/v1/accounts/verify_credentials', null, $headers);
- if(property_exists($response, 'id')){
+ if(isset($response->id)){
$this->setStatic($response->id);
}
@@ -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..2ee3dac 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'] : null;
$height = isset( $instance['height'] ) ? esc_attr( $instance['height'] ) : '100%';
echo $args['before_widget'];
@@ -46,13 +47,14 @@ 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(WP_DEBUG_DISPLAY === true): echo 'PeerTube
'; var_dump($status); echo '
'; endif;
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 +81,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'] ) : '';
?>
@@ -98,6 +101,17 @@ class FediEmbedi_PeerTube extends WP_Widget {
+
+
+
-
-
-
@@ -126,6 +129,17 @@ class FediEmbedi_PeerTube extends WP_Widget {
+
+
+