-
Notifications
You must be signed in to change notification settings - Fork 7
/
extend.php
52 lines (42 loc) · 1.64 KB
/
extend.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/*
* This file is part of Flarum Profile Cover.
*
* (c) Sami "SychO" Mazouz <[email protected]>
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
use Flarum\Api\Serializer\UserSerializer;
use Flarum\Extend;
use Flarum\Foundation\Paths;
use Flarum\Http\UrlGenerator;
use Flarum\User\User;
use SychO\ProfileCover\Controller;
use SychO\ProfileCover\Listener\UserCoverRelationship;
use SychO\ProfileCover\Access\UserPolicy;
return [
(new Extend\Frontend('forum'))
->js(__DIR__.'/js/dist/forum.js')
->css(__DIR__.'/resources/less/forum.less'),
(new Extend\Frontend('admin'))
->js(__DIR__.'/js/dist/admin.js')
->css(__DIR__.'/resources/less/admin.less'),
(new Extend\Routes('api'))
->post('/users/{id}/cover', 'users.cover.upload', Controller\UploadCoverController::class)
->delete('/users/{id}/cover', 'users.cover.delete', Controller\DeleteCoverController::class),
new Extend\Locales(__DIR__.'/resources/locale'),
(new Extend\Settings())
->serializeToForum('sycho-profile-cover.max_size', 'sycho-profile-cover.max_size'),
(new Extend\ApiSerializer(UserSerializer::class))
->attributes(UserCoverRelationship::class),
(new Extend\Policy())
->modelPolicy(User::class, UserPolicy::class),
(new Extend\Filesystem())
->disk('sycho-profile-cover', function (Paths $paths, UrlGenerator $url) {
return [
'root' => "$paths->public/assets/covers",
'url' => $url->to('forum')->path('assets/covers')
];
}),
];