Store the output format setting in localStorage

This commit is contained in:
cmdr2 2022-10-08 18:22:01 +05:30
parent 6b7d4877e6
commit 6855e314b3
2 changed files with 9 additions and 1 deletions

View File

@ -226,7 +226,7 @@
</div>
</body>
<script src="media/main.js?v=33"></script>
<script src="media/main.js?v=34"></script>
<script>
async function init() {
await loadModifiers()

View File

@ -10,6 +10,7 @@ const USE_FACE_CORRECTION_KEY = "useFaceCorrection"
const USE_UPSCALING_KEY = "useUpscaling"
const SHOW_ONLY_FILTERED_IMAGE_KEY = "showOnlyFilteredImage"
const STREAM_IMAGE_PROGRESS_KEY = "streamImageProgress"
const OUTPUT_FORMAT_KEY = "outputFormat"
const HEALTH_PING_INTERVAL = 5 // seconds
const MAX_INIT_IMAGE_DIMENSION = 768
@ -204,6 +205,10 @@ function isStreamImageProgressEnabled() {
return getLocalStorageBoolItem(STREAM_IMAGE_PROGRESS_KEY, false)
}
function getOutputFormat() {
return getLocalStorageItem(OUTPUT_FORMAT_KEY, 'jpeg')
}
function setStatus(statusType, msg, msgType) {
if (statusType !== 'server') {
return
@ -906,6 +911,9 @@ turboField.checked = isUseTurboModeEnabled()
streamImageProgressField.addEventListener('click', handleBoolSettingChange(STREAM_IMAGE_PROGRESS_KEY))
streamImageProgressField.checked = isStreamImageProgressEnabled()
outputFormatField.addEventListener('change', handleStringSettingChange(OUTPUT_FORMAT_KEY))
outputFormatField.value = getOutputFormat()
diskPathField.addEventListener('change', handleStringSettingChange(DISK_PATH_KEY))
saveToDiskField.addEventListener('click', function(e) {