From e627b103c50067f302c424af21ec25f953d5868c Mon Sep 17 00:00:00 2001 From: Sugeng Sulistiyawan Date: Sat, 19 Oct 2024 22:32:28 +0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20Bugs=20Action=20For=20Ac?= =?UTF-8?q?cess=20File=20Google=20Drive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++--- src/GoogleCloudStorageComponent.php | 1 - src/GoogleDriveComponent.php | 17 ++++++++++++++++- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0d3577f..876ced4 100644 --- a/README.md +++ b/README.md @@ -241,7 +241,6 @@ return [ // 'scopes' => [], // 'quotaProject' => '', // 'userProject' => false, - // 'debug' => false, // 'prefix' => '', ], ], @@ -418,7 +417,7 @@ See: [masbug/flysystem-google-drive-ext](https://github.com/masbug/flysystem-goo Either run ```shell -composer require masbug/flysystem-google-drive-ext +composer require masbug/flysystem-google-drive-ext:^2.0 ``` or add @@ -443,7 +442,8 @@ return [ // 'teamDriveId' => '', // 'sharedFolderId' => '', // 'options' => [], - // 'debug' => false, + 'secret' => 'my-secret', // for secure route url + // 'action' => '/site/file', // action route // 'prefix' => '', ], ], diff --git a/src/GoogleCloudStorageComponent.php b/src/GoogleCloudStorageComponent.php index facfabc..e121876 100644 --- a/src/GoogleCloudStorageComponent.php +++ b/src/GoogleCloudStorageComponent.php @@ -31,7 +31,6 @@ * // 'scopes' => [], * // 'quotaProject' => '', * // 'userProject' => false, - * // 'debug' => false, * // 'prefix' => '', * ], * ], diff --git a/src/GoogleDriveComponent.php b/src/GoogleDriveComponent.php index 4ebd99e..47b3d0a 100644 --- a/src/GoogleDriveComponent.php +++ b/src/GoogleDriveComponent.php @@ -3,6 +3,7 @@ namespace diecoding\flysystem; use diecoding\flysystem\adapter\GoogleDriveAdapter; +use diecoding\flysystem\traits\UrlGeneratorComponentTrait; use Google\Client; use Google\Service\Drive; use yii\base\InvalidConfigException; @@ -22,7 +23,8 @@ * // 'teamDriveId' => '', * // 'sharedFolderId' => '', * // 'options' => [], - * // 'debug' => false, + * 'secret' => 'my-secret', // for secure route url + * // 'action' => '/site/file', // action route * // 'prefix' => '', * ], * ], @@ -34,6 +36,8 @@ */ class GoogleDriveComponent extends AbstractComponent { + use UrlGeneratorComponentTrait; + /** * @var string */ @@ -64,6 +68,11 @@ class GoogleDriveComponent extends AbstractComponent */ public $sharedFolderId; + /** + * @var string + */ + public $secret; + /** * @var array */ @@ -99,6 +108,12 @@ public function init() $this->options['sharedFolderId'] = $this->sharedFolderId; } + if (empty($this->secret)) { + throw new InvalidConfigException('The "secret" property must be set.'); + } + + $this->initEncrypter($this->secret); + parent::init(); }