Merge branch 'master' of github.com:appwrite/appwrite into 0.7.x

This commit is contained in:
Eldad Fux
2020-10-13 16:30:59 +03:00
20 changed files with 274 additions and 17 deletions
+44
View File
@@ -0,0 +1,44 @@
---
name: 🐛 Bug Report
about: Submit a bug report to help us improve
labels: "bug"
---
## 🐛 Bug Report
(A clear and concise description of what the bug is)
## Have you spent some time to check if this issue has been raised before?
(Have you googled for a similar issue or checked our older issues for a similar bug)
## To Reproduce
(Write your steps here:)
## Expected behavior
<!--
How did you expect your project to behave?
Its fine if youre not sure your understanding is correct.
Write down what you thought would happen.
-->
(Write what you thought would happen.)
## Actual Behavior
<!--
Did something go wrong?
Is something broken, or not behaving as you expected?
Describe this section in detail, and attach screenshots if possible.
Don't only say "it doesn't work"!
-->
(Write what happened. Add screenshots, if applicable.)
## Your Environment
<!-- Include as many relevant details about the environment you experienced the bug in -->
(Write Environment, Operating system and version etc.)
+17
View File
@@ -0,0 +1,17 @@
---
name: 📚 Documentation
about: Report an issue related to documentation
labels: "documentation"
---
## 📚 Documentation
(A clear and concise description of what the issue is.)
## Have you spent some time to check if this issue has been raised before?
(Have you googled for a similar issue or checked our older issues for a similar bug)
### Have you read the [Code of Conduct](https://github.com/appwrite/appwrite/blob/master/CODE_OF_CONDUCT.md)?
(Write your answer here.)
+21
View File
@@ -0,0 +1,21 @@
---
name: 🚀 Feature
about: Submit a proposal for a new feature
labels: "feature"
---
## 🚀 Feature
(A clear and concise description of what the feature is.)
## Have you spent some time to check if this issue has been raised before?
(Have you googled for a similar issue or checked our older issues for a similar bug)
### Have you read the [Code of Conduct](https://github.com/appwrite/appwrite/blob/master/CODE_OF_CONDUCT.md)?
(Write your answer here.)
## Pitch
(Please explain why this feature should be implemented and how it would be used. Add examples, if applicable.)
+26
View File
@@ -0,0 +1,26 @@
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.
You can learn more about contributing to appwrite here: https://github.com/appwrite/appwrite/blob/master/CONTRIBUTING.md
Happy contributing!
-->
## What does this PR do?
(Provide a description of what this PR does.)
## Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)
## Related PRs and Issues
(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)
### Have you read the [Contributing Guidelines on issues](https://github.com/appwrite/appwrite/blob/master/CONTRIBUTING.md)?
(Write your answer here.)
+1 -1
View File
@@ -59,7 +59,7 @@
- Fixed update form labels and tooltips for Flutter Android apps
- Fixed missing custom scopes param for OAuth2 session create API route
- Fixed wrong JSON validation when creating and updating database documents
- Fixed bug where max file size was limited to max of 10MB
- Fixed bug where max file size was limited to a max of 10MB
- Fixed bug preventing the deletion of the project logo
- Fixed Bug when trying to overwrite OAuth cookie in the Flutter SDK
- Fixed OAuth redirect when using the self-hosted instance default success URL ([#454](https://github.com/appwrite/appwrite/issues/454))
+6 -1
View File
@@ -29,6 +29,7 @@ Table of Contents:
- [Windows](#windows)
- [CMD](#cmd)
- [PowerShell](#powershell)
- [Upgrade from an Older Version](#upgrade-from-an-older-version)
- [Getting Started](#getting-started)
- [Services](#services)
- [SDKs](#sdks)
@@ -82,6 +83,10 @@ Once the Docker installation completes, go to http://localhost to access the App
For advanced production and custom installation, check out our Docker [environment variables](docs/tutorials/environment-variables.md) docs. You can also use our public [docker-compose.yml](https://appwrite.io/docker-compose.yml) file to manually set up and environment.
### Upgrade from an Older Version
If you are upgrading your Appwrite server from an older version, you should use the Appwrite migration tool once your setup is completed. For more information regarding this, check out the [Installation Docs](https://appwrite.io/docs/installation).
## Getting Started
Getting started with Appwrite is as easy as creating a new project, choosing your platform, and integrating its SDK in your code. You can easily get started with your platform of choice by reading one of our Getting Started tutorials.
@@ -132,7 +137,7 @@ We truly ❤️ pull requests! If you wish to help, you can learn more about how
## Security
For security issues, kindly email us [security@appwrite.io](mailto:security@appwrite.io) instead of posting a public issue in GitHub.
For security issues, kindly email us at [security@appwrite.io](mailto:security@appwrite.io) instead of posting a public issue in GitHub.
## Follow Us
+1 -1
View File
@@ -11,4 +11,4 @@
## Reporting a Vulnerability
For security issues, kindly email us security@appwrite.io instead of posting a public issue in GitHub.
For security issues, kindly email us at security@appwrite.io instead of posting a public issue in GitHub.
@@ -44,7 +44,7 @@ return [
'CR' => 'Costa Rica',
'CU' => 'Kuba',
'CY' => 'Ciprus',
'CZ' => 'Tsjeggiese Republiek',
'CZ' => 'Tsjeggië',
'DE' => 'Duitsland',
'DJ' => 'Djiboeti',
'DM' => 'Dominica',
@@ -195,4 +195,4 @@ return [
'ZA' => 'Suid-Afrika',
'ZM' => 'Zambia',
'ZW' => 'Zimbabwe',
];
];
@@ -44,7 +44,7 @@ return [
'CR' => 'Costa Rica',
'CU' => 'Cuba',
'CY' => 'Chipre',
'CZ' => 'República Checa',
'CZ' => 'Chequia',
'DE' => 'Alemania',
'DJ' => 'Yibuti',
'DM' => 'Dominica',
@@ -44,7 +44,7 @@ return [
'CR' => 'Kosta Rika',
'CU' => 'Kuba',
'CY' => 'Kýpros',
'CZ' => 'Kekkoslovakia',
'CZ' => 'Kekkia',
'DE' => 'Týskland',
'DJ' => 'Djibouti',
'DM' => 'Dominika',
@@ -44,7 +44,7 @@ return [
'CR' => 'Costa Rica',
'CU' => 'Cuba',
'CY' => 'Chypre',
'CZ' => 'République Tchèque',
'CZ' => 'Tchéquie',
'DE' => 'Allemagne',
'DJ' => 'Djibouti',
'DM' => 'Dominique',
@@ -44,7 +44,7 @@ return [
'CR' => 'Costa Rica',
'CU' => 'Cuba',
'CY' => 'Cipro',
'CZ' => 'Repubblica Ceca',
'CZ' => 'Cechia',
'DE' => 'Germania',
'DJ' => 'Gibuti',
'DM' => 'Dominica',
@@ -13,7 +13,6 @@ return [
'AU' => 'ऑस्ट्रेलिया',
'AT' => 'ऑस्ट्रिया',
'AZ' => 'अजरबैजान',
'BI' => 'बुरुंडी',
'BE' => 'बेल्जियम',
'BJ' => 'बेनिन',
@@ -44,7 +44,7 @@ return [
'CR' => 'Kosta Rika',
'CU' => 'Kuba',
'CY' => 'Qipro',
'CZ' => 'Republika Czecheke',
'CZ' => 'Çekia',
'DE' => 'Gjermani',
'DJ' => 'Djibouti',
'DM' => 'Dominica',
@@ -195,4 +195,4 @@ return [
'ZA' => 'Afrika e Jugut',
'ZM' => 'Zambia',
'ZW' => 'Zimbabve',
];
];
@@ -44,7 +44,7 @@ return [
'CR' => 'Kosta Rika',
'CU' => 'Küba',
'CY' => 'Güney Kıbrıs Rum Kesimi',
'CZ' => 'Çek Cumhuriyeti',
'CZ' => 'Çekya',
'DE' => 'Almanya',
'DJ' => 'Cibuti',
'DM' => 'Dominika',
+9
View File
@@ -224,5 +224,14 @@ return [ // Ordered by ABC.
'form' => false,
'beta' => false,
'mock' => true,
],
'wordpress' => [
'name' => 'WordPress',
'developers' => 'https://developer.wordpress.com/docs/oauth2/',
'icon' => 'icon-wordpress',
'enabled' => true,
'form' => false,
'beta' => false,
'mock' => false
]
];
@@ -1,3 +1,3 @@
Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](/docs/client/account#updateAccountVerification).
Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](/docs/client/account#updateVerification).
Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
+3 -3
View File
@@ -26,7 +26,7 @@ Appwrite was built with scalability in mind. Appwrite can potentially scale hori
Appwrite uses a few containers to run, where each container has its job. Most of the Appwrite containers are stateless, and in order to scale them, all you need is run multiple instances of them and setup a load balancer in front of them.
If you decide to set up a load balancer for a specific container, make sure that the containers that are trying to communicate with him are accessing him trough a load balancer and not directly. All connections between Appwrite different containers are set using Docker environment variables.
If you decide to set up a load balancer for a specific container, make sure that the containers that are trying to communicate with it are accessing it through a load balancer and not directly. All connections between Appwrite different containers are set using Docker environment variables.
There are three Appwrite containers that do keep their state are the MariaDB, Redis, and InfluxDB containers that are used for storing data, cache, and stats (in this order). To scale them out, all you need to do is set up a standard cluster (just like you would with any other app using these technologies) according to your needs and performance.
@@ -34,7 +34,7 @@ There are three Appwrite containers that do keep their state are the MariaDB, Re
Sending emails is hard. There are a lot of SPAM rules and configurations to master in order to set a functional SMTP server. The SMTP server that comes packaged with Appwrite is great for development but needs some work done to function well against SPAM filters. You can find some guidelines in this [tutorial]([https://www.digitalocean.com/community/tutorials/how-to-use-an-spf-record-to-prevent-spoofing-improve-e-mail-reliability](https://www.digitalocean.com/community/tutorials/how-to-use-an-spf-record-to-prevent-spoofing-improve-e-mail-reliability)).
Another **easier option** is to use an SMTP as a service product like [Sendgrid]([https://sendgrid.com/](https://sendgrid.com/)) or [Mailgun]([https://www.mailgun.com/](https://www.mailgun.com/)). You can change Appwrite SMTP settings and credentials to any 3rrd party provider you like who support SMTP integration using our [Docker environment variables]([https://github.com/appwrite/appwrite/blob/master/docs/tutorials/environment-variables.md#smtp](https://github.com/appwrite/appwrite/blob/master/docs/tutorials/environment-variables.md#smtp)). Most services offer a decent free tier to get started with.
Another **easier option** is to use an SMTP as a service product like [Sendgrid]([https://sendgrid.com/](https://sendgrid.com/)) or [Mailgun]([https://www.mailgun.com/](https://www.mailgun.com/)). You can change Appwrite SMTP settings and credentials to any 3rd party provider you like who support SMTP integration using our [Docker environment variables]([https://github.com/appwrite/appwrite/blob/master/docs/tutorials/environment-variables.md#smtp](https://github.com/appwrite/appwrite/blob/master/docs/tutorials/environment-variables.md#smtp)). Most services offer a decent free tier to get started with.
## Backups
@@ -42,4 +42,4 @@ Backups are highly recommended for any production environment. Currently, there
1. Create a script to backups and restore your MariaDB Appwrite schema. Note that trying to backup MariaDB using a docker volume backup can result in a corrupted copy of your data. It is recommended to use MariaDB or MySQL built-in tools for this.
2. Create a script to backups and restore your InfluxDB stats. If you dont care much about your server stats, you can skip this.
3. Create a script to backup Appwrite storage volume. There are many [online resources]([https://blog.ssdnodes.com/blog/docker-backup-volumes/](https://blog.ssdnodes.com/blog/docker-backup-volumes/)) explaining different ways to backup a docker volume. When running on multiple servers, it is very recommended to use an attachable storage point. Some cloud providers offer integrated backups to such attachable mount, some of them are GCP, AWS, DigitalOcean, and the list continues.
3. Create a script to backup Appwrite storage volume. There are many [online resources]([https://blog.ssdnodes.com/blog/docker-backup-volumes/](https://blog.ssdnodes.com/blog/docker-backup-volumes/)) explaining different ways to backup a docker volume. When running on multiple servers, it is very recommended to use an attachable storage point. Some cloud providers offer integrated backups to such attachable mount like GCP, AWS, DigitalOcean, and the list continues.
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

+136
View File
@@ -0,0 +1,136 @@
<?php
namespace Appwrite\Auth\OAuth2;
use Appwrite\Auth\OAuth2;
// Reference Material
// https://developer.wordpress.com/docs/wpcc/
class WordPress extends OAuth2
{
/**
* @var array
*/
protected $user = [];
/**
* @var array
*/
protected $scopes = [
'auth',
];
/**
* @return string
*/
public function getName():string
{
return 'wordpress';
}
/**
* @return string
*/
public function getLoginURL():string
{
return 'https://public-api.wordpress.com/oauth2/authorize?'. \http_build_query([
'client_id' => $this->appID,
'redirect_uri' => $this->callback,
'response_type' => 'code',
'scope' => $this->getScopes(),
'state' => \json_encode($this->state)
]);
}
/**
* @param string $code
*
* @return string
*/
public function getAccessToken(string $code):string
{
$accessToken = $this->request(
'POST',
'https://public-api.wordpress.com/oauth2/token',
[],
\http_build_query([
'client_id' => $this->appID,
'redirect_uri' => $this->callback,
'client_secret' => $this->appSecret,
'grant_type' => 'authorization_code',
'code' => $code
])
);
$accessToken = \json_decode($accessToken, true);
if (isset($accessToken['access_token'])) {
return $accessToken['access_token'];
}
return '';
}
/**
* @param $accessToken
*
* @return string
*/
public function getUserID(string $accessToken):string
{
$user = $this->getUser($accessToken);
if (isset($user['ID'])) {
return $user['ID'];
}
return '';
}
/**
* @param $accessToken
*
* @return string
*/
public function getUserEmail(string $accessToken):string
{
$user = $this->getUser($accessToken);
if (isset($user['email']) && $user['verified']) {
return $user['email'];
}
return '';
}
/**
* @param $accessToken
*
* @return string
*/
public function getUserName(string $accessToken):string
{
$user = $this->getUser($accessToken);
if (isset($user['username'])) {
return $user['username'];
}
return '';
}
/**
* @param string $accessToken
*
* @return array
*/
protected function getUser(string $accessToken)
{
if (empty($this->user)) {
$this->user = \json_decode($this->request('GET', 'https://public-api.wordpress.com/rest/v1/me', ['Authorization: Bearer '.$accessToken]), true);
}
return $this->user;
}
}