forked from datlechin/flarum-link-preview
-
Notifications
You must be signed in to change notification settings - Fork 0
/
extend.php
46 lines (38 loc) · 2.11 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
<?php
/*
* This file is part of datlechin/flarum-link-preview.
*
* Copyright (c) 2022 Ngo Quoc Dat.
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*/
namespace Datlechin\LinkPreview;
use Datlechin\LinkPreview\Api\Controllers\BatchLinkPreviewController;
use Datlechin\LinkPreview\Api\Controllers\SingleLinkPreviewController;
use Flarum\Extend;
return [
(new Extend\Frontend('forum'))
->js(__DIR__ . '/js/dist/forum.js')
->css(__DIR__ . '/less/forum.less'),
(new Extend\Frontend('admin'))
->js(__DIR__ . '/js/dist/admin.js'),
new Extend\Locales(__DIR__ . '/locale'),
(new Extend\Routes('api'))
->get('/datlechin-link-preview', 'datlechin-link-preview', SingleLinkPreviewController::class)
->post('/datlechin-link-preview/batch', 'datlechin-link-preview.batch', BatchLinkPreviewController::class),
(new Extend\Settings())
->default('datlechin-link-preview.enable_batch_requests', true)
->default('datlechin-link-preview.blacklist', '')
->default('datlechin-link-preview.whitelist', '')
->default('datlechin-link-preview.use_google_favicons', false)
->default('datlechin-link-preview.convert_media_urls', false)
->default('datlechin-link-preview.cache_time', 60)
->default('datlechin-link-preview.open_links_in_new_tab', true)
->serializeToForum('datlechin-link-preview.enableBatchRequests', 'datlechin-link-preview.enable_batch_requests', 'boolval')
->serializeToForum('datlechin-link-preview.blacklist', key: 'datlechin-link-preview.blacklist')
->serializeToForum('datlechin-link-preview.whitelist', 'datlechin-link-preview.whitelist')
->serializeToForum('datlechin-link-preview.useGoogleFavicons', 'datlechin-link-preview.use_google_favicons', 'boolval')
->serializeToForum('datlechin-link-preview.convertMediaURLs', 'datlechin-link-preview.convert_media_urls', 'boolval')
->serializeToForum('datlechin-link-preview.openLinksInNewTab', 'datlechin-link-preview.open_links_in_new_tab', 'boolval'),
];