aboutsummaryrefslogtreecommitdiff
path: root/src/App.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/App.js')
-rw-r--r--src/App.js28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/App.js b/src/App.js
index 43bb29e..04a2726 100644
--- a/src/App.js
+++ b/src/App.js
@@ -63,21 +63,27 @@ class App extends Component {
let lsSettings = localStorage.getItem("settings");
let settings = JSON.parse(lsSettings);
-
+ const defaultSettings = {
+ homeSound: "msn",
+ threadSound: "msn",
+ nightMode: false,
+ notifyOnHome: true,
+ notifyOnThread: true,
+ autoUpdateThreads: true,
+ showAvatars: true,
+ postPassword: this.genPassword(),
+ embedYoutube: true
+ };
if (lsSettings === null) {
- let defaultSettings = {
- homeSound: "msn",
- threadSound: "msn",
- nightMode: false,
- notifyOnHome: true,
- notifyOnThread: true,
- autoUpdateThreads: true,
- showAvatars: true,
- postPassword: this.genPassword()
- };
localStorage.setItem("settings", JSON.stringify(defaultSettings));
settings = defaultSettings;
} else {
+ Object.keys(defaultSettings).forEach(key => {
+ if (settings[key] === undefined) {
+ settings[key] = defaultSettings[key];
+ }
+ });
+ localStorage.setItem("settings", JSON.stringify(defaultSettings));
this.setState({ nightMode: settings.nightMode });
}
}