Skip to content
Snippets Groups Projects
Commit 4ed6262d authored by Caner Candan's avatar Caner Candan
Browse files

+ added simple contacts section which list public keys of gpg ring

parent 5c9bd1bf
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<div class="list-group" style="background-color: #f7f5fa;"> <div class="list-group" style="background-color: #f7f5fa;">
<a id="new" href="{{ url_for('new_wallet') }}" class="list-group-item"><i class="glyphicon glyphicon-plus-sign"></i> New</a> <a id="new" href="{{ url_for('new_wallet') }}" class="list-group-item"><i class="glyphicon glyphicon-plus-sign"></i> New</a>
<a id="list" href="{{ url_for('wallets') }}" class="list-group-item"><i class="glyphicon glyphicon-credit-card"></i> Wallets</a> <a id="list" href="{{ url_for('wallets') }}" class="list-group-item"><i class="glyphicon glyphicon-credit-card"></i> Wallets</a>
<a id="contacts" href="{{ url_for('wallet_contacts') }}" class="list-group-item"><i class="glyphicon glyphicon-user"></i> Contacts</a>
</div> </div>
{% if key -%} {% if key -%}
...@@ -40,6 +41,7 @@ ...@@ -40,6 +41,7 @@
'/': 'list', '/': 'list',
'{{ url_for('new_wallet') }}': 'new', '{{ url_for('new_wallet') }}': 'new',
'{{ url_for('wallets') }}': 'list', '{{ url_for('wallets') }}': 'list',
'{{ url_for('wallet_contacts') }}': 'contacts',
{% if key -%} {% if key -%}
'{{ url_for('wallet_history', pgp_fingerprint=key.fingerprint) }}': 'history', '{{ url_for('wallet_history', pgp_fingerprint=key.fingerprint) }}': 'history',
......
{% extends "wallets/base.html" %}
{% block sub_content %}
<h1><span class="label label-default">Contacts</span></h1>
<div class="list-group">
{% for fp,k in settings.public_keys.items() %}
<a href="#" class="list-group-item {% if k.keyid == settings.keyid %}active{% endif %}">
<h4 class="list-group-item-heading">{{k.uids.0}}</h4>
<p class="list-group-item-text">{{fp}}</p>
</a>
{% endfor %}
</div>
{% endblock %}
...@@ -30,7 +30,6 @@ from flask import\ ...@@ -30,7 +30,6 @@ from flask import\
flash flash
from io import StringIO from io import StringIO
from werkzeug.contrib.cache import SimpleCache from werkzeug.contrib.cache import SimpleCache
from itertools import combinations, chain
logger = logging.getLogger("cli") logger = logging.getLogger("cli")
app = Flask(__name__) app = Flask(__name__)
...@@ -233,27 +232,6 @@ Comment: ...@@ -233,27 +232,6 @@ Comment:
return False return False
def powerset(iterable):
xs = list(iterable)
return chain.from_iterable( combinations(xs,n) for n in range(len(xs)+1) )
def powerset_bis(iterable, low=0, step=1):
xs = list(iterable)
combins = []
sums = []
for n in range(low, len(xs)+1, step):
for c in combinations(xs,n):
__sum = sum(c)
if __sum not in sums:
combins.append(c)
sums.append(__sum)
res = list(zip(sums, combins))
res.sort()
return res
# return sums, combins
@app.route('/wallets/<pgp_fingerprint>/transfer', methods=['GET', 'POST']) @app.route('/wallets/<pgp_fingerprint>/transfer', methods=['GET', 'POST'])
def wallet_transfer(pgp_fingerprint): def wallet_transfer(pgp_fingerprint):
balance, __clist = clist(pgp_fingerprint) balance, __clist = clist(pgp_fingerprint)
...@@ -310,6 +288,11 @@ def wallet_public_keys(): ...@@ -310,6 +288,11 @@ def wallet_public_keys():
v['name'] = v['uids'][0] v['name'] = v['uids'][0]
return json.dumps(list(keys.values())) return json.dumps(list(keys.values()))
@app.route('/wallets/contacts')
def wallet_contacts():
return render_template('wallets/contacts.html',
settings=ucoin.settings)
def issue(pgp_fingerprint, amendment, coins, message=''): def issue(pgp_fingerprint, amendment, coins, message=''):
try: try:
last_tx = ucoin.hdc.transactions.sender.Last(pgp_fingerprint).get() last_tx = ucoin.hdc.transactions.sender.Last(pgp_fingerprint).get()
...@@ -379,6 +362,7 @@ Comment: ...@@ -379,6 +362,7 @@ Comment:
def compute_dividend_remainders(pgp_fingerprint): def compute_dividend_remainders(pgp_fingerprint):
remainders = {} remainders = {}
for am in ucoin.hdc.amendments.List().get(): for am in ucoin.hdc.amendments.List().get():
if not am['dividend']: continue
if not am['dividend']: continue if not am['dividend']: continue
dividend_sum = 0 dividend_sum = 0
for x in ucoin.hdc.transactions.sender.issuance.Dividend(pgp_fingerprint, am['number']).get(): for x in ucoin.hdc.transactions.sender.issuance.Dividend(pgp_fingerprint, am['number']).get():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment