Commit 9a54bedd authored by Benjamin Bouvier's avatar Benjamin Bouvier
Browse files

Fixes #424: Include Weboob's version in the settings and require 1.1;

parent 6fb93ab3
......@@ -20,8 +20,9 @@ bank website. You'll need to [install Weboob](http://weboob.org/install) core
modules so that the user executing the Kresus server can use them.
Note that Kresus needs the latest stable version of Weboob, which is 1.1 at
this point of time. Although Kresus also works with version 1.0, it is **not**
recommended to run it with this version because bank modules might be outdated.
this point. Although Kresus would also work with the 1.0 version, it won't let
you run this version, because bank modules might be outdated and not updated
anymore, and as a result synchronization with your bank website would not work.
This can be done with the following command, under Debian based systems:
......
......@@ -82,6 +82,15 @@ export default class WeboobParameters extends React.Component {
<div className="panel-body">
<form>
<div className="form-group clearfix">
<label htmlFor="updateWeboob" className="col-xs-4 control-label">
{ $t('client.settings.weboob_version') }
</label>
<label className="col-xs-8 text-info">
{ store.getSetting('weboob-version') }
</label>
</div>
<BoolSetting
label={ $t('client.settings.weboob_enable_debug') }
setting="weboob-enable-debug"
......
......@@ -250,7 +250,11 @@ store.getBoolSetting = function(key) {
};
store.isWeboobInstalled = function() {
return store.getBoolSetting('weboob-installed');
if (!store.getBoolSetting('weboob-installed'))
return false;
let version = store.getSetting('weboob-version');
return version !== '?' && version !== '1.0';
};
/*
......
......@@ -11,6 +11,7 @@ export let SOURCE_NAME = 'weboob';
// Possible commands include:
// - test: test whether weboob is accessible from the current kresus user.
// - version: get weboob's version number.
// - update: updates weboob modules.
// All the four following commands require $bank $login $password $customFields:
// - accounts
......@@ -102,6 +103,15 @@ export async function testInstall() {
}
}
export async function getVersion() {
try {
return await callWeboob('version');
} catch (err) {
log.error(`When getting Weboob version: ${err}`);
return '?';
}
}
// FIXME The import of Config is deferred because Config imports this file for
// testInstall.
let Config = null;
......
import * as americano from 'cozydb';
import { makeLogger, promisify, promisifyModel, KError } from '../helpers';
import { testInstall } from '../lib/sources/weboob';
import { testInstall, getVersion as getWeboobVersion } from '../lib/sources/weboob';
import DefaultSettings from '../shared/default-settings';
......@@ -82,6 +82,12 @@ Config.all = async function() {
value: (await testInstall()).toString()
});
// Add a pair for Weboob's version.
values.push({
name: 'weboob-version',
value: (await getWeboobVersion()).toString()
});
// Add a pair for the locale
values.push({
name: 'locale',
......
......@@ -48,9 +48,13 @@ class Connector(object):
Technically, connectors are weboob backend wrappers.
'''
@staticmethod
def version():
return Weboob.VERSION
@staticmethod
def versionIs10():
return Weboob.VERSION == "1.0"
return Connector.version() == "1.0"
@staticmethod
def weboob():
......@@ -204,6 +208,12 @@ if __name__ == '__main__':
print >> sys.stderr, "Exception when updating weboob: %s" % unicode(e)
sys.exit(1)
if command == 'version':
obj = {}
obj['values'] = Connector.version()
print json.dumps(obj, ensure_ascii=False).encode('utf-8')
sys.exit(0)
if command not in ['accounts', 'transactions', 'debug-accounts', 'debug-transactions']:
print >> sys.stderr, "Unknown command '%s'." % command
sys.exit(1)
......
......@@ -4,6 +4,7 @@ DefaultSettings.set('locale', 'en');
DefaultSettings.set('weboob-auto-update', 'true');
DefaultSettings.set('weboob-auto-merge-accounts', 'true');
DefaultSettings.set('weboob-installed', 'false');
DefaultSettings.set('weboob-version', '?');
DefaultSettings.set('weboob-enable-debug', 'false');
DefaultSettings.set('duplicateThreshold', '24');
DefaultSettings.set('defaultChartType', 'all');
......
......@@ -162,6 +162,7 @@ module.exports = {
weboob_auto_update: 'Automatically update Weboob modules',
weboob_auto_merge_accounts: 'Automatically merge Weboob accounts',
weboob_enable_debug: 'Enable Weboob debug logging',
weboob_version: "Weboob's version",
update_weboob: 'Update weboob',
go_update_weboob: 'Fire the update!',
......@@ -289,8 +290,8 @@ module.exports = {
},
weboobinstallreadme: {
title: 'Please install Weboob',
content: `In order to work as expected, Kresus has a single dependency called Weboob. If you are hosted by CozyCloud, this should be already installed for you and this is an error; please let the CozyCloud administrators know about this. If you are self-hosted, you'll need to install Weboob as described in the README file: `
title: 'Please install Weboob 1.1 or later',
content: `In order to work as expected, Kresus has a single dependency called Weboob. To offer you the best experience, the latest stable version of Weboob has to be installed (1.1 or later, at this point). If you are hosted by CozyCloud, this should be already installed for you and this is an error; please let the CozyCloud administrators know about this by sending an email to contact@cozycloud.cc. If you are self-hosted, you'll need to install Weboob as described in the README file: `
},
datepicker: {
......
......@@ -162,6 +162,7 @@ module.exports = {
weboob_auto_update: 'Mettre à jour Weboob automatiquement',
weboob_auto_merge_accounts: 'Fusionner automatiquement les comptes Weboob',
weboob_enable_debug: 'Activer le journal de debogue de Weboob',
weboob_version: 'Version de Weboob',
update_weboob: 'Mettre Weboob à jour',
go_update_weboob: 'Lancer la mise à jour',
......@@ -289,8 +290,8 @@ module.exports = {
},
weboobinstallreadme: {
title: 'Il vous manque Weboob',
content: `Afin de fonctionner, Kresus a besoin d'une dépendance unique, Weboob. Si vous êtes hébergés par CozyCloud, cela devrait déjà avoir été installé pour vous et c'est une erreur ; merci de contacter un administrateur de CozyCloud pour leur en faire part. Si vous êtes auto-hébergés, vous devriez installer Weboob manuellement, comme indiqué dans le fichier lisezmoi : `
title: 'Il vous manque Weboob en version 1.1 ou supérieure',
content: `Afin de fonctionner, Kresus a besoin d'une dépendance unique, Weboob. Pour vous offrir la meilleure expérience possible, il est nécessaire que Weboob soit installé en version stable ou expérimentale (1.1 à ce jour). Si vous êtes hébergés par CozyCloud, cela devrait déjà avoir été installé pour vous et c'est une erreur ; merci de contacter un administrateur de CozyCloud pour leur en faire part sur contact@cozycloud.cc. Si vous êtes auto-hébergés, vous devriez installer Weboob manuellement, comme indiqué dans le fichier lisezmoi : `
},
datepicker: {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment