-
Notifications
You must be signed in to change notification settings - Fork 5
/
extend.php
63 lines (52 loc) · 2.12 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
<?php
namespace Kyrne\Websocket;
use Flarum\Extend\Console;
use Flarum\Extend\Event;
use Flarum\Extend\Frontend;
use Flarum\Extend\Locales;
use Flarum\Extend\Notification;
use Flarum\Extend\Routes;
use Flarum\Extend\ServiceProvider;
use Flarum\Extend\Settings;
use Flarum\Post\Event\Posted;
use Kyrne\Websocket\Api\Controllers\AuthController;
use Kyrne\Websocket\Api\Controllers\TypingWebsocketController;
use Kyrne\Websocket\Extend\GenerateApp;
use Kyrne\Websocket\Provider\AppProvider;
return [
(new Console())
->command(Commands\WebsocketServer::class)
->command(Commands\AltServer::class),
new GenerateApp(),
(new Settings())
->serializeToForum('websocketSecure', 'kyrne-websocket.force_secure', function ($setting) {
return boolval($setting);
})
->serializeToForum('websocketReverseProxy', 'kyrne-websocket.reverse_proxy')
->serializeToForum('websocketPort', 'kyrne-websocket.app_port')
->serializeToForum('websocketAutoUpdate', 'kyrne-websocket.auto_update', function ($setting) {
return boolval($setting);
})
->serializeToForum('websocketKey', 'kyrne-websocket.app_key')
->serializeToForum('websocketHost', 'kyrne-websocket.app_host')
->serializeToForum('websocketAuthOnly', 'kyrne-websocket.auth_only', function ($setting) {
return boolval($setting);
}),
(new Event())
->listen(Posted::class, Listener\PushNewPost::class),
(new Notification())
->driver('websocket', WebsocketNotificationDriver::class),
(new Frontend('forum'))
->js(__DIR__.'/js/dist/forum.js')
->css(__DIR__.'/resources/less/forum.less'),
(new Frontend('admin'))
->js(__DIR__.'/js/dist/admin.js')
->css(__DIR__.'/resources/less/admin.less')
->content(AddStatsData::class),
new Locales(__DIR__.'/resources/locale'),
(new Routes('api'))
->post('/posts/typing', 'posts.typing', TypingWebsocketController::class)
->post('/websocket/auth', 'websocket.auth', AuthController::class),
(new ServiceProvider())
->register(AppProvider::class),
];