-
Notifications
You must be signed in to change notification settings - Fork 2
/
extend.php
65 lines (52 loc) · 2.39 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
60
61
62
63
64
65
<?php
/*
* This file is part of gbcl/fof-upload-ext-qcloud.
*
* Copyright (c) 2023 GBCLStudio.
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*/
namespace GBCLStudio\UploadExtQcloud;
use Flarum\Api\Serializer\PostSerializer;
use Flarum\Extend;
use FoF\Upload\Events\Adapter\Collecting;
use FoF\Upload\Events\Adapter\Instantiate;
use GBCLStudio\UploadExtQcloud\Formatters\QcloudAudioFormatter;
use GBCLStudio\UploadExtQcloud\Formatters\QcloudDownloadFormatter;
use GBCLStudio\UploadExtQcloud\Formatters\QcloudPdfFormatter;
use GBCLStudio\UploadExtQcloud\Formatters\QcloudPreviewFormatter;
use GBCLStudio\UploadExtQcloud\Formatters\QcloudVideoFormatter;
use GBCLStudio\UploadExtQcloud\Listeners\AdapterInstantiateListener;
use GBCLStudio\UploadExtQcloud\Listeners\AdapterRegisterListener;
use GBCLStudio\UploadExtQcloud\Providers\QcloudProvider;
return [
(new Extend\Routes('api'))
->get('/gbcl/fof-qcloud/download/{uuid}/{post}/{csrf}', 'gbcl-fof-qcloud.download', Api\Controllers\DownloadController::class),
(new Extend\Event())
->listen(Collecting::class, AdapterRegisterListener::class)
->listen(Instantiate::class, AdapterInstantiateListener::class),
(new Extend\Settings())
->default('gbcl-fof-upload-qcloud.qcloudConfig.secretKey', '')
->default('gbcl-fof-upload-qcloud.qcloudConfig.secretId', '')
->default('gbcl-fof-upload-qcloud.qcloudConfig.bucket', '')
->default('gbcl-fof-upload-qcloud.qcloudConfig.appId', '')
->default('gbcl-fof-upload-qcloud.qcloudConfig.domain', ''),
(new Extend\Frontend('admin'))
->js(__DIR__.'/js/dist/admin.js'),
(new Extend\Frontend('forum'))
->js(__DIR__.'/js/dist/forum.js'),
new Extend\Locales(__DIR__.'/resources/locale'),
(new Extend\View())
->namespace('gbcl-fof-upload-qcloud.templates', __DIR__.'/resources/templates'),
(new Extend\ApiSerializer(PostSerializer::class))
->attributes(Extenders\AddCurrentPostAttributes::class),
(new Extend\ServiceProvider())
->register(QcloudProvider::class),
(new Extend\Formatter())
->render(QcloudVideoFormatter::class)
->render(QcloudAudioFormatter::class)
->render(QcloudDownloadFormatter::class)
->render(QcloudPreviewFormatter::class)
->render(QcloudPdfFormatter::class),
];