diff --git a/src/public/app/widgets/buttons/global_menu.js b/src/public/app/widgets/buttons/global_menu.js index 6dc1295c3..658b24d00 100644 --- a/src/public/app/widgets/buttons/global_menu.js +++ b/src/public/app/widgets/buttons/global_menu.js @@ -1,6 +1,7 @@ import BasicWidget from "../basic_widget.js"; import utils from "../../services/utils.js"; import UpdateAvailableWidget from "./update_available.js"; +import options from "../../services/options.js"; const TPL = ` -`; + +
+

Network connections

+ +
+ + +
+
+ +`; export default class ProtectedSessionOptions { constructor() { @@ -142,7 +152,7 @@ export default class ProtectedSessionOptions { this.$availableLanguageCodes = $("#available-language-codes"); if (utils.isElectron()) { - const {webContents} = utils.dynamicRequire('@electron/remote').getCurrentWindow(); + const { webContents } = utils.dynamicRequire('@electron/remote').getCurrentWindow(); this.$availableLanguageCodes.text(webContents.session.availableSpellCheckerLanguages.join(', ')); } @@ -250,6 +260,14 @@ export default class ProtectedSessionOptions { this.setImageCompression(isChecked); }); + + this.$checkForUpdates = $("#check-for-updates"); + this.$checkForUpdates.on("change", () => { + const isChecked = this.$checkForUpdates.prop("checked"); + const opts = { 'checkForUpdates': isChecked ? 'true' : 'false' }; + + server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved.")); + }); } optionsLoaded(options) { @@ -272,5 +290,10 @@ export default class ProtectedSessionOptions { const compressImages = options['compressImages'] === 'true'; this.$enableImageCompression.prop('checked', compressImages); this.setImageCompression(compressImages); + + + const checkForUpdates = options['checkForUpdates'] === 'true'; + this.$checkForUpdates.prop('checked', checkForUpdates); + } } diff --git a/src/routes/api/options.js b/src/routes/api/options.js index 6fd89cdf1..916a89f11 100644 --- a/src/routes/api/options.js +++ b/src/routes/api/options.js @@ -57,7 +57,8 @@ const ALLOWED_OPTIONS = new Set([ 'maxContentWidth', 'compressImages', 'downloadImagesAutomatically', - 'minTocHeadings' + 'minTocHeadings', + 'checkForUpdates' ]); function getOptions() { diff --git a/src/routes/login.js b/src/routes/login.js index 3431f3431..bd29e0765 100644 --- a/src/routes/login.js +++ b/src/routes/login.js @@ -5,6 +5,7 @@ const optionService = require('../services/options'); const myScryptService = require('../services/my_scrypt'); const log = require('../services/log'); const passwordService = require("../services/password"); +const options = require('../services/options'); function loginPage(req, res) { res.render('login', { failedAuth: false }); @@ -36,6 +37,7 @@ function setPassword(req, res) { return; } + options.setOption("checkForUpdates", req.body['check-for-updates'] == 'on'); passwordService.setPassword(password1); res.redirect('login'); diff --git a/src/services/options_init.js b/src/services/options_init.js index 6ee05c06c..e5a13b4da 100644 --- a/src/services/options_init.js +++ b/src/services/options_init.js @@ -85,7 +85,8 @@ const defaultOptions = [ { name: 'maxContentWidth', value: '1200', isSynced: false }, { name: 'compressImages', value: 'true', isSynced: true }, { name: 'downloadImagesAutomatically', value: 'true', isSynced: true }, - { name: 'minTocHeadings', value: '5', isSynced: true } + { name: 'minTocHeadings', value: '5', isSynced: true }, + { name: 'checkForUpdates', value: 'true', isSynced: true }, ]; function initStartupOptions() { diff --git a/src/views/set_password.ejs b/src/views/set_password.ejs index d9079c264..0768f4825 100644 --- a/src/views/set_password.ejs +++ b/src/views/set_password.ejs @@ -33,6 +33,11 @@ +
+ + +
+