Fixed .gitignore, added css, and a README.md
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
/venv
|
/venv
|
||||||
|
assets/*
|
||||||
|
|||||||
151
README.md
Normal file
151
README.md
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
# iPhone-Linux Transfer Service
|
||||||
|
|
||||||
|
A web-based application for transferring files and links between iPhone and Linux devices with a secure and user-friendly interface.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
- **Upload and manage links and files:** Upload HTML links, images, and other files from your device.
|
||||||
|
- **Secure authentication:** User login with salted and hashed password storage for enhanced security.
|
||||||
|
- **Automatic lockout:** Users are locked out after multiple unsuccessful login attempts.
|
||||||
|
- **Device identification:** Uploaders are identified by device type and IP address.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Table of Contents
|
||||||
|
1. [Installation](#installation)
|
||||||
|
2. [Usage](#usage)
|
||||||
|
3. [Database Reset](#database-reset)
|
||||||
|
4. [Security](#security)
|
||||||
|
5. [Dependencies](#dependencies)
|
||||||
|
6. [Known Issues](#known-issues)
|
||||||
|
7. [Contributing](#contributing)
|
||||||
|
8. [License](#license)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
- Python 3.x
|
||||||
|
- `pip` (Python package installer)
|
||||||
|
- `venv` module for creating virtual environments
|
||||||
|
- Required binaries: `flask`, `sqlite3`, `curl`, `openssl`
|
||||||
|
|
||||||
|
### Automated Installation
|
||||||
|
1. Clone this repository:
|
||||||
|
git clone https://github.com/kleinpanic/iphone-linux-transfer.git
|
||||||
|
cd iphone-linux-transfer
|
||||||
|
|
||||||
|
2. Run the installation script:
|
||||||
|
./install.sh
|
||||||
|
This script will:
|
||||||
|
- Check for the `venv` module and attempt installation if missing
|
||||||
|
- Check for required binaries and prompt you to install any that are missing
|
||||||
|
- Set up a virtual environment and install all Python dependencies
|
||||||
|
|
||||||
|
### Manual Installation
|
||||||
|
If you'd prefer to install everything manually, follow these steps:
|
||||||
|
|
||||||
|
1. Install Python 3.x and `venv`.
|
||||||
|
2. Create a virtual environment:
|
||||||
|
python3 -m venv venv
|
||||||
|
3. Activate the virtual environment:
|
||||||
|
- **Linux/Mac:** `source venv/bin/activate`
|
||||||
|
|
||||||
|
4. Install the required Python packages:
|
||||||
|
pip install -r requirements.txt
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
1. **Activate the virtual environment**:
|
||||||
|
- **Linux/Mac:** `source venv/bin/activate`
|
||||||
|
|
||||||
|
2. **Start the application**:
|
||||||
|
python app.py
|
||||||
|
The application will run on `https://127.0.0.1:5000` by default.
|
||||||
|
|
||||||
|
3. **Access the application**:
|
||||||
|
- Open your browser and go to `https://127.0.0.1:5000`.
|
||||||
|
|
||||||
|
### Available Features
|
||||||
|
- **Uploading:** Upload links, images, and other files.
|
||||||
|
- **Downloading:** Download uploaded content.
|
||||||
|
- **Renaming:** Rename uploaded files.
|
||||||
|
- **Preview:** Preview uploaded images directly from the app.
|
||||||
|
- **Delete:** Delete uploaded content.
|
||||||
|
- Curl: compable with curl ideally.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Database Reset
|
||||||
|
|
||||||
|
To start fresh with a new database setup, you can use the reset script provided:
|
||||||
|
|
||||||
|
1. Ensure your virtual environment is activated:
|
||||||
|
source venv/bin/activate
|
||||||
|
2. Run the reset script:
|
||||||
|
python reset_db.py
|
||||||
|
This will:
|
||||||
|
- Remove all existing entries from the database
|
||||||
|
- Reinitialize the tables for users and uploads
|
||||||
|
|
||||||
|
**Note**: Use this command with caution as it will remove all existing data.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Security
|
||||||
|
|
||||||
|
- Passwords are salted and hashed before being stored.
|
||||||
|
- After 3 unsuccessful login attempts, users are locked out, and their IP address is recorded in `locked_ips.txt`.
|
||||||
|
- To unlock a user, manually remove their IP from `locked_ips.txt`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
This project requires the following:
|
||||||
|
- **Python Packages** (specified in `requirements.txt`)
|
||||||
|
- `Flask`
|
||||||
|
- `Werkzeug`
|
||||||
|
- Other packages as needed by your project
|
||||||
|
- **System Binaries**
|
||||||
|
- `flask`
|
||||||
|
- `sqlite3`
|
||||||
|
- `curl`
|
||||||
|
- `openssl`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Known Issues
|
||||||
|
|
||||||
|
- The application is currently set up for development use. It is not secure for deployment in a production environment.
|
||||||
|
- Make sure you properly configure your firewall and network settings when using this application on a publicly accessible server.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Contributions are welcome! Please follow these steps to contribute:
|
||||||
|
|
||||||
|
1. **Fork the repository** on GitHub.
|
||||||
|
2. **Clone your fork**:
|
||||||
|
git clone https://github.com/yourusername/iphone-linux-transfer.git
|
||||||
|
3. **Create a new branch** for your feature or bug fix:
|
||||||
|
git checkout -b feature-name
|
||||||
|
4. **Make your changes**, commit them, and push to your fork:
|
||||||
|
git add .
|
||||||
|
git commit -m "Description of your changes"
|
||||||
|
git push origin feature-name
|
||||||
|
5. Open a **Pull Request** on the main repository.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This project is licensed under the MIT License. Do whatever the fuck you want with it.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Support
|
||||||
|
|
||||||
|
For any issues or suggestions, please open an issue on the GitHub repository or contact me directly.
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 92 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.1 MiB |
Binary file not shown.
Binary file not shown.
@@ -1,3 +0,0 @@
|
|||||||
https://chatgpt.com/c/66fc4ce7-44c4-8011-936a-35d53ae12af2
|
|
||||||
https://chatgpt.com/c/66fc4ce7-44c4-8011-936a-35d53ae12af2
|
|
||||||
Collin: https://10.0.0.235:5000/
|
|
||||||
77
install.sh
Executable file
77
install.sh
Executable file
@@ -0,0 +1,77 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Check for venv installation
|
||||||
|
check_venv() {
|
||||||
|
if ! command -v python3 -m venv &> /dev/null; then
|
||||||
|
echo "Python venv is not installed. Attempting to install it..."
|
||||||
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
|
# Linux
|
||||||
|
if command -v apt-get &> /dev/null; then
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install python3-venv -y
|
||||||
|
elif command -v yum &> /dev/null; then
|
||||||
|
sudo yum install python3-venv -y
|
||||||
|
else
|
||||||
|
echo "Unsupported Linux package manager. Please install Python venv manually."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
# MacOS
|
||||||
|
brew install python3
|
||||||
|
elif [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]]; then
|
||||||
|
# Windows
|
||||||
|
echo "Please install Python and add it to your PATH manually."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "Unsupported operating system. Please install Python venv manually."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Python venv is already installed."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check for required binaries
|
||||||
|
check_binaries() {
|
||||||
|
DEPENDENCIES=("flask" "sqlite3" "curl" "openssl")
|
||||||
|
|
||||||
|
echo "Checking for required dependencies..."
|
||||||
|
for dep in "${DEPENDENCIES[@]}"; do
|
||||||
|
if ! command -v $dep &> /dev/null; then
|
||||||
|
echo "$dep is not installed. Please install it."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "$dep is installed."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create virtual environment and install requirements
|
||||||
|
setup_venv() {
|
||||||
|
echo "Setting up virtual environment..."
|
||||||
|
python3 -m venv venv
|
||||||
|
|
||||||
|
echo "Activating virtual environment..."
|
||||||
|
source venv/bin/activate
|
||||||
|
|
||||||
|
if [[ ! -f "requirements.txt" ]]; then
|
||||||
|
echo "requirements.txt not found!"
|
||||||
|
deactivate
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Installing dependencies from requirements.txt..."
|
||||||
|
pip install --upgrade pip
|
||||||
|
pip install -r requirements.txt
|
||||||
|
echo "All dependencies installed."
|
||||||
|
|
||||||
|
deactivate
|
||||||
|
}
|
||||||
|
|
||||||
|
# Run the checks and setup
|
||||||
|
check_venv
|
||||||
|
check_binaries
|
||||||
|
setup_venv
|
||||||
|
|
||||||
|
echo "Installation completed successfully."
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@ from zipfile import ZipFile
|
|||||||
from preview import generate_preview # Import the preview module
|
from preview import generate_preview # Import the preview module
|
||||||
from rename import rename_file # Import the rename module
|
from rename import rename_file # Import the rename module
|
||||||
|
|
||||||
app = Flask(__name__, template_folder='../templates')
|
app = Flask(__name__, template_folder='../templates', static_folder='../static')
|
||||||
app.secret_key = os.urandom(24)
|
app.secret_key = os.urandom(24)
|
||||||
talisman = Talisman(app, content_security_policy={
|
talisman = Talisman(app, content_security_policy={
|
||||||
'default-src': ["'self'"],
|
'default-src': ["'self'"],
|
||||||
|
|||||||
61
static/login.css
Normal file
61
static/login.css
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
/* Centering the login container */
|
||||||
|
body {
|
||||||
|
background-color: #f0f0f0; /* Light grey background for the whole page */
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 100vh;
|
||||||
|
margin: 0;
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Styling the container that holds the login form */
|
||||||
|
.login-container {
|
||||||
|
background-color: #fff; /* White background for the login form */
|
||||||
|
padding: 30px;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Add a shadow effect */
|
||||||
|
width: 300px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Styling the title */
|
||||||
|
.login-container h1 {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
font-size: 24px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Styling input fields */
|
||||||
|
.login-container input[type="text"],
|
||||||
|
.login-container input[type="password"] {
|
||||||
|
width: 100%; /* Full width of container */
|
||||||
|
padding: 10px;
|
||||||
|
margin: 10px 0;
|
||||||
|
border: 1px solid #ccc; /* Light grey border */
|
||||||
|
border-radius: 4px; /* Rounded corners */
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Styling the login button */
|
||||||
|
.login-container button {
|
||||||
|
background-color: #4CAF50; /* Green background */
|
||||||
|
color: white;
|
||||||
|
padding: 10px;
|
||||||
|
width: 100%;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-container button:hover {
|
||||||
|
background-color: #45a049; /* Darker green on hover */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Responsive design: ensure the form looks good on smaller screens */
|
||||||
|
@media (max-width: 400px) {
|
||||||
|
.login-container {
|
||||||
|
width: 90%; /* Make container smaller on narrow screens */
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,17 +5,20 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Login</title>
|
<title>Login</title>
|
||||||
|
<link rel="stylesheet" href="{{ url_for('static', filename='login.css') }}">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Login</h1>
|
<div class="login-container">
|
||||||
<form method="POST" action="/login">
|
<h1>Login</h1>
|
||||||
<label for="username">Username:</label>
|
<form method="POST" action="/login">
|
||||||
<input type="text" id="username" name="username" required>
|
<label for="username">Username:</label>
|
||||||
<br><br>
|
<input type="text" id="username" name="username" required>
|
||||||
<label for="password">Password:</label>
|
<br><br>
|
||||||
<input type="password" id="password" name="password" required>
|
<label for="password">Password:</label>
|
||||||
<br><br>
|
<input type="password" id="password" name="password" required>
|
||||||
<button type="submit">Login</button>
|
<br><br>
|
||||||
</form>
|
<button type="submit">Login</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
21
templates/login.html.bak
Normal file
21
templates/login.html.bak
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<!-- templates/login.html -->
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Login</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Login</h1>
|
||||||
|
<form method="POST" action="/login">
|
||||||
|
<label for="username">Username:</label>
|
||||||
|
<input type="text" id="username" name="username" required>
|
||||||
|
<br><br>
|
||||||
|
<label for="password">Password:</label>
|
||||||
|
<input type="password" id="password" name="password" required>
|
||||||
|
<br><br>
|
||||||
|
<button type="submit">Login</button>
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user