From 5ad1622bb62ba198ed3edc412b361e5bca84a568 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 7 Aug 2021 19:07:08 +0100 Subject: [PATCH] Set default currency --- epicyon.py | 8 ++++++++ webapp_create_post.py | 11 +++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/epicyon.py b/epicyon.py index f43915d0c..47eae2b10 100644 --- a/epicyon.py +++ b/epicyon.py @@ -119,6 +119,9 @@ parser.add_argument('--libretranslateApiKey', dest='libretranslateApiKey', type=str, default=None, help='API key for LibreTranslate service') +parser.add_argument('--defaultCurrency', dest='defaultCurrency', type=str, + default="EUR", + help='Default currency EUR/GBP/USD...') parser.add_argument('-n', '--nickname', dest='nickname', type=str, default=None, help='Nickname of the account to use') @@ -2696,6 +2699,11 @@ if args.registration: setConfigParam(baseDir, 'registration', 'closed') print('New registrations closed') +if args.defaultCurrency: + if args.defaultCurrency == args.defaultCurrency.upper(): + setConfigParam(baseDir, 'defaultCurrency', args.defaultCurrency) + print('Default currency set to ' + args.defaultCurrency) + if __name__ == "__main__": runDaemon(args.maxLikeCount, sharedItemsFederatedDomains, diff --git a/webapp_create_post.py b/webapp_create_post.py index 69f454713..4f00e810b 100644 --- a/webapp_create_post.py +++ b/webapp_create_post.py @@ -399,9 +399,16 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, for symbol, currName in currencies.items(): currencyList.append(currName + ' ' + symbol) currencyList.sort() + defaultCurrency = getConfigParam(baseDir, 'defaultCurrency') + if not defaultCurrency: + defaultCurrency = "EUR" for currName in currencyList: - extraFields += ' \n' + if defaultCurrency not in currName: + extraFields += ' \n' + else: + extraFields += ' \n' extraFields += ' \n' extraFields += '\n'