mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -10,9 +10,11 @@
|
||||
[](https://hub.docker.com/r/appwrite/appwrite)
|
||||
[](https://discord.gg/GSeTUeA)
|
||||
[](https://travis-ci.org/appwrite/appwrite)
|
||||
[](https://github.com/appwrite/appwrite/stargazers)
|
||||
[](https://stackshare.io/appwrite)
|
||||
[](https://app.releasly.co/sites/appwrite/appwrite?utm_source=github_badge)
|
||||
[](https://opensource.org/licenses/BSD-3-Clause)
|
||||
[](https://twitter.com/appwrite_io)
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -85,7 +85,30 @@ return [
|
||||
'enabled' => true,
|
||||
'mock' => false,
|
||||
],
|
||||
|
||||
'discord' => [
|
||||
'developers' => 'https://discordapp.com/developers/docs/topics/oauth2',
|
||||
'icon' => 'icon-discord',
|
||||
'enabled' => true,
|
||||
'mock' => false,
|
||||
],
|
||||
'twitch' => [
|
||||
'developers' => 'https://dev.twitch.tv/docs/authentication',
|
||||
'icon' => 'icon-twitch',
|
||||
'enabled' => true,
|
||||
'mock' => false,
|
||||
],
|
||||
'spotify' => [
|
||||
'developers' => 'https://developer.spotify.com/documentation/general/guides/authorization-guide/',
|
||||
'icon' => 'icon-spotify',
|
||||
'enabled' => true,
|
||||
'mock' => false,
|
||||
],
|
||||
'yahoo' => [
|
||||
'developers' => 'https://developer.yahoo.com/oauth2/guide/flows_authcode/',
|
||||
'icon' => 'icon-yahoo',
|
||||
'enabled' => true,
|
||||
'mock' => false,
|
||||
],
|
||||
// Keep Last
|
||||
'mock' => [
|
||||
'developers' => 'https://appwrite.io',
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
global $utopia, $register, $response, $user, $audit, $project, $projectDB, $providers;
|
||||
|
||||
use Utopia\Exception;
|
||||
use Utopia\Validator\Assoc;
|
||||
use Utopia\Validator\Text;
|
||||
use Utopia\Validator\Email;
|
||||
use Utopia\Audit\Audit;
|
||||
@@ -59,12 +60,9 @@ $utopia->get('/v1/account/prefs')
|
||||
function () use ($response, $user) {
|
||||
$prefs = $user->getAttribute('prefs', '{}');
|
||||
|
||||
if (empty($prefs)) {
|
||||
$prefs = '[]';
|
||||
}
|
||||
|
||||
try {
|
||||
$prefs = json_decode($prefs, true);
|
||||
$prefs = ($prefs) ? $prefs : [];
|
||||
} catch (\Exception $error) {
|
||||
throw new Exception('Failed to parse prefs', 500);
|
||||
}
|
||||
@@ -302,12 +300,14 @@ $utopia->patch('/v1/account/prefs')
|
||||
->label('scope', 'account')
|
||||
->label('sdk.namespace', 'account')
|
||||
->label('sdk.method', 'updatePrefs')
|
||||
->param('prefs', '', function () { return new \Utopia\Validator\Mock();}, 'Prefs key-value JSON object string.')
|
||||
->param('prefs', '', function () { return new Assoc();}, 'Prefs key-value JSON object.')
|
||||
->label('sdk.description', '/docs/references/account/update-prefs.md')
|
||||
->action(
|
||||
function ($prefs) use ($response, $user, $projectDB, $audit) {
|
||||
$old = json_decode($user->getAttribute('prefs', '{}'), true);
|
||||
$old = ($old) ? $old : [];
|
||||
$user = $projectDB->updateDocument(array_merge($user->getArrayCopy(), [
|
||||
'prefs' => json_encode(array_merge(json_decode($user->getAttribute('prefs', '{}'), true), $prefs)),
|
||||
'prefs' => json_encode(array_merge($old, $prefs)),
|
||||
]));
|
||||
|
||||
if (false === $user) {
|
||||
|
||||
Generated
+86
-86
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "2517b024394e330941d36200186ba59f",
|
||||
"content-hash": "7f0595847c8db28a9cbfdc62f9c15c5f",
|
||||
"packages": [
|
||||
{
|
||||
"name": "appwrite/php-clamav",
|
||||
@@ -239,12 +239,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/composer/ca-bundle.git",
|
||||
"reference": "7a3805d21f689a972f02e8f7f3b9e28475c35d28"
|
||||
"reference": "47fe531de31fca4a1b997f87308e7d7804348f7e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/7a3805d21f689a972f02e8f7f3b9e28475c35d28",
|
||||
"reference": "7a3805d21f689a972f02e8f7f3b9e28475c35d28",
|
||||
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/47fe531de31fca4a1b997f87308e7d7804348f7e",
|
||||
"reference": "47fe531de31fca4a1b997f87308e7d7804348f7e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -287,7 +287,7 @@
|
||||
"ssl",
|
||||
"tls"
|
||||
],
|
||||
"time": "2019-12-20T14:03:23+00:00"
|
||||
"time": "2020-01-13T10:02:55+00:00"
|
||||
},
|
||||
{
|
||||
"name": "dasprid/enum",
|
||||
@@ -1336,12 +1336,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/cli.git",
|
||||
"reference": "27c44f67cb6ff5011ce017e981578dfe9328df78"
|
||||
"reference": "0d232917ec9afefdcb5d0fa486c6005e928e561a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/utopia-php/cli/zipball/27c44f67cb6ff5011ce017e981578dfe9328df78",
|
||||
"reference": "27c44f67cb6ff5011ce017e981578dfe9328df78",
|
||||
"url": "https://api.github.com/repos/utopia-php/cli/zipball/0d232917ec9afefdcb5d0fa486c6005e928e561a",
|
||||
"reference": "0d232917ec9afefdcb5d0fa486c6005e928e561a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1376,7 +1376,7 @@
|
||||
"upf",
|
||||
"utopia"
|
||||
],
|
||||
"time": "2019-12-09T13:04:38+00:00"
|
||||
"time": "2019-12-31T20:42:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/framework",
|
||||
@@ -1384,12 +1384,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/framework.git",
|
||||
"reference": "79d065bbb311a1af626625c1208c9a12b4c970f5"
|
||||
"reference": "aedc4352a5457a6aab518eb59d46848da5261593"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/utopia-php/framework/zipball/79d065bbb311a1af626625c1208c9a12b4c970f5",
|
||||
"reference": "79d065bbb311a1af626625c1208c9a12b4c970f5",
|
||||
"url": "https://api.github.com/repos/utopia-php/framework/zipball/aedc4352a5457a6aab518eb59d46848da5261593",
|
||||
"reference": "aedc4352a5457a6aab518eb59d46848da5261593",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1420,7 +1420,7 @@
|
||||
"php",
|
||||
"upf"
|
||||
],
|
||||
"time": "2019-12-09T13:03:18+00:00"
|
||||
"time": "2020-01-18T18:26:28+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/locale",
|
||||
@@ -1726,12 +1726,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/myclabs/DeepCopy.git",
|
||||
"reference": "579bb7356d91f9456ccd505f24ca8b667966a0a7"
|
||||
"reference": "b2c28789e80a97badd14145fda39b545d83ca3ef"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/579bb7356d91f9456ccd505f24ca8b667966a0a7",
|
||||
"reference": "579bb7356d91f9456ccd505f24ca8b667966a0a7",
|
||||
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/b2c28789e80a97badd14145fda39b545d83ca3ef",
|
||||
"reference": "b2c28789e80a97badd14145fda39b545d83ca3ef",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1766,7 +1766,7 @@
|
||||
"object",
|
||||
"object graph"
|
||||
],
|
||||
"time": "2019-12-15T19:12:40+00:00"
|
||||
"time": "2020-01-17T21:11:47+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phar-io/manifest",
|
||||
@@ -1774,12 +1774,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phar-io/manifest.git",
|
||||
"reference": "b54265b8c837ac11b11465a910487574bca3d41f"
|
||||
"reference": "3d94e3b6eb309e921a100a4992f72314299bb03f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phar-io/manifest/zipball/b54265b8c837ac11b11465a910487574bca3d41f",
|
||||
"reference": "b54265b8c837ac11b11465a910487574bca3d41f",
|
||||
"url": "https://api.github.com/repos/phar-io/manifest/zipball/3d94e3b6eb309e921a100a4992f72314299bb03f",
|
||||
"reference": "3d94e3b6eb309e921a100a4992f72314299bb03f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1825,7 +1825,7 @@
|
||||
}
|
||||
],
|
||||
"description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)",
|
||||
"time": "2019-12-11T21:24:15+00:00"
|
||||
"time": "2019-12-29T10:29:09+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phar-io/version",
|
||||
@@ -1932,12 +1932,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
|
||||
"reference": "c5a39003d5c0ef8e605d123d23355b1cb4112735"
|
||||
"reference": "cf16f630f2211d388b8d254bf2ea936c232b3cb4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/c5a39003d5c0ef8e605d123d23355b1cb4112735",
|
||||
"reference": "c5a39003d5c0ef8e605d123d23355b1cb4112735",
|
||||
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cf16f630f2211d388b8d254bf2ea936c232b3cb4",
|
||||
"reference": "cf16f630f2211d388b8d254bf2ea936c232b3cb4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1977,7 +1977,7 @@
|
||||
}
|
||||
],
|
||||
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
|
||||
"time": "2019-12-27T20:42:04+00:00"
|
||||
"time": "2020-01-16T08:49:07+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/type-resolver",
|
||||
@@ -2248,12 +2248,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/php-timer.git",
|
||||
"reference": "2c84d1b7d56c8fe6988d16a9119a18d995f18c74"
|
||||
"reference": "0f76cad901d778be0e908160d850b5469b9dff89"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/2c84d1b7d56c8fe6988d16a9119a18d995f18c74",
|
||||
"reference": "2c84d1b7d56c8fe6988d16a9119a18d995f18c74",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/0f76cad901d778be0e908160d850b5469b9dff89",
|
||||
"reference": "0f76cad901d778be0e908160d850b5469b9dff89",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2289,7 +2289,7 @@
|
||||
"keywords": [
|
||||
"timer"
|
||||
],
|
||||
"time": "2019-12-27T07:40:22+00:00"
|
||||
"time": "2020-01-17T12:26:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-token-stream",
|
||||
@@ -2297,12 +2297,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
|
||||
"reference": "4a863f9ce1871119671a4a7e90333f499b22a0e7"
|
||||
"reference": "80d6b894fd17bbeb2c6432209afbda84c34e129d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/4a863f9ce1871119671a4a7e90333f499b22a0e7",
|
||||
"reference": "4a863f9ce1871119671a4a7e90333f499b22a0e7",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/80d6b894fd17bbeb2c6432209afbda84c34e129d",
|
||||
"reference": "80d6b894fd17bbeb2c6432209afbda84c34e129d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2338,7 +2338,7 @@
|
||||
"keywords": [
|
||||
"tokenizer"
|
||||
],
|
||||
"time": "2019-12-27T07:40:11+00:00"
|
||||
"time": "2020-01-17T12:30:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
@@ -2346,12 +2346,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "2076dc78f288aa7156c26d21032be04c4f4f46e7"
|
||||
"reference": "c1f3abbf7ae96fa6491c5a25f8d5c4c57ff11d43"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2076dc78f288aa7156c26d21032be04c4f4f46e7",
|
||||
"reference": "2076dc78f288aa7156c26d21032be04c4f4f46e7",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c1f3abbf7ae96fa6491c5a25f8d5c4c57ff11d43",
|
||||
"reference": "c1f3abbf7ae96fa6491c5a25f8d5c4c57ff11d43",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2422,7 +2422,7 @@
|
||||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2019-12-27T10:28:55+00:00"
|
||||
"time": "2020-01-17T12:47:07+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/code-unit-reverse-lookup",
|
||||
@@ -2430,12 +2430,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git",
|
||||
"reference": "5a1086ca6f2307d3d05699535f0aed498cd04605"
|
||||
"reference": "f48317adc82e5b3f6d2b369af78e2a721d027f5d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/5a1086ca6f2307d3d05699535f0aed498cd04605",
|
||||
"reference": "5a1086ca6f2307d3d05699535f0aed498cd04605",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/f48317adc82e5b3f6d2b369af78e2a721d027f5d",
|
||||
"reference": "f48317adc82e5b3f6d2b369af78e2a721d027f5d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2467,7 +2467,7 @@
|
||||
],
|
||||
"description": "Looks up which function or method a line of code belongs to",
|
||||
"homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
|
||||
"time": "2019-12-27T07:40:57+00:00"
|
||||
"time": "2020-01-17T12:04:18+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/comparator",
|
||||
@@ -2475,12 +2475,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/comparator.git",
|
||||
"reference": "b9494f5255afdf7ff522fb99ab39024ec4b066a0"
|
||||
"reference": "99ca128ebc89c8b52a833cc8509d1a96f68c8029"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/b9494f5255afdf7ff522fb99ab39024ec4b066a0",
|
||||
"reference": "b9494f5255afdf7ff522fb99ab39024ec4b066a0",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/99ca128ebc89c8b52a833cc8509d1a96f68c8029",
|
||||
"reference": "99ca128ebc89c8b52a833cc8509d1a96f68c8029",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2531,7 +2531,7 @@
|
||||
"compare",
|
||||
"equality"
|
||||
],
|
||||
"time": "2019-12-27T07:40:38+00:00"
|
||||
"time": "2020-01-17T12:00:41+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/diff",
|
||||
@@ -2539,12 +2539,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/diff.git",
|
||||
"reference": "81601e236afb661d9ddb85a9d8467a6f1156cd2f"
|
||||
"reference": "cffa47fbd31d34858a8fae5235445af221689028"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/81601e236afb661d9ddb85a9d8467a6f1156cd2f",
|
||||
"reference": "81601e236afb661d9ddb85a9d8467a6f1156cd2f",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/cffa47fbd31d34858a8fae5235445af221689028",
|
||||
"reference": "cffa47fbd31d34858a8fae5235445af221689028",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2552,7 +2552,7 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^7.5 || ^8.0",
|
||||
"symfony/process": "^2 || ^3.3 || ^4 || ^5"
|
||||
"symfony/process": "^4 || ^5"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
@@ -2587,7 +2587,7 @@
|
||||
"unidiff",
|
||||
"unified diff"
|
||||
],
|
||||
"time": "2019-12-27T07:42:46+00:00"
|
||||
"time": "2020-01-17T12:05:53+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/environment",
|
||||
@@ -2595,12 +2595,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/environment.git",
|
||||
"reference": "e6e8e5503d69e910ad16340d55dd208307a8bcf0"
|
||||
"reference": "635345ff4f2262c07379fdbb4ead0ca14efa941b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/e6e8e5503d69e910ad16340d55dd208307a8bcf0",
|
||||
"reference": "e6e8e5503d69e910ad16340d55dd208307a8bcf0",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/635345ff4f2262c07379fdbb4ead0ca14efa941b",
|
||||
"reference": "635345ff4f2262c07379fdbb4ead0ca14efa941b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2640,7 +2640,7 @@
|
||||
"environment",
|
||||
"hhvm"
|
||||
],
|
||||
"time": "2019-12-27T07:41:20+00:00"
|
||||
"time": "2020-01-17T12:13:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/exporter",
|
||||
@@ -2648,12 +2648,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/exporter.git",
|
||||
"reference": "5c4345bb9a966b8e5c5db0ff7415defb7811aabb"
|
||||
"reference": "a20d741c53278346c3d06b11679f2ac11b514a42"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/5c4345bb9a966b8e5c5db0ff7415defb7811aabb",
|
||||
"reference": "5c4345bb9a966b8e5c5db0ff7415defb7811aabb",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/a20d741c53278346c3d06b11679f2ac11b514a42",
|
||||
"reference": "a20d741c53278346c3d06b11679f2ac11b514a42",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2707,7 +2707,7 @@
|
||||
"export",
|
||||
"exporter"
|
||||
],
|
||||
"time": "2019-12-27T07:41:40+00:00"
|
||||
"time": "2020-01-17T12:16:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/global-state",
|
||||
@@ -2766,12 +2766,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/object-enumerator.git",
|
||||
"reference": "2433e3c454abf3c1d3d2d7dcef3d8ce9f85f371c"
|
||||
"reference": "9b995602514d979119740cfc2f8b0a9ba5fa20f0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/2433e3c454abf3c1d3d2d7dcef3d8ce9f85f371c",
|
||||
"reference": "2433e3c454abf3c1d3d2d7dcef3d8ce9f85f371c",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/9b995602514d979119740cfc2f8b0a9ba5fa20f0",
|
||||
"reference": "9b995602514d979119740cfc2f8b0a9ba5fa20f0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2805,7 +2805,7 @@
|
||||
],
|
||||
"description": "Traverses array structures and object graphs to enumerate all referenced objects",
|
||||
"homepage": "https://github.com/sebastianbergmann/object-enumerator/",
|
||||
"time": "2019-12-27T07:41:54+00:00"
|
||||
"time": "2020-01-17T12:21:33+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/object-reflector",
|
||||
@@ -2813,12 +2813,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/object-reflector.git",
|
||||
"reference": "b460ee91c739fff47e91ed09584ae4c0f83483a4"
|
||||
"reference": "1df36c0abf55daf0c71d053c905b146b83c5cac4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b460ee91c739fff47e91ed09584ae4c0f83483a4",
|
||||
"reference": "b460ee91c739fff47e91ed09584ae4c0f83483a4",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/1df36c0abf55daf0c71d053c905b146b83c5cac4",
|
||||
"reference": "1df36c0abf55daf0c71d053c905b146b83c5cac4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2850,7 +2850,7 @@
|
||||
],
|
||||
"description": "Allows reflection of object attributes, including inherited and non-public ones",
|
||||
"homepage": "https://github.com/sebastianbergmann/object-reflector/",
|
||||
"time": "2019-12-27T07:41:47+00:00"
|
||||
"time": "2020-01-17T12:24:06+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/recursion-context",
|
||||
@@ -2858,12 +2858,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/recursion-context.git",
|
||||
"reference": "7e026994ce2247128670301c684d1ea4c4fd58c1"
|
||||
"reference": "6cb3d7ee69cd8c5f89e35832e30a7ed478ec262f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/7e026994ce2247128670301c684d1ea4c4fd58c1",
|
||||
"reference": "7e026994ce2247128670301c684d1ea4c4fd58c1",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/6cb3d7ee69cd8c5f89e35832e30a7ed478ec262f",
|
||||
"reference": "6cb3d7ee69cd8c5f89e35832e30a7ed478ec262f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2903,7 +2903,7 @@
|
||||
],
|
||||
"description": "Provides functionality to recursively process PHP variables",
|
||||
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
|
||||
"time": "2019-12-27T07:42:02+00:00"
|
||||
"time": "2020-01-17T12:28:51+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/resource-operations",
|
||||
@@ -2996,12 +2996,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-ctype.git",
|
||||
"reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3"
|
||||
"reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3",
|
||||
"reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/fbdeaec0df06cf3d51c93de80c7eb76e271f5a38",
|
||||
"reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3013,7 +3013,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.13-dev"
|
||||
"dev-master": "1.14-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -3046,7 +3046,7 @@
|
||||
"polyfill",
|
||||
"portable"
|
||||
],
|
||||
"time": "2019-11-27T13:56:44+00:00"
|
||||
"time": "2020-01-13T11:15:53+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
@@ -3054,12 +3054,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||
"reference": "7b4aab9743c30be783b73de055d24a39cf4b954f"
|
||||
"reference": "34094cfa9abe1f0f14f48f490772db7a775559f2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f",
|
||||
"reference": "7b4aab9743c30be783b73de055d24a39cf4b954f",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/34094cfa9abe1f0f14f48f490772db7a775559f2",
|
||||
"reference": "34094cfa9abe1f0f14f48f490772db7a775559f2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3071,7 +3071,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.13-dev"
|
||||
"dev-master": "1.14-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -3105,7 +3105,7 @@
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"time": "2019-11-27T14:18:11+00:00"
|
||||
"time": "2020-01-13T11:15:53+00:00"
|
||||
},
|
||||
{
|
||||
"name": "theseer/tokenizer",
|
||||
@@ -3153,12 +3153,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/twigphp/Twig.git",
|
||||
"reference": "41a87b972972c81d35fe9718e9432c659e48b6dd"
|
||||
"reference": "e52bcf67cfc047c3aeecb67b6db462165ae3d7a6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/twigphp/Twig/zipball/41a87b972972c81d35fe9718e9432c659e48b6dd",
|
||||
"reference": "41a87b972972c81d35fe9718e9432c659e48b6dd",
|
||||
"url": "https://api.github.com/repos/twigphp/Twig/zipball/e52bcf67cfc047c3aeecb67b6db462165ae3d7a6",
|
||||
"reference": "e52bcf67cfc047c3aeecb67b6db462165ae3d7a6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3210,7 +3210,7 @@
|
||||
"keywords": [
|
||||
"templating"
|
||||
],
|
||||
"time": "2019-12-28T07:14:03+00:00"
|
||||
"time": "2020-01-13T08:20:25+00:00"
|
||||
},
|
||||
{
|
||||
"name": "webmozart/assert",
|
||||
@@ -3267,7 +3267,7 @@
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": ">=7.3.0",
|
||||
"php": ">=7.4.0",
|
||||
"ext-curl": "*",
|
||||
"ext-imagick": "*",
|
||||
"ext-mbstring": "*",
|
||||
@@ -3281,6 +3281,6 @@
|
||||
},
|
||||
"platform-dev": [],
|
||||
"platform-overrides": {
|
||||
"php": "7.3"
|
||||
"php": "7.4"
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ services:
|
||||
command: 'mysqld --innodb-flush-method=fsync'
|
||||
|
||||
smtp:
|
||||
image: appwrite/smtp:1.0.0
|
||||
image: appwrite/smtp:1.0.1
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- appwrite
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 5.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
@@ -1,5 +1,5 @@
|
||||
@config-width: 910px;
|
||||
@config-width-xxl: 1100px;
|
||||
@config-width-xxl: 1000px;
|
||||
@config-width-xl: 910px;
|
||||
@config-width-large: 700px;
|
||||
@config-width-medium: 550px;
|
||||
@@ -10,6 +10,7 @@
|
||||
@config-color-normal: #40404c;
|
||||
@config-color-focus: #f02e65;
|
||||
@config-color-focus-fade: #fff6f9;
|
||||
@config-color-focus-hover: #ff729b;
|
||||
@config-color-focus-glow: #fce5ec;
|
||||
@config-color-focus-dark: #c52653;
|
||||
@config-color-fade: #818181;
|
||||
|
||||
@@ -31,7 +31,7 @@ button,
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
background: @config-color-focus-dark;
|
||||
background: @config-color-focus-hover;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
@@ -74,8 +74,8 @@ button,
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
color: @config-color-focus-dark;
|
||||
border-color: @config-color-focus-dark;
|
||||
color: @config-color-focus-hover;
|
||||
border-color: @config-color-focus-hover;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@
|
||||
}
|
||||
|
||||
.container {
|
||||
overflow: scroll;
|
||||
overflow: auto;
|
||||
height: ~"calc(100% - 183px)";
|
||||
padding-bottom: 50px;
|
||||
width: 100%;
|
||||
@@ -752,4 +752,4 @@
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
<?php
|
||||
|
||||
namespace Auth\OAuth;
|
||||
|
||||
use Auth\OAuth;
|
||||
|
||||
// Reference Material
|
||||
// https://discordapp.com/developers/docs/topics/oauth2
|
||||
|
||||
class Discord extends OAuth
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $endpoint = 'https://discordapp.com/api';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $user = [];
|
||||
|
||||
|
||||
protected $scope = [
|
||||
'identify',
|
||||
'email'
|
||||
];
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return 'discord';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLoginURL(): string
|
||||
{
|
||||
$url = $this->endpoint . '/oauth2/authorize?'.
|
||||
http_build_query([
|
||||
'response_type' => 'code',
|
||||
'client_id' => $this->appID,
|
||||
'scope' => implode(' ', $this->scope),
|
||||
'redirect_uri' => $this->callback
|
||||
]);
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $code
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessToken(string $code): string
|
||||
{
|
||||
$accessToken = $this->request(
|
||||
'POST',
|
||||
$this->endpoint . '/oauth2/token',
|
||||
['Content-Type: application/x-www-form-urlencoded'],
|
||||
http_build_query([
|
||||
'grant_type' => 'authorization_code',
|
||||
'code' => $code,
|
||||
'redirect_uri' => $this->callback,
|
||||
'client_id' => $this->appID,
|
||||
'client_secret' => $this->appSecret,
|
||||
'scope' => implode(' ', $this->scope)
|
||||
])
|
||||
);
|
||||
|
||||
|
||||
$accessToken = json_decode($accessToken, true);
|
||||
|
||||
|
||||
if (isset($accessToken['access_token'])) {
|
||||
return $accessToken['access_token'];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $accessToken
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUserID(string $accessToken): string
|
||||
{
|
||||
$user = $this->getUser($accessToken);
|
||||
|
||||
if (isset($user['id'])) {
|
||||
return $user['id'];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $accessToken
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUserEmail(string $accessToken): string
|
||||
{
|
||||
$user = $this->getUser($accessToken);
|
||||
|
||||
if (isset($user['email'])) {
|
||||
return $user['email'];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $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): array
|
||||
{
|
||||
if (empty($this->user)) {
|
||||
$user = $this->request(
|
||||
'GET',
|
||||
$this->endpoint . '/users/@me',
|
||||
['Authorization: Bearer '.urlencode($accessToken)]
|
||||
);
|
||||
$this->user = json_decode($user, true);
|
||||
}
|
||||
|
||||
return $this->user;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
<?php
|
||||
|
||||
namespace Auth\OAuth;
|
||||
|
||||
use Auth\OAuth;
|
||||
|
||||
// Reference Material
|
||||
// https://dev.twitch.tv/docs/authentication
|
||||
|
||||
class Spotify extends OAuth
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $endpoint = 'https://accounts.spotify.com/';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $resourceEndpoint = 'https://api.spotify.com/v1/';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $scope = [
|
||||
'user-read-email',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $user = [];
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName():string
|
||||
{
|
||||
return 'spotify';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLoginURL():string
|
||||
{
|
||||
return $this->endpoint . 'authorize?'.
|
||||
http_build_query([
|
||||
'response_type' => 'code',
|
||||
'client_id' => $this->appID,
|
||||
'scope' => implode(' ', $this->scope),
|
||||
'redirect_uri' => $this->callback,
|
||||
'state' => json_encode($this->state)
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $code
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessToken(string $code):string
|
||||
{
|
||||
$header = "Authorization: Basic " . base64_encode($this->appID . ":" . $this->appSecret);
|
||||
$result = json_decode($this->request(
|
||||
'POST',
|
||||
$this->endpoint . 'api/token',
|
||||
[$header],
|
||||
http_build_query([
|
||||
"code" => $code,
|
||||
"grant_type" => "authorization_code",
|
||||
"redirect_uri" => $this->callback
|
||||
])
|
||||
), true);
|
||||
|
||||
if (isset($result['access_token'])) {
|
||||
return $result['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'])) {
|
||||
return $user['email'];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $accessToken
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUserName(string $accessToken):string
|
||||
{
|
||||
$user = $this->getUser($accessToken);
|
||||
|
||||
if (isset($user['display_name'])) {
|
||||
return $user['display_name'];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $accessToken
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getUser(string $accessToken)
|
||||
{
|
||||
if (empty($this->user)) {
|
||||
$this->user = json_decode($this->request('GET',
|
||||
$this->resourceEndpoint . "me", ['Authorization: Bearer '.urlencode($accessToken)]), true);
|
||||
}
|
||||
|
||||
return $this->user;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
|
||||
namespace Auth\OAuth;
|
||||
|
||||
use Auth\OAuth;
|
||||
|
||||
// Reference Material
|
||||
// https://dev.twitch.tv/docs/authentication
|
||||
|
||||
class Twitch extends OAuth
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $endpoint = 'https://id.twitch.tv/oauth2/';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $resourceEndpoint = 'https://api.twitch.tv/helix/users';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $scope = [
|
||||
'user:read:email',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $user = [];
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName():string
|
||||
{
|
||||
return 'twitch';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLoginURL():string
|
||||
{
|
||||
return $this->endpoint . 'authorize?'.
|
||||
http_build_query([
|
||||
'response_type' => 'code',
|
||||
'client_id' => $this->appID,
|
||||
'scope' => implode(' ', $this->scope),
|
||||
'redirect_uri' => $this->callback,
|
||||
'force_verify' => true,
|
||||
'state' => json_encode($this->state)
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $code
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessToken(string $code):string
|
||||
{
|
||||
$result = json_decode($this->request(
|
||||
'POST',
|
||||
$this->endpoint . 'token',
|
||||
[],
|
||||
http_build_query([
|
||||
"client_id" => $this->appID,
|
||||
"client_secret" => $this->appSecret,
|
||||
"code" => $code,
|
||||
"grant_type" => "authorization_code",
|
||||
"redirect_uri" => $this->callback
|
||||
])
|
||||
), true);
|
||||
|
||||
if (isset($result['access_token'])) {
|
||||
return $result['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'])) {
|
||||
return $user['email'];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $accessToken
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUserName(string $accessToken):string
|
||||
{
|
||||
$user = $this->getUser($accessToken);
|
||||
|
||||
if (isset($user['display_name'])) {
|
||||
return $user['display_name'];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $accessToken
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getUser(string $accessToken)
|
||||
{
|
||||
if (empty($this->user)) {
|
||||
$this->user = json_decode($this->request('GET',
|
||||
$this->resourceEndpoint, ['Authorization: Bearer '.urlencode($accessToken)]), true)['data']['0'];
|
||||
}
|
||||
|
||||
return $this->user;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
<?php
|
||||
|
||||
namespace Auth\OAuth;
|
||||
|
||||
use Auth\OAuth;
|
||||
|
||||
// Reference Material
|
||||
// https://developer.yahoo.com/oauth2/guide/
|
||||
|
||||
class Yahoo extends OAuth
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $endpoint = 'https://api.login.yahoo.com/oauth2/';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $resourceEndpoint = 'https://api.login.yahoo.com/openid/v1/userinfo';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $scope = [
|
||||
'sdct-r',
|
||||
'sdpp-w',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $user = [];
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName():string
|
||||
{
|
||||
return 'yahoo';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $state
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function parseState(string $state)
|
||||
{
|
||||
return json_decode(html_entity_decode($state), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLoginURL():string
|
||||
{
|
||||
return $this->endpoint . 'request_auth?'.
|
||||
http_build_query([
|
||||
'response_type' => 'code',
|
||||
'client_id' => $this->appID,
|
||||
'scope' => implode(' ', $this->scope),
|
||||
'redirect_uri' => $this->callback,
|
||||
'state' => json_encode($this->state)
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $code
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessToken(string $code):string
|
||||
{
|
||||
$header = [
|
||||
"Authorization: Basic " . base64_encode($this->appID . ":" . $this->appSecret),
|
||||
"Content-Type: application/x-www-form-urlencoded",
|
||||
];
|
||||
|
||||
$result = json_decode($this->request(
|
||||
'POST',
|
||||
$this->endpoint . 'get_token',
|
||||
$header,
|
||||
http_build_query([
|
||||
"code" => $code,
|
||||
"grant_type" => "authorization_code",
|
||||
"redirect_uri" => $this->callback
|
||||
])
|
||||
), true);
|
||||
|
||||
if (isset($result['access_token'])) {
|
||||
return $result['access_token'];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $accessToken
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUserID(string $accessToken):string
|
||||
{
|
||||
$user = $this->getUser($accessToken);
|
||||
|
||||
if (isset($user['sub'])) {
|
||||
return $user['sub'];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $accessToken
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUserEmail(string $accessToken):string
|
||||
{
|
||||
$user = $this->getUser($accessToken);
|
||||
|
||||
if (isset($user['email'])) {
|
||||
return $user['email'];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $accessToken
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUserName(string $accessToken):string
|
||||
{
|
||||
$user = $this->getUser($accessToken);
|
||||
|
||||
if (isset($user['name'])) {
|
||||
return $user['name'];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $accessToken
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getUser(string $accessToken)
|
||||
{
|
||||
if (empty($this->user)) {
|
||||
$this->user = json_decode($this->request('GET',
|
||||
$this->resourceEndpoint, ['Authorization: Bearer '.urlencode($accessToken)]), true);
|
||||
}
|
||||
|
||||
return $this->user;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user