forked from FriendsOfFlarum/upload
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextend.php
59 lines (47 loc) · 2.14 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
53
54
55
56
57
58
59
<?php
/*
* This file is part of fof/upload.
*
* Copyright (c) 2020 - 2021 FriendsOfFlarum.
* Copyright (c) 2016 - 2019 Flagrow
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*/
namespace FoF\Upload;
use Flarum\Api\Serializer\ForumSerializer;
use Flarum\Extend;
use Flarum\Settings\Event\Deserializing;
use FoF\Upload\Events\File\WillBeUploaded;
return [
(new Extend\Routes('api'))
->get('/fof/uploads', 'fof-upload.list', Api\Controllers\ListUploadsController::class)
->post('/fof/upload', 'fof-upload.upload', Api\Controllers\UploadController::class)
->post('/fof/watermark', 'fof-upload.watermark', Api\Controllers\WatermarkUploadController::class)
->get('/fof/download/{uuid}/{post}/{csrf}', 'fof-upload.download', Api\Controllers\DownloadController::class),
(new Extend\Frontend('admin'))
->css(__DIR__.'/resources/less/admin.less')
->js(__DIR__.'/js/dist/admin.js'),
(new Extend\Frontend('forum'))
->css(__DIR__.'/resources/less/forum/download.less')
->css(__DIR__.'/resources/less/forum/upload.less')
->css(__DIR__.'/resources/less/forum/fileManagerModal.less')
->css(__DIR__.'/resources/less/forum/fileList.less')
->js(__DIR__.'/js/dist/forum.js'),
new Extend\Locales(__DIR__.'/resources/locale'),
new Extenders\AddPostDownloadTags(),
new Extenders\CreateStorageFolder('tmp'),
(new Extend\ApiSerializer(ForumSerializer::class))
->mutate(Extenders\AddForumAttributes::class),
(new Extend\Event())
->listen(Deserializing::class, Listeners\AddAvailableOptionsInAdmin::class)
->listen(WillBeUploaded::class, Listeners\AddImageProcessor::class),
(new Extend\ServiceProvider())
->register(Providers\UtilProvider::class)
->register(Providers\StorageServiceProvider::class)
->register(Providers\DownloadProvider::class),
(new Extend\View())
->namespace('fof-upload.templates', __DIR__.'/resources/templates'),
(new Extend\Formatter())
->parse(Formatter\ReplaceDeprecatedTemplates::class),
];