1
0
Fork 0
mirror of synced 2024-06-26 18:20:43 +12:00

Merge branch '0.7.x' of github.com:appwrite/appwrite into swoole-and-functions

This commit is contained in:
Eldad Fux 2020-09-08 18:19:11 +03:00
commit 9f2b4f7438
16 changed files with 86 additions and 45 deletions

14
SECURITY.md Normal file
View file

@ -0,0 +1,14 @@
# Security Policy
## Supported Versions
| Version | Supported |
| ------- | ------------------ |
| < 0.5 | :x: |
| 0.6.x | :white_check_mark: |
| 0.7.x | :white_check_mark: |
| 0.8.0 | :white_check_mark: |
## Reporting a Vulnerability
For security issues, kindly email us security@appwrite.io instead of posting a public issue in GitHub.

View file

@ -30,7 +30,7 @@ return [
[
'key' => 'flutter',
'name' => 'Flutter',
'version' => '0.3.0-dev.1',
'version' => '0.3.0-dev.2',
'url' => 'https://github.com/appwrite/sdk-for-flutter',
'enabled' => true,
'beta' => true,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,3 +1,7 @@
## 0.3.0-dev.2
- Fix for an error when using a self-signed certificate for Web
## 0.3.0-dev.1
- Updated package dependencies (@lohanidamodar)

View file

@ -20,7 +20,7 @@ Add this to your package's `pubspec.yaml` file:
```yml
dependencies:
appwrite: ^0.3.0-dev.1
appwrite: ^0.3.0-dev.2
```
You can install packages from the command line:

View file

@ -35,7 +35,7 @@ class Client {
this.headers = {
'content-type': 'application/json',
'x-sdk-version': 'appwrite:flutter:0.3.0-dev.1',
'x-sdk-version': 'appwrite:flutter:0.3.0-dev.2',
};
this.config = {};
@ -101,7 +101,7 @@ class Client {
}
Future<Response> call(HttpMethod method, {String path = '', Map<String, String> headers = const {}, Map<String, dynamic> params = const {}}) async {
if(selfSigned) {
if(selfSigned && !kIsWeb) {
// Allow self signed requests
(http.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = (HttpClient client) {
client.badCertificateCallback = (X509Certificate cert, String host, int port) => true;

View file

@ -1,8 +1,10 @@
import 'dart:io';
import 'package:universal_html/html.dart' as html;
import 'package:dio/dio.dart';
import 'package:meta/meta.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_web_auth/flutter_web_auth.dart';
import "../client.dart";
@ -337,19 +339,26 @@ class Account extends Service {
query: query.join('&')
);
return FlutterWebAuth.authenticate(
url: url.toString(),
callbackUrlScheme: "appwrite-callback-" + client.config['project']
).then((value) async {
Uri url = Uri.parse(value);
Cookie cookie = new Cookie(url.queryParameters['key'], url.queryParameters['secret']);
cookie.domain = Uri.parse(client.endPoint).host;
cookie.httpOnly = true;
cookie.path = '/';
List<Cookie> cookies = [cookie];
await client.init();
client.cookieJar.saveFromResponse(Uri.parse(client.endPoint), cookies);
});
if(kIsWeb) {
html.window.location.href = url.toString();
return null;
}else{
return FlutterWebAuth.authenticate(
url: url.toString(),
callbackUrlScheme: "appwrite-callback-" + client.config['project']
).then((value) async {
Uri url = Uri.parse(value);
Cookie cookie = new Cookie(url.queryParameters['key'], url.queryParameters['secret']);
cookie.domain = Uri.parse(client.endPoint).host;
cookie.httpOnly = true;
cookie.path = '/';
List<Cookie> cookies = [cookie];
await client.init();
client.cookieJar.saveFromResponse(Uri.parse(client.endPoint), cookies);
});
}
}
/// Delete Account Session
@ -376,16 +385,17 @@ class Account extends Service {
/// 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 provider to be attached to the verification email. The provided URL
/// should redirect the user back for your app and allow you to complete the
/// 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).
///
/// 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)
/// 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.
///
///
Future<Response> createVerification({@required String url}) {
final String path = '/account/verification';

View file

@ -190,6 +190,10 @@ class Avatars extends Service {
'project': client.config['project'],
};
params.keys.forEach((key) {if (params[key] is int || params[key] is double) {
params[key] = params[key].toString();
}});
Uri endpoint = Uri.parse(client.endPoint);
Uri location = new Uri(scheme: endpoint.scheme,
host: endpoint.host,
@ -206,7 +210,7 @@ class Avatars extends Service {
/// Converts a given plain text to a QR code image. You can use the query
/// parameters to change the size and style of the resulting image.
///
String getQR({@required String text, int size = 400, int margin = 1, int download = 0}) {
String getQR({@required String text, int size = 400, int margin = 1, bool download = false}) {
final String path = '/avatars/qr';
final Map<String, dynamic> params = {

View file

@ -17,7 +17,7 @@ class Database extends Service {
/// of the project documents. [Learn more about different API
/// modes](/docs/admin).
///
Future<Response> listDocuments({@required String collectionId, List filters = const [], int offset = 0, int limit = 50, String orderField = '\$id', OrderType orderType = OrderType.asc, String orderCast = 'string', String search = '', int first = 0, int last = 0}) {
Future<Response> listDocuments({@required String collectionId, List filters = const [], int offset = 0, int limit = 50, String orderField = '\$id', OrderType orderType = OrderType.asc, String orderCast = 'string', String search = ''}) {
final String path = '/database/collections/{collectionId}/documents'.replaceAll(RegExp('{collectionId}'), collectionId);
final Map<String, dynamic> params = {
@ -28,8 +28,6 @@ class Database extends Service {
'orderType': orderType.name(),
'orderCast': orderCast,
'search': search,
'first': first,
'last': last,
};
final Map<String, String> headers = {

View file

@ -1,5 +1,5 @@
name: appwrite
version: 0.3.0-dev.1
version: 0.3.0-dev.2
description: Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API
homepage: https://appwrite.io
repository: https://github.com/appwrite/sdk-for-flutter
@ -15,6 +15,7 @@ dependencies:
cookie_jar: ^1.0.1
dio_cookie_manager: ^1.0.0
flutter_web_auth: ^0.2.4
universal_html: ^1.2.3
flutter:
sdk: flutter

View file

@ -4,8 +4,6 @@
use Utopia\App;
use Utopia\CLI\CLI;
use Utopia\Config\Config;
use Utopia\CLI\Console;
use Appwrite\Spec\Swagger2;
@ -24,12 +22,10 @@ use Appwrite\SDK\Language\Swift;
require_once __DIR__.'/../init.php';
$cli = new CLI();
$version = APP_VERSION_STABLE; // Server version
$warning = '**This SDK is compatible with Appwrite server version ' . $version . '. For older versions, please check previous releases.**';
$cli
->task('generate')
->action(function () use ($warning, $version) {
->action(function () {
function getSSLPage($url)
{
$ch = \curl_init();
@ -46,8 +42,14 @@ $cli
$platforms = Config::getParam('platforms');
$selected = \strtolower(Console::confirm('Choose SDK ("*" for all):'));
$version = Console::confirm('Choose an Appwrite version');
$message = Console::confirm('Please enter your commit message:');
$production = (Console::confirm('Type "Appwrite" to deploy for production') == 'Appwrite');
$warning = '**This SDK is compatible with Appwrite server version ' . $version . '. For older versions, please check previous releases.**';
if(!in_array($version, ['0.6.2', '0.7.0'])) {
throw new Exception('Unknown version given');
}
foreach($platforms as $key => $platform) {
foreach($platform['languages'] as $language) {
@ -60,11 +62,9 @@ $cli
continue;
}
Console::info('Fetching API Spec for '.$language['name'].' for '.$platform['name']);
Console::info('Fetching API Spec for '.$language['name'].' for '.$platform['name'] . ' (version: '.$version.')');
//$spec = getSSLPage('http://localhost/v1/open-api-2.json?extensions=1&platform='.$language['family']);
$spec = getSSLPage('https://appwrite.io/v1/open-api-2.json?extensions=1&platform='.$language['family']);
$spec = getSSLPage('https://localhost/v1/open-api-2.json?extensions=1&platform='.$language['family']);
$spec = file_get_contents(__DIR__.'/../config/specs/'.$version.'.'.$language['family'].'.json');
$result = \realpath(__DIR__.'/..').'/sdks/'.$key.'-'.$language['key'];
$target = \realpath(__DIR__.'/..').'/sdks/git/'.$language['key'].'/';

20
composer.lock generated
View file

@ -2054,7 +2054,7 @@
"source": {
"type": "git",
"url": "https://github.com/appwrite/sdk-generator",
"reference": "506b82a20a004724d88c3c95a090de30a2479a93"
"reference": "552f9d872210c8a689727dd3a661c163b3816686"
},
"require": {
"ext-curl": "*",
@ -2084,7 +2084,7 @@
}
],
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
"time": "2020-08-30T05:15:19+00:00"
"time": "2020-09-08T12:57:50+00:00"
},
{
"name": "doctrine/instantiator",
@ -2476,12 +2476,12 @@
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "13d9a6bb0b5bbb89d085c7d557c4b55499128eb9"
"reference": "069a785b2141f5bcf49f3e353548dc1cce6df556"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/13d9a6bb0b5bbb89d085c7d557c4b55499128eb9",
"reference": "13d9a6bb0b5bbb89d085c7d557c4b55499128eb9",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556",
"reference": "069a785b2141f5bcf49f3e353548dc1cce6df556",
"shasum": ""
},
"require": {
@ -2520,7 +2520,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": "2020-08-22T07:19:02+00:00"
"time": "2020-09-03T19:13:55+00:00"
},
{
"name": "phpdocumentor/type-resolver",
@ -2528,12 +2528,12 @@
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "e878a14a65245fbe78f8080eba03b47c3b705651"
"reference": "e21c0bd532911ec05ebc258e4086ea61c86e0750"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e878a14a65245fbe78f8080eba03b47c3b705651",
"reference": "e878a14a65245fbe78f8080eba03b47c3b705651",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e21c0bd532911ec05ebc258e4086ea61c86e0750",
"reference": "e21c0bd532911ec05ebc258e4086ea61c86e0750",
"shasum": ""
},
"require": {
@ -2565,7 +2565,7 @@
}
],
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
"time": "2020-06-27T10:12:23+00:00"
"time": "2020-09-02T21:29:45+00:00"
},
{
"name": "phpspec/prophecy",

View file

@ -1,3 +1,7 @@
## 0.3.0-dev.2
- Fix for an error when using a self-signed certificate for Web
## 0.3.0-dev.1
- Updated package dependencies (@lohanidamodar)