Skip to content

Commit

Permalink
[fix] Switch to attribute-encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
bevacqua committed Jun 28, 2016
1 parent 08a6f40 commit 2cdb0f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
8 changes: 3 additions & 5 deletions src/ui/public/metadata.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import $ from 'jquery';
import _ from 'lodash';
// singleton for immutable copy of window.__KBN__

if (!_.has(window, '__KBN__')) {
throw new Error('window.__KBN__ must be set for metadata');
}
const state = $('[kbn-initial-state]').attr('kbn-initial-state');
const kbn = window.__KBN__ = JSON.parse(state);

const kbn = _.cloneDeep(window.__KBN__ || {});
export default deepFreeze(kbn);

function deepFreeze(object) {
Expand Down
8 changes: 1 addition & 7 deletions src/ui/views/chrome.jade
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
-
var appName = 'kibana';
function encoded (data) {
var scriptend = /\<\s*\/\s*script\s*>/ig;
var concatend = '</" + "script>';
return JSON.stringify(data).replace(scriptend, concatend);
}
block vars

doctype html
Expand All @@ -18,5 +12,5 @@ html(lang='en')
title Kibana
block head
body(kbn-chrome, id='#{appName}-body')
script window.__KBN__ = !{encoded(kibanaPayload)};
meta(kbn-initial-state=JSON.stringify(kibanaPayload))
block content

0 comments on commit 2cdb0f9

Please sign in to comment.