Add Azure blob storage as file storage option
This commit is contained in:
parent
3711f0e01e
commit
8d80bda629
10 changed files with 193 additions and 5 deletions
|
@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.
|
|||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
## [3.2] - 2020-05-19
|
||||
### Added
|
||||
- Added support to use Azure Blob Storage account as storage location.
|
||||
|
||||
## [3.1.5] - 2020-05-18
|
||||
### Added
|
||||
- Support for other S3-compatible storage endpoint.
|
||||
|
|
|
@ -18,7 +18,7 @@ All the installations, configuration, and usage instructions are available in th
|
|||
+ Supports every upload type from ShareX.
|
||||
+ Config generator for ShareX.
|
||||
+ Low memory footprint.
|
||||
+ Multiple backends support: Local storage, AWS S3, Google Cloud, Dropbox, FTP(s).
|
||||
+ Multiple backends support: Local storage, AWS S3, Google Cloud, Azure Blob Storage, Dropbox, FTP(s).
|
||||
+ Web file upload.
|
||||
+ Code uploads syntax highlighting.
|
||||
+ Video and audio uploads webplayer.
|
||||
|
|
|
@ -9,6 +9,8 @@ use Google\Cloud\Storage\StorageClient;
|
|||
use League\Flysystem\Adapter\Ftp as FtpAdapter;
|
||||
use League\Flysystem\Adapter\Local;
|
||||
use League\Flysystem\AwsS3v3\AwsS3Adapter;
|
||||
use League\Flysystem\AzureBlobStorage\AzureBlobStorageAdapter;
|
||||
use MicrosoftAzure\Storage\Blob\BlobRestProxy;
|
||||
use League\Flysystem\Filesystem;
|
||||
use Monolog\Formatter\LineFormatter;
|
||||
use Monolog\Handler\RotatingFileHandler;
|
||||
|
@ -82,6 +84,15 @@ return [
|
|||
]);
|
||||
|
||||
return new Filesystem(new GoogleStorageAdapter($client, $client->bucket($config['storage']['bucket'])));
|
||||
case 'azure':
|
||||
$client = BlobRestProxy::createBlobService(
|
||||
sprintf(
|
||||
'DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s;',
|
||||
$config['storage']['account_name'],
|
||||
$config['storage']['account_key'])
|
||||
);
|
||||
|
||||
return new Filesystem(new AzureBlobStorageAdapter($client, $config['storage']['container_name']));
|
||||
default:
|
||||
throw new InvalidArgumentException('The driver specified is not supported.');
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
"intervention/image": "^2.4",
|
||||
"league/flysystem": "^1.0.45",
|
||||
"league/flysystem-aws-s3-v3": "^1.0",
|
||||
"league/flysystem-azure-blob-storage": "^0.1.6",
|
||||
"maennchen/zipstream-php": "^2.0",
|
||||
"monolog/monolog": "^1.23",
|
||||
"php-di/slim-bridge": "^3.0",
|
||||
|
|
134
composer.lock
generated
134
composer.lock
generated
|
@ -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": "50cb268c0defd72f37d912fbb6393652",
|
||||
"content-hash": "e3493373b5fac08c5ff8397e894cc0d6",
|
||||
"packages": [
|
||||
{
|
||||
"name": "aws/aws-sdk-php",
|
||||
|
@ -945,6 +945,47 @@
|
|||
"description": "Flysystem adapter for the AWS S3 SDK v3.x",
|
||||
"time": "2020-02-23T13:31:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "league/flysystem-azure-blob-storage",
|
||||
"version": "0.1.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/thephpleague/flysystem-azure-blob-storage.git",
|
||||
"reference": "97215345f3c42679299ba556a4d16d4847ee7f6d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/thephpleague/flysystem-azure-blob-storage/zipball/97215345f3c42679299ba556a4d16d4847ee7f6d",
|
||||
"reference": "97215345f3c42679299ba556a4d16d4847ee7f6d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"guzzlehttp/psr7": "^1.5",
|
||||
"league/flysystem": "^1.0",
|
||||
"microsoft/azure-storage-blob": "^1.1",
|
||||
"php": ">=5.6"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^5.7"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"League\\Flysystem\\AzureBlobStorage\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Frank de Jonge",
|
||||
"email": "info@frenky.net"
|
||||
}
|
||||
],
|
||||
"time": "2019-06-07T20:42:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "maennchen/zipstream-php",
|
||||
"version": "2.0.0",
|
||||
|
@ -1006,6 +1047,94 @@
|
|||
],
|
||||
"time": "2020-02-23T01:48:39+00:00"
|
||||
},
|
||||
{
|
||||
"name": "microsoft/azure-storage-blob",
|
||||
"version": "1.5.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Azure/azure-storage-blob-php.git",
|
||||
"reference": "6a333cd28a3742c3e99e79042dc6510f9f917919"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Azure/azure-storage-blob-php/zipball/6a333cd28a3742c3e99e79042dc6510f9f917919",
|
||||
"reference": "6a333cd28a3742c3e99e79042dc6510f9f917919",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"microsoft/azure-storage-common": "~1.4",
|
||||
"php": ">=5.6.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"MicrosoftAzure\\Storage\\Blob\\": "src/Blob"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Azure Storage PHP Client Library",
|
||||
"email": "dmsh@microsoft.com"
|
||||
}
|
||||
],
|
||||
"description": "This project provides a set of PHP client libraries that make it easy to access Microsoft Azure Storage Blob APIs.",
|
||||
"keywords": [
|
||||
"azure",
|
||||
"blob",
|
||||
"php",
|
||||
"sdk",
|
||||
"storage"
|
||||
],
|
||||
"time": "2020-01-02T07:18:59+00:00"
|
||||
},
|
||||
{
|
||||
"name": "microsoft/azure-storage-common",
|
||||
"version": "1.4.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Azure/azure-storage-common-php.git",
|
||||
"reference": "be4df800761d0d0fa91a9460c7f42517197d57a0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Azure/azure-storage-common-php/zipball/be4df800761d0d0fa91a9460c7f42517197d57a0",
|
||||
"reference": "be4df800761d0d0fa91a9460c7f42517197d57a0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"guzzlehttp/guzzle": "~6.0",
|
||||
"php": ">=5.6.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"MicrosoftAzure\\Storage\\Common\\": "src/Common"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Azure Storage PHP Client Library",
|
||||
"email": "dmsh@microsoft.com"
|
||||
}
|
||||
],
|
||||
"description": "This project provides a set of common code shared by Azure Storage Blob, Table, Queue and File PHP client libraries.",
|
||||
"keywords": [
|
||||
"azure",
|
||||
"common",
|
||||
"php",
|
||||
"sdk",
|
||||
"storage"
|
||||
],
|
||||
"time": "2020-01-02T07:15:54+00:00"
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
"version": "1.25.3",
|
||||
|
@ -5020,5 +5149,6 @@
|
|||
"ext-pdo": "*",
|
||||
"ext-zip": "*"
|
||||
},
|
||||
"platform-dev": []
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "1.1.0"
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ return array(
|
|||
return array(
|
||||
...
|
||||
'storage' => array (
|
||||
'driver' => 'google-client',
|
||||
'driver' => 'google-cloud',
|
||||
'project_id' => 'the-project-id',
|
||||
'key_path' => 'the-key-path',
|
||||
'bucket' => 'bucket-name',
|
||||
|
@ -133,6 +133,19 @@ return array(
|
|||
);
|
||||
```
|
||||
|
||||
+ Azure Blob Storage
|
||||
```php
|
||||
return array(
|
||||
...
|
||||
'storage' => array (
|
||||
'driver' => 'azure',
|
||||
'account_name' => 'the-storage-account-name',
|
||||
'account_key' => 'the-account-key',
|
||||
'container_name' => 'container-name',
|
||||
)
|
||||
);
|
||||
```
|
||||
|
||||
## Changing themes
|
||||
XBackBone supports all [bootswatch.com](https://bootswatch.com/) themes.
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ XBackBone is a simple and lightweight PHP file manager that support the instant
|
|||
+ Supports every upload type from ShareX.
|
||||
+ Config generator for ShareX.
|
||||
+ Low memory footprint.
|
||||
+ Multiple backends support: Local storage, AWS S3, Google Cloud, Dropbox, FTP(s).
|
||||
+ Multiple backends support: Local storage, AWS S3, Google Cloud, Azure Blob Storage, Dropbox, FTP(s).
|
||||
+ Web file upload.
|
||||
+ Code uploads syntax highlighting.
|
||||
+ Video and audio uploads webplayer.
|
||||
|
|
|
@ -160,6 +160,11 @@ $app->post('/', function (Request $request, Response $response, \DI\Container $c
|
|||
$config['storage']['key_path'] = param($request, 'storage_key_path');
|
||||
$config['storage']['bucket'] = param($request, 'storage_bucket');
|
||||
break;
|
||||
case 'azure':
|
||||
$config['storage']['account_name'] = param($request, 'storage_account_name');
|
||||
$config['storage']['account_key'] = param($request, 'storage_account_key');
|
||||
$config['storage']['container_name'] = param($request, 'storage_container_name');
|
||||
break;
|
||||
case 'local':
|
||||
default:
|
||||
$config['storage']['path'] = param($request, 'storage_path');
|
||||
|
|
|
@ -73,6 +73,7 @@
|
|||
<option value="ftp">FTP/FTPS</option>
|
||||
<option value="s3">Amazon S3 (or compatible)</option>
|
||||
<option value="google-cloud">Google Cloud Storage</option>
|
||||
<option value="azure">Azure Blob Storage</option>
|
||||
<option value="dropbox">Dropbox</option>
|
||||
</select>
|
||||
</div>
|
||||
|
@ -167,6 +168,24 @@
|
|||
<input type="text" class="form-control hook-storage-input" id="storage_key_path" name="storage_key_path" placeholder="/path/to/service-account.json" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row hook-storage">
|
||||
<label for="storage_account_name" class="col-sm-3 col-form-label">Azure storage account name</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control hook-storage-input" id="storage_account_name" name="storage_account_name" placeholder="your-storage-account-name" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row hook-storage">
|
||||
<label for="storage_account_key" class="col-sm-3 col-form-label">Azure storage account key</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control hook-storage-input" id="storage_account_key" name="storage_account_key" placeholder="Account (Access) Key" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row hook-storage">
|
||||
<label for="storage_container_name" class="col-sm-3 col-form-label">Azure storage container name</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control hook-storage-input" id="storage_container_name" name="storage_container_name" placeholder="your-blob-container-name" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row hook-storage">
|
||||
<label for="storage_bucket" class="col-sm-3 col-form-label">Storage bucket</label>
|
||||
<div class="col-sm-9">
|
||||
|
|
|
@ -52,6 +52,11 @@ $(document).ready(function () {
|
|||
$('#storage_key_path').prop('required', 'required').parent().parent().show();
|
||||
$('#storage_bucket').prop('required', 'required').parent().parent().show();
|
||||
break;
|
||||
case 'azure':
|
||||
$('#storage_account_name').prop('required', 'required').parent().parent().show();
|
||||
$('#storage_account_key').prop('required', 'required').parent().parent().show();
|
||||
$('#storage_container_name').prop('required', 'required').parent().parent().show();
|
||||
break;
|
||||
case 'dropbox':
|
||||
$('#storage_token').prop('required', 'required').parent().parent().show();
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue