mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
dashboard: add escape-html npm package
This commit is contained in:
parent
bcb290bff0
commit
029982ef5c
5 changed files with 421 additions and 392 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -69,11 +69,3 @@ export const styles = {
|
||||||
color: 'rgba(255, 255, 255, 0.54)',
|
color: 'rgba(255, 255, 255, 0.54)',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// htmlEscape replaces the HTML specific special characters in a string.
|
|
||||||
export const htmlEscape = (str: string) => str
|
|
||||||
.replace(/&/g, '&')
|
|
||||||
.replace(/"/g, '"')
|
|
||||||
.replace(/'/g, ''')
|
|
||||||
.replace(/</g, '<')
|
|
||||||
.replace(/>/g, '>');
|
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@
|
||||||
import React, {Component} from 'react';
|
import React, {Component} from 'react';
|
||||||
|
|
||||||
import List, {ListItem} from 'material-ui/List';
|
import List, {ListItem} from 'material-ui/List';
|
||||||
|
import escapeHtml from 'escape-html';
|
||||||
import type {Record, Content, LogsMessage, Logs as LogsType} from '../types/content';
|
import type {Record, Content, LogsMessage, Logs as LogsType} from '../types/content';
|
||||||
import {htmlEscape} from '../common';
|
|
||||||
|
|
||||||
// requestBand says how wide is the top/bottom zone, eg. 0.1 means 10% of the container height.
|
// requestBand says how wide is the top/bottom zone, eg. 0.1 means 10% of the container height.
|
||||||
const requestBand = 0.05;
|
const requestBand = 0.05;
|
||||||
|
|
@ -84,8 +84,8 @@ const createChunk = (records: Array<Record>) => {
|
||||||
content += `<span style="color:${color}">${lvl}</span>[${month}-${date}|${hours}:${minutes}:${seconds}] ${msg}`;
|
content += `<span style="color:${color}">${lvl}</span>[${month}-${date}|${hours}:${minutes}:${seconds}] ${msg}`;
|
||||||
|
|
||||||
for (let i = 0; i < ctx.length; i += 2) {
|
for (let i = 0; i < ctx.length; i += 2) {
|
||||||
const key = htmlEscape(ctx[i]);
|
const key = escapeHtml(ctx[i]);
|
||||||
const val = htmlEscape(ctx[i + 1]);
|
const val = escapeHtml(ctx[i + 1]);
|
||||||
let padding = fieldPadding.get(key);
|
let padding = fieldPadding.get(key);
|
||||||
if (typeof padding !== 'number' || padding < val.length) {
|
if (typeof padding !== 'number' || padding < val.length) {
|
||||||
padding = val.length;
|
padding = val.length;
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
"babel-runtime": "^6.26.0",
|
"babel-runtime": "^6.26.0",
|
||||||
"classnames": "^2.2.5",
|
"classnames": "^2.2.5",
|
||||||
"css-loader": "^0.28.9",
|
"css-loader": "^0.28.9",
|
||||||
|
"escape-html": "^1.0.3",
|
||||||
"eslint": "^4.16.0",
|
"eslint": "^4.16.0",
|
||||||
"eslint-config-airbnb": "^16.1.0",
|
"eslint-config-airbnb": "^16.1.0",
|
||||||
"eslint-loader": "^2.0.0",
|
"eslint-loader": "^2.0.0",
|
||||||
|
|
|
||||||
|
|
@ -2248,7 +2248,7 @@ es6-weak-map@^2.0.1:
|
||||||
es6-iterator "^2.0.1"
|
es6-iterator "^2.0.1"
|
||||||
es6-symbol "^3.1.1"
|
es6-symbol "^3.1.1"
|
||||||
|
|
||||||
escape-html@~1.0.3:
|
escape-html@^1.0.3, escape-html@~1.0.3:
|
||||||
version "1.0.3"
|
version "1.0.3"
|
||||||
resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
|
resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue