Усилить безопасность веб-интерфейса
This commit is contained in:
@@ -124,14 +124,6 @@
|
||||
return encoded ? ('?' + encoded) : '';
|
||||
}
|
||||
|
||||
function postBytes(path, bytes, fileName) {
|
||||
return request(API_BASE + path, {
|
||||
method: 'POST',
|
||||
headers: headers(fileName ? { 'X-File-Name': fileName } : {}),
|
||||
body: bytes,
|
||||
});
|
||||
}
|
||||
|
||||
window.CrankApi = {
|
||||
login: function(payload) {
|
||||
return request(AUTH_BASE + '/login', {
|
||||
|
||||
@@ -330,6 +330,9 @@ async function loadWorkspaceSettings() {
|
||||
}
|
||||
|
||||
async function initSettingsPage() {
|
||||
document.querySelectorAll('.lang-btn[data-lang]').forEach(function(button) {
|
||||
button.addEventListener('click', function() { setLang(button.dataset.lang); });
|
||||
});
|
||||
bindSectionNavigation();
|
||||
await loadProfile();
|
||||
await loadCapabilities();
|
||||
|
||||
Vendored
-5
File diff suppressed because one or more lines are too long
-2
File diff suppressed because one or more lines are too long
@@ -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,'"');
|
||||
}
|
||||
|
||||
@@ -207,6 +207,17 @@ async function exportWorkspaceSnapshot() {
|
||||
async function initPage() {
|
||||
updatePageMode();
|
||||
|
||||
document.querySelectorAll('.ws-color-swatch').forEach(function(swatch) {
|
||||
swatch.addEventListener('click', function() { pickColor(swatch); });
|
||||
});
|
||||
document.querySelectorAll('[data-history-back]').forEach(function(button) {
|
||||
button.addEventListener('click', function() { window.history.back(); });
|
||||
});
|
||||
var elements = formElements();
|
||||
elements.name.addEventListener('input', function(event) { onWsNameInput(event.target.value); });
|
||||
elements.slug.addEventListener('input', function(event) { onWsSlugInput(event.target.value); });
|
||||
elements.submit.addEventListener('click', submitForm);
|
||||
|
||||
var exportButton = document.getElementById('export-workspace-btn');
|
||||
if (exportButton) {
|
||||
exportButton.addEventListener('click', exportWorkspaceSnapshot);
|
||||
|
||||
Reference in New Issue
Block a user