Escape HTML
This commit is contained in:
parent
08cbc5aa8f
commit
59adbc348a
60 changed files with 245 additions and 192 deletions
|
@ -1,3 +1,4 @@
|
|||
import escapeHtml from 'escape-html';
|
||||
import datetime from '../../scripts/datetime';
|
||||
import { Events } from 'jellyfin-apiclient';
|
||||
import itemHelper from '../../components/itemHelper';
|
||||
|
@ -199,10 +200,10 @@ import confirm from '../../components/confirm/confirm';
|
|||
|
||||
function reloadSystemInfo(view, apiClient) {
|
||||
apiClient.getSystemInfo().then(function (systemInfo) {
|
||||
view.querySelector('#serverName').innerHTML = globalize.translate('DashboardServerName', systemInfo.ServerName);
|
||||
view.querySelector('#versionNumber').innerHTML = globalize.translate('DashboardVersionNumber', systemInfo.Version);
|
||||
view.querySelector('#operatingSystem').innerHTML = globalize.translate('DashboardOperatingSystem', systemInfo.OperatingSystem);
|
||||
view.querySelector('#architecture').innerHTML = globalize.translate('DashboardArchitecture', systemInfo.SystemArchitecture);
|
||||
view.querySelector('#serverName').innerText = globalize.translate('DashboardServerName', systemInfo.ServerName);
|
||||
view.querySelector('#versionNumber').innerText = globalize.translate('DashboardVersionNumber', systemInfo.Version);
|
||||
view.querySelector('#operatingSystem').innerText = globalize.translate('DashboardOperatingSystem', systemInfo.OperatingSystem);
|
||||
view.querySelector('#architecture').innerText = globalize.translate('DashboardArchitecture', systemInfo.SystemArchitecture);
|
||||
|
||||
if (systemInfo.CanSelfRestart) {
|
||||
view.querySelector('#btnRestartServer').classList.remove('hide');
|
||||
|
@ -210,11 +211,11 @@ import confirm from '../../components/confirm/confirm';
|
|||
view.querySelector('#btnRestartServer').classList.add('hide');
|
||||
}
|
||||
|
||||
view.querySelector('#cachePath').innerHTML = systemInfo.CachePath;
|
||||
view.querySelector('#logPath').innerHTML = systemInfo.LogPath;
|
||||
view.querySelector('#transcodePath').innerHTML = systemInfo.TranscodingTempPath;
|
||||
view.querySelector('#metadataPath').innerHTML = systemInfo.InternalMetadataPath;
|
||||
view.querySelector('#webPath').innerHTML = systemInfo.WebPath;
|
||||
view.querySelector('#cachePath').innerText = systemInfo.CachePath;
|
||||
view.querySelector('#logPath').innerText = systemInfo.LogPath;
|
||||
view.querySelector('#transcodePath').innerText = systemInfo.TranscodingTempPath;
|
||||
view.querySelector('#metadataPath').innerText = systemInfo.InternalMetadataPath;
|
||||
view.querySelector('#webPath').innerText = systemInfo.WebPath;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -279,8 +280,8 @@ import confirm from '../../components/confirm/confirm';
|
|||
}
|
||||
|
||||
html += '<div class="sessionAppName" style="display:inline-block;">';
|
||||
html += '<div class="sessionDeviceName">' + session.DeviceName + '</div>';
|
||||
html += '<div class="sessionAppSecondaryText">' + DashboardPage.getAppSecondaryText(session) + '</div>';
|
||||
html += '<div class="sessionDeviceName">' + escapeHtml(session.DeviceName) + '</div>';
|
||||
html += '<div class="sessionAppSecondaryText">' + escapeHtml(DashboardPage.getAppSecondaryText(session)) + '</div>';
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
|
||||
|
@ -289,7 +290,7 @@ import confirm from '../../components/confirm/confirm';
|
|||
html += '<div class="sessionNowPlayingInfo" data-imgsrc="' + nowPlayingName.image + '">';
|
||||
html += nowPlayingName.html;
|
||||
html += '</div>';
|
||||
html += '<div class="sessionNowPlayingTime">' + DashboardPage.getSessionNowPlayingTime(session) + '</div>';
|
||||
html += '<div class="sessionNowPlayingTime">' + escapeHtml(DashboardPage.getSessionNowPlayingTime(session)) + '</div>';
|
||||
html += '</div>';
|
||||
|
||||
let percent = 100 * session?.PlayState?.PositionTicks / nowPlayingItem?.RunTimeTicks;
|
||||
|
@ -480,16 +481,16 @@ import confirm from '../../components/confirm/confirm';
|
|||
};
|
||||
}
|
||||
|
||||
let topText = itemHelper.getDisplayName(nowPlayingItem);
|
||||
let topText = escapeHtml(itemHelper.getDisplayName(nowPlayingItem));
|
||||
let bottomText = '';
|
||||
|
||||
if (nowPlayingItem.Artists && nowPlayingItem.Artists.length) {
|
||||
bottomText = topText;
|
||||
topText = nowPlayingItem.Artists[0];
|
||||
topText = escapeHtml(nowPlayingItem.Artists[0]);
|
||||
} else {
|
||||
if (nowPlayingItem.SeriesName || nowPlayingItem.Album) {
|
||||
bottomText = topText;
|
||||
topText = nowPlayingItem.SeriesName || nowPlayingItem.Album;
|
||||
topText = escapeHtml(nowPlayingItem.SeriesName || nowPlayingItem.Album);
|
||||
} else if (nowPlayingItem.ProductionYear) {
|
||||
bottomText = nowPlayingItem.ProductionYear;
|
||||
}
|
||||
|
@ -575,9 +576,9 @@ import confirm from '../../components/confirm/confirm';
|
|||
btnSessionPlayPauseIcon.classList.remove('play_arrow', 'pause');
|
||||
btnSessionPlayPauseIcon.classList.add(session.PlayState && session.PlayState.IsPaused ? 'play_arrow' : 'pause');
|
||||
|
||||
row.querySelector('.sessionNowPlayingTime').innerHTML = DashboardPage.getSessionNowPlayingTime(session);
|
||||
row.querySelector('.sessionUserName').innerHTML = DashboardPage.getUsersHtml(session);
|
||||
row.querySelector('.sessionAppSecondaryText').innerHTML = DashboardPage.getAppSecondaryText(session);
|
||||
row.querySelector('.sessionNowPlayingTime').innerText = DashboardPage.getSessionNowPlayingTime(session);
|
||||
row.querySelector('.sessionUserName').innerText = DashboardPage.getUsersHtml(session);
|
||||
row.querySelector('.sessionAppSecondaryText').innerText = DashboardPage.getAppSecondaryText(session);
|
||||
const nowPlayingName = DashboardPage.getNowPlayingName(session);
|
||||
const nowPlayingInfoElem = row.querySelector('.sessionNowPlayingInfo');
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import Dashboard from '../../../scripts/clientUtils';
|
|||
|
||||
function load(page, device, deviceOptions) {
|
||||
page.querySelector('#txtCustomName', page).value = deviceOptions.CustomName || '';
|
||||
page.querySelector('.reportedName', page).innerHTML = device.Name || '';
|
||||
page.querySelector('.reportedName', page).innerText = device.Name || '';
|
||||
}
|
||||
|
||||
function loadData() {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import escapeHtml from 'escape-html';
|
||||
import cardBuilder from '../../../components/cardbuilder/cardBuilder';
|
||||
import loading from '../../../components/loading/loading';
|
||||
import dom from '../../../scripts/dom';
|
||||
|
@ -118,15 +119,15 @@ import confirm from '../../../components/confirm/confirm';
|
|||
}
|
||||
|
||||
deviceHtml += "<div class='cardText'>";
|
||||
deviceHtml += device.Name;
|
||||
deviceHtml += escapeHtml(device.Name);
|
||||
deviceHtml += '</div>';
|
||||
deviceHtml += "<div class='cardText cardText-secondary'>";
|
||||
deviceHtml += device.AppName + ' ' + device.AppVersion;
|
||||
deviceHtml += escapeHtml(device.AppName + ' ' + device.AppVersion);
|
||||
deviceHtml += '</div>';
|
||||
deviceHtml += "<div class='cardText cardText-secondary'>";
|
||||
|
||||
if (device.LastUserName) {
|
||||
deviceHtml += device.LastUserName;
|
||||
deviceHtml += escapeHtml(device.LastUserName);
|
||||
deviceHtml += ', ' + formatDistanceToNow(Date.parse(device.DateLastActivity), localeWithSuffix);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import escapeHtml from 'escape-html';
|
||||
import 'jquery';
|
||||
import loading from '../../../components/loading/loading';
|
||||
import globalize from '../../../scripts/globalize';
|
||||
|
@ -76,7 +77,7 @@ import toast from '../../../components/toast/toast';
|
|||
profile.CodecProfiles = profile.CodecProfiles || [];
|
||||
profile.ResponseProfiles = profile.ResponseProfiles || [];
|
||||
const usersHtml = '<option></option>' + users.map(function (u) {
|
||||
return '<option value="' + u.Id + '">' + u.Name + '</option>';
|
||||
return '<option value="' + u.Id + '">' + escapeHtml(u.Name) + '</option>';
|
||||
}).join('');
|
||||
$('#selectUser', page).html(usersHtml).val(profile.UserId || '');
|
||||
renderSubProfiles(page, profile);
|
||||
|
@ -88,8 +89,8 @@ import toast from '../../../components/toast/toast';
|
|||
let li = '<div class="listItem">';
|
||||
li += '<span class="material-icons listItemIcon info" aria-hidden="true"></span>';
|
||||
li += '<div class="listItemBody">';
|
||||
li += '<h3 class="listItemBodyText">' + h.Name + ': ' + (h.Value || '') + '</h3>';
|
||||
li += '<div class="listItemBodyText secondary">' + (h.Match || '') + '</div>';
|
||||
li += '<h3 class="listItemBodyText">' + escapeHtml(h.Name + ': ' + (h.Value || '')) + '</h3>';
|
||||
li += '<div class="listItemBodyText secondary">' + escapeHtml(h.Match || '') + '</div>';
|
||||
li += '</div>';
|
||||
li += '<button type="button" is="paper-icon-button-light" class="btnDeleteIdentificationHeader listItemButton" data-index="' + index + '"><span class="material-icons delete" aria-hidden="true"></span></button>';
|
||||
li += '</div>';
|
||||
|
@ -144,7 +145,7 @@ import toast from '../../../components/toast/toast';
|
|||
let li = '<div class="listItem">';
|
||||
li += '<span class="material-icons listItemIcon info" aria-hidden="true"></span>';
|
||||
li += '<div class="listItemBody">';
|
||||
li += '<h3 class="listItemBodyText">' + h.Name + ' = ' + (h.Value || '') + '</h3>';
|
||||
li += '<h3 class="listItemBodyText">' + escapeHtml(h.Name + ' = ' + (h.Value || '')) + '</h3>';
|
||||
li += '</div>';
|
||||
li += '<button type="button" is="paper-icon-button-light" class="btnDeleteXmlAttribute listItemButton" data-index="0"><span class="material-icons delete" aria-hidden="true"></span></button>';
|
||||
return li += '</div>';
|
||||
|
@ -186,7 +187,7 @@ import toast from '../../../components/toast/toast';
|
|||
let li = '<div class="listItem lnkEditSubProfile" data-index="' + index + '">';
|
||||
li += '<span class="material-icons listItemIcon info" aria-hidden="true"></span>';
|
||||
li += '<div class="listItemBody">';
|
||||
li += '<h3 class="listItemBodyText">' + (h.Format || '') + '</h3>';
|
||||
li += '<h3 class="listItemBodyText">' + escapeHtml(h.Format || '') + '</h3>';
|
||||
li += '</div>';
|
||||
li += '<button type="button" is="paper-icon-button-light" class="btnDeleteProfile listItemButton" data-index="' + index + '"><span class="material-icons delete" aria-hidden="true"></span></button>';
|
||||
li += '</div>';
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import escapeHtml from 'escape-html';
|
||||
import 'jquery';
|
||||
import globalize from '../../../scripts/globalize';
|
||||
import loading from '../../../components/loading/loading';
|
||||
|
@ -42,7 +43,7 @@ import confirm from '../../../components/confirm/confirm';
|
|||
html += '<span class="listItemIcon material-icons live_tv" aria-hidden="true"></span>';
|
||||
html += '<div class="listItemBody two-line">';
|
||||
html += "<a is='emby-linkbutton' style='padding:0;margin:0;' data-ripple='false' class='clearLink' href='#!/dlnaprofile.html?id=" + profile.Id + "'>";
|
||||
html += '<div>' + profile.Name + '</div>';
|
||||
html += '<div>' + escapeHtml(profile.Name) + '</div>';
|
||||
html += '</a>';
|
||||
html += '</div>';
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import escapeHtml from 'escape-html';
|
||||
import 'jquery';
|
||||
import loading from '../../../components/loading/loading';
|
||||
import libraryMenu from '../../../scripts/libraryMenu';
|
||||
|
@ -14,7 +15,7 @@ import Dashboard from '../../../scripts/clientUtils';
|
|||
$('#chkBlastAliveMessages', page).prop('checked', config.BlastAliveMessages);
|
||||
$('#txtBlastInterval', page).val(config.BlastAliveMessageIntervalSeconds);
|
||||
const usersHtml = users.map(function (u) {
|
||||
return '<option value="' + u.Id + '">' + u.Name + '</option>';
|
||||
return '<option value="' + u.Id + '">' + escapeHtml(u.Name) + '</option>';
|
||||
}).join('');
|
||||
$('#selectUser', page).html(usersHtml).val(config.DefaultUserId || '');
|
||||
loading.hide();
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import escapeHtml from 'escape-html';
|
||||
import 'jquery';
|
||||
import taskButton from '../../scripts/taskbutton';
|
||||
import loading from '../../components/loading/loading';
|
||||
|
@ -297,7 +298,7 @@ import cardBuilder from '../../components/cardbuilder/cardBuilder';
|
|||
|
||||
if (virtualFolder.showNameWithIcon) {
|
||||
html += '<div style="margin:1em 0;position:width:100%;">';
|
||||
html += virtualFolder.Name;
|
||||
html += escapeHtml(virtualFolder.Name);
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
|
@ -319,7 +320,7 @@ import cardBuilder from '../../components/cardbuilder/cardBuilder';
|
|||
if (virtualFolder.showNameWithIcon) {
|
||||
html += ' ';
|
||||
} else {
|
||||
html += virtualFolder.Name;
|
||||
html += escapeHtml(virtualFolder.Name);
|
||||
}
|
||||
|
||||
html += '</div>';
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import escapeHtml from 'escape-html';
|
||||
import 'jquery';
|
||||
import loading from '../../components/loading/loading';
|
||||
import libraryMenu from '../../scripts/libraryMenu';
|
||||
|
@ -10,7 +11,7 @@ import alert from '../../components/alert';
|
|||
function loadPage(page, config, users) {
|
||||
let html = '<option value="" selected="selected">' + globalize.translate('None') + '</option>';
|
||||
html += users.map(function (user) {
|
||||
return '<option value="' + user.Id + '">' + user.Name + '</option>';
|
||||
return '<option value="' + user.Id + '">' + escapeHtml(user.Name) + '</option>';
|
||||
}).join('');
|
||||
$('#selectUser', page).html(html).val(config.UserId || '');
|
||||
$('#selectReleaseDateFormat', page).val(config.ReleaseDateFormat);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import escapeHtml from 'escape-html';
|
||||
import 'jquery';
|
||||
import '../../../../elements/emby-checkbox/emby-checkbox';
|
||||
import Dashboard from '../../../../scripts/clientUtils';
|
||||
|
@ -7,7 +8,7 @@ function fillItems(elem, items, cssClass, idPrefix, currentList, isEnabledList)
|
|||
html += items.map(function (u) {
|
||||
const isChecked = isEnabledList ? currentList.indexOf(u.Id) != -1 : currentList.indexOf(u.Id) == -1;
|
||||
const checkedHtml = isChecked ? ' checked="checked"' : '';
|
||||
return '<label><input is="emby-checkbox" class="' + cssClass + '" type="checkbox" data-itemid="' + u.Id + '"' + checkedHtml + '/><span>' + u.Name + '</span></label>';
|
||||
return '<label><input is="emby-checkbox" class="' + cssClass + '" type="checkbox" data-itemid="' + u.Id + '"' + checkedHtml + '/><span>' + escapeHtml(u.Name) + '</span></label>';
|
||||
}).join('');
|
||||
html += '</div>';
|
||||
elem.html(html).trigger('create');
|
||||
|
@ -37,7 +38,7 @@ function reload(page) {
|
|||
$('.monitorUsers', page).hide();
|
||||
}
|
||||
|
||||
$('.notificationType', page).html(typeInfo.Name || 'Unknown Notification');
|
||||
$('.notificationType', page).html(escapeHtml(typeInfo.Name) || 'Unknown Notification');
|
||||
|
||||
if (!notificationConfig) {
|
||||
notificationConfig = {
|
||||
|
|
|
@ -13,7 +13,7 @@ import confirm from '../../../components/confirm/confirm';
|
|||
ApiClient.getUser(userid).then(function (user) {
|
||||
Dashboard.getCurrentUser().then(function (loggedInUser) {
|
||||
libraryMenu.setTitle(user.Name);
|
||||
page.querySelector('.username').innerHTML = user.Name;
|
||||
page.querySelector('.username').innerText = user.Name;
|
||||
let showPasswordSection = true;
|
||||
let showLocalAccessSection = false;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue