diff options
author | Antoine A <> | 2024-04-02 22:50:07 +0200 |
---|---|---|
committer | Antoine A <> | 2024-04-02 22:50:07 +0200 |
commit | 534f2e58e4e46a4689bb6af5291452344c44b9fd (patch) | |
tree | beda900db731419d1b91310d86d66e95d9ffd964 | |
parent | 79bd4982f5a1608e422988f85e48b7c262610342 (diff) | |
download | deployment-534f2e58e4e46a4689bb6af5291452344c44b9fd.tar.gz deployment-534f2e58e4e46a4689bb6af5291452344c44b9fd.tar.bz2 deployment-534f2e58e4e46a4689bb6af5291452344c44b9fd.zip |
region set display-hint
-rwxr-xr-x | regional-currency/config.py | 24 | ||||
-rwxr-xr-x | regional-currency/setup-exchange.sh | 8 |
2 files changed, 15 insertions, 17 deletions
diff --git a/regional-currency/config.py b/regional-currency/config.py index d00ff51..a4bdf3d 100755 --- a/regional-currency/config.py +++ b/regional-currency/config.py @@ -7,9 +7,10 @@ import re import subprocess import urllib.parse import uuid -import argon2 from base64 import b64decode, b64encode from typing import Callable, Dict, TypeVar + +import argon2 from Crypto.Cipher import ChaCha20_Poly1305 from Crypto.Hash import SHA512 from Crypto.Protocol.KDF import PBKDF2 @@ -42,10 +43,7 @@ def load_conf() -> Dict[str, str]: conf = load_conf() -result_conf = { - **conf, - "CONFIG_LOADED": "y" -} +result_conf = {**conf, "CONFIG_LOADED": "y"} def add_conf(name: str, value: str): @@ -55,7 +53,7 @@ def add_conf(name: str, value: str): content = "" for key, value in conf.items(): escaped = value.replace("'", "\\'") - content += f'{key}=\'{escaped}\'\n' + content += f"{key}='{escaped}'\n" with open(CONFIG_FILE, "w") as f: f.write(content) @@ -360,16 +358,20 @@ if do_conversion: "3.1. Enter the name of the fiat currency (e.g. 'CHF'): ", "CHF", ) + ask_str( + "FIAT_BANK_NAME", + "3.2. Enter the name of your fiat bank (e.g. POSTFINANCE AG): ", + ) iban = ask_iban( "FIAT_ACCOUNT_IBAN", - "3.2. Enter the IBAN of your fiat bank account (e.g. 'CH7789144474425692816'): ", + "3.3. Enter the IBAN of your fiat bank account (e.g. 'CH7789144474425692816'): ", ) bic = ask_bic( "FIAT_ACCOUNT_BIC", - "3.3. Enter the BIC of your fiat bank account (e.g. 'POFICHBEXXX'): ", + "3.4. Enter the BIC of your fiat bank account (e.g. 'POFICHBEXXX'): ", ) name = ask_str( - "FIAT_ACCOUNT_NAME", "3.4. Enter the legal name of your fiat bank account: " + "FIAT_ACCOUNT_NAME", "3.5. Enter the legal name of your fiat bank account: " ) params = urllib.parse.urlencode({"receiver-name": name}) add_conf("CONVERSION_PAYTO", f"payto://iban/{bic}/{iban}?{params}") @@ -470,7 +472,7 @@ if ask_yes_no( content = "" for key, value in result_conf.items(): - escaped = value.replace('\'', '\\\'') - content += f'export {key}=\'{escaped}\'\n' + escaped = value.replace("'", "\\'") + content += f"export {key}='{escaped}'\n" with os.fdopen(3, "w") as f: f.write(content) diff --git a/regional-currency/setup-exchange.sh b/regional-currency/setup-exchange.sh index 7f19537..c14adfc 100755 --- a/regional-currency/setup-exchange.sh +++ b/regional-currency/setup-exchange.sh @@ -206,7 +206,6 @@ curl -sS --max-time 30 \ if test ${DO_OFFLINE} == y; then say "Offline interaction..." - sudo -i -u taler-exchange-offline \ taler-exchange-offline \ -c /etc/taler/taler.conf \ @@ -215,11 +214,10 @@ if test ${DO_OFFLINE} == y; then upload &>> setup.log say "Exchange account setup..." - sudo -i -u taler-exchange-offline \ taler-exchange-offline \ enable-account "${EXCHANGE_PAYTO}" \ - display-hint 0 "${CURRENCY} Exchange" \ + display-hint 0 "${CURRENCY} Exchange" \ wire-fee now x-taler-bank "${CURRENCY}":0 "${CURRENCY}":0 \ global-fee now "${CURRENCY}":0 "${CURRENCY}":0 "${CURRENCY}":0 1h 6a 0 \ upload &>> setup.log @@ -230,11 +228,9 @@ if test ${DO_OFFLINE} == y; then if test ${DO_CONVERSION} == y; then say "Conversion account setup (restricted to CH-only)..." - - # FIXME: add 'display-hint 10 "${CURRENCY}"' for 0.10.x! sudo -i -u taler-exchange-offline taler-exchange-offline \ enable-account "${CONVERSION_PAYTO}" \ - display-hint 10 "POSTFINANCE AG" \ + display-hint 10 "${FIAT_BANK_NAME}" \ conversion-url "${PROTO}://bank.$DOMAIN_NAME/conversion-info/" \ debit-restriction deny \ wire-fee now iban "${CURRENCY}":0 "${CURRENCY}":0 \ |