alchemymvc 1.3.21 → 1.4.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +3 -3
- package/lib/app/behaviour/publishable_behaviour.js +5 -5
- package/lib/app/behaviour/revision_behaviour.js +10 -10
- package/lib/app/behaviour/sluggable_behaviour.js +14 -14
- package/lib/app/conduit/electron_conduit.js +9 -9
- package/lib/app/conduit/http_conduit.js +13 -13
- package/lib/app/conduit/loopback_conduit.js +15 -15
- package/lib/app/conduit/socket_conduit.js +43 -43
- package/lib/app/config/routes.js +26 -0
- package/lib/app/controller/00-default_app_controller.js +21 -0
- package/lib/app/controller/alchemy_info_controller.js +12 -12
- package/lib/app/datasource/mongo_datasource.js +16 -16
- package/lib/app/element/00-default_app_element.js +19 -0
- package/lib/app/element/time_ago.js +5 -5
- package/lib/app/helper/00-default_app_helper.js +11 -0
- package/lib/app/helper/alchemy_helper.js +22 -22
- package/lib/app/helper/backed_map.js +1 -1
- package/lib/app/helper/breadcrumb.js +10 -10
- package/lib/app/helper/client_collection.js +3 -3
- package/lib/app/helper/cron.js +29 -29
- package/lib/app/helper/enum_values.js +6 -6
- package/lib/app/helper/pagination_helper.js +36 -36
- package/lib/app/helper/router_helper.js +35 -35
- package/lib/app/helper/socket_helper.js +57 -57
- package/lib/app/helper/syncable.js +84 -59
- package/lib/app/helper_component/paginate_component.js +9 -9
- package/lib/app/helper_controller/component.js +1 -1
- package/lib/app/helper_controller/conduit.js +31 -31
- package/lib/app/helper_controller/controller.js +54 -39
- package/lib/app/helper_datasource/00-nosql_datasource.js +624 -70
- package/lib/app/helper_datasource/05-fallback_datasource.js +10 -10
- package/lib/app/helper_datasource/idb_datasource.js +6 -6
- package/lib/app/helper_datasource/indexed_db.js +22 -22
- package/lib/app/helper_datasource/remote_datasource.js +5 -5
- package/lib/app/helper_error/http_error.js +4 -4
- package/lib/app/helper_error/model_error.js +2 -2
- package/lib/app/helper_error/validation_error.js +12 -12
- package/lib/app/helper_field/00-objectid_field.js +7 -7
- package/lib/app/helper_field/05-string_field.js +16 -12
- package/lib/app/helper_field/06-text_field.js +2 -4
- package/lib/app/helper_field/10-number_field.js +9 -12
- package/lib/app/helper_field/11-date_field.js +15 -15
- package/lib/app/helper_field/15-local_temporal_field.js +10 -10
- package/lib/app/helper_field/20-decimal_field.js +8 -9
- package/lib/app/helper_field/belongsto_field.js +1 -1
- package/lib/app/helper_field/big_int_field.js +8 -8
- package/lib/app/helper_field/boolean_field.js +9 -11
- package/lib/app/helper_field/datetime_field.js +3 -3
- package/lib/app/helper_field/enum_field.js +13 -8
- package/lib/app/helper_field/fixed_decimal_field.js +6 -7
- package/lib/app/helper_field/geopoint_field.js +9 -10
- package/lib/app/helper_field/habtm_field.js +3 -3
- package/lib/app/helper_field/hasoneparent_field.js +1 -1
- package/lib/app/helper_field/html_field.js +2 -4
- package/lib/app/helper_field/integer_field.js +8 -11
- package/lib/app/helper_field/local_date_field.js +5 -5
- package/lib/app/helper_field/local_date_time_field.js +5 -5
- package/lib/app/helper_field/local_time_field.js +5 -5
- package/lib/app/helper_field/mixed_field.js +5 -5
- package/lib/app/helper_field/object_field.js +8 -8
- package/lib/app/helper_field/password_field.js +3 -3
- package/lib/app/helper_field/regexp_field.js +7 -9
- package/lib/app/helper_field/schema_field.js +91 -88
- package/lib/app/helper_field/settings_field.js +92 -0
- package/lib/app/helper_field/time_field.js +6 -6
- package/lib/app/helper_field/url_field.js +2 -4
- package/lib/app/helper_model/00-base_criteria.js +662 -0
- package/lib/app/helper_model/05-criteria_expressions.js +605 -0
- package/lib/app/helper_model/10-model_criteria.js +1182 -0
- package/lib/app/helper_model/data_provider.js +2 -2
- package/lib/app/helper_model/document.js +103 -92
- package/lib/app/helper_model/document_list.js +14 -14
- package/lib/app/helper_model/field_config.js +11 -11
- package/lib/app/helper_model/field_set.js +17 -17
- package/lib/app/helper_model/model.js +203 -124
- package/lib/app/helper_model/remote_data_provider.js +2 -2
- package/lib/app/helper_validator/00_validator.js +16 -16
- package/lib/app/helper_validator/not_empty_validator.js +9 -9
- package/lib/app/model/00-default_app_model.js +18 -0
- package/lib/app/model/05-system_model.js +27 -0
- package/lib/app/model/{alchemy_migration_model.js → system_migration_model.js} +4 -4
- package/lib/app/model/system_setting_model.js +154 -0
- package/lib/app/model/{alchemy_task_history_model.js → system_task_history_model.js} +7 -7
- package/lib/app/model/{alchemy_task_model.js → system_task_model.js} +11 -11
- package/lib/bootstrap.js +22 -312
- package/lib/class/accumulator.js +5 -5
- package/lib/class/behaviour.js +5 -5
- package/lib/class/component.js +3 -3
- package/lib/class/conduit.js +203 -163
- package/lib/class/controller.js +42 -42
- package/lib/class/datasource.js +74 -79
- package/lib/class/document.js +74 -95
- package/lib/class/document_list.js +5 -5
- package/lib/class/element.js +17 -17
- package/lib/class/error.js +3 -3
- package/lib/class/field.js +169 -91
- package/lib/class/field_value.js +6 -6
- package/lib/class/helper.js +3 -3
- package/lib/class/inode.js +17 -17
- package/lib/class/inode_dir.js +12 -12
- package/lib/class/inode_file.js +50 -25
- package/lib/class/inode_list.js +4 -4
- package/lib/class/migration.js +4 -4
- package/lib/class/model.js +182 -168
- package/lib/class/path_definition.js +22 -22
- package/lib/class/path_evaluator.js +5 -5
- package/lib/class/path_param_definition.js +7 -7
- package/lib/class/plugin.js +312 -0
- package/lib/class/postponement.js +29 -29
- package/lib/class/reciprocal.js +8 -8
- package/lib/class/route.js +33 -33
- package/lib/class/router.js +73 -73
- package/lib/class/schema.js +21 -21
- package/lib/class/schema_client.js +73 -67
- package/lib/class/session.js +63 -29
- package/lib/class/session_scene.js +4 -4
- package/lib/class/sitemap.js +16 -16
- package/lib/class/task.js +39 -39
- package/lib/class/task_service.js +43 -47
- package/lib/{init → core}/alchemy.js +413 -374
- package/lib/{init/functions.js → core/alchemy_functions.js} +171 -108
- package/lib/core/alchemy_load_functions.js +715 -0
- package/lib/core/base.js +50 -62
- package/lib/core/client_alchemy.js +144 -152
- package/lib/core/client_base.js +39 -52
- package/lib/core/discovery.js +16 -18
- package/lib/core/middleware.js +54 -43
- package/lib/core/{routing.js → prefix.js} +14 -16
- package/lib/core/setting.js +1684 -0
- package/lib/core/stage.js +758 -0
- package/lib/scripts/create_constants.js +119 -0
- package/lib/{init/languages.js → scripts/create_languages.js} +5 -5
- package/lib/scripts/create_settings.js +449 -0
- package/lib/scripts/create_shared_constants.js +95 -0
- package/lib/scripts/create_stages.js +55 -0
- package/lib/scripts/init_alchemy.js +51 -0
- package/lib/{init/requirements.js → scripts/preload_modules.js} +15 -2
- package/lib/scripts/setup_devwatch.js +238 -0
- package/lib/stages/00-load_core.js +342 -0
- package/lib/stages/05-load_app.js +57 -0
- package/lib/stages/10-datasource.js +61 -0
- package/lib/stages/15-tasks.js +27 -0
- package/lib/stages/20-settings.js +68 -0
- package/lib/stages/50-routes.js +218 -0
- package/lib/stages/90-server.js +347 -0
- package/package.json +5 -7
- package/lib/app/helper_model/criteria.js +0 -2294
- package/lib/app/helper_model/db_query.js +0 -1488
- package/lib/app/routes.js +0 -11
- package/lib/core/socket.js +0 -171
- package/lib/init/constants.js +0 -158
- package/lib/init/devwatch.js +0 -238
- package/lib/init/load_functions.js +0 -973
- package/lib/stages.js +0 -513
package/lib/class/conduit.js
CHANGED
|
@@ -14,7 +14,7 @@ var libstream = alchemy.use('stream'),
|
|
|
14
14
|
/**
|
|
15
15
|
* The Conduit Class
|
|
16
16
|
*
|
|
17
|
-
* @author Jelle De Loecker
|
|
17
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
18
18
|
* @since 0.2.0
|
|
19
19
|
* @version 1.2.0
|
|
20
20
|
*
|
|
@@ -37,7 +37,7 @@ var Conduit = Function.inherits('Alchemy.Base', 'Alchemy.Conduit', function Cond
|
|
|
37
37
|
this._debugConduitInitialize = this._debugObject;
|
|
38
38
|
|
|
39
39
|
// Allow use of the log in the views
|
|
40
|
-
if (alchemy.settings.debug) {
|
|
40
|
+
if (alchemy.settings.debugging.debug) {
|
|
41
41
|
this.internal('debuglog', {_placeholder_: 'debuglog'});
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -61,7 +61,7 @@ var Conduit = Function.inherits('Alchemy.Base', 'Alchemy.Conduit', function Cond
|
|
|
61
61
|
/**
|
|
62
62
|
* Deprecated property names
|
|
63
63
|
*
|
|
64
|
-
* @author Jelle De Loecker
|
|
64
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
65
65
|
* @since 1.0.0
|
|
66
66
|
* @version 1.1.0
|
|
67
67
|
*/
|
|
@@ -75,7 +75,7 @@ Conduit.setDeprecatedProperty('sceneId', 'scene_id');
|
|
|
75
75
|
/**
|
|
76
76
|
* Return the cookies
|
|
77
77
|
*
|
|
78
|
-
* @author Jelle De Loecker
|
|
78
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
79
79
|
* @since 0.2.0
|
|
80
80
|
* @version 0.2.0
|
|
81
81
|
*/
|
|
@@ -86,7 +86,7 @@ Conduit.prepareProperty(function cookies() {
|
|
|
86
86
|
/**
|
|
87
87
|
* Return the parsed useragent string
|
|
88
88
|
*
|
|
89
|
-
* @author Jelle De Loecker
|
|
89
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
90
90
|
* @since 0.2.0
|
|
91
91
|
* @version 0.5.0
|
|
92
92
|
*/
|
|
@@ -97,7 +97,7 @@ Conduit.prepareProperty(function useragent() {
|
|
|
97
97
|
/**
|
|
98
98
|
* Create a Hawkejs Renderer
|
|
99
99
|
*
|
|
100
|
-
* @author Jelle De Loecker
|
|
100
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
101
101
|
* @since 0.2.0
|
|
102
102
|
* @version 1.1.5
|
|
103
103
|
*/
|
|
@@ -117,7 +117,7 @@ Conduit.prepareProperty(function renderer() {
|
|
|
117
117
|
/**
|
|
118
118
|
* Get the SessionScene instance
|
|
119
119
|
*
|
|
120
|
-
* @author Jelle De Loecker
|
|
120
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
121
121
|
* @since 1.3.10
|
|
122
122
|
* @version 1.3.10
|
|
123
123
|
*/
|
|
@@ -128,18 +128,18 @@ Conduit.setProperty(function scene() {
|
|
|
128
128
|
/**
|
|
129
129
|
* The session cookie name to use
|
|
130
130
|
*
|
|
131
|
-
* @author Jelle De Loecker
|
|
131
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
132
132
|
* @since 1.3.18
|
|
133
133
|
* @version 1.3.18
|
|
134
134
|
*/
|
|
135
135
|
Conduit.setProperty(function session_cookie_name() {
|
|
136
|
-
return alchemy.settings.
|
|
136
|
+
return alchemy.settings.sessions.cookie_name || 'alchemy_sid';
|
|
137
137
|
});
|
|
138
138
|
|
|
139
139
|
/**
|
|
140
140
|
* Enforce the scene_id
|
|
141
141
|
*
|
|
142
|
-
* @author Jelle De Loecker
|
|
142
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
143
143
|
* @since 1.1.0
|
|
144
144
|
* @version 1.3.18
|
|
145
145
|
*/
|
|
@@ -187,7 +187,7 @@ Conduit.enforceProperty(function scene_id(new_value, old_value) {
|
|
|
187
187
|
/**
|
|
188
188
|
* Enforce the active_prefix
|
|
189
189
|
*
|
|
190
|
-
* @author Jelle De Loecker
|
|
190
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
191
191
|
* @since 1.1.0
|
|
192
192
|
* @version 1.1.5
|
|
193
193
|
*/
|
|
@@ -226,7 +226,7 @@ Conduit.enforceProperty(function active_prefix(new_value, old_value) {
|
|
|
226
226
|
/**
|
|
227
227
|
* Get a session object by id
|
|
228
228
|
*
|
|
229
|
-
* @author Jelle De Loecker
|
|
229
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
230
230
|
* @since 0.2.0
|
|
231
231
|
* @version 0.2.0
|
|
232
232
|
*/
|
|
@@ -237,7 +237,7 @@ Conduit.setStatic(function getSessionById(id) {
|
|
|
237
237
|
/**
|
|
238
238
|
* See if this is a secure connection
|
|
239
239
|
*
|
|
240
|
-
* @author Jelle De Loecker
|
|
240
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
241
241
|
* @since 0.4.2
|
|
242
242
|
* @version 1.0.2
|
|
243
243
|
*/
|
|
@@ -245,7 +245,7 @@ Conduit.setProperty(function is_secure() {
|
|
|
245
245
|
|
|
246
246
|
var protocol;
|
|
247
247
|
|
|
248
|
-
if (alchemy.settings.assume_https) {
|
|
248
|
+
if (alchemy.settings.network.assume_https) {
|
|
249
249
|
return true;
|
|
250
250
|
}
|
|
251
251
|
|
|
@@ -271,11 +271,11 @@ Conduit.setProperty(function is_secure() {
|
|
|
271
271
|
/**
|
|
272
272
|
* Set the request body
|
|
273
273
|
*
|
|
274
|
-
* @author Jelle De Loecker
|
|
274
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
275
275
|
* @since 1.1.0
|
|
276
276
|
* @version 1.3.18
|
|
277
277
|
*
|
|
278
|
-
* @param {Object|
|
|
278
|
+
* @param {Object|string}
|
|
279
279
|
*/
|
|
280
280
|
Conduit.setMethod(function setRequestBody(body) {
|
|
281
281
|
|
|
@@ -294,7 +294,7 @@ Conduit.setMethod(function setRequestBody(body) {
|
|
|
294
294
|
/**
|
|
295
295
|
* Has the given route been tested yet?
|
|
296
296
|
*
|
|
297
|
-
* @author Jelle De Loecker
|
|
297
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
298
298
|
* @since 1.2.5
|
|
299
299
|
* @version 1.2.5
|
|
300
300
|
*
|
|
@@ -312,7 +312,7 @@ Conduit.setMethod(function hasRouteBeenTested(route) {
|
|
|
312
312
|
/**
|
|
313
313
|
* Mark this route as having been tested
|
|
314
314
|
*
|
|
315
|
-
* @author Jelle De Loecker
|
|
315
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
316
316
|
* @since 1.2.5
|
|
317
317
|
* @version 1.2.5
|
|
318
318
|
*
|
|
@@ -331,11 +331,11 @@ Conduit.setMethod(function markRouteAsTested(route) {
|
|
|
331
331
|
* Rewrite a certain URL parameter
|
|
332
332
|
* (Causing some kind of redirect)
|
|
333
333
|
*
|
|
334
|
-
* @author Jelle De Loecker
|
|
334
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
335
335
|
* @since 1.2.5
|
|
336
336
|
* @version 1.2.5
|
|
337
337
|
*
|
|
338
|
-
* @param {
|
|
338
|
+
* @param {string} route_param
|
|
339
339
|
* @param {*} new_value
|
|
340
340
|
*/
|
|
341
341
|
Conduit.setMethod(function rewriteRequestRouteParam(route_param, new_value) {
|
|
@@ -350,7 +350,7 @@ Conduit.setMethod(function rewriteRequestRouteParam(route_param, new_value) {
|
|
|
350
350
|
/**
|
|
351
351
|
* Set the request files
|
|
352
352
|
*
|
|
353
|
-
* @author Jelle De Loecker
|
|
353
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
354
354
|
* @since 1.1.0
|
|
355
355
|
* @version 1.1.0
|
|
356
356
|
*
|
|
@@ -368,7 +368,7 @@ Conduit.setMethod(function setRequestFiles(files) {
|
|
|
368
368
|
/**
|
|
369
369
|
* Set the request files
|
|
370
370
|
*
|
|
371
|
-
* @author Jelle De Loecker
|
|
371
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
372
372
|
* @since 1.2.0
|
|
373
373
|
* @version 1.3.0
|
|
374
374
|
*
|
|
@@ -403,7 +403,7 @@ function _setRequestFiles(conduit, files, target) {
|
|
|
403
403
|
/**
|
|
404
404
|
* Don't convert a conduit to any special json data
|
|
405
405
|
*
|
|
406
|
-
* @author Jelle De Loecker
|
|
406
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
407
407
|
* @since 0.2.0
|
|
408
408
|
* @version 0.2.0
|
|
409
409
|
*/
|
|
@@ -414,7 +414,7 @@ Conduit.setMethod(function toJSON() {
|
|
|
414
414
|
/**
|
|
415
415
|
* Set the request & response objects
|
|
416
416
|
*
|
|
417
|
-
* @author Jelle De Loecker
|
|
417
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
418
418
|
* @since 1.2.0
|
|
419
419
|
* @version 1.2.0
|
|
420
420
|
*/
|
|
@@ -445,7 +445,7 @@ Conduit.setMethod(function setReqRes(req, res) {
|
|
|
445
445
|
/**
|
|
446
446
|
* Init values
|
|
447
447
|
*
|
|
448
|
-
* @author Jelle De Loecker
|
|
448
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
449
449
|
* @since 0.3.3
|
|
450
450
|
* @version 1.3.15
|
|
451
451
|
*/
|
|
@@ -498,7 +498,7 @@ Conduit.setMethod(function initValues() {
|
|
|
498
498
|
/**
|
|
499
499
|
* Get the time since the conduit was made
|
|
500
500
|
*
|
|
501
|
-
* @author Jelle De Loecker
|
|
501
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
502
502
|
* @since 0.2.0
|
|
503
503
|
* @version 1.1.0
|
|
504
504
|
*/
|
|
@@ -509,7 +509,7 @@ Conduit.setMethod(function time() {
|
|
|
509
509
|
/**
|
|
510
510
|
* Parse the request, get information from the url
|
|
511
511
|
*
|
|
512
|
-
* @author Jelle De Loecker
|
|
512
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
513
513
|
* @since 0.2.0
|
|
514
514
|
* @version 1.3.18
|
|
515
515
|
*
|
|
@@ -552,7 +552,7 @@ Conduit.setMethod(async function parseRequest() {
|
|
|
552
552
|
/**
|
|
553
553
|
* Parse the complete request URL if it hasn't been done yet
|
|
554
554
|
*
|
|
555
|
-
* @author Jelle De Loecker
|
|
555
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
556
556
|
* @since 1.3.18
|
|
557
557
|
* @version 1.3.19
|
|
558
558
|
*/
|
|
@@ -565,7 +565,7 @@ Conduit.setMethod(function parseUrl() {
|
|
|
565
565
|
|
|
566
566
|
let protocol;
|
|
567
567
|
|
|
568
|
-
if (alchemy.settings.assume_https) {
|
|
568
|
+
if (alchemy.settings.network.assume_https) {
|
|
569
569
|
protocol = 'https://';
|
|
570
570
|
} else if (this.headers['x-forwarded-proto']) {
|
|
571
571
|
protocol = this.headers['x-forwarded-proto'];
|
|
@@ -592,7 +592,7 @@ Conduit.setMethod(function parseUrl() {
|
|
|
592
592
|
this.url.hostname = host;
|
|
593
593
|
|
|
594
594
|
// If no URL was set, use the first requests URL (without the path)
|
|
595
|
-
if (!alchemy.settings.
|
|
595
|
+
if (!alchemy.settings.network.main_url && host) {
|
|
596
596
|
alchemy.setUrl(this.url);
|
|
597
597
|
}
|
|
598
598
|
|
|
@@ -605,7 +605,7 @@ Conduit.setMethod(function parseUrl() {
|
|
|
605
605
|
/**
|
|
606
606
|
* Parse the headers for shortcuts
|
|
607
607
|
*
|
|
608
|
-
* @author Jelle De Loecker
|
|
608
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
609
609
|
* @since 0.2.0
|
|
610
610
|
* @version 1.3.17
|
|
611
611
|
*/
|
|
@@ -642,7 +642,7 @@ Conduit.setMethod(function parseShortcuts() {
|
|
|
642
642
|
/**
|
|
643
643
|
* Sort the parsed accept-language header array
|
|
644
644
|
*
|
|
645
|
-
* @author Jelle De Loecker
|
|
645
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
646
646
|
* @since 0.0.1
|
|
647
647
|
* @version 0.0.1
|
|
648
648
|
*
|
|
@@ -662,7 +662,7 @@ function qualityCmp(a, b) {
|
|
|
662
662
|
/**
|
|
663
663
|
* Parses the HTTP accept-language header
|
|
664
664
|
*
|
|
665
|
-
* @author Jelle De Loecker
|
|
665
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
666
666
|
* @since 0.0.1
|
|
667
667
|
* @version 0.2.0
|
|
668
668
|
*/
|
|
@@ -726,7 +726,7 @@ Conduit.setMethod(function parseLanguages() {
|
|
|
726
726
|
* Parses accept-encoding strings
|
|
727
727
|
*
|
|
728
728
|
* @author jshttp
|
|
729
|
-
* @author Jelle De Loecker
|
|
729
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
730
730
|
* @since 0.2.0
|
|
731
731
|
* @version 0.2.0
|
|
732
732
|
*/
|
|
@@ -759,7 +759,7 @@ function parseEncoding(s, i) {
|
|
|
759
759
|
* Parses accept-encoding strings
|
|
760
760
|
*
|
|
761
761
|
* @author jshttp
|
|
762
|
-
* @author Jelle De Loecker
|
|
762
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
763
763
|
* @since 0.2.0
|
|
764
764
|
* @version 0.2.0
|
|
765
765
|
*/
|
|
@@ -782,7 +782,7 @@ function specify(encoding, spec, index) {
|
|
|
782
782
|
/**
|
|
783
783
|
* Parses the HTTP accept-encoding header
|
|
784
784
|
*
|
|
785
|
-
* @author Jelle De Loecker
|
|
785
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
786
786
|
* @since 0.2.0
|
|
787
787
|
* @version 0.2.0
|
|
788
788
|
*/
|
|
@@ -839,7 +839,7 @@ Conduit.setMethod(function parseAcceptEncoding() {
|
|
|
839
839
|
/**
|
|
840
840
|
* See if the wanted encoding is accepted by the client
|
|
841
841
|
*
|
|
842
|
-
* @author Jelle De Loecker
|
|
842
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
843
843
|
* @since 0.2.0
|
|
844
844
|
* @version 0.2.0
|
|
845
845
|
*/
|
|
@@ -866,7 +866,7 @@ Conduit.setMethod(function accepts(encoding) {
|
|
|
866
866
|
/**
|
|
867
867
|
* Create a loopback conduit
|
|
868
868
|
*
|
|
869
|
-
* @author Jelle De Loecker
|
|
869
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
870
870
|
* @since 0.2.0
|
|
871
871
|
* @version 1.1.3
|
|
872
872
|
*
|
|
@@ -882,7 +882,7 @@ Conduit.setMethod(function loopback(args, callback) {
|
|
|
882
882
|
/**
|
|
883
883
|
* Parse the request, get information from the url
|
|
884
884
|
*
|
|
885
|
-
* @author Jelle De Loecker
|
|
885
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
886
886
|
* @since 0.2.0
|
|
887
887
|
* @version 1.1.0
|
|
888
888
|
*/
|
|
@@ -982,7 +982,7 @@ Conduit.setMethod(function parsePrefix() {
|
|
|
982
982
|
/**
|
|
983
983
|
* Get the section
|
|
984
984
|
*
|
|
985
|
-
* @author Jelle De Loecker
|
|
985
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
986
986
|
* @since 0.2.0
|
|
987
987
|
* @version 0.2.1
|
|
988
988
|
*/
|
|
@@ -1006,11 +1006,11 @@ Conduit.setMethod(function parseSection() {
|
|
|
1006
1006
|
/**
|
|
1007
1007
|
* Get a route by its name
|
|
1008
1008
|
*
|
|
1009
|
-
* @author Jelle De Loecker
|
|
1009
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1010
1010
|
* @since 0.2.0
|
|
1011
1011
|
* @version 0.2.0
|
|
1012
1012
|
*
|
|
1013
|
-
* @param {
|
|
1013
|
+
* @param {string|Object} name The name of the route
|
|
1014
1014
|
*/
|
|
1015
1015
|
Conduit.setMethod(function getRouteByName(name) {
|
|
1016
1016
|
|
|
@@ -1027,13 +1027,13 @@ Conduit.setMethod(function getRouteByName(name) {
|
|
|
1027
1027
|
/**
|
|
1028
1028
|
* Get the Route instance & named parameters
|
|
1029
1029
|
*
|
|
1030
|
-
* @author Jelle De Loecker
|
|
1030
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1031
1031
|
* @since 0.2.0
|
|
1032
1032
|
* @version 1.3.0
|
|
1033
1033
|
*
|
|
1034
1034
|
* @param {Route} after_route Only check routes after this one
|
|
1035
1035
|
*
|
|
1036
|
-
* @return {
|
|
1036
|
+
* @return {boolean} Continue processing this request or not?
|
|
1037
1037
|
*/
|
|
1038
1038
|
Conduit.setMethod(async function parseRoute(after_route) {
|
|
1039
1039
|
|
|
@@ -1109,7 +1109,7 @@ Conduit.setMethod(async function parseRoute(after_route) {
|
|
|
1109
1109
|
/**
|
|
1110
1110
|
* Run the middleware
|
|
1111
1111
|
*
|
|
1112
|
-
* @author Jelle De Loecker
|
|
1112
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1113
1113
|
* @since 0.2.0
|
|
1114
1114
|
* @version 1.1.5
|
|
1115
1115
|
*/
|
|
@@ -1224,7 +1224,7 @@ Conduit.setMethod(async function callMiddleware() {
|
|
|
1224
1224
|
/**
|
|
1225
1225
|
* Create a new Hawkejs' ViewRender instance
|
|
1226
1226
|
*
|
|
1227
|
-
* @author Jelle De Loecker
|
|
1227
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1228
1228
|
* @since 0.2.0
|
|
1229
1229
|
* @version 1.3.17
|
|
1230
1230
|
*/
|
|
@@ -1255,7 +1255,7 @@ Conduit.setMethod(function prepareViewRender() {
|
|
|
1255
1255
|
/**
|
|
1256
1256
|
* Call the handler of this route when parsing is finished
|
|
1257
1257
|
*
|
|
1258
|
-
* @author Jelle De Loecker
|
|
1258
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1259
1259
|
* @since 0.2.0
|
|
1260
1260
|
* @version 1.3.16
|
|
1261
1261
|
*/
|
|
@@ -1265,14 +1265,14 @@ Conduit.setMethod(function callHandler() {
|
|
|
1265
1265
|
|
|
1266
1266
|
if (this.route_mismatch) {
|
|
1267
1267
|
|
|
1268
|
-
if (alchemy.settings.debug) {
|
|
1268
|
+
if (alchemy.settings.debugging.debug) {
|
|
1269
1269
|
console.log('Route method not allowed:', this);
|
|
1270
1270
|
}
|
|
1271
1271
|
|
|
1272
1272
|
this.error(405, 'Method Not Allowed', false);
|
|
1273
1273
|
|
|
1274
1274
|
} else {
|
|
1275
|
-
if (alchemy.settings.debug && this.original_path.indexOf('.js.map') == -1) {
|
|
1275
|
+
if (alchemy.settings.debugging.debug && this.original_path.indexOf('.js.map') == -1) {
|
|
1276
1276
|
console.log('Route not found:', this);
|
|
1277
1277
|
}
|
|
1278
1278
|
|
|
@@ -1288,7 +1288,7 @@ Conduit.setMethod(function callHandler() {
|
|
|
1288
1288
|
/**
|
|
1289
1289
|
* Put this request in a queue
|
|
1290
1290
|
*
|
|
1291
|
-
* @author Jelle De Loecker
|
|
1291
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1292
1292
|
* @since 1.3.1
|
|
1293
1293
|
* @version 1.3.1
|
|
1294
1294
|
*
|
|
@@ -1312,11 +1312,11 @@ Conduit.setMethod(function postponeAndQueue(options) {
|
|
|
1312
1312
|
*
|
|
1313
1313
|
* This does not stop the current request from processing.
|
|
1314
1314
|
*
|
|
1315
|
-
* @author Jelle De Loecker
|
|
1315
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1316
1316
|
* @since 1.3.1
|
|
1317
1317
|
* @version 1.3.1
|
|
1318
1318
|
*
|
|
1319
|
-
* @param {
|
|
1319
|
+
* @param {number|Object} options Options or time to wait
|
|
1320
1320
|
*
|
|
1321
1321
|
* @return {Alchemy.Conduit.Postponement}
|
|
1322
1322
|
*/
|
|
@@ -1337,11 +1337,11 @@ Conduit.setMethod(function postponeRequest(options) {
|
|
|
1337
1337
|
*
|
|
1338
1338
|
* This does not stop the current request from processing.
|
|
1339
1339
|
*
|
|
1340
|
-
* @author Jelle De Loecker
|
|
1340
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1341
1341
|
* @since 1.1.0
|
|
1342
1342
|
* @version 1.3.1
|
|
1343
1343
|
*
|
|
1344
|
-
* @param {
|
|
1344
|
+
* @param {number|Object} options Options or time to wait
|
|
1345
1345
|
*
|
|
1346
1346
|
* @return {Alchemy.Conduit.Postponement}
|
|
1347
1347
|
*/
|
|
@@ -1361,7 +1361,7 @@ Conduit.setMethod(function postponeResponse(options) {
|
|
|
1361
1361
|
/**
|
|
1362
1362
|
* Handle the postponement
|
|
1363
1363
|
*
|
|
1364
|
-
* @author Jelle De Loecker
|
|
1364
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1365
1365
|
* @since 1.3.1
|
|
1366
1366
|
* @version 1.3.1
|
|
1367
1367
|
*
|
|
@@ -1411,11 +1411,11 @@ Conduit.setMethod(function _postpone(options) {
|
|
|
1411
1411
|
*
|
|
1412
1412
|
* @deprecated Use {@link #setResponseUrl} instead
|
|
1413
1413
|
*
|
|
1414
|
-
* @author Jelle De Loecker
|
|
1414
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1415
1415
|
* @since 1.2.5
|
|
1416
1416
|
* @version 1.3.0
|
|
1417
1417
|
*
|
|
1418
|
-
* @param {
|
|
1418
|
+
* @param {string|RURL} url
|
|
1419
1419
|
*/
|
|
1420
1420
|
Conduit.setMethod(function overrideResponseUrl(url) {
|
|
1421
1421
|
return this.setResponseUrl(url);
|
|
@@ -1424,11 +1424,11 @@ Conduit.setMethod(function overrideResponseUrl(url) {
|
|
|
1424
1424
|
/**
|
|
1425
1425
|
* Set the response url
|
|
1426
1426
|
*
|
|
1427
|
-
* @author Jelle De Loecker
|
|
1427
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1428
1428
|
* @since 1.3.0
|
|
1429
1429
|
* @version 1.3.0
|
|
1430
1430
|
*
|
|
1431
|
-
* @param {
|
|
1431
|
+
* @param {string|RURL|boolean} new_url
|
|
1432
1432
|
*/
|
|
1433
1433
|
Conduit.setMethod(function setResponseUrl(new_url) {
|
|
1434
1434
|
|
|
@@ -1454,12 +1454,12 @@ Conduit.setMethod(function setResponseUrl(new_url) {
|
|
|
1454
1454
|
/**
|
|
1455
1455
|
* Redirect to another url
|
|
1456
1456
|
*
|
|
1457
|
-
* @author Jelle De Loecker
|
|
1457
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1458
1458
|
* @since 0.2.0
|
|
1459
1459
|
* @version 1.3.17
|
|
1460
1460
|
*
|
|
1461
|
-
* @param {
|
|
1462
|
-
* @param {
|
|
1461
|
+
* @param {number} status 3xx redirection codes. 302 (temporary redirect) by default
|
|
1462
|
+
* @param {string|Object} options Options or url
|
|
1463
1463
|
*/
|
|
1464
1464
|
Conduit.setMethod(function redirect(status, options) {
|
|
1465
1465
|
|
|
@@ -1541,12 +1541,12 @@ Conduit.setMethod(function redirect(status, options) {
|
|
|
1541
1541
|
this.status = status;
|
|
1542
1542
|
|
|
1543
1543
|
// Make sure the url is an internal one if no hard refresh is requested
|
|
1544
|
-
if (!hard_refresh && alchemy.settings.
|
|
1544
|
+
if (!hard_refresh && alchemy.settings.network.main_url) {
|
|
1545
1545
|
let rurl = RURL.parse(url);
|
|
1546
1546
|
|
|
1547
1547
|
// If an explicit hostname is set, this might be an external url
|
|
1548
1548
|
if (rurl.hostname) {
|
|
1549
|
-
let base_url = RURL.parse(alchemy.settings.
|
|
1549
|
+
let base_url = RURL.parse(alchemy.settings.network.main_url);
|
|
1550
1550
|
|
|
1551
1551
|
if (base_url.hostname != rurl.hostname) {
|
|
1552
1552
|
hard_refresh = true;
|
|
@@ -1576,13 +1576,13 @@ Conduit.setMethod(function redirect(status, options) {
|
|
|
1576
1576
|
/**
|
|
1577
1577
|
* Respond with an error
|
|
1578
1578
|
*
|
|
1579
|
-
* @author Jelle De Loecker
|
|
1579
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1580
1580
|
* @since 0.2.0
|
|
1581
1581
|
* @version 1.3.21
|
|
1582
1582
|
*
|
|
1583
1583
|
* @param {Nulber} status Response statuscode
|
|
1584
1584
|
* @param {Error} message Optional error to send
|
|
1585
|
-
* @param {
|
|
1585
|
+
* @param {boolean} print_error Print the error, defaults to true
|
|
1586
1586
|
*/
|
|
1587
1587
|
Conduit.setMethod(function error(status, message, print_error) {
|
|
1588
1588
|
|
|
@@ -1683,11 +1683,11 @@ Conduit.setMethod(function error(status, message, print_error) {
|
|
|
1683
1683
|
/**
|
|
1684
1684
|
* Deny access
|
|
1685
1685
|
*
|
|
1686
|
-
* @author Jelle De Loecker
|
|
1686
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1687
1687
|
* @since 0.2.0
|
|
1688
1688
|
* @version 1.1.0
|
|
1689
1689
|
*
|
|
1690
|
-
* @param {
|
|
1690
|
+
* @param {number} status
|
|
1691
1691
|
* @param {Error} message optional error to send
|
|
1692
1692
|
*/
|
|
1693
1693
|
Conduit.setMethod(function deny(status, message) {
|
|
@@ -1710,11 +1710,11 @@ Conduit.setMethod(function deny(status, message) {
|
|
|
1710
1710
|
* The current user is not authorized and needs to log in
|
|
1711
1711
|
* (Default implementation, is overriden by the acl plugin)
|
|
1712
1712
|
*
|
|
1713
|
-
* @author Jelle De Loecker
|
|
1713
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1714
1714
|
* @since 1.0.7
|
|
1715
1715
|
* @version 1.0.7
|
|
1716
1716
|
*
|
|
1717
|
-
* @param {
|
|
1717
|
+
* @param {boolean} tried_auth Indicate that this was an auth attempt
|
|
1718
1718
|
*/
|
|
1719
1719
|
Conduit.setMethod(function notAuthorized(tried_auth) {
|
|
1720
1720
|
return this.deny();
|
|
@@ -1724,9 +1724,9 @@ Conduit.setMethod(function notAuthorized(tried_auth) {
|
|
|
1724
1724
|
* The current user is authenticated, but not allowed
|
|
1725
1725
|
* (Default implementation, is overriden by the acl plugin)
|
|
1726
1726
|
*
|
|
1727
|
-
* @author
|
|
1728
|
-
* @since
|
|
1729
|
-
* @version
|
|
1727
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1728
|
+
* @since 1.0.7
|
|
1729
|
+
* @version 1.1.0
|
|
1730
1730
|
*/
|
|
1731
1731
|
Conduit.setMethod(function forbidden() {
|
|
1732
1732
|
|
|
@@ -1739,7 +1739,7 @@ Conduit.setMethod(function forbidden() {
|
|
|
1739
1739
|
/**
|
|
1740
1740
|
* Respond with a not found error status
|
|
1741
1741
|
*
|
|
1742
|
-
* @author Jelle De Loecker
|
|
1742
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1743
1743
|
* @since 0.2.0
|
|
1744
1744
|
* @version 1.1.0
|
|
1745
1745
|
*
|
|
@@ -1769,7 +1769,7 @@ Conduit.setMethod(async function notFound(message) {
|
|
|
1769
1769
|
/**
|
|
1770
1770
|
* Respond with a "Not Modified" 304 status
|
|
1771
1771
|
*
|
|
1772
|
-
* @author Jelle De Loecker
|
|
1772
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1773
1773
|
* @since 0.2.0
|
|
1774
1774
|
* @version 0.4.0
|
|
1775
1775
|
*/
|
|
@@ -1781,11 +1781,11 @@ Conduit.setMethod(function notModified() {
|
|
|
1781
1781
|
/**
|
|
1782
1782
|
* Respond with text. Objects get JSON-dry encoded
|
|
1783
1783
|
*
|
|
1784
|
-
* @author Jelle De Loecker
|
|
1784
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1785
1785
|
* @since 0.2.0
|
|
1786
1786
|
* @version 1.3.0
|
|
1787
1787
|
*
|
|
1788
|
-
* @param {
|
|
1788
|
+
* @param {string|Object} message
|
|
1789
1789
|
*/
|
|
1790
1790
|
Conduit.setMethod(function end(message) {
|
|
1791
1791
|
|
|
@@ -1806,8 +1806,12 @@ Conduit.setMethod(function end(message) {
|
|
|
1806
1806
|
|
|
1807
1807
|
if (typeof message !== 'string') {
|
|
1808
1808
|
|
|
1809
|
+
if (message && message instanceof Classes.Stream.Stream) {
|
|
1810
|
+
return this._endWithStream(message);
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1809
1813
|
// Use regular JSON if DRY has been disabled in settings
|
|
1810
|
-
if (alchemy.settings.
|
|
1814
|
+
if (alchemy.settings.network.use_json_dry_response === false || this.json_dry === false) {
|
|
1811
1815
|
json_type = 'json';
|
|
1812
1816
|
json_fnc = JSON.stringify;
|
|
1813
1817
|
} else {
|
|
@@ -1829,7 +1833,7 @@ Conduit.setMethod(function end(message) {
|
|
|
1829
1833
|
cache = this.headers['cache-control'] || this.headers['pragma'];
|
|
1830
1834
|
|
|
1831
1835
|
// Only generate etags when caching is enabled locally & on the browser
|
|
1832
|
-
if (alchemy.settings.cache !== false && (cache == null || cache != 'no-cache')) {
|
|
1836
|
+
if (alchemy.settings.performance.cache !== false && (cache == null || cache != 'no-cache')) {
|
|
1833
1837
|
|
|
1834
1838
|
// Calculate the hash as etag
|
|
1835
1839
|
etag = alchemy.checksum(message);
|
|
@@ -1849,7 +1853,7 @@ Conduit.setMethod(function end(message) {
|
|
|
1849
1853
|
}
|
|
1850
1854
|
|
|
1851
1855
|
// No need to replace anything if debugging is disabled or the log is empty
|
|
1852
|
-
if (alchemy.settings.debug && this.debuglog && this.debuglog.length && message.indexOf('_placeholder_') > -1) {
|
|
1856
|
+
if (alchemy.settings.debugging.debug && this.debuglog && this.debuglog.length && message.indexOf('_placeholder_') > -1) {
|
|
1853
1857
|
temp = JSON.dry(this.debuglog);
|
|
1854
1858
|
message = message.replace(/{\s*"_placeholder_":\s*"debuglog"\s*}/g, temp);
|
|
1855
1859
|
message = message.replace(/{\s*\\"_placeholder_\\":\s*\\"debuglog\\"\s*}/g, JSON.stringify(temp).slice(1,-1));
|
|
@@ -1857,7 +1861,7 @@ Conduit.setMethod(function end(message) {
|
|
|
1857
1861
|
|
|
1858
1862
|
// Compress the output if the client accepts it,
|
|
1859
1863
|
// but only if the file is at least 150 bytes
|
|
1860
|
-
if (alchemy.settings.
|
|
1864
|
+
if (alchemy.settings.network.use_compression !== false && message.length > 150 && this.accepts('gzip')) {
|
|
1861
1865
|
|
|
1862
1866
|
// Set the decompressed content-length for use in progress bars
|
|
1863
1867
|
this.setHeader('x-decompressed-content-length', Buffer.byteLength(message));
|
|
@@ -1878,12 +1882,29 @@ Conduit.setMethod(function end(message) {
|
|
|
1878
1882
|
this._end(message, 'utf-8');
|
|
1879
1883
|
});
|
|
1880
1884
|
|
|
1885
|
+
/**
|
|
1886
|
+
* End with a stream
|
|
1887
|
+
*
|
|
1888
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1889
|
+
* @since 1.3.22
|
|
1890
|
+
* @version 1.3.22
|
|
1891
|
+
*/
|
|
1892
|
+
Conduit.setMethod(function _endWithStream(stream) {
|
|
1893
|
+
|
|
1894
|
+
this.ended = new Date();
|
|
1895
|
+
this.emit('ending');
|
|
1896
|
+
|
|
1897
|
+
this.flushHeaders();
|
|
1898
|
+
|
|
1899
|
+
stream.pipe(this.response);
|
|
1900
|
+
});
|
|
1901
|
+
|
|
1881
1902
|
/**
|
|
1882
1903
|
* Call the actual end method
|
|
1883
1904
|
*
|
|
1884
|
-
* @author Jelle De Loecker
|
|
1905
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1885
1906
|
* @since 0.2.0
|
|
1886
|
-
* @version 1.3.
|
|
1907
|
+
* @version 1.3.22
|
|
1887
1908
|
*/
|
|
1888
1909
|
Conduit.setMethod(function _end(message, encoding = 'utf-8') {
|
|
1889
1910
|
|
|
@@ -1906,18 +1927,42 @@ Conduit.setMethod(function _end(message, encoding = 'utf-8') {
|
|
|
1906
1927
|
return;
|
|
1907
1928
|
}
|
|
1908
1929
|
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1930
|
+
// Set the content-length if it hasn't been set yet
|
|
1931
|
+
if (arguments.length > 0 && !this.response_headers['content-length']) {
|
|
1932
|
+
this.response_headers['content-length'] = Buffer.byteLength(message);
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1935
|
+
this.flushHeaders();
|
|
1936
|
+
|
|
1937
|
+
if (arguments.length === 0) {
|
|
1938
|
+
return this.response.end();
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1941
|
+
// End the response
|
|
1942
|
+
return this.response.end(message, encoding);
|
|
1943
|
+
});
|
|
1944
|
+
|
|
1945
|
+
/**
|
|
1946
|
+
* Flush the headers
|
|
1947
|
+
*
|
|
1948
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1949
|
+
* @since 1.3.22
|
|
1950
|
+
* @version 1.3.22
|
|
1951
|
+
*/
|
|
1952
|
+
Conduit.setMethod(function flushHeaders() {
|
|
1953
|
+
|
|
1954
|
+
if (this._flushed) {
|
|
1955
|
+
return;
|
|
1956
|
+
}
|
|
1957
|
+
|
|
1958
|
+
this._flushed = true;
|
|
1912
1959
|
|
|
1913
1960
|
if (this.status) {
|
|
1914
1961
|
this.response.statusCode = this.status;
|
|
1915
1962
|
}
|
|
1916
1963
|
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
this.response_headers['content-length'] = Buffer.byteLength(message);
|
|
1920
|
-
}
|
|
1964
|
+
let value,
|
|
1965
|
+
key;
|
|
1921
1966
|
|
|
1922
1967
|
for (key in this.response_headers) {
|
|
1923
1968
|
value = this.response_headers[key];
|
|
@@ -1935,19 +1980,12 @@ Conduit.setMethod(function _end(message, encoding = 'utf-8') {
|
|
|
1935
1980
|
|
|
1936
1981
|
// Write the actual headers
|
|
1937
1982
|
this.response.writeHead(this.status);
|
|
1938
|
-
|
|
1939
|
-
if (arguments.length === 0) {
|
|
1940
|
-
return this.response.end();
|
|
1941
|
-
}
|
|
1942
|
-
|
|
1943
|
-
// End the response
|
|
1944
|
-
return this.response.end(message, encoding);
|
|
1945
1983
|
});
|
|
1946
1984
|
|
|
1947
1985
|
/**
|
|
1948
1986
|
* Send a response to the client
|
|
1949
1987
|
*
|
|
1950
|
-
* @author Jelle De Loecker
|
|
1988
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1951
1989
|
* @since 0.2.0
|
|
1952
1990
|
* @version 0.2.0
|
|
1953
1991
|
*/
|
|
@@ -1959,7 +1997,7 @@ Conduit.setMethod(function send(content) {
|
|
|
1959
1997
|
* Create the scene id (if it doesn't exist already)
|
|
1960
1998
|
* We do this using cookies, so the HTML response can be cached
|
|
1961
1999
|
*
|
|
1962
|
-
* @author Jelle De Loecker
|
|
2000
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1963
2001
|
* @since 0.2.0
|
|
1964
2002
|
* @version 1.1.0
|
|
1965
2003
|
*/
|
|
@@ -1970,7 +2008,7 @@ Conduit.setMethod(function createScene() {
|
|
|
1970
2008
|
/**
|
|
1971
2009
|
* Render a view and send it to the client
|
|
1972
2010
|
*
|
|
1973
|
-
* @author Jelle De Loecker
|
|
2011
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
1974
2012
|
* @since 0.2.0
|
|
1975
2013
|
* @version 1.3.17
|
|
1976
2014
|
*/
|
|
@@ -2055,7 +2093,7 @@ Conduit.setMethod(function render(template_name, options, callback) {
|
|
|
2055
2093
|
/**
|
|
2056
2094
|
* Convert a buffer into a stream
|
|
2057
2095
|
*
|
|
2058
|
-
* @author Jelle De Loecker
|
|
2096
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
2059
2097
|
* @since 1.1.0
|
|
2060
2098
|
* @version 1.1.0
|
|
2061
2099
|
*
|
|
@@ -2078,11 +2116,11 @@ function bufferToStream(buffer) {
|
|
|
2078
2116
|
/**
|
|
2079
2117
|
* Send a file to the browser
|
|
2080
2118
|
*
|
|
2081
|
-
* @author Jelle De Loecker
|
|
2119
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
2082
2120
|
* @since 0.2.0
|
|
2083
2121
|
* @version 1.3.0
|
|
2084
2122
|
*
|
|
2085
|
-
* @param {
|
|
2123
|
+
* @param {string} path The path on the server to send to the browser
|
|
2086
2124
|
* @param {Object} options Options, including headers
|
|
2087
2125
|
*/
|
|
2088
2126
|
Conduit.setTypedMethod([Types.String, Types.Object.optional()], function serveFile(path, options = {}) {
|
|
@@ -2099,7 +2137,7 @@ Conduit.setTypedMethod([Types.String, Types.Object.optional()], function serveFi
|
|
|
2099
2137
|
/**
|
|
2100
2138
|
* Send a file to the browser
|
|
2101
2139
|
*
|
|
2102
|
-
* @author Jelle De Loecker
|
|
2140
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
2103
2141
|
* @since 0.2.0
|
|
2104
2142
|
* @version 1.3.13
|
|
2105
2143
|
*
|
|
@@ -2114,7 +2152,7 @@ Conduit.setTypedMethod([Types.Alchemy.Inode.File, Types.Object.optional()], asyn
|
|
|
2114
2152
|
|
|
2115
2153
|
let stats = await file.getStats();
|
|
2116
2154
|
|
|
2117
|
-
if (alchemy.settings.cache && (!options.cache_time && options.cache_time !== false)) {
|
|
2155
|
+
if (alchemy.settings.performance.cache && (!options.cache_time && options.cache_time !== false)) {
|
|
2118
2156
|
options.cache_time = stats.mtime;
|
|
2119
2157
|
}
|
|
2120
2158
|
|
|
@@ -2136,7 +2174,7 @@ Conduit.setTypedMethod([Types.Alchemy.Inode.File, Types.Object.optional()], asyn
|
|
|
2136
2174
|
/**
|
|
2137
2175
|
* Send a buffer to the client
|
|
2138
2176
|
*
|
|
2139
|
-
* @author Jelle De Loecker
|
|
2177
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
2140
2178
|
* @since 1.3.0
|
|
2141
2179
|
* @version 1.3.0
|
|
2142
2180
|
*
|
|
@@ -2150,7 +2188,7 @@ Conduit.setTypedMethod([Buffer, Types.Object.optional()], function serveFile(buf
|
|
|
2150
2188
|
/**
|
|
2151
2189
|
* Send a stream to the client
|
|
2152
2190
|
*
|
|
2153
|
-
* @author Jelle De Loecker
|
|
2191
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
2154
2192
|
* @since 1.3.0
|
|
2155
2193
|
* @version 1.3.0
|
|
2156
2194
|
*
|
|
@@ -2166,7 +2204,7 @@ Conduit.setTypedMethod([Types.Stream, Types.Object.optional()], function serveFi
|
|
|
2166
2204
|
is_text = true;
|
|
2167
2205
|
}
|
|
2168
2206
|
|
|
2169
|
-
if (alchemy.settings.cache === false) {
|
|
2207
|
+
if (alchemy.settings.performance.cache === false) {
|
|
2170
2208
|
options.cache_time = null;
|
|
2171
2209
|
}
|
|
2172
2210
|
|
|
@@ -2174,11 +2212,11 @@ Conduit.setTypedMethod([Types.Stream, Types.Object.optional()], function serveFi
|
|
|
2174
2212
|
options.compress = is_text;
|
|
2175
2213
|
}
|
|
2176
2214
|
|
|
2177
|
-
if (options.compress && (alchemy.settings.
|
|
2215
|
+
if (options.compress && (alchemy.settings.network.use_compression === false || !this.accepts('gzip'))) {
|
|
2178
2216
|
options.compress = false;
|
|
2179
2217
|
}
|
|
2180
2218
|
|
|
2181
|
-
if (options.cache_time && !alchemy.settings.cache) {
|
|
2219
|
+
if (options.cache_time && !alchemy.settings.performance.cache) {
|
|
2182
2220
|
options.cache_time = false;
|
|
2183
2221
|
}
|
|
2184
2222
|
|
|
@@ -2192,7 +2230,7 @@ Conduit.setTypedMethod([Types.Stream, Types.Object.optional()], function serveFi
|
|
|
2192
2230
|
/**
|
|
2193
2231
|
* Send a stream to the client
|
|
2194
2232
|
*
|
|
2195
|
-
* @author Jelle De Loecker
|
|
2233
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
2196
2234
|
* @since 1.3.0
|
|
2197
2235
|
* @version 1.3.14
|
|
2198
2236
|
*
|
|
@@ -2319,19 +2357,19 @@ Conduit.setMethod(function _sendStream(stream, options) {
|
|
|
2319
2357
|
/**
|
|
2320
2358
|
* Create a session
|
|
2321
2359
|
*
|
|
2322
|
-
* @author Jelle De Loecker
|
|
2360
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
2323
2361
|
* @since 0.2.0
|
|
2324
|
-
* @version 1.
|
|
2362
|
+
* @version 1.4.0
|
|
2325
2363
|
*
|
|
2326
|
-
* @param {
|
|
2364
|
+
* @param {boolean} create Create a session if none exist
|
|
2327
2365
|
*
|
|
2328
2366
|
* @return {UserSession}
|
|
2329
2367
|
*/
|
|
2330
2368
|
Conduit.setMethod(function getSession(allow_create = true) {
|
|
2331
2369
|
|
|
2332
2370
|
// Only do this once per request
|
|
2333
|
-
if (this.
|
|
2334
|
-
return this.
|
|
2371
|
+
if (this.session_instance != null) {
|
|
2372
|
+
return this.session_instance;
|
|
2335
2373
|
}
|
|
2336
2374
|
|
|
2337
2375
|
let cookie_name = this.session_cookie_name,
|
|
@@ -2357,7 +2395,7 @@ Conduit.setMethod(function getSession(allow_create = true) {
|
|
|
2357
2395
|
}
|
|
2358
2396
|
|
|
2359
2397
|
if (session) {
|
|
2360
|
-
this.
|
|
2398
|
+
this.session_instance = session;
|
|
2361
2399
|
session.request_count++;
|
|
2362
2400
|
} else {
|
|
2363
2401
|
return false;
|
|
@@ -2369,11 +2407,11 @@ Conduit.setMethod(function getSession(allow_create = true) {
|
|
|
2369
2407
|
/**
|
|
2370
2408
|
* Create a controller of the given type and attach this conduit
|
|
2371
2409
|
*
|
|
2372
|
-
* @author Jelle De Loecker
|
|
2410
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
2373
2411
|
* @since 1.3.16
|
|
2374
2412
|
* @version 1.3.16
|
|
2375
2413
|
*
|
|
2376
|
-
* @param {
|
|
2414
|
+
* @param {string} controller_name
|
|
2377
2415
|
*
|
|
2378
2416
|
* @return {Controller}
|
|
2379
2417
|
*/
|
|
@@ -2397,19 +2435,21 @@ Conduit.setMethod(function getController(controller_name) {
|
|
|
2397
2435
|
/**
|
|
2398
2436
|
* Register live data bindings via websockets
|
|
2399
2437
|
*
|
|
2400
|
-
* @author Jelle De Loecker
|
|
2438
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
2401
2439
|
* @since 0.2.0
|
|
2402
|
-
* @version
|
|
2440
|
+
* @version 1.4.0
|
|
2403
2441
|
*/
|
|
2404
2442
|
Conduit.setMethod(function registerBindings(arr) {
|
|
2405
2443
|
|
|
2406
|
-
|
|
2444
|
+
const websockets = alchemy.settings.network.use_websockets;
|
|
2407
2445
|
|
|
2408
2446
|
// Don't do anything is websockets aren't enabled
|
|
2409
|
-
if (!
|
|
2447
|
+
if (!websockets || websockets == 'never') {
|
|
2410
2448
|
return;
|
|
2411
2449
|
}
|
|
2412
2450
|
|
|
2451
|
+
let data_ids;
|
|
2452
|
+
|
|
2413
2453
|
if (arr) {
|
|
2414
2454
|
data_ids = arr;
|
|
2415
2455
|
} else {
|
|
@@ -2426,42 +2466,42 @@ Conduit.setMethod(function registerBindings(arr) {
|
|
|
2426
2466
|
/**
|
|
2427
2467
|
* Get a a value from the session object
|
|
2428
2468
|
*
|
|
2429
|
-
* @author Jelle De Loecker
|
|
2469
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
2430
2470
|
* @since 0.2.0
|
|
2431
|
-
* @version
|
|
2471
|
+
* @version 1.4.0
|
|
2432
2472
|
*
|
|
2433
|
-
* @param {
|
|
2473
|
+
* @param {string} name
|
|
2434
2474
|
* @param {Mixed} value
|
|
2435
2475
|
*
|
|
2436
2476
|
* @return {Mixed}
|
|
2437
2477
|
*/
|
|
2438
2478
|
Conduit.setMethod(function session(name, value) {
|
|
2439
2479
|
|
|
2440
|
-
this.getSession();
|
|
2480
|
+
const session = this.getSession();
|
|
2441
2481
|
|
|
2442
2482
|
if (arguments.length === 0) {
|
|
2443
|
-
return
|
|
2483
|
+
return session;
|
|
2444
2484
|
}
|
|
2445
2485
|
|
|
2446
2486
|
if (arguments.length === 1) {
|
|
2447
|
-
return
|
|
2487
|
+
return session.get(name);
|
|
2448
2488
|
}
|
|
2449
2489
|
|
|
2450
|
-
|
|
2490
|
+
session.set(name, value);
|
|
2451
2491
|
});
|
|
2452
2492
|
|
|
2453
2493
|
/**
|
|
2454
2494
|
* Get a route URL
|
|
2455
2495
|
*
|
|
2456
|
-
* @author Jelle De Loecker
|
|
2496
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
2457
2497
|
* @since 1.2.7
|
|
2458
2498
|
* @version 1.2.7
|
|
2459
2499
|
*
|
|
2460
|
-
* @param {
|
|
2500
|
+
* @param {string} name
|
|
2461
2501
|
* @param {Object} parameters
|
|
2462
2502
|
* @param {Object} options
|
|
2463
2503
|
*
|
|
2464
|
-
* @return {
|
|
2504
|
+
* @return {string}
|
|
2465
2505
|
*/
|
|
2466
2506
|
Conduit.setMethod(function routeUrl(name, parameters, options) {
|
|
2467
2507
|
return this.renderer.helpers.Router.routeUrl(name, parameters, options);
|
|
@@ -2470,11 +2510,11 @@ Conduit.setMethod(function routeUrl(name, parameters, options) {
|
|
|
2470
2510
|
/**
|
|
2471
2511
|
* Get a parameter from the route
|
|
2472
2512
|
*
|
|
2473
|
-
* @author Jelle De Loecker
|
|
2513
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
2474
2514
|
* @since 0.2.0
|
|
2475
2515
|
* @version 0.2.0
|
|
2476
2516
|
*
|
|
2477
|
-
* @param {
|
|
2517
|
+
* @param {string} name
|
|
2478
2518
|
*/
|
|
2479
2519
|
Conduit.setMethod(function routeParam(name) {
|
|
2480
2520
|
return this.params[name];
|
|
@@ -2483,7 +2523,7 @@ Conduit.setMethod(function routeParam(name) {
|
|
|
2483
2523
|
/**
|
|
2484
2524
|
* Set route parameters
|
|
2485
2525
|
*
|
|
2486
|
-
* @author Jelle De Loecker
|
|
2526
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
2487
2527
|
* @since 1.3.0
|
|
2488
2528
|
* @version 1.3.0
|
|
2489
2529
|
*/
|
|
@@ -2501,18 +2541,18 @@ Conduit.setMethod(function setRouteParameters(data) {
|
|
|
2501
2541
|
/**
|
|
2502
2542
|
* Get/set a cookie
|
|
2503
2543
|
*
|
|
2504
|
-
* @author Jelle De Loecker
|
|
2544
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
2505
2545
|
* @since 0.2.0
|
|
2506
|
-
* @version 1.
|
|
2546
|
+
* @version 1.4.0
|
|
2507
2547
|
*
|
|
2508
|
-
* @param {
|
|
2548
|
+
* @param {string} name
|
|
2509
2549
|
* @param {Mixed} value
|
|
2510
2550
|
* @param {Object} options
|
|
2511
2551
|
*/
|
|
2512
2552
|
Conduit.setMethod(function cookie(name, value, options) {
|
|
2513
2553
|
|
|
2514
2554
|
// Return if cookies are disabled
|
|
2515
|
-
if (!alchemy.settings.cookies) {
|
|
2555
|
+
if (!alchemy.settings.frontend.cookies.enabled) {
|
|
2516
2556
|
return;
|
|
2517
2557
|
}
|
|
2518
2558
|
|
|
@@ -2542,8 +2582,8 @@ Conduit.setMethod(function cookie(name, value, options) {
|
|
|
2542
2582
|
this.new_cookies[name] = value;
|
|
2543
2583
|
|
|
2544
2584
|
// If there is no domain set, see if it is required
|
|
2545
|
-
if ((options.domain === true || options.domain == null) && alchemy.settings.
|
|
2546
|
-
let wanted_domain = alchemy.settings.
|
|
2585
|
+
if ((options.domain === true || options.domain == null) && alchemy.settings.frontend.cookies.domain && this.url) {
|
|
2586
|
+
let wanted_domain = alchemy.settings.frontend.cookies.domain,
|
|
2547
2587
|
actual_domain = this.url.hostname;
|
|
2548
2588
|
|
|
2549
2589
|
if (wanted_domain != actual_domain) {
|
|
@@ -2577,11 +2617,11 @@ Conduit.setMethod(function cookie(name, value, options) {
|
|
|
2577
2617
|
/**
|
|
2578
2618
|
* Set a response header
|
|
2579
2619
|
*
|
|
2580
|
-
* @author Jelle De Loecker
|
|
2620
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
2581
2621
|
* @since 0.2.0
|
|
2582
2622
|
* @version 1.3.0
|
|
2583
2623
|
*
|
|
2584
|
-
* @param {
|
|
2624
|
+
* @param {string} name
|
|
2585
2625
|
* @param {Mixed} value
|
|
2586
2626
|
*/
|
|
2587
2627
|
Conduit.setMethod(function setHeader(name, value) {
|
|
@@ -2600,11 +2640,11 @@ Conduit.setMethod(function setHeader(name, value) {
|
|
|
2600
2640
|
/**
|
|
2601
2641
|
* Get a response header
|
|
2602
2642
|
*
|
|
2603
|
-
* @author Jelle De Loecker
|
|
2643
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
2604
2644
|
* @since 1.1.0
|
|
2605
2645
|
* @version 1.1.0
|
|
2606
2646
|
*
|
|
2607
|
-
* @param {
|
|
2647
|
+
* @param {string} name
|
|
2608
2648
|
*/
|
|
2609
2649
|
Conduit.setMethod(function getHeader(name) {
|
|
2610
2650
|
|
|
@@ -2620,11 +2660,11 @@ Conduit.setMethod(function getHeader(name) {
|
|
|
2620
2660
|
/**
|
|
2621
2661
|
* Update data to this scene only
|
|
2622
2662
|
*
|
|
2623
|
-
* @author Jelle De Loecker
|
|
2663
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
2624
2664
|
* @since 0.2.0
|
|
2625
2665
|
* @version 0.4.0
|
|
2626
2666
|
*
|
|
2627
|
-
* @param {
|
|
2667
|
+
* @param {string} name
|
|
2628
2668
|
* @param {Mixed} value
|
|
2629
2669
|
*/
|
|
2630
2670
|
Conduit.setMethod(function update(name, value) {
|
|
@@ -2639,7 +2679,7 @@ Conduit.setMethod(function update(name, value) {
|
|
|
2639
2679
|
/**
|
|
2640
2680
|
* Push a flash message to the client
|
|
2641
2681
|
*
|
|
2642
|
-
* @author Jelle De Loecker
|
|
2682
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
2643
2683
|
* @since 0.2.0
|
|
2644
2684
|
* @version 0.2.0
|
|
2645
2685
|
*/
|
|
@@ -2668,11 +2708,11 @@ Conduit.setMethod(function flash(message, options) {
|
|
|
2668
2708
|
/**
|
|
2669
2709
|
* Set a theme to use
|
|
2670
2710
|
*
|
|
2671
|
-
* @author Jelle De Loecker
|
|
2711
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
2672
2712
|
* @since 0.2.0
|
|
2673
2713
|
* @version 0.2.0
|
|
2674
2714
|
*
|
|
2675
|
-
* @param {
|
|
2715
|
+
* @param {string} name
|
|
2676
2716
|
*/
|
|
2677
2717
|
Conduit.setMethod(function setTheme(name) {
|
|
2678
2718
|
this.theme = name;
|
|
@@ -2682,13 +2722,13 @@ Conduit.setMethod(function setTheme(name) {
|
|
|
2682
2722
|
/**
|
|
2683
2723
|
* Does this user support a certain feature?
|
|
2684
2724
|
*
|
|
2685
|
-
* @author Jelle De Loecker
|
|
2725
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
2686
2726
|
* @since 1.0.4
|
|
2687
2727
|
* @version 1.0.4
|
|
2688
2728
|
*
|
|
2689
|
-
* @param {
|
|
2729
|
+
* @param {string} feature
|
|
2690
2730
|
*
|
|
2691
|
-
* @return {
|
|
2731
|
+
* @return {boolean}
|
|
2692
2732
|
*/
|
|
2693
2733
|
Conduit.setMethod(function supports(feature) {
|
|
2694
2734
|
|
|
@@ -2726,15 +2766,15 @@ Conduit.setMethod(function supports(feature) {
|
|
|
2726
2766
|
* This is mainly so we can prevent Server-Side-Renders from happening
|
|
2727
2767
|
* when the system is already overloaded.
|
|
2728
2768
|
*
|
|
2729
|
-
* @author Jelle De Loecker
|
|
2769
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
2730
2770
|
* @since 1.3.1
|
|
2731
2771
|
* @version 1.3.1
|
|
2732
2772
|
*
|
|
2733
|
-
* @return {
|
|
2773
|
+
* @return {boolean}
|
|
2734
2774
|
*/
|
|
2735
2775
|
Conduit.setMethod(function shouldBePostponed() {
|
|
2736
2776
|
|
|
2737
|
-
if (!alchemy.settings.postpone_requests_on_overload) {
|
|
2777
|
+
if (!alchemy.settings.performance.postpone_requests_on_overload) {
|
|
2738
2778
|
return false;
|
|
2739
2779
|
}
|
|
2740
2780
|
|
|
@@ -2789,11 +2829,11 @@ Conduit.setMethod(function shouldBePostponed() {
|
|
|
2789
2829
|
/**
|
|
2790
2830
|
* Broadcast data to every connected user
|
|
2791
2831
|
*
|
|
2792
|
-
* @author Jelle De Loecker
|
|
2832
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
2793
2833
|
* @since 0.3.0
|
|
2794
2834
|
* @version 1.3.16
|
|
2795
2835
|
*
|
|
2796
|
-
* @param {
|
|
2836
|
+
* @param {string} type
|
|
2797
2837
|
* @param {Object} data
|
|
2798
2838
|
*/
|
|
2799
2839
|
Alchemy.setMethod(function broadcast(type, data) {
|
|
@@ -2807,7 +2847,7 @@ Alchemy.setMethod(function broadcast(type, data) {
|
|
|
2807
2847
|
return;
|
|
2808
2848
|
}
|
|
2809
2849
|
|
|
2810
|
-
if (alchemy.settings.debug) {
|
|
2850
|
+
if (alchemy.settings.debugging.debug) {
|
|
2811
2851
|
log.debug('Broadcasting', type, {data, scene: socket_conduit});
|
|
2812
2852
|
}
|
|
2813
2853
|
|
|
@@ -2819,9 +2859,9 @@ Alchemy.setMethod(function broadcast(type, data) {
|
|
|
2819
2859
|
/**
|
|
2820
2860
|
* Get the magic mimetype function
|
|
2821
2861
|
*
|
|
2822
|
-
* @author Jelle De Loecker
|
|
2862
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
2823
2863
|
* @since 0.3.0
|
|
2824
|
-
* @version
|
|
2864
|
+
* @version 1.4.0
|
|
2825
2865
|
*/
|
|
2826
2866
|
function getMagic() {
|
|
2827
2867
|
|
|
@@ -2832,7 +2872,7 @@ function getMagic() {
|
|
|
2832
2872
|
}
|
|
2833
2873
|
|
|
2834
2874
|
// Get mmmagic module
|
|
2835
|
-
mmmagic = alchemy.use('mmmagic')
|
|
2875
|
+
mmmagic = alchemy.use('@picturae/mmmagic')
|
|
2836
2876
|
|
|
2837
2877
|
if (mmmagic) {
|
|
2838
2878
|
magic = new mmmagic.Magic(mmmagic.MAGIC_MIME_TYPE);
|