-
Notifications
You must be signed in to change notification settings - Fork 19
/
ext_localconf.php
135 lines (115 loc) · 7.98 KB
/
ext_localconf.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?php
/** @noinspection PhpFullyQualifiedNameUsageInspection */
defined('TYPO3') || die('Access denied.');
call_user_func(
static function () {
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3api']['basePath'] = '_api';
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3api']['languageHeader'] = 'X-Locale';
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3api']['operationHandlers'] = [
\SourceBroker\T3api\OperationHandler\OptionsOperationHandler::class => 10500,
\SourceBroker\T3api\OperationHandler\FileUploadOperationHandler::class => -400,
\SourceBroker\T3api\OperationHandler\CollectionGetOperationHandler::class => -500,
\SourceBroker\T3api\OperationHandler\CollectionPostOperationHandler::class => -500,
\SourceBroker\T3api\OperationHandler\CollectionMethodNotAllowedOperationHandler::class => -9999,
\SourceBroker\T3api\OperationHandler\ItemGetOperationHandler::class => -500,
\SourceBroker\T3api\OperationHandler\ItemPutOperationHandler::class => -500,
\SourceBroker\T3api\OperationHandler\ItemPatchOperationHandler::class => -500,
\SourceBroker\T3api\OperationHandler\ItemDeleteOperationHandler::class => -500,
\SourceBroker\T3api\OperationHandler\ItemMethodNotAllowedOperationHandler::class => -9999,
];
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3api']['processors'] = [
\SourceBroker\T3api\Processor\CorsProcessor::class => 100,
];
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3api']['apiResourcePathProviders'] = [
\SourceBroker\T3api\Provider\ApiResourcePath\LoadedExtensionsDomainModelApiResourcePathProvider::class,
];
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3api']['serializerObjectConstructors'] = [
\SourceBroker\T3api\Serializer\Construction\InitializedObjectConstructor::class,
\SourceBroker\T3api\Serializer\Construction\ExtbaseObjectConstructor::class,
];
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3api']['serializerHandlers'] = [
\SourceBroker\T3api\Serializer\Handler\AbstractDomainObjectHandler::class,
\SourceBroker\T3api\Serializer\Handler\ObjectStorageHandler::class,
\SourceBroker\T3api\Serializer\Handler\FileReferenceHandler::class,
\SourceBroker\T3api\Serializer\Handler\ImageHandler::class,
\SourceBroker\T3api\Serializer\Handler\RecordUriHandler::class,
\SourceBroker\T3api\Serializer\Handler\TypolinkHandler::class,
\SourceBroker\T3api\Serializer\Handler\CurrentFeUserHandler::class,
\SourceBroker\T3api\Serializer\Handler\RteHandler::class,
\SourceBroker\T3api\Serializer\Handler\PasswordHashHandler::class,
];
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3api']['serializerSubscribers'] = [
\SourceBroker\T3api\Serializer\Subscriber\GenerateMetadataSubscriber::class,
\SourceBroker\T3api\Serializer\Subscriber\FileReferenceSubscriber::class,
\SourceBroker\T3api\Serializer\Subscriber\AbstractEntitySubscriber::class,
\SourceBroker\T3api\Serializer\Subscriber\ThrowableSubscriber::class,
\SourceBroker\T3api\Serializer\Subscriber\CurrentFeUserSubscriber::class,
];
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3api']['serializerMetadataDirs'] = [
't3api' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('t3api') . 'Resources/Private/Serializer/Metadata',
];
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3api']['forceEntityProperties'] = [
'uid',
];
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3api']['collectionResponseClass'] = \SourceBroker\T3api\Response\HydraCollectionResponse::class;
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3api']['mainEndpointResponseClass'] = \SourceBroker\T3api\Response\MainEndpointResponse::class;
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3api']['pagination'] = [
'pagination_enabled' => true,
'pagination_client_enabled' => false,
'pagination_items_per_page' => 30,
'maximum_items_per_page' => 9999999,
'pagination_client_items_per_page' => false,
'items_per_page_parameter_name' => 'itemsPerPage',
'enabled_parameter_name' => 'pagination',
'page_parameter_name' => 'page',
];
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3api']['cors']['allowCredentials'] = false;
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3api']['cors']['allowOrigin'] = [];
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3api']['cors']['allowHeaders'] = [];
// simple headers are always accepted. They are kept in separate element than `allowHeaders` to avoid mistakenly override by 3rd party extensions
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3api']['cors']['simpleHeaders'] = [
'Accept',
'Accept-Language',
'Content-Language',
'Origin',
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3api']['languageHeader'],
];
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3api']['cors']['allowMethods'] = [];
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3api']['cors']['exposeHeaders'] = [];
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3api']['cors']['maxAge'] = 0;
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3api']['cors']['originRegex'] = false;
if (!isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['t3api']) || !is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['t3api'])) {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['t3api'] = [
'frontend' => \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class,
'backend' => \TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend::class,
'options' => [
'defaultLifetime' => 0,
],
'groups' => ['system'],
];
}
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['t3api']['serializer']['exclusionForExceptionsInAccessorStrategyGetValue'] = [
TYPO3\CMS\Core\Resource\FileReference::class => [
\TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException::class,
\UnexpectedValueException::class,
],
TYPO3\CMS\Extbase\Domain\Model\FileReference::class => [
\TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException::class,
\UnexpectedValueException::class,
],
];
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc']['t3api_clearcache'] =
\SourceBroker\T3api\Service\SerializerService::class . '->clearCache';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['createHashBase']['t3api'] =
\SourceBroker\T3api\Hook\EnrichHashBase::class . '->init';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['routing']['enhancers'][\SourceBroker\T3api\Routing\Enhancer\ResourceEnhancer::ENHANCER_NAME] = \SourceBroker\T3api\Routing\Enhancer\ResourceEnhancer::class;
// protects against "&cHash empty" error when `cacheHash.enforceValidation` is set to `true`
if (!isset($GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'])) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'] = [\SourceBroker\T3api\Routing\Enhancer\ResourceEnhancer::PARAMETER_NAME];
} elseif (is_array($GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'])) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = \SourceBroker\T3api\Routing\Enhancer\ResourceEnhancer::PARAMETER_NAME;
} elseif (is_string($GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'])) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'] .= ',' . \SourceBroker\T3api\Routing\Enhancer\ResourceEnhancer::PARAMETER_NAME;
}
}
);