diff --git a/airshare/cli.py b/airshare/cli.py index 1002199..809d35b 100644 --- a/airshare/cli.py +++ b/airshare/cli.py @@ -58,6 +58,7 @@ def main(code, port, text, upload, clip_send, clip_receive, file_path, files): if is_file_copyable(content): with open(content, "r") as f: pyperclip.copy(f.read()) + print("File copied to clipboard!") else: print("This file cannot be copied to the clipboard!") else: diff --git a/airshare/sender.py b/airshare/sender.py index b179c11..42c1d21 100644 --- a/airshare/sender.py +++ b/airshare/sender.py @@ -4,7 +4,6 @@ from aiohttp import web import asyncio import humanize -import magic from multiprocessing import Process import os import pkgutil @@ -68,8 +67,7 @@ async def _file_stream_sender(request): file_name = request.app["file_name"] file_size = str(request.app["file_size"]) header = "attachment; filename={}; size={}".format(file_name, file_size) - response.headers["content-type"] = magic.Magic(mime=True) \ - .from_file(file_path) + response.headers["content-type"] = "application/octet-stream" response.headers["content-length"] = str(request.app["file_size"]) response.headers["content-disposition"] = header await response.prepare(request) @@ -203,7 +201,7 @@ def send_server(*, code, text=None, file=None, compress=False, port=80): app["file_path"] = os.path.realpath(content) app["file_name"] = name or app["file_path"].split(os.path.sep)[-1] app["file_size"] = os.stat(app["file_path"]).st_size - file_size = " (" + humanize.naturalsize(app["file_size"]) + ") " + file_size = " (" + humanize.naturalsize(app["file_size"]) + ")" content = app["file_name"] app.router.add_get(path="/", handler=_download_page) app.router.add_get(path="/airshare", handler=_is_airshare_file_sender) @@ -216,7 +214,7 @@ def send_server(*, code, text=None, file=None, compress=False, port=80): if port != 80: url_port = ":" + str(port) ip = socket.inet_ntoa(addresses[0]) + url_port - print("`" + content + "`" + file_size + "available at " + ip + print("`" + content + "`" + file_size + " available at " + ip + " and `http://" + code + ".local" + url_port + "`, press CtrlC" + " to stop sharing...") if platform.system() != "Windows": diff --git a/airshare/static/download.html b/airshare/static/download.html index bfaf9a2..6546c9c 100644 --- a/airshare/static/download.html +++ b/airshare/static/download.html @@ -32,6 +32,7 @@ backface-visibility: hidden; text-decoration: none; color: var(--text); + cursor: pointer; } .rocket-button:before { content: ''; @@ -463,7 +464,7 @@