znote 1.2.8__tar.gz → 1.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {znote-1.2.8/znote.egg-info → znote-1.4.0}/PKG-INFO +2 -1
- {znote-1.2.8 → znote-1.4.0}/README.md +1 -0
- {znote-1.2.8 → znote-1.4.0}/znote/client.py +38 -15
- {znote-1.2.8 → znote-1.4.0}/znote/server.py +44 -6
- {znote-1.2.8 → znote-1.4.0/znote.egg-info}/PKG-INFO +2 -1
- {znote-1.2.8 → znote-1.4.0}/LICENSE +0 -0
- {znote-1.2.8 → znote-1.4.0}/setup.cfg +0 -0
- {znote-1.2.8 → znote-1.4.0}/znote/__init__.py +0 -0
- {znote-1.2.8 → znote-1.4.0}/znote/app/display.p +0 -0
- {znote-1.2.8 → znote-1.4.0}/znote/app/display.py +0 -0
- {znote-1.2.8 → znote-1.4.0}/znote/app/input.py +0 -0
- {znote-1.2.8 → znote-1.4.0}/znote/core/auth.py +0 -0
- {znote-1.2.8 → znote-1.4.0}/znote/core/client/connect.py +0 -0
- {znote-1.2.8 → znote-1.4.0}/znote/core/client/fetch.py +0 -0
- {znote-1.2.8 → znote-1.4.0}/znote/core/client/metafile.py +0 -0
- {znote-1.2.8 → znote-1.4.0}/znote/core/client/settings.py +0 -0
- {znote-1.2.8 → znote-1.4.0}/znote/core/client/token.py +0 -0
- {znote-1.2.8 → znote-1.4.0}/znote/core/config.py +0 -0
- {znote-1.2.8 → znote-1.4.0}/znote/core/editor.py +0 -0
- {znote-1.2.8 → znote-1.4.0}/znote/core/gen.py +0 -0
- {znote-1.2.8 → znote-1.4.0}/znote/core/pack.py +0 -0
- {znote-1.2.8 → znote-1.4.0}/znote/core/server/note.py +0 -0
- {znote-1.2.8 → znote-1.4.0}/znote/core/server/settings.py +0 -0
- {znote-1.2.8 → znote-1.4.0}/znote/core/workspace.py +0 -0
- {znote-1.2.8 → znote-1.4.0}/znote/main.py +0 -0
- {znote-1.2.8 → znote-1.4.0}/znote/model/models.py +0 -0
- {znote-1.2.8 → znote-1.4.0}/znote.egg-info/SOURCES.txt +0 -0
- {znote-1.2.8 → znote-1.4.0}/znote.egg-info/dependency_links.txt +0 -0
- {znote-1.2.8 → znote-1.4.0}/znote.egg-info/entry_points.txt +0 -0
- {znote-1.2.8 → znote-1.4.0}/znote.egg-info/requires.txt +0 -0
- {znote-1.2.8 → znote-1.4.0}/znote.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: znote
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.0
|
|
4
4
|
Summary: Vault de prise de note
|
|
5
5
|
Author:
|
|
6
6
|
License: mit
|
|
@@ -168,6 +168,7 @@ La fonctionnalité de "channel" permet de synchroniser des fichiers entre plus
|
|
|
168
168
|
| `channel <nom> --tree` | Affiche l'arborescence et la liste des fichiers contenus dans le channel. | `znote channel mon-canal --tree` |
|
|
169
169
|
| `publish <channel> <fichier>` | Publie un fichier sur un channel. Si le fichier existe déjà , il est mis à jour. | `znote publish mon-canal ./rapport.pdf` |
|
|
170
170
|
| `publish <channel> --purge` | Supprime les fichiers du channel qui ne sont pas présents dans la publication actuelle. | `znote publish mon-canal --purge` |
|
|
171
|
+
| `unpublish <channel>` | Supprime un channel. | `znote unpublish mon-canal` |
|
|
171
172
|
| `fetch <channel> (<path>)` | Récupère (télécharge) tous les fichiers d'un channel dans le répertoire local. | `znote fetch mon-canal` |
|
|
172
173
|
| `fetch <channel> --force` | Force le téléchargement et l'écrasement des fichiers locaux même s'ils existent déjà . | `znote fetch mon-canal --force` |
|
|
173
174
|
| `fetch <channel> --purge` | Supprime les fichiers locaux qui ne sont pas présent dans le channel. | `znote fetch mon-canal --purge` |
|
|
@@ -138,6 +138,7 @@ La fonctionnalité de "channel" permet de synchroniser des fichiers entre plusie
|
|
|
138
138
|
| `channel <nom> --tree` | Affiche l'arborescence et la liste des fichiers contenus dans le channel. | `znote channel mon-canal --tree` |
|
|
139
139
|
| `publish <channel> <fichier>` | Publie un fichier sur un channel. Si le fichier existe déjà, il est mis à jour. | `znote publish mon-canal ./rapport.pdf` |
|
|
140
140
|
| `publish <channel> --purge` | Supprime les fichiers du channel qui ne sont pas présents dans la publication actuelle. | `znote publish mon-canal --purge` |
|
|
141
|
+
| `unpublish <channel>` | Supprime un channel. | `znote unpublish mon-canal` |
|
|
141
142
|
| `fetch <channel> (<path>)` | Récupère (télécharge) tous les fichiers d'un channel dans le répertoire local. | `znote fetch mon-canal` |
|
|
142
143
|
| `fetch <channel> --force` | Force le téléchargement et l'écrasement des fichiers locaux même s'ils existent déjà. | `znote fetch mon-canal --force` |
|
|
143
144
|
| `fetch <channel> --purge` | Supprime les fichiers locaux qui ne sont pas présent dans le channel. | `znote fetch mon-canal --purge` |
|
|
@@ -44,23 +44,38 @@ class Client():
|
|
|
44
44
|
|
|
45
45
|
#Réception des données
|
|
46
46
|
@impmagic.loader(
|
|
47
|
-
{'module': 'select'}
|
|
47
|
+
{'module': 'select'},
|
|
48
|
+
{'module': 'time'}
|
|
48
49
|
)
|
|
49
50
|
def receive(self):
|
|
50
51
|
data = b""
|
|
51
|
-
while True:
|
|
52
|
-
#Pour éviter les exceptions avec le socket non bloquant
|
|
53
|
-
#ready_to_read, _, _ = select.select([self.connexion], [], [], 1)
|
|
54
|
-
#if ready_to_read:
|
|
55
|
-
chunk = self.connexion.recv(2048)
|
|
56
52
|
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
#Boucle pour récupérer l'ensemble des chunk d'un message
|
|
54
|
+
while True:
|
|
55
|
+
#Pour éviter les exceptions avec le socket non
|
|
56
|
+
#A voir si ça crash pas si on reçoit de gros fichiers
|
|
57
|
+
ready_to_read, _, _ = select.select([self.connexion], [], [], 1)
|
|
58
|
+
if ready_to_read:
|
|
59
|
+
chunk = self.connexion.recv(2048)
|
|
60
|
+
|
|
61
|
+
if len(chunk):
|
|
62
|
+
if not chunk.endswith(b'EOF'):
|
|
63
|
+
data += chunk
|
|
64
|
+
else:
|
|
65
|
+
return data+chunk[:-3]
|
|
66
|
+
else:
|
|
67
|
+
time.sleep(0.2)
|
|
68
|
+
"""
|
|
69
|
+
if chunk:
|
|
70
|
+
print(chunk)
|
|
71
|
+
if chunk and len(chunk)<2048:
|
|
72
|
+
return data+chunk
|
|
59
73
|
|
|
60
|
-
|
|
61
|
-
|
|
74
|
+
if not chunk:
|
|
75
|
+
return data
|
|
62
76
|
|
|
63
|
-
|
|
77
|
+
data += chunk
|
|
78
|
+
"""
|
|
64
79
|
|
|
65
80
|
|
|
66
81
|
@impmagic.loader(
|
|
@@ -93,7 +108,7 @@ class Client():
|
|
|
93
108
|
# Sauvegarde du IV, de la clé symétrique chiffrée et du fichier chiffré
|
|
94
109
|
message_cipher = iv + sym_key_encrypted + ciphertext
|
|
95
110
|
|
|
96
|
-
self.connexion.send(message_cipher)
|
|
111
|
+
self.connexion.send(message_cipher + b'EOF')
|
|
97
112
|
|
|
98
113
|
|
|
99
114
|
#Premier appel avec le serveur
|
|
@@ -112,7 +127,7 @@ class Client():
|
|
|
112
127
|
payload = {'method': 'sendKey', 'content': __main__.settings.PubKey.decode()}
|
|
113
128
|
logs("Envoi de la clé public au serveur", component="client")
|
|
114
129
|
|
|
115
|
-
self.connexion.send(encrypt(json.dumps(payload).encode()))
|
|
130
|
+
self.connexion.send(encrypt(json.dumps(payload).encode()) + b'EOF')
|
|
116
131
|
|
|
117
132
|
try:
|
|
118
133
|
message_recu = self.receive()
|
|
@@ -225,7 +240,6 @@ class Client():
|
|
|
225
240
|
self.well_come = True
|
|
226
241
|
|
|
227
242
|
message = None
|
|
228
|
-
|
|
229
243
|
#if not __main__.settings.pubserv_set:
|
|
230
244
|
#if not __main__.settings.serverhash:
|
|
231
245
|
|
|
@@ -480,6 +494,15 @@ class Client():
|
|
|
480
494
|
if len(parameter)>2:
|
|
481
495
|
command['path'] = parameter[2]
|
|
482
496
|
|
|
497
|
+
elif instruction=="unpublish":
|
|
498
|
+
if len(parameter)>1:
|
|
499
|
+
command = {
|
|
500
|
+
'method': 'channel',
|
|
501
|
+
'action': 'unpublish',
|
|
502
|
+
'channel_name': parameter[1],
|
|
503
|
+
'token': __main__.settings.token
|
|
504
|
+
}
|
|
505
|
+
|
|
483
506
|
elif instruction=="publish":
|
|
484
507
|
channel_name = parameter[1]
|
|
485
508
|
path = parameter[2]
|
|
@@ -662,7 +685,7 @@ class Client():
|
|
|
662
685
|
file_path = message['path']
|
|
663
686
|
else:
|
|
664
687
|
file_path = "."
|
|
665
|
-
|
|
688
|
+
|
|
666
689
|
diff_output = build_diff_tree(file_path, message["tree"])
|
|
667
690
|
print_tree(diff_output)
|
|
668
691
|
|
|
@@ -120,7 +120,7 @@ class ThreadClient(threading.Thread):
|
|
|
120
120
|
message_cipher = iv + sym_key_encrypted + ciphertext
|
|
121
121
|
|
|
122
122
|
try:
|
|
123
|
-
self.connexion.send(message_cipher)
|
|
123
|
+
self.connexion.send(message_cipher + b'EOF')
|
|
124
124
|
except:
|
|
125
125
|
logs(f"[Thread:{self.name}] - Echec de l'envoi", "error")
|
|
126
126
|
self.kill_thread()
|
|
@@ -128,7 +128,8 @@ class ThreadClient(threading.Thread):
|
|
|
128
128
|
|
|
129
129
|
#Réception des données
|
|
130
130
|
@impmagic.loader(
|
|
131
|
-
{'module': 'select'}
|
|
131
|
+
{'module': 'select'},
|
|
132
|
+
{'module': 'time'}
|
|
132
133
|
)
|
|
133
134
|
def receive(self):
|
|
134
135
|
data = b""
|
|
@@ -141,6 +142,16 @@ class ThreadClient(threading.Thread):
|
|
|
141
142
|
if ready_to_read:
|
|
142
143
|
chunk = self.connexion.recv(2048)
|
|
143
144
|
|
|
145
|
+
if len(chunk):
|
|
146
|
+
if not chunk.endswith(b'EOF'):
|
|
147
|
+
data += chunk
|
|
148
|
+
else:
|
|
149
|
+
return data+chunk[:-3]
|
|
150
|
+
else:
|
|
151
|
+
time.sleep(0.2)
|
|
152
|
+
"""
|
|
153
|
+
if chunk:
|
|
154
|
+
print(chunk)
|
|
144
155
|
if chunk and len(chunk)<2048:
|
|
145
156
|
return data+chunk
|
|
146
157
|
|
|
@@ -148,6 +159,7 @@ class ThreadClient(threading.Thread):
|
|
|
148
159
|
return data
|
|
149
160
|
|
|
150
161
|
data += chunk
|
|
162
|
+
"""
|
|
151
163
|
|
|
152
164
|
|
|
153
165
|
#Déchiffrement du message du client
|
|
@@ -230,13 +242,13 @@ class ThreadClient(threading.Thread):
|
|
|
230
242
|
|
|
231
243
|
logs(f"[{self.get_name_user()}] - Clé public reçu")
|
|
232
244
|
payload = {'method': 'sendKey', 'content': __main__.settings.PubKey.decode()}
|
|
233
|
-
self.connexion.send(self.encrypt(json.dumps(payload).encode()))
|
|
245
|
+
self.connexion.send(self.encrypt(json.dumps(payload).encode()) + b'EOF')
|
|
234
246
|
logs(f"[{self.get_name_user()}] - Connecté")
|
|
235
247
|
|
|
236
248
|
else:
|
|
237
249
|
logs(f'[{self.get_name_user()}] - Clé public invalide', 'error')
|
|
238
250
|
self.key=None
|
|
239
|
-
self.connexion.send("00000")
|
|
251
|
+
self.connexion.send("00000" + b'EOF')
|
|
240
252
|
|
|
241
253
|
elif msgClient['method']=="welcome": #Récupération de la clé publique du client grâce au token
|
|
242
254
|
logs(f"[{self.get_name_user()}] - Welcome")
|
|
@@ -266,7 +278,7 @@ class ThreadClient(threading.Thread):
|
|
|
266
278
|
payload = {'method': 'welcome', 'message': 'Bad request', 'status': 0}
|
|
267
279
|
logs(f"[{self.get_name_user()}] - Bad request", "error")
|
|
268
280
|
|
|
269
|
-
self.connexion.send(self.encrypt(json.dumps(payload).encode()))
|
|
281
|
+
self.connexion.send(self.encrypt(json.dumps(payload).encode()) + b'EOF')
|
|
270
282
|
|
|
271
283
|
|
|
272
284
|
elif self.key!=None:
|
|
@@ -709,7 +721,33 @@ class ThreadClient(threading.Thread):
|
|
|
709
721
|
payload = {'method': 'channel', 'action': 'tree', 'list_files': list_files}
|
|
710
722
|
|
|
711
723
|
else:
|
|
712
|
-
payload = {'method': 'notify', 'message': f"channel {message['channel_name']} introuvable", 'status_code': 'error'}
|
|
724
|
+
payload = {'method': 'notify', 'message': f"channel {message['channel_name']} introuvable", 'status_code': 'error'}
|
|
725
|
+
|
|
726
|
+
elif message['action'] == "unpublish":
|
|
727
|
+
if "channel_name" in message:
|
|
728
|
+
channel = __main__.settings.orm.Channel.get(name=message['channel_name'])
|
|
729
|
+
if channel:
|
|
730
|
+
channel_id = channel.id
|
|
731
|
+
|
|
732
|
+
# Supprimer les publications liées
|
|
733
|
+
query = __main__.settings.orm.PubChannel.select(lambda p: p.channel_id == channel_id)
|
|
734
|
+
for pub in query:
|
|
735
|
+
pub.delete()
|
|
736
|
+
|
|
737
|
+
# Supprimer le channel
|
|
738
|
+
channel.delete()
|
|
739
|
+
|
|
740
|
+
pony.commit()
|
|
741
|
+
|
|
742
|
+
logs(f"[{self.get_name_user()}] - channel: {message['channel_name']} supprimé avec ses publications", "success")
|
|
743
|
+
payload = {'method': 'notify', 'message': f"channel {message['channel_name']} supprimé", 'status_code': 'success'}
|
|
744
|
+
else:
|
|
745
|
+
logs(f"[{self.get_name_user()}] - channel: {message['channel_name']} introuvable pour suppression", "error")
|
|
746
|
+
payload = {'method': 'notify', 'message': f"channel {message['channel_name']} introuvable", 'status_code': 'error'}
|
|
747
|
+
else:
|
|
748
|
+
logs(f"[{self.get_name_user()}] - 'channel_name' manquant pour unpublish", "error")
|
|
749
|
+
payload = {'method': 'notify', 'message': "'channel_name' manquant pour unpublish", 'status_code': 'error'}
|
|
750
|
+
|
|
713
751
|
|
|
714
752
|
|
|
715
753
|
else:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: znote
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.0
|
|
4
4
|
Summary: Vault de prise de note
|
|
5
5
|
Author:
|
|
6
6
|
License: mit
|
|
@@ -168,6 +168,7 @@ La fonctionnalité de "channel" permet de synchroniser des fichiers entre plus
|
|
|
168
168
|
| `channel <nom> --tree` | Affiche l'arborescence et la liste des fichiers contenus dans le channel. | `znote channel mon-canal --tree` |
|
|
169
169
|
| `publish <channel> <fichier>` | Publie un fichier sur un channel. Si le fichier existe déjà , il est mis à jour. | `znote publish mon-canal ./rapport.pdf` |
|
|
170
170
|
| `publish <channel> --purge` | Supprime les fichiers du channel qui ne sont pas présents dans la publication actuelle. | `znote publish mon-canal --purge` |
|
|
171
|
+
| `unpublish <channel>` | Supprime un channel. | `znote unpublish mon-canal` |
|
|
171
172
|
| `fetch <channel> (<path>)` | Récupère (télécharge) tous les fichiers d'un channel dans le répertoire local. | `znote fetch mon-canal` |
|
|
172
173
|
| `fetch <channel> --force` | Force le téléchargement et l'écrasement des fichiers locaux même s'ils existent déjà . | `znote fetch mon-canal --force` |
|
|
173
174
|
| `fetch <channel> --purge` | Supprime les fichiers locaux qui ne sont pas présent dans le channel. | `znote fetch mon-canal --purge` |
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|