gina 0.1.1-alpha.21 → 0.1.1-alpha.211
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/AUTHORS +2 -1
- package/LICENSE +1 -1
- package/README-4Contributors.md +30 -0
- package/README.md +210 -32
- package/bin/cli +166 -68
- package/bin/cli-debug +49 -18
- package/bin/cmd +40 -18
- package/bin/gina +48 -37
- package/framework/{v0.1.1-alpha.21/lib/inherits → v0.1.1-alpha.211}/LICENSE +1 -1
- package/framework/v0.1.1-alpha.211/VERSION +1 -0
- package/framework/{v0.1.1-alpha.21/core/asset/js/plugin/readme.md → v0.1.1-alpha.211/core/asset/plugin/README.md} +31 -9
- package/framework/v0.1.1-alpha.211/core/asset/plugin/dist/vendor/gina/css/gina.min.css +1 -0
- package/framework/v0.1.1-alpha.211/core/asset/plugin/dist/vendor/gina/css/gina.min.css.map +1 -0
- package/framework/v0.1.1-alpha.211/core/asset/plugin/dist/vendor/gina/html/toolbar.html +251 -0
- package/framework/{v0.1.1-alpha.21/core/asset/js/plugin/dist → v0.1.1-alpha.211/core/asset/plugin/dist/vendor/gina/js}/gina.js +4364 -3175
- package/framework/v0.1.1-alpha.211/core/asset/plugin/dist/vendor/gina/js/gina.min.js +764 -0
- package/framework/v0.1.1-alpha.211/core/asset/plugin/dist/vendor/gina/js/gina.min.js.map +8 -0
- package/framework/v0.1.1-alpha.211/core/asset/plugin/dist/vendor/gina/js/gina.onload.min.js +5 -0
- package/framework/v0.1.1-alpha.211/core/asset/plugin/dist/vendor/gina/js/gina.onload.min.js.map +8 -0
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/config.js +172 -79
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/connectors/couchbase/index.js +373 -259
- package/framework/v0.1.1-alpha.211/core/connectors/couchbase/lib/connector.js +22 -0
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/connectors/couchbase/lib/connector.v2.js +51 -51
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/connectors/couchbase/lib/connector.v3.js +51 -51
- package/framework/v0.1.1-alpha.211/core/connectors/couchbase/lib/connector.v4.js +384 -0
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/connectors/couchbase/lib/n1ql.js +3 -2
- package/framework/v0.1.1-alpha.211/core/connectors/couchbase/lib/session-store.js +22 -0
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/connectors/couchbase/lib/session-store.v3.js +12 -12
- package/framework/v0.1.1-alpha.211/core/connectors/couchbase/lib/session-store.v4.js +361 -0
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/controller/controller.js +921 -773
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/dev/index.js +1 -1
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/dev/lib/class.js +1 -1
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/dev/lib/factory.js +2 -2
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/gna.js +13 -9
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/locales/README.md +5 -0
- package/framework/v0.1.1-alpha.211/core/locales/dist/region/en.json +5727 -0
- package/framework/v0.1.1-alpha.211/core/locales/dist/region/fr.json +11452 -0
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/locales/index.js +2 -2
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/locales/src/make.js +39 -41
- package/framework/v0.1.1-alpha.211/core/locales/src/resources/region.mapping.json +43 -0
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/model/entity.js +87 -67
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/model/index.js +16 -16
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/model/template/entityFactory.js +1 -1
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/model/template/index.js +17 -15
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/plugins/index.js +1 -1
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/plugins/lib/file/package.json +1 -1
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/plugins/lib/intl/package.json +1 -1
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/plugins/lib/intl/src/main.js +5 -5
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/plugins/lib/storage/package.json +1 -1
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/plugins/lib/storage/src/main.js +6 -5
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/plugins/lib/validator/package.json +1 -1
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/plugins/lib/validator/src/form-validator.js +403 -300
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/plugins/lib/validator/src/main.js +1368 -1314
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/router.js +99 -90
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/server.isaac.js +203 -180
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/server.js +439 -238
- package/framework/v0.1.1-alpha.211/core/template/boilerplate/bundle/config/settings.json +12 -0
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/boilerplate/bundle/config/settings.server.json +4 -4
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/boilerplate/bundle/config/templates.json +4 -4
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/boilerplate/bundle/controllers/controller.content.js +1 -1
- package/framework/v0.1.1-alpha.211/core/template/boilerplate/bundle/controllers/setup.js +111 -0
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/boilerplate/bundle/index.js +13 -1
- package/framework/v0.1.1-alpha.211/core/template/boilerplate/bundle_templates/html/content/homepage.html +8 -0
- package/framework/v0.1.1-alpha.211/core/template/boilerplate/bundle_templates/html/includes/error-msg-noscript.html +11 -0
- package/framework/v0.1.1-alpha.211/core/template/boilerplate/bundle_templates/html/includes/error-msg-outdated-browser.html +8 -0
- package/framework/{v0.1.1-alpha.21/core/template/boilerplate/bundle_templates/html/layout → v0.1.1-alpha.211/core/template/boilerplate/bundle_templates/html/layouts}/main.html +10 -3
- package/framework/v0.1.1-alpha.211/core/template/command/gina.bat.tpl +8 -0
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/command/gina.tpl +4 -4
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/conf/env.json +11 -0
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/conf/package.json +1 -1
- package/framework/v0.1.1-alpha.211/core/template/conf/statics.json +12 -0
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/conf/templates.json +2 -2
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/helpers/console.js +3 -3
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/helpers/context.js +148 -7
- package/framework/v0.1.1-alpha.211/helpers/data/LICENSE +9 -0
- package/framework/v0.1.1-alpha.211/helpers/data/README.md +12 -0
- package/framework/v0.1.1-alpha.211/helpers/data/package.json +20 -0
- package/framework/v0.1.1-alpha.211/helpers/data/src/main.js +295 -0
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/helpers/dateFormat.js +9 -7
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/helpers/index.js +13 -8
- package/framework/v0.1.1-alpha.211/helpers/json/LICENSE +9 -0
- package/framework/v0.1.1-alpha.211/helpers/json/README.md +12 -0
- package/framework/{v0.1.1-alpha.21/helpers/plugins → v0.1.1-alpha.211/helpers/json}/package.json +2 -2
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/helpers/json/src/main.js +28 -26
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/helpers/path.js +176 -96
- package/framework/{v0.1.1-alpha.21/helpers/json → v0.1.1-alpha.211/helpers/plugins}/package.json +2 -2
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/helpers/plugins/src/api-error.js +23 -23
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/helpers/plugins/src/main.js +3 -3
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/helpers/prototypes.js +46 -38
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/helpers/task.js +21 -14
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/helpers/text.js +2 -2
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/archiver/package.json +1 -1
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/archiver/src/dep/jszip.min.js +3 -3
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/archiver/src/main.js +168 -168
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/aliases.json +4 -1
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/bundle/add.js +84 -27
- package/framework/v0.1.1-alpha.211/lib/cmd/bundle/arguments.json +7 -0
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/bundle/help.txt +4 -2
- package/framework/v0.1.1-alpha.211/lib/cmd/bundle/list.js +176 -0
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/bundle/remove.js +36 -27
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/bundle/start.js +264 -46
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/bundle/stop.js +93 -74
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/env/add.js +44 -43
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/env/list.js +23 -4
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/env/remove.js +19 -19
- package/framework/{v0.1.1-alpha.21/lib/cmd/scope → v0.1.1-alpha.211/lib/cmd/env}/use.js +21 -1
- package/framework/v0.1.1-alpha.211/lib/cmd/framework/build.js +88 -0
- package/framework/v0.1.1-alpha.211/lib/cmd/framework/init.js +798 -0
- package/framework/v0.1.1-alpha.211/lib/cmd/framework/link-node-modules.js +116 -0
- package/framework/v0.1.1-alpha.211/lib/cmd/framework/link.js +114 -0
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/framework/open.js +22 -1
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/framework/restart.js +61 -26
- package/framework/v0.1.1-alpha.211/lib/cmd/framework/set.js +285 -0
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/framework/start.js +46 -20
- package/framework/v0.1.1-alpha.211/lib/cmd/framework/status.js +141 -0
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/framework/stop.js +47 -28
- package/framework/v0.1.1-alpha.211/lib/cmd/framework/tail.js +302 -0
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/framework/version.js +15 -3
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/helper.js +131 -18
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/index.js +23 -23
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/port/inc/scan.js +32 -16
- package/framework/v0.1.1-alpha.211/lib/cmd/port/list.js +462 -0
- package/framework/v0.1.1-alpha.211/lib/cmd/port/reset.js +429 -0
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/project/add.js +147 -122
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/project/arguments.json +2 -1
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/project/build.js +28 -28
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/project/list.js +19 -2
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/project/remove.js +19 -17
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/project/rename.js +11 -11
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/protocol/set.js +256 -209
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/scope/list.js +27 -8
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/scope/remove.js +19 -19
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/view/add.js +35 -10
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/collection/package.json +1 -1
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/collection/src/main.js +243 -242
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/config.js +31 -30
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cron/package.json +1 -1
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cron/src/main.js +10 -9
- package/framework/v0.1.1-alpha.211/lib/domain/LICENSE +9 -0
- package/framework/v0.1.1-alpha.211/lib/domain/README.md +46 -0
- package/framework/v0.1.1-alpha.211/lib/domain/dist/public_suffix_list.dat +14186 -0
- package/framework/v0.1.1-alpha.211/lib/domain/package.json +20 -0
- package/framework/v0.1.1-alpha.211/lib/domain/src/main.js +442 -0
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/generator/index.js +5 -5
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/index.js +3 -2
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211/lib/inherits}/LICENSE +1 -1
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/inherits/README.md +2 -2
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/inherits/package.json +3 -4
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/inherits/src/main.js +3 -3
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/logger/package.json +2 -2
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/logger/src/containers/default/index.js +13 -2
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/logger/src/containers/file/index.js +109 -14
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/logger/src/containers/mq/index.js +12 -3
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/logger/src/containers/mq/listener.js +16 -14
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/logger/src/containers/mq/speaker.js +32 -3
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/logger/src/helper.js +21 -1
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/logger/src/main.js +36 -9
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/math/index.js +9 -9
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/merge/README.md +2 -2
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/merge/package.json +1 -1
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/merge/src/main.js +118 -91
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/model.js +10 -10
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/proc.js +87 -49
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/routing/package.json +1 -1
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/routing/src/main.js +313 -285
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/session-store.js +6 -6
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/shell.js +3 -3
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/swig-filters/package.json +1 -1
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/swig-filters/src/main.js +140 -119
- package/framework/v0.1.1-alpha.211/lib/url/README.md +0 -0
- package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/validator.js +2 -2
- package/framework/v0.1.1-alpha.211/package.json +14 -0
- package/package.json +37 -25
- package/resources/home/main.json +53 -4
- package/resources/home/settings.json +9 -0
- package/resources/home/user/extensions/logger/default/config.json +1 -1
- package/resources/package.json.template +29 -18
- package/script/lib.js +0 -0
- package/script/post_install.js +496 -139
- package/script/pre_install.js +489 -77
- package/services/.gna/67fdf1b224a2ed5597e63d4b64283834468e05e3.txt +0 -0
- package/services/.gna/arch +1 -0
- package/services/.gna/locals.json +14 -0
- package/services/.gna/platform +1 -0
- package/services/configure +6 -0
- package/services/env.json +18 -0
- package/services/manifest.json +30 -0
- package/services/package.json +11 -0
- package/services/src/proxy/config/app.json +6 -0
- package/services/src/proxy/config/routing.json +11 -0
- package/services/src/proxy/config/settings.json +9 -0
- package/services/src/proxy/config/settings.server.json +31 -0
- package/services/src/proxy/config/statics.json +3 -0
- package/services/src/proxy/controllers/controller.content.js +58 -0
- package/services/src/proxy/controllers/controller.js +30 -0
- package/{framework/v0.1.1-alpha.21/core/template/boilerplate/bundle → services/src/proxy}/controllers/setup.js +14 -14
- package/services/src/proxy/index.js +31 -0
- package/services/src/proxy/lib/domain/README.md +48 -0
- package/services/src/proxy/lib/domain/src/config/public_suffix_list.dat +14186 -0
- package/services/src/toolbar/config/app.json +6 -0
- package/services/src/toolbar/config/routing.json +11 -0
- package/{framework/v0.1.1-alpha.21/core/template/boilerplate/bundle → services/src/toolbar}/config/settings.json +0 -0
- package/services/src/toolbar/config/settings.server.json +30 -0
- package/services/src/toolbar/controllers/controller.content.js +39 -0
- package/services/src/toolbar/controllers/controller.js +30 -0
- package/services/src/toolbar/controllers/setup.js +111 -0
- package/services/src/toolbar/index.js +43 -0
- package/utils/helper.js +236 -185
- package/utils/prototypes.js +9 -9
- package/utils/prototypes.json_clone.js +70 -37
- package/doc/framework/cli/doc.json +0 -9
- package/doc/framework/index.md +0 -60
- package/framework/v0.1.1-alpha.21/VERSION +0 -1
- package/framework/v0.1.1-alpha.21/core/asset/js/plugin/dist/gina.js.map +0 -56
- package/framework/v0.1.1-alpha.21/core/asset/js/plugin/dist/gina.min.css +0 -1
- package/framework/v0.1.1-alpha.21/core/asset/js/plugin/dist/gina.min.css.map +0 -1
- package/framework/v0.1.1-alpha.21/core/asset/js/plugin/dist/gina.min.js +0 -736
- package/framework/v0.1.1-alpha.21/core/asset/js/plugin/dist/gina.min.js.map +0 -56
- package/framework/v0.1.1-alpha.21/core/asset/js/plugin/dist/gina.onload.min.js +0 -5
- package/framework/v0.1.1-alpha.21/core/asset/js/plugin/dist/gina.onload.min.js.map +0 -8
- package/framework/v0.1.1-alpha.21/core/connectors/couchbase/lib/connector.js +0 -20
- package/framework/v0.1.1-alpha.21/core/connectors/couchbase/lib/session-store.js +0 -21
- package/framework/v0.1.1-alpha.21/core/locales/dist/region/en.json +0 -9492
- package/framework/v0.1.1-alpha.21/core/locales/dist/region/fr.json +0 -9492
- package/framework/v0.1.1-alpha.21/core/locales/src/resources/region.mapping.json +0 -28
- package/framework/v0.1.1-alpha.21/core/template/boilerplate/bundle_templates/html/homepage.html +0 -4
- package/framework/v0.1.1-alpha.21/core/template/conf/statics.json +0 -10
- package/framework/v0.1.1-alpha.21/lib/cmd/bundle/arguments.json +0 -4
- package/framework/v0.1.1-alpha.21/lib/cmd/bundle/list.js +0 -129
- package/framework/v0.1.1-alpha.21/lib/cmd/framework/init.js +0 -514
- package/framework/v0.1.1-alpha.21/lib/cmd/framework/set.js +0 -161
- package/framework/v0.1.1-alpha.21/lib/cmd/framework/status.js +0 -72
- package/framework/v0.1.1-alpha.21/lib/cmd/framework/tail.js +0 -183
- package/framework/v0.1.1-alpha.21/lib/cmd/port/list.js +0 -176
- package/framework/v0.1.1-alpha.21/package.json +0 -14
- package/script/prepare_version.js +0 -429
- /package/{framework/v0.1.1-alpha.21/core/template/command/gina.bat.tpl → bin/gina.bat} +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/AUTHORS +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/asset/html/nolayout.html +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/asset/html/static.html +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/asset/img/android-chrome-192x192.png +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/asset/img/android-chrome-512x512.png +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/asset/img/apple-touch-icon.png +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/asset/img/favicon-16x16.png +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/asset/img/favicon-32x32.png +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/asset/img/favicon.ico +0 -0
- /package/framework/{v0.1.1-alpha.21/core/asset/js → v0.1.1-alpha.211/core/asset}/plugin/uuid.json +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/connectors/couchbase/lib/session-store.v2.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/controller/controller.framework.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/controller/index.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/deps/busboy/.travis.yml +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/deps/busboy/LICENSE +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/deps/busboy/README.md +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/deps/busboy/deps/encoding/encoding-indexes.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/deps/busboy/deps/encoding/encoding.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/deps/busboy/lib/main.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/deps/busboy/lib/types/multipart.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/deps/busboy/lib/types/urlencoded.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/deps/busboy/lib/utils.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/deps/busboy/package.json +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/deps/swig-client/swig-2.0.0.min.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/dev/lib/tools.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/locales/currency.json +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/locales/dist/language/en.json +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/locales/dist/language/fr.json +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/locales/src/resources/currency.csv +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/locales/src/resources/region.csv +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/mime.types +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/plugins/README.md +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/plugins/lib/file/README.md +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/plugins/lib/file/build.json +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/plugins/lib/intl/README.md +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/plugins/lib/intl/build.json +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/plugins/lib/storage/README.md +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/plugins/lib/storage/build.json +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/plugins/lib/validator/README.md +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/plugins/lib/validator/build.json +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/server.express.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/status.codes +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/boilerplate/bundle/config/app.json +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/boilerplate/bundle/config/routing.json +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/boilerplate/bundle/controllers/controller.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/boilerplate/bundle_namespace/controllers/controller.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/boilerplate/bundle_public/css/default.css +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/boilerplate/bundle_public/css/vendor/readme.md +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/boilerplate/bundle_public/favicon.ico +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/boilerplate/bundle_public/js/vendor/readme.md +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/boilerplate/bundle_public/readme.md +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/boilerplate/bundle_templates/handlers/main.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/conf/manifest.json +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/conf/settings.json +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/error/client/json/401.json +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/error/client/json/403.json +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/error/client/json/404.json +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/error/server/html/50x.html +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/error/server/json/500.json +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/error/server/json/503.json +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/core/template/extensions/logger/config.json +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/helpers/plugins/README.md +0 -0
- /package/framework/{v0.1.1-alpha.21/helpers/json → v0.1.1-alpha.211/lib/archiver}/README.md +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/archiver/build.json +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/bundle/copy.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/bundle/cp.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/bundle/help.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/bundle/rename.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/bundle/restart.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/bundle/rm.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/bundle/status.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/env/get.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/env/help.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/env/help.txt +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/env/link-dev.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/env/rm.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/env/set.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/env/unset.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/framework/dot.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/framework/get.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/framework/help.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/framework/help.txt +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/framework/msg.json +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/framework/update.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/gina-dev.1.md +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/gina-framework.1.md +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/gina.1.md +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/msg.json +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/port/help.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/port/help.txt +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/port/set.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/project/help.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/project/help.txt +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/project/import.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/project/move.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/project/restart.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/project/rm.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/project/start.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/project/status.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/project/stop.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/protocol/help.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/protocol/help.txt +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/protocol/list.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/scope/help.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/scope/help.txt +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/scope/link-local.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/scope/rm.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/scope/set.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cmd/scope/unset.js +0 -0
- /package/framework/{v0.1.1-alpha.21/lib/cmd/env → v0.1.1-alpha.211/lib/cmd/scope}/use.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/collection/README.md +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/collection/build.json +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/cron/README.md +0 -0
- /package/framework/{v0.1.1-alpha.21/lib/archiver/README.md → v0.1.1-alpha.211/lib/domain/exemples/backend.js} +0 -0
- /package/framework/{v0.1.1-alpha.21/lib/routing/README.md → v0.1.1-alpha.211/lib/domain/exemples/frontend.html} +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/inherits/example/inheriting_eventemitter.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/inherits/example/protected_inheritance.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/inherits/example/simple_inheritance.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/inherits/example/super_attribute_overridden_by_child_on_init.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/logger/README.md +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/logger/src/containers/file/lib/logrotator/README.md +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/logger/src/containers/file/lib/logrotator/index.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/merge/example/merge.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/merge/example/merge_2_literal objects.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/merge/example/merge_and_preserve_first.js +0 -0
- /package/framework/{v0.1.1-alpha.21/lib/swig-filters → v0.1.1-alpha.211/lib/routing}/README.md +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/routing/build.json +0 -0
- /package/framework/{v0.1.1-alpha.21/lib/url → v0.1.1-alpha.211/lib/swig-filters}/README.md +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/url/index.js +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/url/mocks.json +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/url/routing.json +0 -0
- /package/framework/{v0.1.1-alpha.21 → v0.1.1-alpha.211}/lib/url/test.js +0 -0
|
@@ -15,7 +15,7 @@ const swig = require( _(GINA_FRAMEWORK_DIR +'/node_modules/swig', true)
|
|
|
15
15
|
var Config = require('./config');
|
|
16
16
|
var Router = require('./router');
|
|
17
17
|
var lib = require('./../lib');
|
|
18
|
-
var
|
|
18
|
+
var routingLib = lib.routing;
|
|
19
19
|
var inherits = lib.inherits;
|
|
20
20
|
var merge = lib.merge;
|
|
21
21
|
var Proc = lib.Proc;
|
|
@@ -227,13 +227,56 @@ function Server(options) {
|
|
|
227
227
|
})
|
|
228
228
|
});
|
|
229
229
|
} catch (err) {
|
|
230
|
-
|
|
231
|
-
|
|
230
|
+
if (!sslDetails) {
|
|
231
|
+
throw new Error('DNS issue ? Did you check your `/etc/hosts` or your DNS configuration ?\n'+ err.stack);
|
|
232
|
+
}
|
|
233
|
+
throw new Error(sslDetails +'\n'+ err.stack);
|
|
232
234
|
}
|
|
233
235
|
|
|
234
236
|
|
|
235
237
|
const failed = !sslDetails.valid;
|
|
236
238
|
const humanView = JSON.stringify(sslDetails, null, ' ');
|
|
239
|
+
|
|
240
|
+
// Wildcard exception - See https://github.com/dyaa/ssl-checker/issues/381
|
|
241
|
+
// Date of the test: 2022-12-18T00:00:00.000Z
|
|
242
|
+
// container-87546.dev.sample.app -> not valid when it should return true.
|
|
243
|
+
// {
|
|
244
|
+
// "daysRemaining": 290,
|
|
245
|
+
// "valid": false,
|
|
246
|
+
// "validFrom": "2022-10-03T00:00:00.000Z",
|
|
247
|
+
// "validTo": "2023-10-03T23:59:59.000Z",
|
|
248
|
+
// "validFor": [
|
|
249
|
+
// "*.sample.app",
|
|
250
|
+
// "sample.app"
|
|
251
|
+
// ]
|
|
252
|
+
// }
|
|
253
|
+
|
|
254
|
+
const isHandleByWildcardCert = function(endpoint, hv) {
|
|
255
|
+
var isAllowed = false;
|
|
256
|
+
const start = new Date(hv.validFrom).format('longIsoDateTime');
|
|
257
|
+
const end = new Date(hv.validTo).format('longIsoDateTime');
|
|
258
|
+
const today = new Date().format('longIsoDateTime');
|
|
259
|
+
const allowed = hv.validFor;
|
|
260
|
+
|
|
261
|
+
for (let i=0, len=allowed.length; i<len; ++i ) {
|
|
262
|
+
// skip if not a wildcard
|
|
263
|
+
if ( ! /^[*]\./.test(allowed[i]) ) continue;
|
|
264
|
+
|
|
265
|
+
let re = new RegExp( allowed[i].replace(/^[*]/, '')+'$' );
|
|
266
|
+
if ( ! re.test(endpoint) ) continue;
|
|
267
|
+
|
|
268
|
+
if ( today >= start && today < end) {
|
|
269
|
+
isAllowed = true;
|
|
270
|
+
break
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return isAllowed;
|
|
274
|
+
}
|
|
275
|
+
if ( failed && Array.isArray(sslDetails.validFor) && isHandleByWildcardCert(endpoint, sslDetails) ) {
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
|
|
237
280
|
if (failed) {
|
|
238
281
|
if (sslDetails.daysRemaining > -1) {
|
|
239
282
|
console.emerg(`[Certificate] ${endpoint} : It is like there is a problem with your CA certificate${'\n'} ${humanView}`);
|
|
@@ -495,149 +538,149 @@ function Server(options) {
|
|
|
495
538
|
return _hasViews
|
|
496
539
|
}
|
|
497
540
|
|
|
498
|
-
var parseCollection = function (collection, obj) {
|
|
499
|
-
|
|
500
|
-
for(var i = 0, len = collection.length; i<len; ++i) {
|
|
501
|
-
obj[i] = parseObject(collection[i], obj);
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
return obj
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
var parseObject = function (tmp, obj) {
|
|
508
|
-
var el = []
|
|
509
|
-
, key = null
|
|
510
|
-
;
|
|
511
|
-
|
|
512
|
-
for (var o in tmp) {
|
|
513
|
-
|
|
514
|
-
el[0] = o;
|
|
515
|
-
el[1] = tmp[o];
|
|
516
|
-
|
|
517
|
-
if ( /^(.*)\[(.*)\]/.test(el[0]) ) { // some[field] ?
|
|
518
|
-
key = el[0].replace(/\]/g, '').split(/\[/g);
|
|
519
|
-
obj = parseLocalObj(obj, key, 0, el[1])
|
|
520
|
-
} else {
|
|
521
|
-
obj[ el[0] ] = el[1]
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
return obj
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
var parseBody = function(body) {
|
|
529
|
-
var obj = null, tmp = null, arr = null;
|
|
530
|
-
if ( /^(\{|\[|\%7B|\%5B)/.test(body) ) {
|
|
531
|
-
try {
|
|
532
|
-
obj = {};
|
|
533
|
-
|
|
534
|
-
if ( /^(\%7B|\%5B)/.test(body) ) {
|
|
535
|
-
tmp = JSON.parse(decodeURIComponent(body))
|
|
536
|
-
} else {
|
|
537
|
-
tmp = JSON.parse(body)
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
if ( Array.isArray(tmp) ) {
|
|
541
|
-
obj = parseCollection(tmp, obj)
|
|
542
|
-
} else {
|
|
543
|
-
obj = parseObject(tmp, obj)
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
return obj
|
|
547
|
-
} catch (err) {
|
|
548
|
-
console.error('[365] could not parse body:\n' + body)
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
} else {
|
|
552
|
-
obj = {};
|
|
553
|
-
arr = body.split(/&/g);
|
|
554
|
-
if ( /(\"false\"|\"true\"|\"on\")/.test(body) )
|
|
555
|
-
body = body.replace(/\"false\"/g, false).replace(/\"true\"/g, true).replace(/\"on\"/g, true);
|
|
556
|
-
|
|
541
|
+
// var parseCollection = function (collection, obj) {
|
|
557
542
|
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
543
|
+
// for(var i = 0, len = collection.length; i<len; ++i) {
|
|
544
|
+
// obj[i] = parseObject(collection[i], obj);
|
|
545
|
+
// }
|
|
561
546
|
|
|
562
|
-
|
|
563
|
-
|
|
547
|
+
// return obj
|
|
548
|
+
// }
|
|
564
549
|
|
|
565
|
-
|
|
550
|
+
// var parseObject = function (tmp, obj) {
|
|
551
|
+
// var el = []
|
|
552
|
+
// , key = null
|
|
553
|
+
// ;
|
|
566
554
|
|
|
567
|
-
|
|
568
|
-
//if ( /^\{/.test(arr[i]) ) { // is a json string
|
|
569
|
-
try {
|
|
570
|
-
if (/^\{/.test(arr[i])) {
|
|
571
|
-
obj = JSON.parse(arr[i]);
|
|
572
|
-
break;
|
|
573
|
-
} else {
|
|
574
|
-
el = arr[i].match(/\=(.*)/);
|
|
575
|
-
el[0] = arr[i].split(/\=/)[0];
|
|
576
|
-
obj[ el[0] ] = JSON.parse( el[1] );
|
|
577
|
-
}
|
|
555
|
+
// for (var o in tmp) {
|
|
578
556
|
|
|
557
|
+
// el[0] = o;
|
|
558
|
+
// el[1] = tmp[o];
|
|
579
559
|
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
el[1] = JSON.parse(el[1])
|
|
588
|
-
} catch (err) {
|
|
589
|
-
console.error('[parseBody#2] could not parse body:\n' + el[1])
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
if ( typeof(el[1]) == 'string' && !/\[object /.test(el[1])) {
|
|
594
|
-
key = null;
|
|
595
|
-
el[0] = decodeURIComponent(el[0]);
|
|
596
|
-
el[1] = decodeURIComponent(el[1]);
|
|
560
|
+
// if ( /^(.*)\[(.*)\]/.test(el[0]) ) { // some[field] ?
|
|
561
|
+
// key = el[0].replace(/\]/g, '').split(/\[/g);
|
|
562
|
+
// obj = parseLocalObj(obj, key, 0, el[1])
|
|
563
|
+
// } else {
|
|
564
|
+
// obj[ el[0] ] = el[1]
|
|
565
|
+
// }
|
|
566
|
+
// }
|
|
597
567
|
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
obj = parseLocalObj(obj, key, 0, el[1])
|
|
601
|
-
} else {
|
|
602
|
-
obj[ el[0] ] = el[1]
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
}
|
|
568
|
+
// return obj
|
|
569
|
+
// }
|
|
607
570
|
|
|
608
|
-
|
|
609
|
-
|
|
571
|
+
// var parseBody = function(body) {
|
|
572
|
+
// var obj = null, tmp = null, arr = null;
|
|
573
|
+
// if ( /^(\{|\[|\%7B|\%5B)/.test(body) ) {
|
|
574
|
+
// try {
|
|
575
|
+
// obj = ( /^(\{|\%7B)/.test() ) ? {} : [];
|
|
576
|
+
|
|
577
|
+
// if ( /^(\%7B|\%5B)/.test(body) ) {
|
|
578
|
+
// tmp = JSON.parse(decodeURIComponent(body))
|
|
579
|
+
// } else {
|
|
580
|
+
// tmp = JSON.parse(body)
|
|
581
|
+
// }
|
|
582
|
+
|
|
583
|
+
// if ( Array.isArray(tmp) ) {
|
|
584
|
+
// obj = parseCollection(tmp, obj)
|
|
585
|
+
// } else {
|
|
586
|
+
// obj = parseObject(tmp, obj)
|
|
587
|
+
// }
|
|
588
|
+
|
|
589
|
+
// return obj
|
|
590
|
+
// } catch (err) {
|
|
591
|
+
// console.error('[365] could not parse body:\n' + body)
|
|
592
|
+
// }
|
|
593
|
+
|
|
594
|
+
// } else {
|
|
595
|
+
// obj = {};
|
|
596
|
+
// arr = body.split(/&/g);
|
|
597
|
+
// if ( /(\"false\"|\"true\"|\"on\")/.test(body) )
|
|
598
|
+
// body = body.replace(/\"false\"/g, false).replace(/\"true\"/g, true).replace(/\"on\"/g, true);
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
// var el = {}
|
|
602
|
+
// , value = null
|
|
603
|
+
// , key = null;
|
|
604
|
+
|
|
605
|
+
// for (var i = 0, len = arr.length; i < len; ++i) {
|
|
606
|
+
// if (!arr[i]) continue;
|
|
607
|
+
|
|
608
|
+
// arr[i] = decodeURIComponent(arr[i]);
|
|
609
|
+
|
|
610
|
+
// if ( /^\{/.test(arr[i]) || /\=\{/.test(arr[i]) || /\=\[/.test(arr[i]) ) {
|
|
611
|
+
// //if ( /^\{/.test(arr[i]) ) { // is a json string
|
|
612
|
+
// try {
|
|
613
|
+
// if (/^\{/.test(arr[i])) {
|
|
614
|
+
// obj = JSON.parse(arr[i]);
|
|
615
|
+
// break;
|
|
616
|
+
// } else {
|
|
617
|
+
// el = arr[i].match(/\=(.*)/);
|
|
618
|
+
// el[0] = arr[i].split(/\=/)[0];
|
|
619
|
+
// obj[ el[0] ] = JSON.parse( el[1] );
|
|
620
|
+
// }
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
// } catch (err) {
|
|
624
|
+
// console.error('[parseBody#1] could not parse body:\n' + arr[i])
|
|
625
|
+
// }
|
|
626
|
+
// } else {
|
|
627
|
+
// el = arr[i].split(/=/);
|
|
628
|
+
// if ( /\{\}\"\:/.test(el[1]) ) { //might be a json
|
|
629
|
+
// try {
|
|
630
|
+
// el[1] = JSON.parse(el[1])
|
|
631
|
+
// } catch (err) {
|
|
632
|
+
// console.error('[parseBody#2] could not parse body:\n' + el[1])
|
|
633
|
+
// }
|
|
634
|
+
// }
|
|
635
|
+
|
|
636
|
+
// if ( typeof(el[1]) == 'string' && !/\[object /.test(el[1])) {
|
|
637
|
+
// key = null;
|
|
638
|
+
// el[0] = decodeURIComponent(el[0]);
|
|
639
|
+
// el[1] = decodeURIComponent(el[1]);
|
|
640
|
+
|
|
641
|
+
// if ( /^(.*)\[(.*)\]/.test(el[0]) ) { // some[field] ?
|
|
642
|
+
// key = el[0].replace(/\]/g, '').split(/\[/g);
|
|
643
|
+
// obj = parseLocalObj(obj, key, 0, el[1])
|
|
644
|
+
// } else {
|
|
645
|
+
// obj[ el[0] ] = el[1]
|
|
646
|
+
// }
|
|
647
|
+
// }
|
|
648
|
+
// }
|
|
649
|
+
// }
|
|
650
|
+
|
|
651
|
+
// return obj
|
|
652
|
+
// }
|
|
610
653
|
|
|
611
654
|
|
|
612
|
-
}
|
|
655
|
+
// }
|
|
613
656
|
|
|
614
|
-
var parseLocalObj = function(obj, key, k, value) {
|
|
657
|
+
// var parseLocalObj = function(obj, key, k, value) {
|
|
615
658
|
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
659
|
+
// if ( typeof(obj[ key[k] ]) == 'undefined' ) {
|
|
660
|
+
// obj[ key[k] ] = {};
|
|
661
|
+
// }
|
|
619
662
|
|
|
620
|
-
|
|
663
|
+
// for (var prop in obj) {
|
|
621
664
|
|
|
622
|
-
|
|
665
|
+
// if (k == key.length-1) {
|
|
623
666
|
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
667
|
+
// if (prop == key[k]) {
|
|
668
|
+
// obj[prop] = ( typeof(value) != 'undefined' ) ? value : '';
|
|
669
|
+
// }
|
|
627
670
|
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
671
|
+
// } else if ( key.indexOf(prop) > -1 ) {
|
|
672
|
+
// ++k;
|
|
673
|
+
// if ( !obj[prop][ key[k] ] )
|
|
674
|
+
// obj[prop][ key[k] ] = {};
|
|
632
675
|
|
|
633
676
|
|
|
634
|
-
|
|
677
|
+
// parseLocalObj(obj[prop], key, k, value)
|
|
635
678
|
|
|
636
|
-
|
|
637
|
-
|
|
679
|
+
// }
|
|
680
|
+
// }
|
|
638
681
|
|
|
639
|
-
|
|
640
|
-
}
|
|
682
|
+
// return obj;
|
|
683
|
+
// }
|
|
641
684
|
|
|
642
685
|
var getAssetFilenameFromUrl = function(bundleConf, url) {
|
|
643
686
|
|
|
@@ -1071,7 +1114,6 @@ function Server(options) {
|
|
|
1071
1114
|
// Should not override main server.response.header.methods
|
|
1072
1115
|
resHeaders['access-control-allow-methods'] = request.routing.method.replace(/(\,\s+|\,)/g, ', ').toUpperCase();
|
|
1073
1116
|
|
|
1074
|
-
|
|
1075
1117
|
if ( typeof(request.headers.origin) != 'undefined' ) {
|
|
1076
1118
|
authority = request.headers.origin;
|
|
1077
1119
|
} else if (request.headers.referer) {
|
|
@@ -1082,7 +1124,6 @@ function Server(options) {
|
|
|
1082
1124
|
// access-control-allow-origin settings
|
|
1083
1125
|
if ( resHeaders.count() > 0 ) {
|
|
1084
1126
|
// authority by default if no Access Control Allow Origin set
|
|
1085
|
-
//authority = ( typeof(referer) != 'undefined') ? conf.server.scheme +'://'+ request.headers.referer.match(/:\/\/(.[^\/]+)(.*)/)[1] : (request.headers[':scheme'] +'://'+request.headers[':authority'] || conf.server.scheme +'://'+request.headers.host || null);
|
|
1086
1127
|
if (!authority) {
|
|
1087
1128
|
if (!referer) {
|
|
1088
1129
|
if ( /http\/2/.test(conf.server.protocol) ) {
|
|
@@ -1106,58 +1147,97 @@ function Server(options) {
|
|
|
1106
1147
|
re = new RegExp(authority);
|
|
1107
1148
|
allowedOrigin = ( typeof(conf.server.response.header['access-control-allow-origin']) != 'undefined' && conf.server.response.header['access-control-allow-origin'] != '' ) ? conf.server.response.header['access-control-allow-origin'] : authority;
|
|
1108
1149
|
var found = null, origin = null, origins = null; // to handles multiple origins
|
|
1150
|
+
// var originHostReplacement = function(name) {
|
|
1151
|
+
// name = name.replace(/\{|\}/g, '');
|
|
1152
|
+
// name = name.split(/\@/);
|
|
1153
|
+
// var bundle = name[0]
|
|
1154
|
+
// , project = name[1]
|
|
1155
|
+
// , arr = null
|
|
1156
|
+
// , domain = null
|
|
1157
|
+
// ;
|
|
1158
|
+
// var env = conf.env; // current env by default
|
|
1159
|
+
// if ( /\//.test(name[1]) ) {
|
|
1160
|
+
// arr = name[1].split(/\//);
|
|
1161
|
+
// project = arr[0];
|
|
1162
|
+
// env = (arr[1]) ? arr[1] : env;
|
|
1163
|
+
// }
|
|
1164
|
+
|
|
1165
|
+
// domain = ( !/^http/.test(self.conf[bundle][env].hostname) || /^\/\//.test(self.conf[bundle][env].hostname) ) ? scheme +'://'+ self.conf[bundle][env].hostname.replace(/^\/\//, '') : self.conf[bundle][env].hostname;
|
|
1166
|
+
// // sameOrigin = (domain == self.conf[bundle][env].hostname) ? self.conf[bundle][env].hostname : false;
|
|
1167
|
+
|
|
1168
|
+
// return domain
|
|
1169
|
+
// }
|
|
1170
|
+
|
|
1109
1171
|
var originHostReplacement = function(name) {
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
, arr = null
|
|
1114
|
-
, domain = null
|
|
1115
|
-
;
|
|
1116
|
-
var env = conf.env; // current env by default
|
|
1117
|
-
if ( /\//.test(name[1]) ) {
|
|
1118
|
-
arr = name[1].split(/\//);
|
|
1119
|
-
project = arr[0];
|
|
1120
|
-
env = (arr[1]) ? arr[1] : env;
|
|
1172
|
+
var matched = name.match(/{([-_A-z]+?@[-_A-z]+?)}/g);
|
|
1173
|
+
if (!matched || !Array.isArray(matched) || Array.isArray(matched) && matched.length == 0 ) {
|
|
1174
|
+
return name
|
|
1121
1175
|
}
|
|
1176
|
+
var env = self.conf.env;
|
|
1177
|
+
|
|
1178
|
+
for (let i=0, len=matched.length; i<len; ++i) {
|
|
1179
|
+
let oldHost = matched[i];
|
|
1180
|
+
let newHost = matched[i].replace(/\{|\}|\s+/g, '');
|
|
1181
|
+
newHost = newHost.split(/\@/);
|
|
1182
|
+
let bundle = newHost[0]
|
|
1183
|
+
, project = newHost[1]
|
|
1184
|
+
, arr = null
|
|
1185
|
+
, hostname = null
|
|
1186
|
+
, scheme = null
|
|
1187
|
+
;
|
|
1188
|
+
if ( /\//.test(newHost[1]) ) {
|
|
1189
|
+
arr = newHost[1].split(/\//);
|
|
1190
|
+
project = arr[0];
|
|
1191
|
+
env = (arr[1]) ? arr[1] : env;
|
|
1192
|
+
}
|
|
1193
|
+
scheme = self.conf[bundle][env].server.scheme;
|
|
1194
|
+
hostname = ( !self.conf[bundle][env].hostname ) ? self.conf[bundle][env].server.scheme + '://' + self.conf[bundle][env].host + ':' + self.conf[bundle][env].server.port : self.conf[bundle][env].hostname;
|
|
1195
|
+
name = name.replace(oldHost, hostname);
|
|
1196
|
+
}
|
|
1197
|
+
matched = null;
|
|
1198
|
+
env = null;
|
|
1122
1199
|
|
|
1123
|
-
|
|
1124
|
-
sameOrigin = (domain == self.conf[bundle][env].hostname) ? self.conf[bundle][env].hostname : false;
|
|
1125
|
-
|
|
1126
|
-
return domain
|
|
1200
|
+
return name;
|
|
1127
1201
|
}
|
|
1128
1202
|
|
|
1129
|
-
var headerValue = null;
|
|
1203
|
+
var headerValue = null, re = new RegExp('\{\s*(.*)\s*\}', 'g');
|
|
1130
1204
|
for (var h in resHeaders) {
|
|
1131
|
-
if (
|
|
1205
|
+
if (
|
|
1206
|
+
!response.headersSent
|
|
1207
|
+
) {
|
|
1132
1208
|
// handles multiple origins
|
|
1133
1209
|
if ( /access\-control\-allow\-origin/i.test(h) ) { // re.test(resHeaders[h]
|
|
1134
1210
|
if (sameOrigin) {
|
|
1135
1211
|
origin = sameOrigin
|
|
1136
1212
|
} else {
|
|
1137
1213
|
if ( /\,/.test(allowedOrigin) ) {
|
|
1138
|
-
origins = allowedOrigin.replace(/\s+/g, '').replace(
|
|
1214
|
+
origins = allowedOrigin.replace(/\s+/g, '').replace(re, originHostReplacement).split(/\,/g);
|
|
1139
1215
|
|
|
1140
1216
|
found = ( origins.indexOf(authority) > -1 ) ? origins[origins.indexOf(authority)] : false;
|
|
1141
1217
|
if ( found != false ) {
|
|
1142
1218
|
origin = found
|
|
1143
1219
|
}
|
|
1144
1220
|
} else {
|
|
1145
|
-
origin = allowedOrigin
|
|
1221
|
+
origin = allowedOrigin.replace(/\s+/g, '').replace(re, originHostReplacement);
|
|
1146
1222
|
}
|
|
1147
1223
|
}
|
|
1148
1224
|
|
|
1149
1225
|
if (origin || sameOrigin) {
|
|
1150
|
-
if (!origin && sameOrigin)
|
|
1226
|
+
if (!origin && sameOrigin) {
|
|
1151
1227
|
origin = sameOrigin;
|
|
1228
|
+
}
|
|
1152
1229
|
|
|
1153
|
-
|
|
1154
|
-
|
|
1230
|
+
try {
|
|
1231
|
+
response.setHeader(h, origin);
|
|
1232
|
+
} catch (headerError) {
|
|
1233
|
+
console.error(headerError)
|
|
1234
|
+
}
|
|
1155
1235
|
}
|
|
1156
1236
|
sameOrigin = false;
|
|
1157
1237
|
} else {
|
|
1158
1238
|
headerValue = resHeaders[h];
|
|
1159
1239
|
try {
|
|
1160
|
-
response.setHeader(h, headerValue)
|
|
1240
|
+
response.setHeader(h, headerValue);
|
|
1161
1241
|
} catch (headerError) {
|
|
1162
1242
|
console.error(headerError)
|
|
1163
1243
|
}
|
|
@@ -1178,11 +1258,92 @@ function Server(options) {
|
|
|
1178
1258
|
}
|
|
1179
1259
|
|
|
1180
1260
|
this.onHttp2Stream = function(stream, headers, response) {
|
|
1261
|
+
var header = null
|
|
1262
|
+
, isWebroot = false
|
|
1263
|
+
, pathname = null
|
|
1264
|
+
, asset = null
|
|
1265
|
+
, assets = this._options.template.assets
|
|
1266
|
+
, conf = this._options.conf
|
|
1267
|
+
, cacheless = conf.cacheless
|
|
1268
|
+
;
|
|
1269
|
+
|
|
1270
|
+
|
|
1271
|
+
if (
|
|
1272
|
+
headers[':path'] == '/'
|
|
1273
|
+
|| headers[':path'] == this._options.conf.server.webroot
|
|
1274
|
+
) {
|
|
1275
|
+
|
|
1276
|
+
if (
|
|
1277
|
+
this._options.conf.server.webroot != headers[':path']
|
|
1278
|
+
&& this._options.conf.server.webrootAutoredirect
|
|
1279
|
+
|| headers[':path'] == this._options.conf.server.webroot
|
|
1280
|
+
&& this._options.conf.server.webrootAutoredirect
|
|
1281
|
+
) {
|
|
1282
|
+
isWebroot = true
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
var url = (isWebroot) ? this._referrer : headers[':path'];
|
|
1287
|
+
|
|
1288
|
+
var hanlersPath = conf.handlersPath
|
|
1289
|
+
, isHandler = (
|
|
1290
|
+
typeof(assets[ url ]) != 'undefined'
|
|
1291
|
+
&& typeof(assets[ url ].filename) != 'undefined'
|
|
1292
|
+
&& new RegExp('^'+ hanlersPath).test(assets[ url ].filename)
|
|
1293
|
+
) ? true: false
|
|
1294
|
+
;
|
|
1181
1295
|
|
|
1182
1296
|
if (!stream.pushAllowed) {
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1297
|
+
asset = {
|
|
1298
|
+
url : url,
|
|
1299
|
+
filename : assets[ url ].filename,
|
|
1300
|
+
file : null,
|
|
1301
|
+
isAvailable : assets[ url ].isAvailable,
|
|
1302
|
+
mime : assets[ url ].mime,
|
|
1303
|
+
encoding : conf.encoding,
|
|
1304
|
+
isBinary : assets[ url ].isBinary,
|
|
1305
|
+
isHandler : assets[ url ].isHandler
|
|
1306
|
+
};
|
|
1307
|
+
header = merge({ ':status': 200 }, response.getHeaders());
|
|
1308
|
+
header['content-type'] = ( !/charset/.test(asset.mime ) ) ? asset.mime + '; charset='+ asset.encoding : asset.mime;
|
|
1309
|
+
header = completeHeaders(header, local.request, response);
|
|
1310
|
+
if (asset.isBinary || asset.isHandler ) {
|
|
1311
|
+
|
|
1312
|
+
|
|
1313
|
+
if (asset.isHandler) {
|
|
1314
|
+
// adding handler `gina.ready(...)` wrapper
|
|
1315
|
+
var file = null;
|
|
1316
|
+
if ( !fs.existsSync(asset.filename) ) {
|
|
1317
|
+
throwError({stream: stream}, 404, 'Page not found: \n' + headers[':path']);
|
|
1318
|
+
return;
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
if (!assets[ url ].file) {
|
|
1322
|
+
file = fs.readFileSync(asset.filename, asset.encoding).toString();
|
|
1323
|
+
file = '(gina.ready(function onGinaReady($){\n'+ file + '\n},window["originalContext"]));';
|
|
1324
|
+
this._options.template.assets[ headers[':path'] ].file = file;
|
|
1325
|
+
} else {
|
|
1326
|
+
file = assets[ url ].file;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
// header['content-length'] = fs.statSync(file).size;
|
|
1330
|
+
stream.respond(header);
|
|
1331
|
+
stream.end(file);
|
|
1332
|
+
|
|
1333
|
+
return;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
header['content-length'] = fs.statSync(asset.filename).size;
|
|
1337
|
+
stream.respondWithFile(
|
|
1338
|
+
asset.filename
|
|
1339
|
+
, header
|
|
1340
|
+
//, { onError }
|
|
1341
|
+
);
|
|
1342
|
+
} else {
|
|
1343
|
+
stream.respond(header);
|
|
1344
|
+
stream.end();
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1186
1347
|
return;
|
|
1187
1348
|
}
|
|
1188
1349
|
|
|
@@ -1193,18 +1354,18 @@ function Server(options) {
|
|
|
1193
1354
|
return;
|
|
1194
1355
|
}
|
|
1195
1356
|
|
|
1196
|
-
var header = null, isWebroot = false, pathname = null;
|
|
1197
1357
|
if (
|
|
1198
|
-
headers[':path'] == '/'
|
|
1199
|
-
|| headers[':path'] == this._options.conf.server.webroot
|
|
1358
|
+
// headers[':path'] == '/'
|
|
1359
|
+
// || headers[':path'] == this._options.conf.server.webroot
|
|
1360
|
+
/^true$/i.test(isWebroot)
|
|
1200
1361
|
) {
|
|
1201
1362
|
|
|
1202
|
-
if (
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
) {
|
|
1363
|
+
// if (
|
|
1364
|
+
// this._options.conf.server.webroot != headers[':path']
|
|
1365
|
+
// && this._options.conf.server.webrootAutoredirect
|
|
1366
|
+
// || headers[':path'] == this._options.conf.server.webroot
|
|
1367
|
+
// && this._options.conf.server.webrootAutoredirect
|
|
1368
|
+
// ) {
|
|
1208
1369
|
|
|
1209
1370
|
header = {
|
|
1210
1371
|
':status': 301
|
|
@@ -1220,9 +1381,10 @@ function Server(options) {
|
|
|
1220
1381
|
stream.respond(header);
|
|
1221
1382
|
stream.end();
|
|
1222
1383
|
return;
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
|
|
1384
|
+
// }
|
|
1385
|
+
// else {
|
|
1386
|
+
// isWebroot = true;
|
|
1387
|
+
// }
|
|
1226
1388
|
}
|
|
1227
1389
|
|
|
1228
1390
|
if (
|
|
@@ -1235,21 +1397,19 @@ function Server(options) {
|
|
|
1235
1397
|
header = {
|
|
1236
1398
|
':status': 200
|
|
1237
1399
|
};
|
|
1238
|
-
var
|
|
1239
|
-
var
|
|
1400
|
+
// var assets = this._options.template.assets;
|
|
1401
|
+
// var url = (isWebroot) ? this._referrer : headers[':path'];
|
|
1240
1402
|
var responseHeaders = ( typeof(this._responseHeaders) != 'undefined') ? this._responseHeaders : null;
|
|
1241
|
-
var conf = this._options.conf;
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
, cacheless = conf.cacheless
|
|
1252
|
-
;
|
|
1403
|
+
// var conf = this._options.conf;
|
|
1404
|
+
asset = {
|
|
1405
|
+
url : url,
|
|
1406
|
+
filename : assets[ url ].filename,
|
|
1407
|
+
file : null,
|
|
1408
|
+
isAvailable : assets[ url ].isAvailable,
|
|
1409
|
+
mime : assets[ url ].mime,
|
|
1410
|
+
encoding : conf.encoding,
|
|
1411
|
+
isHandler : isHandler
|
|
1412
|
+
};
|
|
1253
1413
|
|
|
1254
1414
|
console.debug('h2 pushing: '+ headers[':path'] + ' -> '+ asset.filename);
|
|
1255
1415
|
|
|
@@ -1261,7 +1421,7 @@ function Server(options) {
|
|
|
1261
1421
|
return;
|
|
1262
1422
|
}
|
|
1263
1423
|
|
|
1264
|
-
asset.isHandler = true;
|
|
1424
|
+
asset.isHandler = this._options.template.assets[ headers[':path'] ].isHandler = true;
|
|
1265
1425
|
asset.file = fs.readFileSync(asset.filename, asset.encoding).toString();
|
|
1266
1426
|
asset.file = '(gina.ready(function onGinaReady($){\n'+ asset.file + '\n},window["originalContext"]));';
|
|
1267
1427
|
|
|
@@ -1287,6 +1447,9 @@ function Server(options) {
|
|
|
1287
1447
|
|
|
1288
1448
|
|
|
1289
1449
|
header['content-type'] = ( !/charset/.test(asset.mime ) ) ? asset.mime + '; charset='+ asset.encoding : asset.mime;
|
|
1450
|
+
if (assets[ url ].isBinary) {
|
|
1451
|
+
header['content-length'] = fs.statSync(assets[ url ].filename).size;
|
|
1452
|
+
}
|
|
1290
1453
|
|
|
1291
1454
|
if (cacheless) {
|
|
1292
1455
|
// source maps integration for javascript & css
|
|
@@ -1305,8 +1468,9 @@ function Server(options) {
|
|
|
1305
1468
|
header = merge(header, responseHeaders);
|
|
1306
1469
|
}
|
|
1307
1470
|
header = completeHeaders(header, local.request, response);
|
|
1471
|
+
var pushedFile = (/index.html$/.test(headers[':path']) && /\/$/.test(asset.filename) ) ? asset.filename +'index.html': asset.filename;
|
|
1308
1472
|
pushStream.respondWithFile(
|
|
1309
|
-
|
|
1473
|
+
pushedFile
|
|
1310
1474
|
, header
|
|
1311
1475
|
//, { onError }
|
|
1312
1476
|
);
|
|
@@ -1382,6 +1546,7 @@ function Server(options) {
|
|
|
1382
1546
|
var isFilenameDir = null
|
|
1383
1547
|
, dirname = null
|
|
1384
1548
|
, isBinary = null
|
|
1549
|
+
, isHandler = null
|
|
1385
1550
|
, hanlersPath = null
|
|
1386
1551
|
;
|
|
1387
1552
|
|
|
@@ -1431,7 +1596,7 @@ function Server(options) {
|
|
|
1431
1596
|
header['pragma'] = 'no-cache';
|
|
1432
1597
|
header['expires'] = '0';
|
|
1433
1598
|
}
|
|
1434
|
-
request = checkPreflightRequest(request);
|
|
1599
|
+
request = checkPreflightRequest(request, response);
|
|
1435
1600
|
header = completeHeaders(header, request, response);
|
|
1436
1601
|
|
|
1437
1602
|
if (!stream.destroyed) {
|
|
@@ -1441,7 +1606,7 @@ function Server(options) {
|
|
|
1441
1606
|
|
|
1442
1607
|
} else {
|
|
1443
1608
|
response.setHeader('location', request.url);
|
|
1444
|
-
request = checkPreflightRequest(request);
|
|
1609
|
+
request = checkPreflightRequest(request, response);
|
|
1445
1610
|
completeHeaders(null, request, response);
|
|
1446
1611
|
if (cacheless) {
|
|
1447
1612
|
response.writeHead(301, {
|
|
@@ -1458,20 +1623,27 @@ function Server(options) {
|
|
|
1458
1623
|
}
|
|
1459
1624
|
|
|
1460
1625
|
|
|
1461
|
-
if (cacheless)
|
|
1626
|
+
if (cacheless) {
|
|
1462
1627
|
delete require.cache[require.resolve(filename)];
|
|
1628
|
+
}
|
|
1463
1629
|
|
|
1464
|
-
|
|
1630
|
+
if (response.headersSent) {
|
|
1631
|
+
// May be sent by http/2 push
|
|
1632
|
+
return
|
|
1633
|
+
}
|
|
1465
1634
|
fs.readFile(filename, bundleConf.encoding, function onStaticFileRead(err, file) {
|
|
1466
1635
|
if (err) {
|
|
1467
1636
|
throwError(response, 404, 'Page not found: \n' + pathname, next);
|
|
1468
1637
|
return;
|
|
1469
|
-
}
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
if (!response.headersSent) {
|
|
1470
1641
|
|
|
1471
|
-
isBinary
|
|
1642
|
+
isBinary = true;
|
|
1643
|
+
isHandler = false;
|
|
1472
1644
|
|
|
1473
1645
|
try {
|
|
1474
|
-
contentType =
|
|
1646
|
+
contentType = getContentTypeByFilename(filename);
|
|
1475
1647
|
|
|
1476
1648
|
// adding gina loader
|
|
1477
1649
|
if ( /text\/html/i.test(contentType) && self.isCacheless() ) {
|
|
@@ -1488,7 +1660,8 @@ function Server(options) {
|
|
|
1488
1660
|
hanlersPath = bundleConf.handlersPath;
|
|
1489
1661
|
|
|
1490
1662
|
if ( new RegExp('^'+ hanlersPath).test(filename) ) {
|
|
1491
|
-
isBinary
|
|
1663
|
+
isBinary = false;
|
|
1664
|
+
isHandler = true;
|
|
1492
1665
|
file = '(gina.ready(function onGinaReady($){\n'+ file + '\n},window["originalContext"]));'
|
|
1493
1666
|
}
|
|
1494
1667
|
}
|
|
@@ -1513,7 +1686,9 @@ function Server(options) {
|
|
|
1513
1686
|
isAvailable: true,
|
|
1514
1687
|
mime: contentType,
|
|
1515
1688
|
url: request.url,
|
|
1516
|
-
filename: filename
|
|
1689
|
+
filename: filename,
|
|
1690
|
+
isBinary: isBinary,
|
|
1691
|
+
isHandler: isHandler
|
|
1517
1692
|
}
|
|
1518
1693
|
}
|
|
1519
1694
|
|
|
@@ -1577,7 +1752,7 @@ function Server(options) {
|
|
|
1577
1752
|
}
|
|
1578
1753
|
}
|
|
1579
1754
|
|
|
1580
|
-
contentType =
|
|
1755
|
+
contentType = getContentTypeByFilename(filename);
|
|
1581
1756
|
contentType = contentType +'; charset='+ bundleConf.encoding;
|
|
1582
1757
|
ext = request.url.match(/\.([A-Za-z0-9]+)$/);
|
|
1583
1758
|
request.url = ( ext != null && typeof(ext[0]) != 'undefined' ) ? request.url : request.url + 'index.html';
|
|
@@ -1592,12 +1767,15 @@ function Server(options) {
|
|
|
1592
1767
|
isAvailable: (!/404\.html/.test(filename)) ? true : false,
|
|
1593
1768
|
mime: contentType,
|
|
1594
1769
|
url: request.url,
|
|
1595
|
-
filename: filename
|
|
1770
|
+
filename: filename,
|
|
1771
|
+
isBinary: isBinary,
|
|
1772
|
+
isHandler: isHandler
|
|
1596
1773
|
}
|
|
1597
1774
|
}
|
|
1598
1775
|
|
|
1599
1776
|
if (!fs.existsSync(filename)) return;
|
|
1600
|
-
isBinary
|
|
1777
|
+
isBinary = ( /text\/html/i.test(contentType) ) ? false : true;
|
|
1778
|
+
isHandler = ( new RegExp('^'+ bundleConf.handlersPath).test(filename) ) ? true : false;
|
|
1601
1779
|
if ( isBinary ) {
|
|
1602
1780
|
// override
|
|
1603
1781
|
self._options.template.assets[request.url] = {
|
|
@@ -1605,7 +1783,19 @@ function Server(options) {
|
|
|
1605
1783
|
isAvailable: true,
|
|
1606
1784
|
mime: contentType,
|
|
1607
1785
|
url: request.url,
|
|
1608
|
-
filename: filename
|
|
1786
|
+
filename: filename,
|
|
1787
|
+
isBinary: isBinary,
|
|
1788
|
+
isHandler: isHandler
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
if ( isHandler ) {
|
|
1793
|
+
// adding handler `gina.ready(...)` wrapper
|
|
1794
|
+
var file = null;
|
|
1795
|
+
if (!self._options.template.assets[request.url].file) {
|
|
1796
|
+
file = fs.readFileSync(filename, bundleConf.encoding).toString();
|
|
1797
|
+
file = '(gina.ready(function onGinaReady($){\n'+ file + '\n},window["originalContext"]));';
|
|
1798
|
+
self._options.template.assets[request.url].file = file;
|
|
1609
1799
|
}
|
|
1610
1800
|
}
|
|
1611
1801
|
self.onHttp2Stream(stream, headers, response);
|
|
@@ -1729,21 +1919,23 @@ function Server(options) {
|
|
|
1729
1919
|
* */
|
|
1730
1920
|
request.isWithCredentials = ( request.headers['access-control-allow-credentials'] && request.headers['access-control-allow-credentials'] == true ) ? true : false;
|
|
1731
1921
|
/**
|
|
1732
|
-
* Intercept gina headers
|
|
1922
|
+
* Intercept gina headers for:
|
|
1923
|
+
* - form valdiation
|
|
1924
|
+
* - form security
|
|
1733
1925
|
*/
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
request.ginaHeaders = ginaHeaders;
|
|
1926
|
+
var ginaHeaders = {
|
|
1927
|
+
form: {}
|
|
1928
|
+
};
|
|
1929
|
+
// if (/x\-gina\-form\-id/i.test(request.headers['access-control-request-headers']) ) {
|
|
1930
|
+
if ( typeof(request.headers['x-gina-form-rule']) != 'undefined' ) {
|
|
1931
|
+
ginaHeaders.form.id = request.headers['x-gina-form-id'];
|
|
1932
|
+
}
|
|
1933
|
+
if ( typeof(request.headers['x-gina-form-rule']) != 'undefined' ) {
|
|
1934
|
+
var rule = request.headers['x-gina-form-rule'].split(/\@/);
|
|
1935
|
+
ginaHeaders.form.rule = rule[0];
|
|
1936
|
+
ginaHeaders.form.bundle = rule[1];
|
|
1746
1937
|
}
|
|
1938
|
+
request.ginaHeaders = ginaHeaders;
|
|
1747
1939
|
|
|
1748
1940
|
local.request = request;
|
|
1749
1941
|
|
|
@@ -1830,8 +2022,6 @@ function Server(options) {
|
|
|
1830
2022
|
if (
|
|
1831
2023
|
staticProps.isStaticFilename && staticsArr.indexOf(request.url) > -1
|
|
1832
2024
|
|| staticProps.isStaticFilename && staticsArr.indexOf( request.url.replace(request.url.substr(request.url.lastIndexOf('/')+1), '') ) > -1
|
|
1833
|
-
//|| staticProps.isStaticFilename && staticsArr.indexOf(staticProps.firstLevel) > -1
|
|
1834
|
-
// take ^/dir/sub/*
|
|
1835
2025
|
|| staticProps.isStaticFilename && new RegExp('^'+ staticProps.firstLevel).test(request.url)
|
|
1836
2026
|
|| /\/$/.test(request.url) && !isWebrootHandledByRouting && !/\/engine\.io\//.test(request.url)
|
|
1837
2027
|
) {
|
|
@@ -1845,7 +2035,7 @@ function Server(options) {
|
|
|
1845
2035
|
'method': 'GET',
|
|
1846
2036
|
'bundle' : self.appName
|
|
1847
2037
|
};
|
|
1848
|
-
request = checkPreflightRequest(request);
|
|
2038
|
+
request = checkPreflightRequest(request, response);
|
|
1849
2039
|
local.request = request; // update request
|
|
1850
2040
|
// filtered to handle only html for now
|
|
1851
2041
|
if ( /text\/html/.test(request.headers['accept'])
|
|
@@ -1923,6 +2113,8 @@ function Server(options) {
|
|
|
1923
2113
|
* - https://developers.google.com/web/updates/2012/06/How-to-convert-ArrayBuffer-to-and-from-String
|
|
1924
2114
|
* - https://jsperf.com/arraybuffer-string-conversion/4
|
|
1925
2115
|
*
|
|
2116
|
+
* TODO - Test with audio content
|
|
2117
|
+
*
|
|
1926
2118
|
* @param {string} str
|
|
1927
2119
|
*
|
|
1928
2120
|
* @returns {array} buffer
|
|
@@ -2155,16 +2347,16 @@ function Server(options) {
|
|
|
2155
2347
|
|
|
2156
2348
|
});//EO this.instance
|
|
2157
2349
|
|
|
2158
|
-
|
|
2159
2350
|
self.instance.listen(self.conf[self.appName][self.env].server.port);//By Default 3100
|
|
2160
2351
|
self.instance.timeout = (1000 * 300); // e.g.: 1000x60 => 60 sec
|
|
2161
2352
|
|
|
2353
|
+
|
|
2162
2354
|
self.emit('started', self.conf[self.appName][self.env], true);
|
|
2163
2355
|
}
|
|
2164
2356
|
|
|
2165
2357
|
var processRequestData = function(request, response, next) {
|
|
2166
2358
|
|
|
2167
|
-
var bodyStr = null, obj = null;
|
|
2359
|
+
var bodyStr = null, obj = null, exception = null;
|
|
2168
2360
|
// to compare with /core/controller/controller.js -> getParams()
|
|
2169
2361
|
switch( request.method.toLowerCase() ) {
|
|
2170
2362
|
case 'post':
|
|
@@ -2193,7 +2385,13 @@ function Server(options) {
|
|
|
2193
2385
|
bodyStr = bodyStr.replace(/\"null\"/ig, null);
|
|
2194
2386
|
|
|
2195
2387
|
try {
|
|
2196
|
-
obj = parseBody(bodyStr);
|
|
2388
|
+
// obj = parseBody(bodyStr);
|
|
2389
|
+
obj = formatDataFromString(bodyStr);
|
|
2390
|
+
if ( !obj) {
|
|
2391
|
+
exception = new Error('Could not convert POST::BODY_STRING to POST::OBJECT. Possible JSON error in `bodyStr`');
|
|
2392
|
+
throwError(response, 500, exception, next);
|
|
2393
|
+
return;
|
|
2394
|
+
}
|
|
2197
2395
|
request.post = obj;
|
|
2198
2396
|
isPostSet = true;
|
|
2199
2397
|
} catch (err) {
|
|
@@ -2226,7 +2424,8 @@ function Server(options) {
|
|
|
2226
2424
|
if (request.body.count() == 0 && typeof(request.query) != 'string' && request.query.count() > 0 ) {
|
|
2227
2425
|
request.body = request.query
|
|
2228
2426
|
}
|
|
2229
|
-
|
|
2427
|
+
// 2023-01-31: fixed `request.body` might not be an `object`
|
|
2428
|
+
bodyStr = ( typeof(request.body) == 'object') ? JSON.stringify(request.body) : request.body;
|
|
2230
2429
|
// false & true case
|
|
2231
2430
|
if ( /(\"false\"|\"true\"|\"on\")/.test(bodyStr) )
|
|
2232
2431
|
bodyStr = bodyStr.replace(/\"false\"/g, false).replace(/\"true\"/g, true).replace(/\"on\"/g, true);
|
|
@@ -2235,7 +2434,7 @@ function Server(options) {
|
|
|
2235
2434
|
}
|
|
2236
2435
|
|
|
2237
2436
|
try {
|
|
2238
|
-
if ( obj.count() > 0 ) {
|
|
2437
|
+
if ( typeof(obj) == 'object' && obj.count() > 0 ) {
|
|
2239
2438
|
// still need this to allow compatibility with express & connect middlewares
|
|
2240
2439
|
request.body = request.post = obj;
|
|
2241
2440
|
}
|
|
@@ -2276,7 +2475,7 @@ function Server(options) {
|
|
|
2276
2475
|
|
|
2277
2476
|
|
|
2278
2477
|
if ( typeof(request.query.inheritedData) == 'string' ) {
|
|
2279
|
-
inheritedDataObj =
|
|
2478
|
+
inheritedDataObj = formatDataFromString(decodeURIComponent(request.query.inheritedData));
|
|
2280
2479
|
} else {
|
|
2281
2480
|
inheritedDataObj = JSON.clone(request.query.inheritedData);
|
|
2282
2481
|
}
|
|
@@ -2293,7 +2492,7 @@ function Server(options) {
|
|
|
2293
2492
|
bodyStr = bodyStr.replace(/\"null\"/ig, null);
|
|
2294
2493
|
|
|
2295
2494
|
|
|
2296
|
-
obj =
|
|
2495
|
+
obj = formatDataFromString(decodeURIComponent(bodyStr));
|
|
2297
2496
|
|
|
2298
2497
|
request.query = merge(obj, inheritedDataObj);
|
|
2299
2498
|
delete obj;
|
|
@@ -2336,7 +2535,7 @@ function Server(options) {
|
|
|
2336
2535
|
if ( /(\"null\")/i.test(bodyStr) )
|
|
2337
2536
|
bodyStr = bodyStr.replace(/\"null\"/ig, null);
|
|
2338
2537
|
|
|
2339
|
-
obj =
|
|
2538
|
+
obj = formatDataFromString(bodyStr);
|
|
2340
2539
|
|
|
2341
2540
|
if ( typeof(obj) != 'undefined' && obj.count() == 0 && bodyStr.length > 1 ) {
|
|
2342
2541
|
try {
|
|
@@ -2418,21 +2617,21 @@ function Server(options) {
|
|
|
2418
2617
|
})
|
|
2419
2618
|
}
|
|
2420
2619
|
|
|
2421
|
-
var
|
|
2620
|
+
var getContentTypeByFilename = function(filename) {
|
|
2422
2621
|
try {
|
|
2423
|
-
var s =
|
|
2622
|
+
var s = filename.split(/\./);
|
|
2424
2623
|
var ext = s[s.length-1];
|
|
2425
2624
|
var type = null;
|
|
2426
2625
|
var mime = self.conf[self.appName][self.env].server.coreConfiguration.mime;
|
|
2427
2626
|
|
|
2428
|
-
if( typeof(mime[ext]) != 'undefined' ) {
|
|
2627
|
+
if ( typeof(mime[ext]) != 'undefined' ) {
|
|
2429
2628
|
type = mime[ext];
|
|
2430
2629
|
} else {
|
|
2431
|
-
console.warn('[ '+
|
|
2630
|
+
console.warn('[ '+filename+' ] extension: `'+s[2]+'` not supported by gina: `core/mime.types`. Pathname must be a directory. Replacing with `plain/text` ')
|
|
2432
2631
|
}
|
|
2433
|
-
return type ||
|
|
2632
|
+
return type || 'plain/text'
|
|
2434
2633
|
} catch (err) {
|
|
2435
|
-
console.error('Error while trying to
|
|
2634
|
+
console.error('Error while trying to getContentTypeByFilename('+ filename +') extention. Replacing with `plain/text` '+ err.stack);
|
|
2436
2635
|
return 'plain/text'
|
|
2437
2636
|
}
|
|
2438
2637
|
|
|
@@ -2531,13 +2730,13 @@ function Server(options) {
|
|
|
2531
2730
|
}
|
|
2532
2731
|
|
|
2533
2732
|
expressMiddlewares[nextMiddleware._index](nextMiddleware._request, nextMiddleware._response, function onNextMiddleware(err, request, response) {
|
|
2534
|
-
++nextMiddleware._index;
|
|
2535
2733
|
|
|
2536
2734
|
if (err) {
|
|
2537
2735
|
throwError(nextMiddleware._response, 500, (err.stack||err.message||err), nextMiddleware._next, nextMiddleware._nextAction);
|
|
2538
2736
|
return;
|
|
2539
2737
|
}
|
|
2540
2738
|
|
|
2739
|
+
++nextMiddleware._index;
|
|
2541
2740
|
if (request)
|
|
2542
2741
|
nextMiddleware._request = request;
|
|
2543
2742
|
|
|
@@ -2562,7 +2761,7 @@ function Server(options) {
|
|
|
2562
2761
|
});
|
|
2563
2762
|
};
|
|
2564
2763
|
|
|
2565
|
-
var checkPreflightRequest = function(request) {
|
|
2764
|
+
var checkPreflightRequest = function(request, response) {
|
|
2566
2765
|
var config = self.conf[self.appName][self.env];
|
|
2567
2766
|
// by default, if not set in `${projectPath}/env.json`
|
|
2568
2767
|
var corsMethod = 'GET, POST, HEAD';
|
|
@@ -2606,7 +2805,7 @@ function Server(options) {
|
|
|
2606
2805
|
} else {
|
|
2607
2806
|
request.method = method
|
|
2608
2807
|
}
|
|
2609
|
-
accessControlRequestHeaders = ( typeof(request.headers['access-control-request-headers']) != 'undefined' ) ? request.headers['access-control-request-headers'] : '';
|
|
2808
|
+
accessControlRequestHeaders = ( typeof(request.headers['access-control-request-headers']) != 'undefined' ) ? request.headers['access-control-request-headers'].replace(/\s+/, '').split(/\,/g) : '';
|
|
2610
2809
|
if ( typeof(request.headers['access-control-request-credentials']) != 'undefined' && typeof(serverResponseHeaders['access-control-allow-credentials']) != 'undefined' ) {
|
|
2611
2810
|
request.isWithCredentials = true;
|
|
2612
2811
|
}
|
|
@@ -2616,6 +2815,7 @@ function Server(options) {
|
|
|
2616
2815
|
request.isXMLRequest = true;
|
|
2617
2816
|
}
|
|
2618
2817
|
}
|
|
2818
|
+
response.setHeader('access-control-allow-headers', request.headers['access-control-request-headers']);
|
|
2619
2819
|
}
|
|
2620
2820
|
}
|
|
2621
2821
|
|
|
@@ -2632,9 +2832,9 @@ function Server(options) {
|
|
|
2632
2832
|
, wroot = null
|
|
2633
2833
|
;
|
|
2634
2834
|
|
|
2635
|
-
//matched =
|
|
2835
|
+
//matched = routingLib.getRouteByUrl(req.url, bundle, (req.method||req[':method']), req);
|
|
2636
2836
|
|
|
2637
|
-
req = checkPreflightRequest(req);
|
|
2837
|
+
req = checkPreflightRequest(req, res);
|
|
2638
2838
|
var params = {}
|
|
2639
2839
|
, _routing = {}
|
|
2640
2840
|
, method = ( /http\/2/.test(self.conf[self.appName][self.env].server.protocol) ) ? req.headers[':method'] : req.method
|
|
@@ -2657,9 +2857,10 @@ function Server(options) {
|
|
|
2657
2857
|
}
|
|
2658
2858
|
var isMethodAllowed = null, hostname = null;
|
|
2659
2859
|
out:
|
|
2660
|
-
for (
|
|
2661
|
-
if (typeof(routing[name]['param']) == 'undefined')
|
|
2860
|
+
for (let name in routing) {
|
|
2861
|
+
if ( typeof(routing[name]['param']) == 'undefined' ) {
|
|
2662
2862
|
break;
|
|
2863
|
+
}
|
|
2663
2864
|
|
|
2664
2865
|
// updating hostname
|
|
2665
2866
|
// if (
|
|
@@ -2687,7 +2888,7 @@ function Server(options) {
|
|
|
2687
2888
|
method : method,
|
|
2688
2889
|
requirements : routing[name].requirements,
|
|
2689
2890
|
namespace : routing[name].namespace || undefined,
|
|
2690
|
-
url :
|
|
2891
|
+
url : decodeURI(pathname), /// avoid %20
|
|
2691
2892
|
rule : routing[name].originalRule || name,
|
|
2692
2893
|
param : JSON.clone(routing[name].param),
|
|
2693
2894
|
middleware : JSON.clone(routing[name].middleware),
|
|
@@ -2698,7 +2899,7 @@ function Server(options) {
|
|
|
2698
2899
|
|
|
2699
2900
|
//Parsing for the right url.
|
|
2700
2901
|
try {
|
|
2701
|
-
isRoute = await
|
|
2902
|
+
isRoute = await routingLib.compareUrls(params, routing[name].url, req, res, next);
|
|
2702
2903
|
} catch (err) {
|
|
2703
2904
|
var msg = 'Internal server error.\nRule [ '+name+' ] needs your attention.\n';
|
|
2704
2905
|
// TODO - Refactor `ApiError`to handle the following param
|
|
@@ -2818,8 +3019,8 @@ function Server(options) {
|
|
|
2818
3019
|
}
|
|
2819
3020
|
|
|
2820
3021
|
if (!res.headersSent) {
|
|
2821
|
-
res.headersSent = true;
|
|
2822
|
-
local.request = checkPreflightRequest(local.request);
|
|
3022
|
+
// res.headersSent = true;
|
|
3023
|
+
local.request = checkPreflightRequest(local.request, local.response);
|
|
2823
3024
|
// updated filter on controller.js : 2020/09/25
|
|
2824
3025
|
//if (isXMLRequest || !withViews || !isUsingTemplate ) {
|
|
2825
3026
|
if (isXMLRequest || !withViews || !isUsingTemplate || withViews && !isUsingTemplate ) {
|
|
@@ -2875,7 +3076,7 @@ function Server(options) {
|
|
|
2875
3076
|
//console.error('[ BUNDLE ][ '+self.appName+' ] '+ local.request.method +' [ '+code+' ] '+ local.request.url);
|
|
2876
3077
|
console.error(local.request.method +' [ '+code+' ] '+ local.request.url);
|
|
2877
3078
|
// intercept none HTML mime types
|
|
2878
|
-
var url =
|
|
3079
|
+
var url = decodeURI(local.request.url) /// avoid %20
|
|
2879
3080
|
, ext = null
|
|
2880
3081
|
, isHtmlContent = false
|
|
2881
3082
|
, hasCustomErrorFile = false
|
|
@@ -2937,7 +3138,7 @@ function Server(options) {
|
|
|
2937
3138
|
}
|
|
2938
3139
|
|
|
2939
3140
|
var eRule = 'custom-error-page@'+ self.appName;
|
|
2940
|
-
var routeObj =
|
|
3141
|
+
var routeObj = routingLib.getRoute(eRule);
|
|
2941
3142
|
routeObj.rule = eRule;
|
|
2942
3143
|
routeObj.url = url;
|
|
2943
3144
|
routeObj.param.title = ( typeof(eData.title) != 'undefined' ) ? eData.title : 'Error ' + eData.status;
|