Skip to content

Commit

Permalink
🐛 Fixed Bugs Action For Access File Google Drive
Browse files Browse the repository at this point in the history
  • Loading branch information
sugeng-sulistiyawan committed Oct 19, 2024
1 parent fb18323 commit e627b10
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ return [
// 'scopes' => [],
// 'quotaProject' => '',
// 'userProject' => false,
// 'debug' => false,
// 'prefix' => '',
],
],
Expand Down Expand Up @@ -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
Expand All @@ -443,7 +442,8 @@ return [
// 'teamDriveId' => '',
// 'sharedFolderId' => '',
// 'options' => [],
// 'debug' => false,
'secret' => 'my-secret', // for secure route url
// 'action' => '/site/file', // action route
// 'prefix' => '',
],
],
Expand Down
1 change: 0 additions & 1 deletion src/GoogleCloudStorageComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
* // 'scopes' => [],
* // 'quotaProject' => '',
* // 'userProject' => false,
* // 'debug' => false,
* // 'prefix' => '',
* ],
* ],
Expand Down
17 changes: 16 additions & 1 deletion src/GoogleDriveComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -22,7 +23,8 @@
* // 'teamDriveId' => '',
* // 'sharedFolderId' => '',
* // 'options' => [],
* // 'debug' => false,
* 'secret' => 'my-secret', // for secure route url
* // 'action' => '/site/file', // action route
* // 'prefix' => '',
* ],
* ],
Expand All @@ -34,6 +36,8 @@
*/
class GoogleDriveComponent extends AbstractComponent
{
use UrlGeneratorComponentTrait;

/**
* @var string
*/
Expand Down Expand Up @@ -64,6 +68,11 @@ class GoogleDriveComponent extends AbstractComponent
*/
public $sharedFolderId;

/**
* @var string
*/
public $secret;

/**
* @var array
*/
Expand Down Expand Up @@ -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();
}

Expand Down

0 comments on commit e627b10

Please sign in to comment.