znote 1.2.7__tar.gz → 1.3.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.
Files changed (31) hide show
  1. {znote-1.2.7/znote.egg-info → znote-1.3.0}/PKG-INFO +1 -1
  2. {znote-1.2.7 → znote-1.3.0}/znote/client.py +20 -8
  3. {znote-1.2.7 → znote-1.3.0}/znote/server.py +8 -0
  4. {znote-1.2.7 → znote-1.3.0/znote.egg-info}/PKG-INFO +1 -1
  5. {znote-1.2.7 → znote-1.3.0}/LICENSE +0 -0
  6. {znote-1.2.7 → znote-1.3.0}/README.md +0 -0
  7. {znote-1.2.7 → znote-1.3.0}/setup.cfg +0 -0
  8. {znote-1.2.7 → znote-1.3.0}/znote/__init__.py +0 -0
  9. {znote-1.2.7 → znote-1.3.0}/znote/app/display.p +0 -0
  10. {znote-1.2.7 → znote-1.3.0}/znote/app/display.py +0 -0
  11. {znote-1.2.7 → znote-1.3.0}/znote/app/input.py +0 -0
  12. {znote-1.2.7 → znote-1.3.0}/znote/core/auth.py +0 -0
  13. {znote-1.2.7 → znote-1.3.0}/znote/core/client/connect.py +0 -0
  14. {znote-1.2.7 → znote-1.3.0}/znote/core/client/fetch.py +0 -0
  15. {znote-1.2.7 → znote-1.3.0}/znote/core/client/metafile.py +0 -0
  16. {znote-1.2.7 → znote-1.3.0}/znote/core/client/settings.py +0 -0
  17. {znote-1.2.7 → znote-1.3.0}/znote/core/client/token.py +0 -0
  18. {znote-1.2.7 → znote-1.3.0}/znote/core/config.py +0 -0
  19. {znote-1.2.7 → znote-1.3.0}/znote/core/editor.py +0 -0
  20. {znote-1.2.7 → znote-1.3.0}/znote/core/gen.py +0 -0
  21. {znote-1.2.7 → znote-1.3.0}/znote/core/pack.py +0 -0
  22. {znote-1.2.7 → znote-1.3.0}/znote/core/server/note.py +0 -0
  23. {znote-1.2.7 → znote-1.3.0}/znote/core/server/settings.py +0 -0
  24. {znote-1.2.7 → znote-1.3.0}/znote/core/workspace.py +0 -0
  25. {znote-1.2.7 → znote-1.3.0}/znote/main.py +0 -0
  26. {znote-1.2.7 → znote-1.3.0}/znote/model/models.py +0 -0
  27. {znote-1.2.7 → znote-1.3.0}/znote.egg-info/SOURCES.txt +0 -0
  28. {znote-1.2.7 → znote-1.3.0}/znote.egg-info/dependency_links.txt +0 -0
  29. {znote-1.2.7 → znote-1.3.0}/znote.egg-info/entry_points.txt +0 -0
  30. {znote-1.2.7 → znote-1.3.0}/znote.egg-info/requires.txt +0 -0
  31. {znote-1.2.7 → znote-1.3.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.2.7
3
+ Version: 1.3.0
4
4
  Summary: Vault de prise de note
5
5
  Author:
6
6
  License: mit
@@ -93,7 +93,7 @@ class Client():
93
93
  # Sauvegarde du IV, de la clé symétrique chiffrée et du fichier chiffré
94
94
  message_cipher = iv + sym_key_encrypted + ciphertext
95
95
 
96
- self.connexion.send(message_cipher)
96
+ self.connexion.send(message_cipher + b'EOF')
97
97
 
98
98
 
99
99
  #Premier appel avec le serveur
@@ -112,7 +112,7 @@ class Client():
112
112
  payload = {'method': 'sendKey', 'content': __main__.settings.PubKey.decode()}
113
113
  logs("Envoi de la clé public au serveur", component="client")
114
114
 
115
- self.connexion.send(encrypt(json.dumps(payload).encode()))
115
+ self.connexion.send(encrypt(json.dumps(payload).encode()) + b'EOF')
116
116
 
117
117
  try:
118
118
  message_recu = self.receive()
@@ -187,7 +187,12 @@ class Client():
187
187
  {'module': 'app.display', 'submodule': ['logs', 'notify']},
188
188
  )
189
189
  def publish_file(self, file, expanded_path, channel_name):
190
- logs(f"Envoi de {os.path.relpath(file, expanded_path)}")
190
+ if expanded_path:
191
+ filename = os.path.relpath(file, expanded_path)
192
+ else:
193
+ filename = os.path.basename(file)
194
+
195
+ logs(f"Envoi de {filename}")
191
196
  with open(file, 'rb') as f:
192
197
  content = f.read()
193
198
  content_hash = hashlib.sha256(content).hexdigest()
@@ -196,7 +201,7 @@ class Client():
196
201
  'method': 'channel',
197
202
  'action': 'publish',
198
203
  'channel_name': channel_name,
199
- 'name': os.path.relpath(file, expanded_path),
204
+ 'name': filename,
200
205
  'content': content,
201
206
  'hash': content_hash,
202
207
  'token': __main__.settings.token
@@ -220,7 +225,6 @@ class Client():
220
225
  self.well_come = True
221
226
 
222
227
  message = None
223
-
224
228
  #if not __main__.settings.pubserv_set:
225
229
  #if not __main__.settings.serverhash:
226
230
 
@@ -481,8 +485,16 @@ class Client():
481
485
 
482
486
  expanded_path = os.path.expanduser(path)
483
487
 
484
- files = glob(f"{expanded_path}/**/*", recursive=True)
485
- #files = [os.path.relpath(p, expanded_path) for p in results]
488
+ if not os.path.exists(expanded_path):
489
+ logs("La source n'existe pas", "error")
490
+
491
+ if os.path.isdir(expanded_path):
492
+ files = glob(f"{expanded_path}/**/*", recursive=True)
493
+ #files = [os.path.relpath(p, expanded_path) for p in results]
494
+ else:
495
+ files = [expanded_path]
496
+ expanded_path = None
497
+
486
498
  push_file = []
487
499
 
488
500
  for file in files:
@@ -649,7 +661,7 @@ class Client():
649
661
  file_path = message['path']
650
662
  else:
651
663
  file_path = "."
652
- print(file_path)
664
+
653
665
  diff_output = build_diff_tree(file_path, message["tree"])
654
666
  print_tree(diff_output)
655
667
 
@@ -141,6 +141,13 @@ class ThreadClient(threading.Thread):
141
141
  if ready_to_read:
142
142
  chunk = self.connexion.recv(2048)
143
143
 
144
+ while not chunk.endswith(b'EOF'):
145
+ data += chunk
146
+
147
+ return data+chunk[:-3]
148
+ """
149
+ if chunk:
150
+ print(chunk)
144
151
  if chunk and len(chunk)<2048:
145
152
  return data+chunk
146
153
 
@@ -148,6 +155,7 @@ class ThreadClient(threading.Thread):
148
155
  return data
149
156
 
150
157
  data += chunk
158
+ """
151
159
 
152
160
 
153
161
  #Déchiffrement du message du client
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: znote
3
- Version: 1.2.7
3
+ Version: 1.3.0
4
4
  Summary: Vault de prise de note
5
5
  Author:
6
6
  License: mit
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