Skip to content

Commit ead7ce6

Browse files
committed
push refs
1 parent fbf39fe commit ead7ce6

File tree

6 files changed

+413
-228
lines changed

6 files changed

+413
-228
lines changed

README.md

Lines changed: 81 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,81 @@
1-
# FLUX
2-
A GUI File sharing tool based on
3-
- Fast
4-
- Link
5-
- Universal
6-
- eXchange
1+
<div align="center" class="text-center">
2+
<h1>FLUX</h1>
3+
<p><em>Securely transfer files, effortlessly and efficiently.</em></p>
4+
5+
<img alt="last-commit" src="https://img.shields.io/github/last-commit/PythonicBoat/FLUX?style=flat&amp;logo=git&amp;logoColor=white&amp;color=0080ff" class="inline-block mx-1" style="margin: 0px 2px;">
6+
<!-- Version Tag Badge -->
7+
<img alt="version" src="https://img.shields.io/github/v/tag/PythonicBoat/FLUX?style=flat&color=0080ff" class="inline-block mx-1" style="margin: 0px 2px;">
8+
9+
<!-- Visitor Count Badge -->
10+
<img alt="visitors" src="https://visitor-badge.laobi.icu/badge?page_id=PythonicBoat.FLUX&style=flat&color=0080ff" class="inline-block mx-1" style="margin: 0px 2px;">
11+
12+
<p><em>Built with the tools and technologies:</em></p>
13+
<img alt="TOML" src="https://img.shields.io/badge/TOML-9C4121.svg?style=flat&amp;logo=TOML&amp;logoColor=white" class="inline-block mx-1" style="margin: 0px 2px;">
14+
<img alt="Python" src="https://img.shields.io/badge/Python-3776AB.svg?style=flat&amp;logo=Python&amp;logoColor=white" class="inline-block mx-1" style="margin: 0px 2px;">
15+
</div>
16+
17+
## Table of Contents
18+
- [Overview](#flux)
19+
- [Getting Started](#features)
20+
- [Prerequisites](#prerequisites)
21+
- [Installation](#installation)
22+
- [Usage](#usage)
23+
- [Features](#features)
24+
- [Contributing](#contributing)
25+
- [License](#license)
26+
27+
## Overview
28+
FLUX is a powerful and secure file transfer utility tool for developers who prioritize speed and security. It is designed to be fast, lightweight, and easy to use.
29+
30+
<ul class="list-disc pl-4 my-0">
31+
<li class="my-0">🔒 <strong>Secure File Transfers:</strong> Ensures data integrity with encryption and compression during transfers.</li>
32+
<li class="my-0">🖥️ <strong>User-Friendly Interface:</strong> Simplifies file management with real-time progress tracking and intuitive controls.</li>
33+
<li class="my-0">🛠️ <strong>Modular Architecture:</strong> Enhances maintainability and scalability through well-defined components.</li>
34+
<li class="my-0">🌍 <strong>Cross-Platform Compatibility:</strong> Built with Python, ensuring seamless operation across various systems.</li>
35+
<li class="my-0">📜 <strong>Open Source:</strong> Licensed under MIT, fostering collaboration and innovation within the developer community.</li>
36+
</ul>
37+
38+
### Installation
39+
Build FLUX from the source and install dependencies using the following steps:
40+
41+
<ol>
42+
<li class="my-0">
43+
<p><strong>Clone the repository:</strong></p>
44+
<pre><code class="language-sh">❯ git clone https://github.com/PythonicBoat/FLUX
45+
</code></pre>
46+
</li>
47+
<li class="my-0">
48+
<p><strong>Navigate to the project directory:</strong></p>
49+
<pre><code class="language-sh">❯ cd FLUX
50+
</code></pre>
51+
</li>
52+
<li class="my-0">
53+
<p><strong>Install the dependencies:</strong></p>
54+
</li>
55+
</ol>
56+
57+
Using uv:
58+
59+
```bash
60+
❯ uv init
61+
```
62+
63+
```bash
64+
❯ uv install
65+
```
66+
67+
### Usage
68+
To run FLUX, use the following command:
69+
70+
```bash
71+
❯ uv run main.py
72+
```
73+
74+
### Build
75+
To build FLUX, use the following command:
76+
77+
##
78+
uv build
79+
80+
81+
<div align="left" class=""><a href="#top">⬆ Return</a></div>
File renamed without changes.

build.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import PyInstaller.__main__
2+
3+
PyInstaller.__main__.run([
4+
'main.py',
5+
'--onefile',
6+
'--windowed',
7+
'--noconfirm',
8+
'-nFluxUI',
9+
'-iassets/flux.jpg'
10+
])

flux/compression.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,19 @@
77
COMPRESSION_LEVEL = 3 # Moderate compression level
88

99
def compress_file(file_path: str, output_path: Optional[str] = None) -> str:
10-
"""Compress a file using zstandard
10+
"""Compress a file using zstandard if it's larger than 10MB
1111
1212
Args:
1313
file_path: Path to the file to compress
1414
output_path: Optional path for the compressed file
1515
1616
Returns:
17-
Path to the compressed file
17+
Path to the compressed file if size > 10MB, otherwise original file path
1818
"""
19+
# Check if file size is greater than 10MB (10 * 1024 * 1024 bytes)
20+
if os.path.getsize(file_path) <= 10 * 1024 * 1024:
21+
return file_path
22+
1923
if output_path is None:
2024
output_path = f"{file_path}.zst"
2125

@@ -44,11 +48,10 @@ def decompress_file(compressed_path: str, output_path: str) -> str:
4448
dctx = zstd.ZstdDecompressor()
4549
with open(compressed_path, 'rb') as f_in:
4650
with open(output_path, 'wb') as f_out:
47-
decompressor = dctx.stream_writer(f_out)
51+
decompressor = dctx.stream_reader(f_in)
4852
while True:
49-
chunk = f_in.read(BUFFER_SIZE)
53+
chunk = decompressor.read(BUFFER_SIZE)
5054
if not chunk:
5155
break
52-
decompressor.write(chunk)
53-
decompressor.flush()
56+
f_out.write(chunk)
5457
return output_path

flux/core.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,18 @@ def update_receiver_server(self):
5252
"""Update the receiver server with current settings"""
5353
if self.receiver_server:
5454
self.receiver_server.close()
55+
self.receiver_server = None
5556

5657
code = self.ui.transfer_code_field.value.strip()
57-
if code and len(code) == 6: # CODE_LENGTH from network module
58-
self.receiver_server = start_receiver_server(
59-
self.save_directory,
60-
password=self.transfer_password,
61-
transfer_code=code,
62-
progress_callback=self.ui.update_transfer_progress
63-
)
58+
# Only attempt to start receiver when we have a complete code and password
59+
if code and len(code) == 6 and self.transfer_password: # CODE_LENGTH from network module
60+
try:
61+
self.receiver_server = start_receiver_server(
62+
self.save_directory,
63+
password=self.transfer_password,
64+
transfer_code=code,
65+
progress_callback=self.ui.update_transfer_progress
66+
)
67+
except Exception as e:
68+
# Silently handle validation errors during typing
69+
pass

0 commit comments

Comments
 (0)