1
0
mirror of https://github.com/flarum/core.git synced 2025-10-14 00:15:51 +02:00

Use Laravel filesystem interface for assets and avatars (#2729)

* WIP: Use Laravel filesystem interface where possible
* Drop vendorFilesystem
* Support getting URL of cloud-based logo and favicon
* FilesystemAdapter should always be cloud
* Get base avatar URL from filesystem adapter
* Restore deleted getAsset method

Co-authored-by: Alexander Skvortsov <askvortsov1@users.noreply.github.com>
This commit is contained in:
Alexander Skvortsov
2021-04-19 15:11:03 -04:00
committed by GitHub
parent a2d77d7b81
commit f67149bb06
13 changed files with 82 additions and 92 deletions

View File

@@ -24,10 +24,7 @@ use Flarum\User\DisplayName\UsernameDriver;
use Flarum\User\Event\EmailChangeRequested;
use Flarum\User\Event\Registered;
use Flarum\User\Event\Saving;
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\Filesystem\Factory;
use Illuminate\Support\Arr;
use League\Flysystem\FilesystemInterface;
class UserServiceProvider extends AbstractServiceProvider
{
@@ -36,7 +33,6 @@ class UserServiceProvider extends AbstractServiceProvider
*/
public function register()
{
$this->registerAvatarsFilesystem();
$this->registerDisplayNameDrivers();
$this->registerPasswordCheckers();
@@ -78,17 +74,6 @@ class UserServiceProvider extends AbstractServiceProvider
$this->container->alias('flarum.user.display_name.driver', DriverInterface::class);
}
protected function registerAvatarsFilesystem()
{
$avatarsFilesystem = function (Container $container) {
return $container->make(Factory::class)->disk('flarum-avatars')->getDriver();
};
$this->container->when(AvatarUploader::class)
->needs(FilesystemInterface::class)
->give($avatarsFilesystem);
}
protected function registerPasswordCheckers()
{
$this->container->singleton('flarum.user.password_checkers', function () {