diff --git a/expedite/bridge/__init__.py b/expedite/bridge/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/expedite/bridge/base.py b/expedite/bridge/base.py
deleted file mode 100644
index 347948d..0000000
--- a/expedite/bridge/base.py
+++ /dev/null
@@ -1,51 +0,0 @@
-"""
-expedite
-Copyright (C) 2024 Akashdeep Dhar
-
-This program is free software: you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see .
-
-Any Red Hat trademarks that are incorporated in the codebase or documentation
-are not subject to the GNU General Public License and may only be utilized or
-replicated with the express permission of Red Hat, Inc.
-"""
-
-
-from PySide6.QtWidgets import QFileDialog
-
-
-def show_location_dialog(parent=None, oper: str = "") -> str:
- dialog = QFileDialog()
- if oper == "dlvr":
- client_path = dialog.getOpenFileName(parent, "Select location", "", "All Files (*)")[0]
- else:
- client_path = dialog.getExistingDirectory(parent, "Select location", "", QFileDialog.ShowDirsOnly)
- return client_path
-
-
-def truncate_text(text: str = "", size: int = 32) -> str:
- if len(text) >= 32:
- return text[0:size-3] + "..."
- else:
- return text
-
-
-def return_detail_text() -> str:
- text = """
- Expedite v{vers}
- A simple encrypted file transfer service for humans
- Expedite is a simple encrypted file transfer service that allows for people to share synchronously assets among each other without having to rely on third party file sharing services (and constantly worrying about how their data might be used) or feeling the need of having publicly visible IP addresses (and constantly worrying about script kiddies attacking your computer).
- Expedite Server can be deployed on a virtual private server having an IP address that is discoverable by the Expedite Client users to broker file contents. The transfers facilitated using WebSockets are end-to-end encrypted with the use of 128-bit Advanced Encryption Standard and the server is restricted to logging only unidentifiable activities to the volatile memory.
- Expedite is currently in BETA phase and if you like to direction the project is heading towards, kindly consider helping me out by starring the project repository, filing issue tickets for software errors or feature requests, contributing to the codebase of the project or sponsoring me to help maintain the servers and to help me keep working on more FOSS projects like these.
- """
- return text
diff --git a/expedite/client/bridge/__init__.py b/expedite/client/bridge/__init__.py
new file mode 100644
index 0000000..b6ebd36
--- /dev/null
+++ b/expedite/client/bridge/__init__.py
@@ -0,0 +1,21 @@
+"""
+expedite
+Copyright (C) 2024 Akashdeep Dhar
+
+This program is free software: you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation, either version 3 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+You should have received a copy of the GNU General Public License along with
+this program. If not, see .
+
+Any Red Hat trademarks that are incorporated in the codebase or documentation
+are not subject to the GNU General Public License and may only be utilized or
+replicated with the express permission of Red Hat, Inc.
+"""
diff --git a/expedite/bridge/data.py b/expedite/client/bridge/data.py
similarity index 100%
rename from expedite/bridge/data.py
rename to expedite/client/bridge/data.py
diff --git a/expedite/bridge/main.py b/expedite/client/bridge/main.py
similarity index 93%
rename from expedite/bridge/main.py
rename to expedite/client/bridge/main.py
index af4b936..685ed26 100644
--- a/expedite/bridge/main.py
+++ b/expedite/client/bridge/main.py
@@ -27,8 +27,8 @@
from PySide6.QtGui import QFontDatabase
from PySide6.QtWidgets import QApplication
-from expedite.bridge import data # noqa
-from expedite.bridge.room import MainWindow
+from expedite.client.bridge import data # noqa
+from expedite.client.bridge.room import MainWindow
def load_custom_font():
diff --git a/expedite/bridge/room.py b/expedite/client/bridge/room.py
similarity index 97%
rename from expedite/bridge/room.py
rename to expedite/client/bridge/room.py
index a1ca0da..11a6bc3 100644
--- a/expedite/bridge/room.py
+++ b/expedite/client/bridge/room.py
@@ -23,7 +23,7 @@
import time
from asyncio import ensure_future, get_event_loop, new_event_loop, set_event_loop
-from json import dumps, loads
+from json import loads
from os.path import basename, getsize
from pathlib import Path
from uuid import uuid4
@@ -34,10 +34,14 @@
from websockets.exceptions import ConnectionClosed, InvalidURI
from expedite import __versdata__
-from expedite.bridge.base import return_detail_text, show_location_dialog, truncate_text
-from expedite.bridge.util import ValidateFields
-from expedite.bridge.wind import Ui_mainwind
from expedite.client.base import bite_file, ease_size, find_size, fuse_file
+from expedite.client.bridge.util import (
+ ValidateFields,
+ return_detail_text,
+ show_location_dialog,
+ truncate_text,
+)
+from expedite.client.bridge.wind import Ui_mainwind
from expedite.client.conn import (
collect_confirmation,
collect_connection_from_pairness,
@@ -54,9 +58,11 @@
deliver_dropping_summon,
deliver_metadata,
deliver_separation_from_mistaken_password,
+ deliver_suspension_from_expiry,
)
+from expedite.client.meet import talk
from expedite.config import standard
-from expedite.view import general, warning
+from expedite.view import warning
class MainWindow(QMainWindow, Ui_mainwind):
@@ -181,6 +187,7 @@ def initialize_connection(self):
standard.client_host = self.sockaddr.text()
standard.client_progress = True
self.statarea.showMessage("Please wait while the client connects to the broker")
+ talk()
ensure_future(self.maintain_connection())
def normal_both_side(self):
@@ -205,7 +212,7 @@ def show_dialog(self, icon, head, text):
async def maintain_connection(self):
try:
async with connect(standard.client_host) as self.sock:
- get_event_loop().call_later(standard.client_time, lambda: ensure_future(self.suspension_from_expiry()))
+ get_event_loop().call_later(standard.client_time, lambda: ensure_future(self.deliver_suspension_from_expiry_bridge()))
await deliver_connection_to_server(self.sock)
async for mesgcont in self.sock:
if isinstance(mesgcont, str):
@@ -333,10 +340,9 @@ async def show_collect_contents(self, pack):
self.progbarg.setValue(progress)
self.progbarg.setValue(100)
- async def suspension_from_expiry(self):
+ async def deliver_suspension_from_expiry_bridge(self):
if not standard.client_pair:
- general("Attempting to abandon from the network after expiry.")
- await self.sock.send(dumps({"call": "rest"}))
+ await deliver_suspension_from_expiry(self.sock)
await self.sock.close()
warning(standard.client_note["rest"])
self.show_dialog(QMessageBox.Warning, standard.client_note["rest"], standard.client_text["rest"])
diff --git a/expedite/bridge/util.py b/expedite/client/bridge/util.py
similarity index 62%
rename from expedite/bridge/util.py
rename to expedite/client/bridge/util.py
index 5d4dd03..08155ea 100644
--- a/expedite/bridge/util.py
+++ b/expedite/client/bridge/util.py
@@ -23,6 +23,35 @@
from os.path import exists
+from PySide6.QtWidgets import QFileDialog
+
+
+def show_location_dialog(parent=None, oper: str = "") -> str:
+ dialog = QFileDialog()
+ if oper == "dlvr":
+ client_path = dialog.getOpenFileName(parent, "Select location", "", "All Files (*)")[0]
+ else:
+ client_path = dialog.getExistingDirectory(parent, "Select location", "", QFileDialog.ShowDirsOnly)
+ return client_path
+
+
+def truncate_text(text: str = "", size: int = 32) -> str:
+ if len(text) >= 32:
+ return text[0:size-3] + "..."
+ else:
+ return text
+
+
+def return_detail_text() -> str:
+ text = """
+ Expedite v{vers}
+ A simple encrypted file transfer service for humans
+ Expedite is a simple encrypted file transfer service that allows for people to share synchronously assets among each other without having to rely on third party file sharing services (and constantly worrying about how their data might be used) or feeling the need of having publicly visible IP addresses (and constantly worrying about script kiddies attacking your computer).
+ Expedite Server can be deployed on a virtual private server having an IP address that is discoverable by the Expedite Client users to broker file contents. The transfers facilitated using WebSockets are end-to-end encrypted with the use of 128-bit Advanced Encryption Standard and the server is restricted to logging only unidentifiable activities to the volatile memory.
+ Expedite is currently in BETA phase and if you like to direction the project is heading towards, kindly consider helping me out by starring the project repository, filing issue tickets for software errors or feature requests, contributing to the codebase of the project or sponsoring me to help maintain the servers and to help me keep working on more FOSS projects like these.
+ """
+ return text
+
class ValidateFields:
def __init__(self):
diff --git a/expedite/bridge/wind.py b/expedite/client/bridge/wind.py
similarity index 100%
rename from expedite/bridge/wind.py
rename to expedite/client/bridge/wind.py
diff --git a/expedite/client/conn.py b/expedite/client/conn.py
index e51731c..8a484b2 100644
--- a/expedite/client/conn.py
+++ b/expedite/client/conn.py
@@ -23,19 +23,15 @@
import asyncio
import time
-from datetime import datetime
from hashlib import sha256
from json import dumps
from typing import Generator, Tuple
-from tqdm.asyncio import tqdm
-from tqdm.contrib.logging import logging_redirect_tqdm
from websockets.legacy.client import WebSocketClientProtocol
from expedite.client.auth import decr_metadata, encr_metadata
from expedite.client.base import ease_size, fuse_file, read_file
from expedite.client.excp import PasswordMistaken
-from expedite.client.util import facade_exit
from expedite.config import standard
from expedite.view import general, warning
@@ -57,11 +53,11 @@ async def collect_permission_to_join(iden: str = standard.client_iden) -> bool:
return True
-async def deliver_suspension_from_expiry(sock: WebSocketClientProtocol) -> None | bool:
+async def deliver_suspension_from_expiry(sock: WebSocketClientProtocol) -> bool:
if not standard.client_pair:
general("Attempting to abandon from the network after expiry.")
await sock.send(dumps({"call": "rest"}))
- await facade_exit(sock, False, "rest")
+ return True
else:
return False
@@ -108,17 +104,6 @@ async def deliver_contents(sock: WebSocketClientProtocol) -> Generator[Tuple[byt
yield sha256(bite).hexdigest(), len(bite)
-async def show_deliver_contents(sock: WebSocketClientProtocol) -> bool:
- general(f"Delivering contents for '{standard.client_filename}' ({ease_size(standard.client_filesize)}) to {standard.client_endo}.")
- standard.client_movestrt = time.time()
- with logging_redirect_tqdm():
- with tqdm(total=standard.client_filesize, unit="B", unit_scale=True, unit_divisor=1024, leave=False, initial=0) as prog:
- async for dgst, size in deliver_contents(sock):
- prog.set_description(f"{datetime.now().strftime("[%Y-%m-%d %H:%M:%S]")} SHA256 {dgst}")
- prog.update(size)
- return True
-
-
async def collect_contents(sock: WebSocketClientProtocol) -> Generator[Tuple[bytes, int], None, None]:
for _ in range(standard.client_chks - 1):
mesgcont = await sock.recv()
@@ -128,18 +113,6 @@ async def collect_contents(sock: WebSocketClientProtocol) -> Generator[Tuple[byt
yield sha256(mesgcont).hexdigest(), len(mesgcont) - 16
-async def show_collect_contents(sock: WebSocketClientProtocol, pack: bytes = b"") -> bool:
- general(f"Collecting contents for '{standard.client_filename}' ({ease_size(standard.client_filesize)}) from {standard.client_endo}.")
- standard.client_movestrt = time.time()
- fuse_file(pack)
- with logging_redirect_tqdm():
- with tqdm(total=standard.client_filesize, unit="B", unit_scale=True, unit_divisor=1024, leave=False, initial=len(pack)) as prog:
- async for dgst, size in collect_contents(sock):
- prog.set_description(f"{datetime.now().strftime("[%Y-%m-%d %H:%M:%S]")} SHA256 {dgst}")
- prog.update(size)
- return True
-
-
async def deliver_digest_checks(sock: WebSocketClientProtocol) -> bool:
general("Delivering contents digest for confirmation.")
await sock.send(dumps({"call": "hash", "data": standard.client_hash.hexdigest()}))
diff --git a/expedite/client/prompt/__init__.py b/expedite/client/prompt/__init__.py
new file mode 100644
index 0000000..b6ebd36
--- /dev/null
+++ b/expedite/client/prompt/__init__.py
@@ -0,0 +1,21 @@
+"""
+expedite
+Copyright (C) 2024 Akashdeep Dhar
+
+This program is free software: you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation, either version 3 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+details.
+
+You should have received a copy of the GNU General Public License along with
+this program. If not, see .
+
+Any Red Hat trademarks that are incorporated in the codebase or documentation
+are not subject to the GNU General Public License and may only be utilized or
+replicated with the express permission of Red Hat, Inc.
+"""
diff --git a/expedite/client/main.py b/expedite/client/prompt/main.py
similarity index 97%
rename from expedite/client/main.py
rename to expedite/client/prompt/main.py
index 0983f3f..2225faa 100644
--- a/expedite/client/main.py
+++ b/expedite/client/prompt/main.py
@@ -30,8 +30,8 @@
from expedite import __versdata__
from expedite.client.base import bite_file, find_name, find_size
from expedite.client.meet import talk
-from expedite.client.room import oper
-from expedite.client.util import facade_exit
+from expedite.client.prompt.room import oper
+from expedite.client.prompt.util import facade_exit
from expedite.config import standard
diff --git a/expedite/client/room.py b/expedite/client/prompt/room.py
similarity index 72%
rename from expedite/client/room.py
rename to expedite/client/prompt/room.py
index 56ce786..13f7603 100644
--- a/expedite/client/room.py
+++ b/expedite/client/prompt/room.py
@@ -22,15 +22,22 @@
import sys
+import time
from asyncio import ensure_future, get_event_loop
+from datetime import datetime
from json import loads
+from tqdm.asyncio import tqdm
+from tqdm.contrib.logging import logging_redirect_tqdm
from websockets import connect
from websockets.exceptions import ConnectionClosed
+from websockets.legacy.client import WebSocketClientProtocol
+from expedite.client.base import ease_size, fuse_file
from expedite.client.conn import (
collect_confirmation,
collect_connection_from_pairness,
+ collect_contents,
collect_digest_checks,
collect_dropping_summon,
collect_metadata,
@@ -38,22 +45,21 @@
collect_separation_from_mistaken_password,
deliver_confirmation,
deliver_connection_to_server,
+ deliver_contents,
deliver_digest_checks,
deliver_dropping_summon,
deliver_metadata,
deliver_separation_from_mistaken_password,
- deliver_suspension_from_expiry,
- facade_exit,
- show_collect_contents,
- show_deliver_contents,
)
+from expedite.client.prompt.util import deliver_suspension_from_expiry_prompt, facade_exit
from expedite.config import standard
+from expedite.view import general
async def oper():
try:
async with connect(standard.client_host) as sock:
- get_event_loop().call_later(standard.client_time, lambda: ensure_future(deliver_suspension_from_expiry(sock)))
+ get_event_loop().call_later(standard.client_time, lambda: ensure_future(deliver_suspension_from_expiry_prompt(sock)))
await deliver_connection_to_server(sock)
async for mesgcont in sock:
if isinstance(mesgcont, str):
@@ -104,3 +110,26 @@ async def oper():
except ConnectionClosed:
await facade_exit(sock, False, "dprt")
sys.exit(standard.client_exit)
+
+
+async def show_deliver_contents(sock: WebSocketClientProtocol) -> bool:
+ general(f"Delivering contents for '{standard.client_filename}' ({ease_size(standard.client_filesize)}) to {standard.client_endo}.")
+ standard.client_movestrt = time.time()
+ with logging_redirect_tqdm():
+ with tqdm(total=standard.client_filesize, unit="B", unit_scale=True, unit_divisor=1024, leave=False, initial=0) as prog:
+ async for dgst, size in deliver_contents(sock):
+ prog.set_description(f"{datetime.now().strftime("[%Y-%m-%d %H:%M:%S]")} SHA256 {dgst}")
+ prog.update(size)
+ return True
+
+
+async def show_collect_contents(sock: WebSocketClientProtocol, pack: bytes = b"") -> bool:
+ general(f"Collecting contents for '{standard.client_filename}' ({ease_size(standard.client_filesize)}) from {standard.client_endo}.")
+ standard.client_movestrt = time.time()
+ fuse_file(pack)
+ with logging_redirect_tqdm():
+ with tqdm(total=standard.client_filesize, unit="B", unit_scale=True, unit_divisor=1024, leave=False, initial=len(pack)) as prog:
+ async for dgst, size in collect_contents(sock):
+ prog.set_description(f"{datetime.now().strftime("[%Y-%m-%d %H:%M:%S]")} SHA256 {dgst}")
+ prog.update(size)
+ return True
diff --git a/expedite/client/util.py b/expedite/client/prompt/util.py
similarity index 87%
rename from expedite/client/util.py
rename to expedite/client/prompt/util.py
index 9628431..60aef3d 100644
--- a/expedite/client/util.py
+++ b/expedite/client/prompt/util.py
@@ -25,6 +25,7 @@
from websockets.legacy.client import WebSocketClientProtocol
+from expedite.client.conn import deliver_suspension_from_expiry
from expedite.config import standard
from expedite.view import failure, general, success, warning
@@ -42,3 +43,8 @@ async def facade_exit(sock: WebSocketClientProtocol = None, cond: bool = True, n
failure(f"{plan} fail after {(time.time() - standard.client_strt):.2f} seconds.")
standard.client_exit = 1
general("Exiting.")
+
+
+async def deliver_suspension_from_expiry_prompt(sock: WebSocketClientProtocol):
+ if await deliver_suspension_from_expiry(sock):
+ await facade_exit(sock, False, "rest")
diff --git a/pyproject.toml b/pyproject.toml
index 91277f4..dcee2d8 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -52,5 +52,5 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry.scripts]
ed-server = "expedite.server.main:main"
-ed-client = "expedite.client.main:main"
-ed-bridge = "expedite.bridge.main:main"
+ed-prompt = "expedite.client.prompt.main:main"
+ed-bridge = "expedite.client.bridge.main:main"