From bfc2559893d43da1de6fb16fbb01ea074dd3fd92 Mon Sep 17 00:00:00 2001
From: vtexier <vit@free.fr>
Date: Mon, 17 Feb 2020 11:26:47 +0100
Subject: [PATCH] [fix] fix update_licence.sh

Fix license english variables and filenames
Remove dependency to pandoc software
Add md-to-html module to python dev dependencies
---
 requirements_dev.txt                         |   5 +-
 src/sakia/constants.py                       |   4 +-
 src/sakia/g1_licence.html                    |  60 -------
 src/sakia/g1_license.html                    | 164 +++++++++++++++++++
 src/sakia/gui/dialogs/connection_cfg/view.py |   4 +-
 src/sakia/gui/sub/certification/view.py      |   4 +-
 update_licence.sh                            |   7 -
 update_license.sh                            |   7 +
 8 files changed, 180 insertions(+), 75 deletions(-)
 delete mode 100644 src/sakia/g1_licence.html
 create mode 100644 src/sakia/g1_license.html
 delete mode 100755 update_licence.sh
 create mode 100755 update_license.sh

diff --git a/requirements_dev.txt b/requirements_dev.txt
index 60d2ef0c..cea6b28f 100644
--- a/requirements_dev.txt
+++ b/requirements_dev.txt
@@ -2,5 +2,6 @@ black==19.10b0
 duniter-mirage==0.1.15
 mypy==0.761
 pylint==2.4.4
-pytest==5.3.2
-pytest-asyncio==0.10.0
\ No newline at end of file
+pytest==5.3.5
+pytest-asyncio==0.10.0
+md-to-html
\ No newline at end of file
diff --git a/src/sakia/constants.py b/src/sakia/constants.py
index c3e5a92d..28c73bb8 100644
--- a/src/sakia/constants.py
+++ b/src/sakia/constants.py
@@ -9,6 +9,6 @@ with open(
     ROOT_SERVERS = yaml.load(stream, Loader=yaml.FullLoader)
 
 with open(
-    os.path.join(os.path.dirname(__file__), "g1_licence.html"), "r", encoding="utf-8"
+    os.path.join(os.path.dirname(__file__), "g1_license.html"), "r", encoding="utf-8"
 ) as stream:
-    G1_LICENCE = stream.read()
+    G1_LICENSE = stream.read()
diff --git a/src/sakia/g1_licence.html b/src/sakia/g1_licence.html
deleted file mode 100644
index 209a7383..00000000
--- a/src/sakia/g1_licence.html
+++ /dev/null
@@ -1,60 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-  <meta http-equiv="Content-Style-Type" content="text/css" />
-  <meta name="generator" content="pandoc" />
-  <title></title>
-  <style type="text/css">code{white-space: pre;}</style>
-</head>
-<body>
-<h1 id="license-ÄŸ1---v0.2.3">License Äž1 - v0.2.3</h1>
-<p><strong>Money licensing and liability commitment.</strong></p>
-<p>Any certification operation of a new member of Äž1 must first be accompanied by the transmission of this license of the currency Äž1 whose certifier must ensure that it has been studied, understood and accepted by the person who will be certified.</p>
-<h2 id="money-ÄŸ1">Money Äž1</h2>
-<p>Äž1 occurs via a Universal Dividend (DU) for any human member, which is of the form:</p>
-<ul>
-<li>1 DU per person per day</li>
-</ul>
-<p>The amount of DU is identical each day until the next equinox, where the DU will then be reevaluated according to the formula:</p>
-<ul>
-<li>DU <sub>day</sub> (the following equinox) = DU <day>(equinox) + c² (M / N) (equinox) / (15778800 seconds)</day></li>
-</ul>
-<p>With as parameters:</p>
-<ul>
-<li>c = 4.88% / equinox</li>
-<li>UD (0) = 10.00 Äž1</li>
-</ul>
-<p>And as variables:</p>
-<ul>
-<li><em>M</em> the total monetary mass at the equinox</li>
-<li><em>N</em> the number of members at the equinox</li>
-</ul>
-<h2 id="web-of-trust-ÄŸ1-wot-ÄŸ1">Web of Trust Äž1 (WoT Äž1)</h2>
-<p><strong>Warning:</strong> Certifying is not just about making sure you've met the person, it's ensuring that the community Äž1 knows the certified person well enough and Duplicate account made by a person certified by you, or other types of problems (disappearance ...), by cross-checking that will reveal the problem if necessary.</p>
-<p>When you are a member of Äž1 and you are about to certify a new account:</p>
-<p><strong>You are assured:</strong></p>
-<p>1°) The person who declares to manage this public key (new account) and to have personally checked with him that this is the public key is sufficiently well known (not only to know this person visually) that you are about to certify.</p>
-<p>2a°) To meet her physically to make sure that it is this person you know who manages this public key.</p>
-<p>2b°) Remotely verify the public person / key link by contacting the person via several different means of communication, such as social network + forum + mail + video conference + phone (acknowledge voice).</p>
-<p>Because if you can hack an email account or a forum account, it will be much harder to imagine hacking four distinct means of communication, and mimic the appearance (video) as well as the voice of the person .</p>
-<p>However, the 2 °) is preferable to 3 °, whereas the 1 °) is always indispensable in all cases.</p>
-<p>3 °) To have verified with the person concerned that he has indeed generated his Duniter account revocation document, which will enable him, if necessary, to cancel his account (in case of account theft, ID, an incorrectly created account, etc.).</p>
-<p><strong>Abbreviated WoT rules:</strong></p>
-<p>Each member has a stock of 100 possible certifications, which can only be issued at the rate of 1 certification / 5 days.</p>
-<p>Valid for 2 months, certification for a new member is definitively adopted only if the certified has at least 4 other certifications after these 2 months, otherwise the entry process will have to be relaunched.</p>
-<p>To become a new member of WoT Äž1 therefore 5 certifications must be obtained at a distance&gt; 5 of 80% of the WoT sentinels.</p>
-<p>A member of the TdC Äž1 is sentinel when he has received and issued at least Y [N] certifications where N is the number of members of the TdC and Y [N] = ceiling N ^ (1/5). Examples:</p>
-<ul>
-<li>For 1024 &lt; N ≤ 3125 we have Y [N] = 5</li>
-<li>For 7776 &lt; N ≤ 16807 we have Y [N] = 7</li>
-<li>For 59049 &lt; N ≤ 100 000 we have Y [N] = 10</li>
-</ul>
-<p>Once the new member is part of the WoT Äž1 his certifications remain valid for 2 years.</p>
-<p>To remain a member, you must renew your agreement regularly with your private key (every 12 months) and make sure you have at least 5 certifications valid after 2 years.</p>
-<h2 id="software-ÄŸ1-and-license-ÄŸ1">Software Äž1 and license Äž1</h2>
-<p>The software Äž1 allowing users to manage their use of Äž1 must transmit this license with the software and all the technical parameters of the currency Äž1 and TdC Äž1 which are entered in block 0 of Äž1.</p>
-<p>For more details in the technical details it is possible to consult directly the code of Duniter which is a free software and also the data of the blockchain Äž1 by retrieving it via a Duniter instance or node Äž1.</p>
-<p>More information on the Duniter Team website <a href="https://www.duniter.org" class="uri">https://www.duniter.org</a></p>
-</body>
-</html>
diff --git a/src/sakia/g1_license.html b/src/sakia/g1_license.html
new file mode 100644
index 00000000..10b951c5
--- /dev/null
+++ b/src/sakia/g1_license.html
@@ -0,0 +1,164 @@
+<!DOCTYPE html>
+<!--Converted via md-to-html-->
+<html>
+ <head>
+ </head>
+ <body>
+  <p>
+   License Äž1 - v0.2.5
+  </p>
+  <p>
+   ===================
+  </p>
+  <p>
+   <strong>
+    Money licensing and liability commitment.
+   </strong>
+  </p>
+  <p>
+   Any certification operation of a new member of Äž1 must first be accompanied by the transmission of this license of the currency Äž1 whose certifier must ensure that it has been studied, understood and accepted by the person who will be certified.
+  </p>
+  <p>
+   Money Äž1
+  </p>
+  <hr/>
+  <p>
+   Äž1 occurs via a Universal Dividend (DU) for any human member, which is of the form:
+  </p>
+  <ul>
+   <li>
+    1 DU per person per day
+   </li>
+  </ul>
+  <p>
+   The amount of DU is identical each day until the next equinox, where the DU will then be reevaluated according to the formula:
+  </p>
+  <ul>
+   <li>
+    DU &lt;sub&gt;day&lt;/sub&gt; (the following equinox) = DU &lt;day&gt;(equinox) + c² (M / N) (equinox) / (15778800 seconds)&lt;/day&gt;
+   </li>
+  </ul>
+  <p>
+   With as parameters:
+  </p>
+  <ul>
+   <li>
+    c = 4.88% / equinox
+   </li>
+  </ul>
+  <ul>
+   <li>
+    UD (0) = 10.00 Äž1
+   </li>
+  </ul>
+  <p>
+   And as variables:
+  </p>
+  <ul>
+   <li>
+    <em>
+     M
+    </em>
+    the total monetary mass at the equinox
+   </li>
+  </ul>
+  <ul>
+   <li>
+    <em>
+     N
+    </em>
+    the number of members at the equinox
+   </li>
+  </ul>
+  <p>
+   Web of Trust Äž1 (WoT Äž1)
+  </p>
+  <hr/>
+  <p>
+   <strong>
+    Warning:
+   </strong>
+   Certifying is not just about making sure you've met the person, it's ensuring that the community Äž1 knows the certified person well enough and Duplicate account made by a person certified by you, or other types of problems (disappearance ...), by cross-checking that will reveal the problem if necessary.
+  </p>
+  <p>
+   When you are a member of Äž1 and you are about to certify a new account:
+  </p>
+  <p>
+   <strong>
+    You are assured:
+   </strong>
+  </p>
+  <p>
+   1°) The person who declares to manage this public key (new account) and to have personally checked with him that this is the public key is sufficiently well known (not only to know this person visually) that you are about to certify.
+  </p>
+  <p>
+   2a°) To meet her physically to make sure that it is this person you know who manages this public key.
+  </p>
+  <p>
+   2b°) Remotely verify the public person / key link by contacting the person via several different means of communication, such as social network + forum + mail + video conference + phone (acknowledge voice).
+  </p>
+  <p>
+   Because if you can hack an email account or a forum account, it will be much harder to imagine hacking four distinct means of communication, and mimic the appearance (video) as well as the voice of the person .
+  </p>
+  <p>
+   However, the 2 °) is preferable to 3 °, whereas the 1 °) is always indispensable in all cases.
+  </p>
+  <p>
+   3 °) To have verified with the person concerned that he has indeed generated his Duniter account revocation document, which will enable him, if necessary, to cancel his account (in case of account theft, ID, an incorrectly created account, etc.).
+  </p>
+  <p>
+   <strong>
+    Abbreviated WoT rules:
+   </strong>
+  </p>
+  <p>
+   Each member has a stock of 100 possible certifications, which can only be issued at the rate of 1 certification / 5 days.
+  </p>
+  <p>
+   Valid for 2 months, certification for a new member is definitively adopted only if the certified has at least 4 other certifications after these 2 months, otherwise the entry process will have to be relaunched.
+  </p>
+  <p>
+   To become a new member of WoT Äž1 therefore 5 certifications must be obtained at a distance &lt; 5 of 80% of the WoT sentinels.
+  </p>
+  <p>
+   A member of the TdC Äž1 is sentinel when he has received and issued at least Y [N] certifications where N is the number of members of the TdC and Y [N] = ceiling N ^ (1/5). Examples:
+  </p>
+  <ul>
+   <li>
+    For 1024 &lt; N ≤ 3125 we have Y [N] = 5
+   </li>
+  </ul>
+  <ul>
+   <li>
+    For 7776 &lt; N ≤ 16807 we have Y [N] = 7
+   </li>
+  </ul>
+  <ul>
+   <li>
+    For 59049 &lt; N ≤ 100 000 we have Y [N] = 10
+   </li>
+  </ul>
+  <p>
+   Once the new member is part of the WoT Äž1 his certifications remain valid for 2 years.
+  </p>
+  <p>
+   To remain a member, you must renew your agreement regularly with your private key (every 12 months) and make sure you have at least 5 certifications valid after 2 years.
+  </p>
+  <p>
+   Software Äž1 and license Äž1
+  </p>
+  <hr/>
+  <p>
+   The software Äž1 allowing users to manage their use of Äž1 must transmit this license with the software and all the technical parameters of the currency Äž1 and TdC Äž1 which are entered in block 0 of Äž1.
+  </p>
+  <p>
+   For more details in the technical details it is possible to consult directly the code of Duniter which is a free software and also the data of the blockchain Äž1 by retrieving it via a Duniter instance or node Äž1.
+  </p>
+  <p>
+   More information on the Duniter Team website
+   <a href="https://www.duniter.org">
+    https://www.duniter.org
+   </a>
+  </p>
+ </body>
+</html>
\ No newline at end of file
diff --git a/src/sakia/gui/dialogs/connection_cfg/view.py b/src/sakia/gui/dialogs/connection_cfg/view.py
index 182786aa..396a2f80 100644
--- a/src/sakia/gui/dialogs/connection_cfg/view.py
+++ b/src/sakia/gui/dialogs/connection_cfg/view.py
@@ -10,7 +10,7 @@ from sakia.gui.widgets import toast
 from sakia.decorators import asyncify
 from sakia.helpers import timestamp_to_dhms
 from sakia.gui.widgets.dialogs import dialog_async_exec, QAsyncMessageBox
-from sakia.constants import ROOT_SERVERS, G1_LICENCE
+from sakia.constants import ROOT_SERVERS, G1_LICENSE
 
 
 class ConnectionConfigView(QDialog, Ui_ConnectionConfigurationDialog):
@@ -68,7 +68,7 @@ class ConnectionConfigView(QDialog, Ui_ConnectionConfigurationDialog):
         self.spin_p.blockSignals(False)
 
     def set_license(self, currency):
-        license_text = self.tr(G1_LICENCE)
+        license_text = self.tr(G1_LICENSE)
         self.text_license.setText(license_text)
 
     def handle_n_change(self, value):
diff --git a/src/sakia/gui/sub/certification/view.py b/src/sakia/gui/sub/certification/view.py
index 36c6ef25..dcf430e4 100644
--- a/src/sakia/gui/sub/certification/view.py
+++ b/src/sakia/gui/sub/certification/view.py
@@ -3,7 +3,7 @@ from PyQt5.QtCore import QT_TRANSLATE_NOOP, Qt, pyqtSignal
 from .certification_uic import Ui_CertificationWidget
 from sakia.gui.widgets import toast
 from sakia.gui.widgets.dialogs import QAsyncMessageBox
-from sakia.constants import ROOT_SERVERS, G1_LICENCE
+from sakia.constants import ROOT_SERVERS, G1_LICENSE
 from duniterpy.documents import Identity, MalformedDocumentError
 from enum import Enum
 
@@ -84,7 +84,7 @@ class CertificationView(QWidget, Ui_CertificationWidget):
             lambda c: self.stackedWidget.setCurrentIndex(2)
         )
 
-        licence_text = self.tr(G1_LICENCE)
+        licence_text = self.tr(G1_LICENSE)
         self.text_licence.setText(licence_text)
 
     def clear(self):
diff --git a/update_licence.sh b/update_licence.sh
deleted file mode 100755
index 641bb334..00000000
--- a/update_licence.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-wget https://duniter.org/en/files/licence_g1.txt
-sed "s/:date.*//g" -i licence_g1.txt
-sed "s/:modified.*//g" -i licence_g1.txt
-pandoc -s licence_g1.txt -o src/sakia/g1_licence.html
-rm licence_g1.txt
diff --git a/update_license.sh b/update_license.sh
new file mode 100755
index 00000000..55339e84
--- /dev/null
+++ b/update_license.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+wget https://duniter.org/en/files/license_g1.txt
+sed "s/:date.*//g" -i license_g1.txt
+sed "s/:modified.*//g" -i license_g1.txt
+md-to-html -i license_g1.txt -o src/sakia/g1_license.html
+rm license_g1.txt
-- 
GitLab