-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
config: only save non default values #1023
Conversation
@@ -1050,33 +1055,57 @@ <h1 class="my-4">Configuration</h1> | |||
this.resolutions.join("," + nl + " ") + | |||
nl + | |||
"]"; | |||
this.config.fps = JSON.stringify(this.fps); | |||
// remove quotes from values in fps | |||
this.config.fps = JSON.stringify(this.fps).replace(/"/g, ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes a possible bug where new FPS values were added surrounded by quotes, whereas the default values where without quotes.
}, | ||
save() { | ||
this.saved = this.restarted = false; | ||
this.serialize(); | ||
|
||
// create a temp copy of this.config to use for the post request | ||
let config = JSON.parse(JSON.stringify(this.config)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A temp copy of the config is created, because if we delete this.config[key]
, the values are removed from the UI once you save them.
}).then((r) => { | ||
if (r.status === 200) this.saved = true; | ||
}); | ||
}, | ||
apply() { | ||
this.saved = this.restarted = false; | ||
this.serialize(); | ||
fetch("/api/config", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was removed, since the user must already click "Save" for the "Apply" button to appear... but we will save again anyway just to be safe (but without repeating code).
6debd1a
to
e18358d
Compare
Description
Only save non default config values.
Also fixes a potential issue where new FPS values were quoted, as discovered when reviewing #1002.
Screenshot
Issues Fixed or Closed
Type of Change
.github/...
)Checklist
Branch Updates
LizardByte requires that branches be up-to-date before merging. This means that after any PR is merged, this branch
must be updated before it can be merged. You must also
Allow edits from maintainers.