diff --git a/fediembedi-client.php b/fediembedi-client.php index 440edfc..88c47ea 100644 --- a/fediembedi-client.php +++ b/fediembedi-client.php @@ -1,5 +1,8 @@ _post('/api/v1/apps', array( 'client_name' => 'FediEmbedi for WordPress', 'redirect_uris' => $redirect_uri, - 'scopes' => 'read', + 'scopes' => $scopes, 'website' => get_site_url() )); @@ -38,7 +41,7 @@ class Client $params = http_build_query(array( 'response_type' => 'code', 'redirect_uri' => $redirect_uri, - 'scope' => 'read', + 'scope' => $scopes, 'client_id' =>$this->app->client_id )); @@ -131,47 +134,6 @@ class Client return $response; } - public function postStatus($status, $mode, $media = '', $spoiler_text = '') { - - $headers = array( - 'Authorization'=> 'Bearer '.$this->access_token - ); - - $response = $this->_post('/api/v1/statuses', array( - 'status' => $status, - 'visibility' => $mode, - 'spoiler_text' => $spoiler_text, - 'media_ids[]' => $media - ), $headers); - - return $response; - } - - public function create_attachment($media_path) { - - $filename =basename($media_path); - $mime_type = mime_content_type($media_path); - - $boundary ='hlx'.time(); - - $headers = array ( - 'Authorization'=> 'Bearer '.$this->access_token, - 'Content-Type' => 'multipart/form-data; boundary='. $boundary, - ); - - $nl = "\r\n"; - - $data = '--'.$boundary.$nl; - $data .= 'Content-Disposition: form-data; name="file"; filename="'.$filename.'"'.$nl; - $data .= 'Content-Type: '. $mime_type .$nl.$nl; - $data .= file_get_contents($media_path) .$nl; - $data .= '--'.$boundary.'--'; - - $response = $this->_post('/api/v1/media', $data, $headers); - - return $response; - } - private function _post($url, $data = array(), $headers = array()) { return $this->post($this->instance_url.$url, $data, $headers); } diff --git a/form.tpl.php b/fediembedi-settings-form.tpl.php similarity index 69% rename from form.tpl.php rename to fediembedi-settings-form.tpl.php index 2a172b1..1f61391 100644 --- a/form.tpl.php +++ b/fediembedi-settings-form.tpl.php @@ -12,13 +12,16 @@ define("ADVANCED_VIEW",false);
"> - - + -
The currently supported software are Mastodon, Pleroma, Pixelfed. +
The currently supported software are Mastodon, Pleroma, Pixelfed.
+

Don't have an account?

+

Visit joinmastodon.org to find an instance.

+

Visit pixelfed.org/join to find an instance.

">