Revert to last known fallback mode when validation failed

This commit is contained in:
Yukino Song
2024-09-19 20:07:03 +08:00
parent 2c3a08574b
commit 4982074fcf
+7 -1
View File
@@ -114,6 +114,8 @@
import ContainerEncoders from './configs/tabs/ContainerEncoders.vue' import ContainerEncoders from './configs/tabs/ContainerEncoders.vue'
import {$tp, usePlatformI18n} from './platform-i18n' import {$tp, usePlatformI18n} from './platform-i18n'
let fallbackDisplayModeCache = "";
const app = createApp({ const app = createApp({
components: { components: {
Navbar, Navbar,
@@ -319,6 +321,8 @@
this.vdisplayStatus = this.config.vdisplayStatus; this.vdisplayStatus = this.config.vdisplayStatus;
delete this.config.vdisplayStatus; delete this.config.vdisplayStatus;
fallbackDisplayModeCache = this.config.fallback_mode || "";
// TODO: let each tab's Component handle it's own data instead of doing it here // TODO: let each tab's Component handle it's own data instead of doing it here
// Populate default values from tabs options // Populate default values from tabs options
@@ -346,7 +350,9 @@
// Validate fallback mode // Validate fallback mode
if (this.config.fallback_mode && !this.config.fallback_mode.match(/^\d+x\d+x\d+$/)) { if (this.config.fallback_mode && !this.config.fallback_mode.match(/^\d+x\d+x\d+$/)) {
this.config.fallback_mode = "1920x1080x60"; this.config.fallback_mode = fallbackDisplayModeCache;
} else {
fallbackDisplayModeCache = this.config.fallback_mode;
} }
}, },
save() { save() {