diff --git a/bootstrap/css/bootstrap.min.css b/assets/bootstrap/css/bootstrap.min.css similarity index 100% rename from bootstrap/css/bootstrap.min.css rename to assets/bootstrap/css/bootstrap.min.css diff --git a/bootstrap/css/bootstrap.min.css.map b/assets/bootstrap/css/bootstrap.min.css.map similarity index 100% rename from bootstrap/css/bootstrap.min.css.map rename to assets/bootstrap/css/bootstrap.min.css.map diff --git a/mastodon/mastodon.css b/assets/mastodon.css similarity index 100% rename from mastodon/mastodon.css rename to assets/mastodon.css diff --git a/assets/peertube.css b/assets/peertube.css new file mode 100644 index 0000000..a229e1e --- /dev/null +++ b/assets/peertube.css @@ -0,0 +1,301 @@ +/* .scrollable { + contain: strict; +} */ +.scrollable { + overflow-y: scroll; + overflow-x: hidden; + flex: 1 1 auto; + -webkit-overflow-scrolling: touch; + will-change: transform; +} + +.status { + padding: 8px 10px 8px 68px; + position: relative; + min-height: 54px; + border-bottom: 1px solid #c0cdd9; + cursor: default; + opacity: 1; + -webkit-animation: fade .15s linear; + animation: fade .15s linear; +} +.status__prepend { + margin-left: 68px; + color: #444b5d; + padding: 8px 0 2px; + font-size: 14px; + position: relative; +} +.status__prepend-icon-wrapper { + left: -26px; + position: absolute; +} +.fa-fw { + width: 1.28571429em; + text-align: center; +} +.fa { + display: inline-block; + +} +.account__header { + overflow: hidden; +} +.account__header__image { + overflow: hidden; + height: 145px; + position: relative; + background: #e6ebf0; +} +.account__header__info { + position: absolute; + top: 10px; + left: 10px; +} +.account__header__image img { + object-fit: cover; + display: block; + width: 100%; + height: 100%; + margin: 0; +} +.account__header__bar { + position: relative; + background: #fff; + padding: 5px; + border-bottom: 1px solid #b3c3d1; +} +.account__header__tabs { + display: flex; + align-items: flex-start; + padding: 7px 5px; + margin-top: -55px; +} +.account__header__bar .avatar { + display: block; + flex: 0 0 auto; + width: 94px; + margin-left: -2px; +} +.account__header__tabs .spacer { + flex: 1 1 auto; +} +.account__header__tabs__buttons .button { + margin: 0 8px; + color: #fff; + border-radius: 4px; + padding: 0px 16px; + height: 36px; + line-height: 36px; +} +.account__header__tabs__name { + padding: 5px; +} +.account__header__tabs__name h1 { + font-size: 16px; + line-height: 24px; + color: #000; + font-weight: 500; + margin: 0; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} +.account__header__tabs__name h1 small { + display: block; + font-size: 14px; + color: #282c37; + font-weight: 400; + overflow: hidden; + text-overflow: ellipsis; +} +.account__header__extra { + margin-top: 4px; +} +.account__header__bio { + overflow: hidden; + margin: 0 -5px; +} +.account__header__bio .account__header__content { + padding: 20px 15px 5px; + color: #000; +} +.account__header__content { + color: #282c37; + font-size: 14px; + font-weight: 400; + overflow: hidden; + word-break: normal; + word-wrap: break-word; +} +.account__display-name, +.detailed-status__application, +.detailed-status__datetime, +.detailed-status__display-name, +.status__display-name, +.status__relative-time { + text-decoration: none; +} +.status__display-name { + color: #444b5d; +} +.status__expand { + width: 68px; + position: absolute; + left: 0; + top: 0; + height: 100%; + cursor: pointer; +} +.status__info { + font-size: 15px; +} +.status__info .status__display-name { + display: block; + max-width: 100%; + padding-right: 25px; +} +.status__avatar { + height: 48px; + left: 10px; + position: absolute; + top: 10px; + width: 48px; +} +.account__avatar { + border-radius: 4px; + background: transparent no-repeat; + background-position: 50%; + background-clip: padding-box; + position: relative; +} +.account__avatar-overlay { + width: 48px; + height: 48px; + background-size: 48px 48px; +} +.account__avatar-overlay-base { + border-radius: 4px; + background: transparent no-repeat; + background-position: 50%; + background-clip: padding-box; + width: 36px; + height: 36px; + background-size: 36px 36px; +} +.account__avatar-overlay-overlay { + border-radius: 4px; + background: transparent no-repeat; + background-position: 50%; + background-clip: padding-box; + width: 24px; + height: 24px; + background-size: 24px 24px; + position: absolute; + bottom: 0; + right: 0; + z-index: 1; +} +.display-name { + display: block; + max-width: 100%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.display-name__account { + font-size: 14px; +} +.account__display-name strong, .status__display-name strong { + color: #000; +} +.display-name__html { + font-weight: 500; +} +.notification__relative_time, .status__relative-time { + color: #444b5d; + float: right; + font-size: 14px; +} +.status-card.compact { + border-color: #ccd7e0; +} +.status-card { + display: flex; + font-size: 14px; + border: 1px solid #c0cdd9; + border-radius: 4px; + color: #444b5d; + margin-top: 14px; + text-decoration: none; + overflow: hidden; + cursor: pointer; +} +.status-card.compact .status-card__image { + flex: 0 0 60px; +} +.status-card__image { + flex: 0 0 100px; + background: #c0cdd9; + position: relative; +} +.status-card__image-image { + border-radius: 4px 0 0 4px; + display: block; + margin: 0; + width: 100%; + height: 100%; + object-fit: cover; + background-size: cover; + background-position: 50%; +} +.status-card.compact .status-card__content { + padding: 10px 8px 8px; +} +.status-card__content { + flex: 1 1 auto; + overflow: hidden; + padding: 14px 14px 14px 8px; +} +.status-card__title { + display: block; + font-weight: 500; + margin-bottom: 5px; + color: #282c37; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + text-decoration: none; +} +.status-card__description { + color: #282c37; +} +.status-card__host { + display: block; + margin-top: 5px; + font-size: 13px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.status__content summary { + background: #eee; + border-radius: 5px; + padding: 2px 8px; + cursor: pointer; + display: inline-block; +} +.status__content .media-gallery__item{ + margin: 1em 0; +} +i.fa-retweet { + background-image: url('../img/retoot.svg'); + background-position: 0 0; + height: 19px; + vertical-align: middle; + width: 22px; + color: #ccc; + opacity: .75; + z-index: 10; + position: relative; +} diff --git a/pixelfed/pixelfed.css b/assets/pixelfed.css similarity index 100% rename from pixelfed/pixelfed.css rename to assets/pixelfed.css diff --git a/fediembedi-client.php b/fediembedi-client.php index 88c47ea..2392a20 100644 --- a/fediembedi-client.php +++ b/fediembedi-client.php @@ -3,7 +3,7 @@ * The Client class contains all the methods to * connect to your fediverse instance */ -class Client +class FediClient { private $instance_url; private $access_token; @@ -48,6 +48,26 @@ class Client return $this->instance_url.'/oauth/authorize?'.$params; } + public function register_client($redirect_uri, $scopes = 'read') { + + $response = $this->_get('/api/v1/oauth-clients/local'); + + if (!isset($response->client_id)){ + return "ERROR"; + } + + $this->app = $response; + + $params = http_build_query(array( + 'scope' => $scopes, + 'client_id' =>$this->app->client_id, + 'client_secret' =>$this->app->client_secret + )); + + $access_token = $this->_post('/api/v1/oauth-clients/local'); +// return $this->instance_url.'/users/token?'.$params; + } + public function verify_credentials($access_token){ $headers = array( @@ -76,6 +96,16 @@ class Client return $response; } + public function get_user_token($client_id, $client_secret) { + + $response = $this->_post('/oauth/token',array( + 'client_id' => $client_id, + 'client_secret' => $client_secret, + )); + + return $response; + } + public function get_client_id() { return $this->app->client_id; } @@ -108,6 +138,44 @@ class Client return $response; } + public function getVideos($media = 'false', $pinned = 'false', $replies = 'false', $max_id = null, $since_id = null, $min_id = null, $limit = 10, $reblogs = 'false') { + + $headers = array( + 'Authorization'=> 'Bearer '.$this->access_token + ); + + $account_id = self::$acct_id; + + // $query = http_build_query(array( + // 'only_media' => $media, + // 'pinned' => $pinned, + // 'exclude_replies' => $replies, + // 'max_id' => $max_id, + // 'since_id' => $since_id, + // 'min_id' => $min_id, + // 'limit' => $limit, + // 'exclude_reblogs' => $reblogs + // )); + + $response = $this->_get("/api/v1/accounts/{$account_id}/videos", null, $headers); + + return $response; + } + + public function getTimelineHome() { + + $headers = array( + 'Authorization'=> 'Bearer '.$this->access_token + ); + + $account_id = self::$acct_id; + + $response = $this->_get("/api/v1/accounts/{$account_id}/lists", null, $headers); + //$response = $this->_get("/api/v1/timelines/home?limit=20", null, $headers); + + return $response; + } + public function getAccount() { $headers = array( diff --git a/fediembedi-settings-form.tpl.php b/fediembedi-settings-form.tpl.php index d8e3b89..e962f27 100644 --- a/fediembedi-settings-form.tpl.php +++ b/fediembedi-settings-form.tpl.php @@ -1,6 +1,5 @@ @@ -11,11 +10,11 @@ define("ADVANCED_VIEW",false);
-
"> - - +

@@ -23,11 +22,11 @@ define("ADVANCED_VIEW",false);

Visit joinmastodon.org to find an instance.

Visit pixelfed.org/join to find an instance.

-
"> +
">