-
-
Notifications
You must be signed in to change notification settings - Fork 838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSINFO moved to <meta> #4242
base: master
Are you sure you want to change the base?
JSINFO moved to <meta> #4242
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,6 +99,13 @@ function js_out() | |
ob_start(); | ||
|
||
// add some global variables | ||
echo "const JSINFO = JSON.parse(atob(document.head.querySelector('meta[itemprop=JSINFO]').content));"; | ||
// TODO Is this neccessary? | ||
echo "const NS = JSINFO.namespace;"; | ||
// TODO From template.php. Is this neccessary? | ||
if ($conf['useacl'] && $INPUT->server->str('REMOTE_USER')) { | ||
echo "var SIG=" . toolbar_signature() . ";"; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The JS dispatcher runs without a session and the results are meant to be cacheable. So no user dependent information (like the signature) can be set here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Add SIG into JSINFO? See the updated PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll have to admit I adapted the function toolbar_signature(). At least the test case will have to be adapted, too. |
||
echo "var DOKU_BASE = '" . DOKU_BASE . "';"; | ||
echo "var DOKU_TPL = '" . tpl_basedir($tpl) . "';"; | ||
echo "var DOKU_COOKIE_PARAM = " . json_encode([ | ||
|
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.
why the base64 encoding?
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.
Well this PR was just thought as a quick proof-of-concept. I used base64 as kind-of quick means to safely escape the string properly for use in the HTML meta attribute.
htmlspecialchars
does not escape double quotes, so that would fail when constructing the meta tag using double quotes.Feel free to suggest anything different.
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.
Not to rain on your parade, I appreciate your desire to help, but I can do a quick proof of concept myself - no problem. The bigger task is to bring it to a state where it works well enough to be merged with confidence and for that a quick proof of concept PR is not really helping much.