Skip to content

Commit

Permalink
Revert "feat: Add support for base_url and secure_base_url" (#453)
Browse files Browse the repository at this point in the history
This reverts commit cc3ca08.
  • Loading branch information
Ubersmake authored and bc-zoharmuzafi committed Apr 3, 2019
1 parent 3437bc0 commit 74d1122
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 0 additions & 3 deletions server/plugins/renderer/renderer.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,6 @@ internals.getPencilResponse = function (data, request, response, configuration)
data.context.settings.theme_config_id = Utils.int2uuid(request.app.themeConfig.variationIndex + 1);
data.context.settings.theme_session_id = null;
data.context.settings.maintenance = {secure_path: `http://localhost:${internals.options.stencilEditorPort}`};
data.context.settings.base_url = `http://${request.info.host}`;
// intentionally not secure, stencil-cli doesn't have an ssl-bound port
data.context.settings.secure_base_url = `http://${request.info.host}`;

return new Responses.PencilResponse({
template_file: internals.getTemplatePath(request.path, data),
Expand Down
8 changes: 8 additions & 0 deletions server/plugins/renderer/responses/pencil-response.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ internals.makeDecorator = function (request, context) {
var regex,
debugBar;

if (context.settings) {
regex = new RegExp(internals.escapeRegex(context.settings.base_url), 'g');
content = content.replace(regex, '');

regex = new RegExp(internals.escapeRegex(context.settings.secure_base_url), 'g');
content = content.replace(regex, '');
}

if (request.query.debug === 'bar') {
debugBar = '<pre style="background-color:#EEE; word-wrap:break-word;">';
debugBar += internals.escapeHtml(JSON.stringify(context, null, 2)) + '</pre>';
Expand Down

1 comment on commit 74d1122

@jeremysimmons
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not get any kind of exception when loading http://localhost:3000 - Node Version: v8.12.0,
Microsoft Windows [Version 10.0.17763.475]

What OS / Node did you get this issue on?

Please sign in to comment.