diff --git a/.env.example b/.env.example index 490bfe87..8c5aabb3 100644 --- a/.env.example +++ b/.env.example @@ -44,3 +44,5 @@ REDIS_PORT = 6379 PLUGINS_DIR = null PLUGINS_URL = null + +TEXTURES_DIR = null diff --git a/.env.testing b/.env.testing index ecd5cf76..d390b41d 100644 --- a/.env.testing +++ b/.env.testing @@ -32,4 +32,6 @@ REDIS_PORT=6379 PLUGINS_DIR=plugins PLUGINS_URL= +TEXTURES_DIR= + JWT_SECRET=1tdM3gXarxYI4KlAHMBo238iC2tEb4I3EtBlZTQQXvInXIt7V2ix7hJ1KTvxCKZW diff --git a/config/filesystems.php b/config/filesystems.php index 228682bc..9b06ac61 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -55,7 +55,7 @@ return [ 'textures' => [ 'driver' => env('FS_DRIVER', 'local'), - 'root' => storage_path('textures'), + 'root' => env('TEXTURES_DIR', storage_path('textures')), ], 'testing' => [ diff --git a/resources/misc/changelogs/en/5.0.0.md b/resources/misc/changelogs/en/5.0.0.md index acbc88a7..bf28ecd1 100644 --- a/resources/misc/changelogs/en/5.0.0.md +++ b/resources/misc/changelogs/en/5.0.0.md @@ -19,6 +19,7 @@ - Added support of character "§" for player name. (Under CJK mode.) - New password hash algorithm: Argon2i. - Support searching players when applying textures. +- Support customizing textures storage directory. ## Tweaked diff --git a/resources/misc/changelogs/zh_CN/5.0.0.md b/resources/misc/changelogs/zh_CN/5.0.0.md index c6333729..b0669400 100644 --- a/resources/misc/changelogs/zh_CN/5.0.0.md +++ b/resources/misc/changelogs/zh_CN/5.0.0.md @@ -19,6 +19,7 @@ - 角色名支持字符「§」(需开启「CJK」模式) - 新的密码哈希算法:Argon2i - 将材质应用到角色时可进行搜索 +- 支持自定义材质存储目录 ## 调整 diff --git a/tests/HttpTest/ControllersTest/SkinlibControllerTest.php b/tests/HttpTest/ControllersTest/SkinlibControllerTest.php index 8a673402..0d352030 100644 --- a/tests/HttpTest/ControllersTest/SkinlibControllerTest.php +++ b/tests/HttpTest/ControllersTest/SkinlibControllerTest.php @@ -593,6 +593,8 @@ class SkinlibControllerTest extends TestCase public function testDelete() { + $disk = Storage::fake('textures'); + $uploader = factory(User::class)->create(); $other = factory(User::class)->create(); $texture = factory(Texture::class)->create(['uploader' => $uploader->uid]); @@ -625,7 +627,7 @@ class SkinlibControllerTest extends TestCase $texture = factory(Texture::class)->create(); factory(Texture::class)->create(['hash' => $texture->hash]); - Storage::disk('textures')->put($texture->hash, ''); + $disk->put($texture->hash, ''); // When file is occupied, the file should not be deleted $this->postJson('/skinlib/delete', ['tid' => $texture->tid])