How to use the electron-json-storage.getAll function in electron-json-storage

To help you get started, we’ve selected a few electron-json-storage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yafp / ttth / app / js / ttth / ttth.js View on Github external
function updateAllUserServiceConfigurationsSince_1_9_0 () {
    // 1.9.0 introduced userAgents per service. See #158
    // TODO:
    // patch all user-services:
    // add: userAgentDefault

    const storage = require('electron-json-storage')

    writeLog('info', 'updateAllUserServiceConfigurationsSince_1_9_0 ::: Starting to validate all user service configurations')

    // loop over all json files - and see if we need to patch something
    storage.getAll(function (error, data) {
        if (error) {
            writeLog('error', 'updateAllUserServiceConfigurationsSince_1_9_0 ::: Got error while trying to fetch all service configs. Error: ' + error)
            throw error
        }

        // show object which contains all config files
        // writeLog("info", "loadEnabledUserServices ::: Object: " + data);
        // console.error(data);

        var userAgentDefaultMissing
        var newUserAgentDefaultString
        var userAgentCustomMissing
        var userUserAgentCustomString

        // loop over upper object
        for (var key in data) {
github yafp / ttth / app / js / ttth / ttth.js View on Github external
function loadEnabledUserServices () {
    const storage = require('electron-json-storage')

    writeLog('info', 'loadEnabledUserServices ::: Starting to fetch all user configured service files')

    // loop over all json files - add tab for the enabled ones
    storage.getAll(function (error, data) {
        if (error) {
            throw error
        }

        // show object which contains all config files
        // writeLog("info", "loadEnabledUserServices ::: Object: " + data);
        // console.error(data);

        // loop over upper object
        for (var key in data) {
            if (data.hasOwnProperty(key)) {
                writeLog('info', 'loadEnabledUserServices ::: ' + key)
                writeLog('info', 'loadEnabledUserServices ::: ' + key + ' -> ' + data[key])

                // show enabled configured service
                if (data[key].serviceEnableStatus === true) {
github yafp / ttth / app / js / ttth / ttth.js View on Github external
function updateAllUserServiceConfigurationsSince_1_8_0 () {
    // changes from 1.7.0 to 1.8.0:
    // - inject files got re-structured. Path & names are stored in the user-services configuration files
    //
    const storage = require('electron-json-storage')

    writeLog('info', 'updateAllUserServiceConfigurationsSince_1_8_0 ::: Starting to validate all user service configurations')

    // loop over all json files - and see if we need to patch something
    storage.getAll(function (error, data) {
        if (error) {
            writeLog('error', 'updateAllUserServiceConfigurationsSince_1_8_0 ::: Got error while trying to fetch all service configs. Error: ' + error)
            throw error
        }

        // show object which contains all config files
        // writeLog("info", "loadEnabledUserServices ::: Object: " + data);
        // console.error(data);

        var shouldConfigBeUpdated = false
        var newInjectCodePath

        // loop over upper object
        for (var key in data) {
            if (data.hasOwnProperty(key)) {
                writeLog('info', 'updateAllUserServiceConfigurationsSince_1_8_0 ::: ' + key + ' -> ' + data[key])
github yafp / ttth / app / js / ttth / ttth.js View on Github external
function loadConfiguredUserServices () {
    const storage = require('electron-json-storage')
    const remote = require('electron').remote
    const app = remote.app
    const path = require('path')

    $('#settingsServicesConfigured').empty() // empty the div

    // ensure we are reading from the correct location
    const defaultUserDataPath = app.getPath('userData')
    var customUserDataPath = path.join(defaultUserDataPath, 'storage')
    storage.setDataPath(customUserDataPath)

    // read all user service configuration files
    storage.getAll(function (error, data) {
        if (error) {
            // FIXME
            throw error
        }

        // show object which contains all config files
        // writeLog("error", (data);
        // writeLog("error", (typeof data);

        var serviceCount = 0

        writeLog('info', 'loadConfiguredUserServices ::: Found the following user configs: _' + data + '_.')

        // loop over upper object
        for (var key in data) {
            if (data.hasOwnProperty(key)) {
github steventhanna / proton / main.js View on Github external
function getAllSettings(callback) {
  storage.getAll(function(err, data) {
    if (err || data == undefined) {
      console.log("There was an error finding the user.");
      console.log("Error = " + err);
      error('danger', "<strong>Uh-Oh!</strong> There was an error getting all of the settings.");
    } else {
      callback(data);
    }
  });
}