-
Notifications
You must be signed in to change notification settings - Fork 672
Fix issue #255, exposes site url and editor url to JS and editor #4404
Fix issue #255, exposes site url and editor url to JS and editor #4404
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4404 +/- ##
==========================================
+ Coverage 94.73% 94.73% +<.01%
==========================================
Files 254 254
Lines 22620 22621 +1
Branches 1666 1666
==========================================
+ Hits 21428 21429 +1
Misses 963 963
Partials 229 229
Continue to review full report at Codecov.
|
|
Since @schalkneethling needs access to the editor URL (and the survey URL, which is not yet part of this PR) within kumascript macros as well, and since we'd prefer to have those settings in one place (here in kuma) rather than also having them somewhere in the kumascript settings, I'm proposing we should do the following (either in this PR or a related one):
which could be accessed within the kumascript macros like this:
What do you guys think? |
|
@escattone that works for me. It is a little strange to pass this value, but it is also trivial to make it a KumaScript setting if that makes more sense in the future. For speed, I think a backend dev should make those changes. @escattone, do you want to make these changes in a follow-on commit, or should I? I think https://interactive-examples.mdn.mozilla.net is the right default for development, until we add a container for interactive examples development to the docker dev environment. |
jwhitlock
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, with one nit. @escattone has ideas for making it configurable from the environment, and for extending it to KumaScript, which could be done in the context of this PR or a new one.
kuma/settings/common.py
Outdated
| STAGING_DOMAIN = 'developer.allizom.org' | ||
| STAGING_URL = PROTOCOL + STAGING_DOMAIN | ||
|
|
||
| INTERACTIVE_EXAMPLES_BASE = 'https://interactive-examples.mdn.mozilla.net' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should use config so it can be set from the environment, like:
INTERACTIVE_EXAMPLES_BASE = config('https://interactive-examples.mdn.mozilla.net', default='https://interactive-examples.mdn.mozilla.net')
|
@jwhitlock It is a little strange. Maybe my desire not to repeat code is leading me down an un-natural path. I'm happy to just add it as a setting in kumascript as well. Maybe that's more natural. |
|
@jwhitlock I'll make the changes in a new kumascript PR, and I think I'll just add the settings to kumascript. |
|
Do we need to include the survey URL in this? It's going away in a few weeks and there isn't a staging version vs a production version. |
|
Data objects on the HTML tag feel like the wrong way to pass these to javascript. Can we make them part of our global MDN object with the other javascript config stuff in config.html |
Most definitely, I was not aware of this file. Let me move it there and make the relevant updates. |
kuma/settings/common.py
Outdated
|
|
||
| INTERACTIVE_EXAMPLES_BASE = 'https://interactive-examples.mdn.mozilla.net' | ||
| INTERACTIVE_EXAMPLES_BASE = config( | ||
| 'interactive-examples.mdn.mozilla.net', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be https://interactive-examples.mdn.mozilla.net?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Crud, indeed. Copy/paste fail. Let me update it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed up.
|
This change worked locally, after I made some further changes to the Docker configuration. Your branch doesn't allow commits from maintainers, so I'll open a new PR for the changes:
|
…4936) This addresses some issues when reviewing PR #4935 and getting my Kuma dev environment to talk to a local checkout of https://github.com/mdn/interactive-examples/ * I gave @schalkneethling the wrong command in #4404 (comment) to override ``INTERACTIVE_EXAMPLES_BASE`` from the environment, this corrects it. * The code that looks for the interactive example iframe events was always looking for the production domain, this changes it to look for ``INTERACTIVE_EXAMPLES_BASE`` via ``mdn.interactiveEditor.editorUrl``.
@jwhitlock This should be sufficient to expose the needed URLs to the JS in kuma and, make available a
postMessagetarget call for the editor to get its parent URL.Anything here that concern you security wise? Anything you would do different? Thanks!