Skip to content
Snippets Groups Projects
Commit c0306582 authored by Moul's avatar Moul
Browse files

Merge branch '95_license_cmd' into dev

parents 02dfb9e1 077f5c3e
No related branches found
No related tags found
No related merge requests found
import webbrowser
import urllib import urllib
from sys import exit
from pydoc import pager
from tabulate import tabulate from tabulate import tabulate
from auth import auth_method from auth import auth_method
from tools import get_publickey_from_seed, message_exit, sign_document_from_seed from tools import get_publickey_from_seed, message_exit, sign_document_from_seed
from network_tools import get_current_block, post_request from network_tools import get_current_block, post_request
from license import license_approval
from constants import NO_MATCHING_ID from constants import NO_MATCHING_ID
from wot import is_member, get_pubkey_from_id, get_pubkeys_from_id,\ from wot import is_member, get_pubkey_from_id, get_pubkeys_from_id,\
get_uid_from_pubkey get_uid_from_pubkey
...@@ -55,21 +52,6 @@ def send_certification(ep, cli_args): ...@@ -55,21 +52,6 @@ def send_certification(ep, cli_args):
print("Certification successfully sent.") print("Certification successfully sent.")
def license_approval(currency):
if currency != "g1":
return
language = input("In which language would you like to display Ğ1 license [en/fr]? ")
if (language == "en"):
if not webbrowser.open("https://duniter.org/en/get-g1/"):
pager(open("licence-G1/license/license_g1-en.rst").read())
else:
if not webbrowser.open("https://duniter.org/fr/wiki/licence-g1/"):
pager(open("licence-G1/license/license_g1-fr-FR.rst").read())
if (input("Do you approve Ğ1 license [yes/no]? ") != "yes"):
exit(1)
def certification_confirmation(issuer_id, issuer_pubkey, certified_uid, certified_pubkey): def certification_confirmation(issuer_id, issuer_pubkey, certified_uid, certified_pubkey):
cert = list() cert = list()
cert.append(["Cert", "From", "–>", "To"]) cert.append(["Cert", "From", "–>", "To"])
......
import webbrowser
from pydoc import pager
from sys import exit
def license_approval(currency):
if currency != "g1":
return
display_license()
if (input("Do you approve Ğ1 license [yes/no]? ") != "yes"):
exit(1)
def display_license():
language = input("In which language would you like to display Ğ1 license [en/fr]? ")
if (language == "en"):
if not webbrowser.open("https://duniter.org/en/wiki/g1-license/"):
pager(open("licence-G1/license/license_g1-en.rst").read())
else:
if not webbrowser.open("https://duniter.org/fr/wiki/licence-g1/"):
pager(open("licence-G1/license/license_g1-fr-FR.rst").read())
...@@ -12,6 +12,7 @@ from tools import message_exit ...@@ -12,6 +12,7 @@ from tools import message_exit
from network_tools import check_port, best_node from network_tools import check_port, best_node
from wot import received_sent_certifications, id_pubkey_correspondence from wot import received_sent_certifications, id_pubkey_correspondence
from auth import generate_auth_file from auth import generate_auth_file
from license import display_license
from constants import SILKAJ_VERSION, G1_SYMBOL, GTEST_SYMBOL, G1_DEFAULT_ENDPOINT, G1_TEST_DEFAULT_ENDPOINT from constants import SILKAJ_VERSION, G1_SYMBOL, GTEST_SYMBOL, G1_DEFAULT_ENDPOINT, G1_TEST_DEFAULT_ENDPOINT
...@@ -67,7 +68,9 @@ def usage(): ...@@ -67,7 +68,9 @@ def usage():
\n it could autocomplete the pubkey corresponding to an identity with three or four following characters.\ \n it could autocomplete the pubkey corresponding to an identity with three or four following characters.\
\n \ \n \
\n - wot <pubkey> or <identity>: display received and sent certifications for an account.\ \n - wot <pubkey> or <identity>: display received and sent certifications for an account.\
\n\ \n \
\n - license: display Ğ1 currency license.\
\n \
\nAuthentication:\ \nAuthentication:\
\n for amount, transaction, certification, and generate_auth_file commands\ \n for amount, transaction, certification, and generate_auth_file commands\
\n - Scrypt is the default authentication method with 4096,16,1 as default values\ \n - Scrypt is the default authentication method with 4096,16,1 as default values\
...@@ -80,7 +83,7 @@ def usage(): ...@@ -80,7 +83,7 @@ def usage():
def cli(): def cli():
# ep: endpoint, node's network interface # ep: endpoint, node's network interface
ep, cli_args = dict(), Command() ep, cli_args = dict(), Command()
subcmd = ["about", "info", "diffi", "net", "network", "issuers", "argos", "amount", "tx", "transaction", "cert", "generate_auth_file", "id", "identities", "wot"] subcmd = ["license", "about", "info", "diffi", "net", "network", "issuers", "argos", "amount", "tx", "transaction", "cert", "generate_auth_file", "id", "identities", "wot"]
if cli_args.is_version_request(): if cli_args.is_version_request():
message_exit(SILKAJ_VERSION) message_exit(SILKAJ_VERSION)
if cli_args.is_help_request() or cli_args.is_usage_request() or cli_args.subcmd not in subcmd: if cli_args.is_help_request() or cli_args.is_usage_request() or cli_args.subcmd not in subcmd:
...@@ -136,6 +139,9 @@ def manage_cmd(ep, c): ...@@ -136,6 +139,9 @@ def manage_cmd(ep, c):
elif cli_args.subcmd == "wot": elif cli_args.subcmd == "wot":
received_sent_certifications(ep, cli_args.subsubcmd) received_sent_certifications(ep, cli_args.subsubcmd)
elif cli_args.subcmd == "license":
display_license()
def about(): def about():
print("\ print("\
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment