Усилить безопасность веб-интерфейса
This commit is contained in:
@@ -83,6 +83,7 @@ async function initWizardPage() {
|
||||
await loadProtocolCapabilities();
|
||||
|
||||
await loadWizardPanels([1, 2, 3, 4, 5]);
|
||||
bindWizardPanelActions();
|
||||
if (window.CrankOverlay && typeof window.CrankOverlay.render === 'function') {
|
||||
await window.CrankOverlay.render(document, {
|
||||
workspace: workspace,
|
||||
@@ -248,6 +249,36 @@ function selectMethod(btn) {
|
||||
}
|
||||
}
|
||||
|
||||
function bindWizardPanelActions() {
|
||||
var upstreamSearch = document.getElementById('upstream-search');
|
||||
var authMode = document.getElementById('new-upstream-auth-mode');
|
||||
var authKind = document.getElementById('new-auth-profile-kind');
|
||||
|
||||
if (upstreamSearch) {
|
||||
upstreamSearch.addEventListener('input', function(event) {
|
||||
filterUpstreams(event.target.value);
|
||||
});
|
||||
}
|
||||
if (authMode) authMode.addEventListener('change', updateUpstreamAuthUi);
|
||||
if (authKind) authKind.addEventListener('change', updateAuthProfileCreateUi);
|
||||
|
||||
document.querySelectorAll('.method-card[data-method]').forEach(function(button) {
|
||||
button.addEventListener('click', function() { selectMethod(button); });
|
||||
});
|
||||
|
||||
document.querySelectorAll('[data-wizard-action]').forEach(function(element) {
|
||||
element.addEventListener('click', function(event) {
|
||||
var action = element.dataset.wizardAction;
|
||||
if (action === 'toggle-upstream') toggleUpstreamDropdown(event);
|
||||
if (action === 'edit-upstream') beginEditSelectedUpstream(event);
|
||||
if (action === 'new-upstream') startNewUpstream();
|
||||
if (action === 'quick-secret') openQuickSecretModal(event);
|
||||
if (action === 'save-upstream') void saveNewUpstream(event);
|
||||
if (action === 'cancel-upstream') cancelNewUpstream(event);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function escapeHtml(str) {
|
||||
return String(str).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user