()
| 480 | } |
| 481 | |
| 482 | async function getAppConfig() { |
| 483 | try { |
| 484 | let res = await fetch("/get/app_config") |
| 485 | const config = await res.json() |
| 486 | |
| 487 | applySettingsFromConfig(config) |
| 488 | |
| 489 | // custom overrides |
| 490 | if (config.update_branch === "beta") { |
| 491 | useBetaChannelField.checked = true |
| 492 | document.querySelector("#updateBranchLabel").innerText = "(beta)" |
| 493 | } |
| 494 | if (config.ui && config.ui.open_browser_on_start === false) { |
| 495 | uiOpenBrowserOnStartField.checked = false |
| 496 | } |
| 497 | if (config.net && config.net.listen_to_network === false) { |
| 498 | listenToNetworkField.checked = false |
| 499 | } |
| 500 | if (config.net && config.net.listen_port !== undefined) { |
| 501 | listenPortField.value = config.net.listen_port |
| 502 | } |
| 503 | modelsDirField.value = config.models_dir |
| 504 | |
| 505 | let testDiffusersEnabled = true |
| 506 | if (config.backend === "ed_classic") { |
| 507 | testDiffusersEnabled = false |
| 508 | } |
| 509 | testDiffusers.checked = testDiffusersEnabled |
| 510 | backendEngine.value = config.backend |
| 511 | document.querySelector("#test_diffusers").checked = testDiffusers.checked // don't break plugins |
| 512 | document.querySelector("#use_v3_engine").checked = testDiffusers.checked // don't break plugins |
| 513 | |
| 514 | if (config.config_on_startup) { |
| 515 | if (config.config_on_startup?.backend !== "ed_classic") { |
| 516 | document.body.classList.add("diffusers-enabled-on-startup") |
| 517 | document.body.classList.remove("diffusers-disabled-on-startup") |
| 518 | } else { |
| 519 | document.body.classList.add("diffusers-disabled-on-startup") |
| 520 | document.body.classList.remove("diffusers-enabled-on-startup") |
| 521 | } |
| 522 | } |
| 523 | |
| 524 | if (config.backend === "ed_classic") { |
| 525 | IMAGE_STEP_SIZE = 64 |
| 526 | } else { |
| 527 | IMAGE_STEP_SIZE = 8 |
| 528 | } |
| 529 | |
| 530 | customWidthField.step = IMAGE_STEP_SIZE |
| 531 | customHeightField.step = IMAGE_STEP_SIZE |
| 532 | |
| 533 | const currentBackendKey = "backend_" + config.backend |
| 534 | |
| 535 | document.querySelectorAll('.gated-feature').forEach((element) => { |
| 536 | const featureKeys = element.getAttribute('data-feature-keys').split(' ') |
| 537 | |
| 538 | if (featureKeys.includes(currentBackendKey)) { |
| 539 | element.style.display = getDefaultDisplay(element) |
no test coverage detected