Adds a list of properties to not export by default.

This commit is contained in:
Marc-Andre Ferland 2022-11-03 03:10:31 -04:00
parent d2e6011089
commit c3cc75feff

View File

@ -351,6 +351,13 @@ function dragOverHandler(ev) {
document.addEventListener("drop", dropHandler) document.addEventListener("drop", dropHandler)
document.addEventListener("dragover", dragOverHandler) document.addEventListener("dragover", dragOverHandler)
const TASK_REQ_NO_EXPORT = [
"use_cpu",
"turbo",
"use_full_precision",
"save_to_disk_path"
]
// Adds a copy icon if the browser grants permission to write to clipboard. // Adds a copy icon if the browser grants permission to write to clipboard.
function checkWriteToClipboardPermission (result) { function checkWriteToClipboardPermission (result) {
if (result.state == "granted" || result.state == "prompt") { if (result.state == "granted" || result.state == "prompt") {
@ -361,7 +368,9 @@ function checkWriteToClipboardPermission (result) {
copyIcon.innerHTML = `<span class="simple-tooltip right">Copy Image Settings</span>` copyIcon.innerHTML = `<span class="simple-tooltip right">Copy Image Settings</span>`
copyIcon.addEventListener('click', (event) => { copyIcon.addEventListener('click', (event) => {
event.stopPropagation() event.stopPropagation()
navigator.clipboard.writeText(JSON.stringify(readUI(), undefined, 4)) const uiState = readUI()
TASK_REQ_NO_EXPORT.forEach((key) => delete uiState.reqBody[key])
navigator.clipboard.writeText(JSON.stringify(uiState, undefined, 4))
}) })
resetSettings.parentNode.insertBefore(copyIcon, resetSettings) resetSettings.parentNode.insertBefore(copyIcon, resetSettings)
} }