Initial v1.1 push
This commit is contained in:
14
.gitignore
vendored
Normal file
14
.gitignore
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
uploads/
|
||||
database.db
|
||||
.DS_Store
|
||||
upload*
|
||||
*.db
|
||||
.env
|
||||
wsgi.py
|
||||
|
||||
# Ignore Python cache files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
# Ignore virtual environment directories
|
||||
venv/
|
||||
|
7
README.md
Normal file
7
README.md
Normal file
@ -0,0 +1,7 @@
|
||||
#i2p-drop
|
||||
|
||||
favicon
|
||||
|
||||
test admin login/hash
|
||||
|
||||
pastebin increase width
|
1
announcement.txt
Normal file
1
announcement.txt
Normal file
@ -0,0 +1 @@
|
||||
We are currently in beta, please report any issues to stormycloud@mail.i2p
|
590
app.py
Normal file
590
app.py
Normal file
@ -0,0 +1,590 @@
|
||||
# app.py
|
||||
|
||||
import os
|
||||
import uuid
|
||||
import sqlite3
|
||||
from datetime import datetime, timedelta
|
||||
from io import BytesIO
|
||||
|
||||
from flask import (
|
||||
Flask, render_template, request, redirect, url_for, flash,
|
||||
session, g, abort, send_file, jsonify, Response
|
||||
)
|
||||
from werkzeug.utils import secure_filename
|
||||
from werkzeug.middleware.proxy_fix import ProxyFix
|
||||
from werkzeug.security import generate_password_hash, check_password_hash
|
||||
|
||||
from PIL import Image
|
||||
from pygments import highlight
|
||||
from pygments.lexers import get_lexer_by_name
|
||||
from pygments.formatters import HtmlFormatter
|
||||
from apscheduler.schedulers.background import BackgroundScheduler
|
||||
from cryptography.fernet import Fernet
|
||||
from flask_limiter import Limiter
|
||||
from flask_limiter.util import get_remote_address
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Load environment variables from a .env file
|
||||
load_dotenv()
|
||||
|
||||
app = Flask(__name__)
|
||||
app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_proto=1, x_host=1, x_prefix=1)
|
||||
|
||||
|
||||
app.config['SECRET_KEY'] = os.getenv('SSP_SECRET_KEY')
|
||||
app.config['ADMIN_PASSWORD_HASH'] = os.getenv('SSP_ADMIN_PASSWORD_HASH')
|
||||
app.config['ADMIN_URL'] = os.getenv('SSP_ADMIN_URL')
|
||||
|
||||
enc_key = os.getenv('SSP_ENCRYPTION_KEY')
|
||||
if not enc_key:
|
||||
raise ValueError("FATAL: SSP_ENCRYPTION_KEY is not set in the environment.")
|
||||
app.config['ENCRYPTION_KEY'] = enc_key.encode('utf-8')
|
||||
|
||||
app.config['UPLOAD_FOLDER'] = os.getenv('SSP_UPLOAD_FOLDER', 'uploads')
|
||||
app.config['DATABASE_PATH'] = os.getenv('SSP_DATABASE_PATH', 'database.db')
|
||||
app.config['MAX_CONTENT_LENGTH'] = 10 * 1024 * 1024 # 10MB
|
||||
|
||||
app.config['FLASK_DEBUG'] = os.getenv('SSP_FLASK_DEBUG', 'False').lower() in ('true', '1', 't')
|
||||
|
||||
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif', 'webp', 'bmp', 'ico', 'tiff'}
|
||||
|
||||
# --- Rate Limiting (I2P-aware) ---
|
||||
def i2p_key_func():
|
||||
# Prioritize the I2P destination header for rate limiting
|
||||
b32 = request.headers.get('X-I2P-DestB32')
|
||||
if b32:
|
||||
return b32
|
||||
# Fallback to X-Forwarded-For if behind a standard proxy
|
||||
fwd = request.headers.get('X-Forwarded-For')
|
||||
if fwd:
|
||||
return fwd.split(',')[0].strip()
|
||||
# Final fallback to the direct remote address
|
||||
return get_remote_address()
|
||||
|
||||
limiter = Limiter(
|
||||
app=app,
|
||||
key_func=i2p_key_func,
|
||||
default_limits=["200 per day", "50 per hour"],
|
||||
storage_uri="memory://"
|
||||
)
|
||||
|
||||
fernet = Fernet(app.config['ENCRYPTION_KEY'])
|
||||
|
||||
# --- Expiry Map & Languages ---
|
||||
EXPIRY_MAP = {
|
||||
"15m": timedelta(minutes=15), "1h": timedelta(hours=1), "2h": timedelta(hours=2),
|
||||
"4h": timedelta(hours=4), "8h": timedelta(hours=8), "12h": timedelta(hours=12),
|
||||
"24h": timedelta(hours=24), "48h": timedelta(hours=48)
|
||||
}
|
||||
POPULAR_LANGUAGES = [
|
||||
'bash', 'c', 'cpp', 'csharp', 'css', 'go', 'html', 'java', 'javascript', 'json',
|
||||
'kotlin', 'lua', 'markdown', 'php', 'python', 'ruby', 'rust', 'sql', 'swift',
|
||||
'typescript', 'xml', 'yaml'
|
||||
]
|
||||
|
||||
# --- Database Helpers ---
|
||||
def get_db():
|
||||
if 'db' not in g:
|
||||
g.db = sqlite3.connect(app.config['DATABASE_PATH'])
|
||||
g.db.row_factory = sqlite3.Row
|
||||
return g.db
|
||||
|
||||
def close_db(e=None):
|
||||
db = g.pop('db', None)
|
||||
if db:
|
||||
db.close()
|
||||
|
||||
app.teardown_appcontext(close_db)
|
||||
|
||||
def init_db():
|
||||
with app.app_context():
|
||||
db = get_db()
|
||||
c = db.cursor()
|
||||
c.execute('''
|
||||
CREATE TABLE IF NOT EXISTS pastes (
|
||||
id TEXT PRIMARY KEY,
|
||||
content BLOB NOT NULL,
|
||||
language TEXT NOT NULL,
|
||||
expiry_date DATETIME NOT NULL,
|
||||
password_hash TEXT,
|
||||
view_count INTEGER DEFAULT 0,
|
||||
max_views INTEGER
|
||||
)
|
||||
''')
|
||||
c.execute('''
|
||||
CREATE TABLE IF NOT EXISTS images (
|
||||
id TEXT PRIMARY KEY,
|
||||
upload_date DATETIME NOT NULL,
|
||||
expiry_date DATETIME NOT NULL,
|
||||
password_hash TEXT,
|
||||
view_count INTEGER DEFAULT 0,
|
||||
max_views INTEGER
|
||||
)
|
||||
''')
|
||||
c.execute('CREATE TABLE IF NOT EXISTS stats (stat_key TEXT PRIMARY KEY, stat_value INTEGER NOT NULL)')
|
||||
for stat in ['total_images', 'total_pastes', 'total_api_uploads']:
|
||||
c.execute("INSERT OR IGNORE INTO stats(stat_key,stat_value) VALUES(?,0)", (stat,))
|
||||
db.commit()
|
||||
|
||||
def update_stat(key, inc=1):
|
||||
db = get_db()
|
||||
db.execute("UPDATE stats SET stat_value = stat_value + ? WHERE stat_key = ?", (inc, key))
|
||||
db.commit()
|
||||
|
||||
# --- Cleanup Scheduler ---
|
||||
scheduler = BackgroundScheduler(daemon=True)
|
||||
|
||||
def cleanup_expired_content():
|
||||
with app.app_context():
|
||||
now = datetime.now()
|
||||
conn = sqlite3.connect(app.config['DATABASE_PATH'])
|
||||
cur = conn.cursor()
|
||||
cur.execute("DELETE FROM pastes WHERE expiry_date < ?", (now,))
|
||||
cur.execute("SELECT id FROM images WHERE expiry_date < ?", (now,))
|
||||
for (img_id,) in cur.fetchall():
|
||||
path = os.path.join(app.config['UPLOAD_FOLDER'], img_id)
|
||||
try:
|
||||
os.remove(path)
|
||||
except OSError as e:
|
||||
app.logger.error(f"Error removing expired image file {path}: {e}")
|
||||
cur.execute("DELETE FROM images WHERE id = ?", (img_id,))
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
||||
# --- Utility Functions ---
|
||||
def allowed_file(fn):
|
||||
return '.' in fn and fn.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
|
||||
|
||||
def get_time_left(expiry_str):
|
||||
try:
|
||||
expiry = datetime.fromisoformat(expiry_str)
|
||||
rem = expiry - datetime.now()
|
||||
if rem.total_seconds() <= 0:
|
||||
return "Expired"
|
||||
days = rem.days
|
||||
hrs = rem.seconds // 3600
|
||||
mins = (rem.seconds % 3600) // 60
|
||||
if days > 0:
|
||||
return f"~{days} days {hrs} hours"
|
||||
if hrs > 0:
|
||||
return f"~{hrs} hours {mins} minutes"
|
||||
return f"~{mins} minutes"
|
||||
except (ValueError, TypeError):
|
||||
return "N/A"
|
||||
|
||||
def process_and_encrypt_image(stream, orig_fn, keep_exif=False):
|
||||
try:
|
||||
img = Image.open(stream)
|
||||
if img.mode in ('RGBA', 'P'):
|
||||
img = img.convert('RGB')
|
||||
buf = BytesIO()
|
||||
exif = img.info.get('exif') if keep_exif and 'exif' in img.info else None
|
||||
|
||||
save_params = {'quality': 80}
|
||||
if exif:
|
||||
save_params['exif'] = exif
|
||||
|
||||
img.save(buf, 'WEBP', **save_params)
|
||||
buf.seek(0)
|
||||
encrypted = fernet.encrypt(buf.read())
|
||||
|
||||
new_fn = f"{uuid.uuid4().hex}.webp"
|
||||
path = os.path.join(app.config['UPLOAD_FOLDER'], new_fn)
|
||||
with open(path, 'wb') as f:
|
||||
f.write(encrypted)
|
||||
return new_fn
|
||||
except Exception as e:
|
||||
app.logger.error(f"Image processing failed ({orig_fn}): {e}")
|
||||
return None
|
||||
|
||||
@app.context_processor
|
||||
def inject_announcement():
|
||||
try:
|
||||
with open('announcement.txt', 'r') as f:
|
||||
msg = f.read().strip()
|
||||
if msg:
|
||||
return dict(announcement_enabled=True, announcement_message=msg)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
return dict(announcement_enabled=False, announcement_message='')
|
||||
|
||||
# --- Error Handlers ---
|
||||
@app.errorhandler(404)
|
||||
def not_found(e):
|
||||
flash('Content not found or has expired.', 'error')
|
||||
return redirect(url_for('index'))
|
||||
|
||||
@app.errorhandler(410)
|
||||
def gone(e):
|
||||
flash('Content has expired due to exceeding its view limit.', 'error')
|
||||
return redirect(url_for('index'))
|
||||
|
||||
@app.errorhandler(413)
|
||||
def too_large(e):
|
||||
if request.path.startswith('/api/'):
|
||||
return jsonify(error="File is too large (max 10MB)."), 413
|
||||
flash('File is too large (max 10MB).', 'error')
|
||||
return redirect(url_for('index'))
|
||||
|
||||
@app.errorhandler(429)
|
||||
def rate_limited(e):
|
||||
if request.path.startswith('/api/'):
|
||||
return jsonify(error=f"Rate limit exceeded: {e.description}"), 429
|
||||
flash('Too many requests. Please wait a while.', 'error')
|
||||
return redirect(url_for('index'))
|
||||
|
||||
# --- Health Check ---
|
||||
@app.route('/healthz')
|
||||
def healthz():
|
||||
try:
|
||||
conn = sqlite3.connect(app.config['DATABASE_PATH'])
|
||||
conn.execute("SELECT 1").fetchone()
|
||||
conn.close()
|
||||
db_status = "ok"
|
||||
except Exception as e:
|
||||
app.logger.error(f"Health check DB error: {e}")
|
||||
db_status = "error"
|
||||
sched_status = "running" if scheduler.running and scheduler.state == 1 else "stopped"
|
||||
return jsonify(database=db_status, scheduler=sched_status)
|
||||
|
||||
# --- Web UI Routes ---
|
||||
@app.route('/')
|
||||
def index():
|
||||
db = get_db()
|
||||
rows = db.execute("SELECT stat_key, stat_value FROM stats").fetchall()
|
||||
stats = {r['stat_key']: r['stat_value'] for r in rows}
|
||||
return render_template(
|
||||
'index.html',
|
||||
languages=POPULAR_LANGUAGES,
|
||||
stats=stats,
|
||||
allowed_extensions=list(ALLOWED_EXTENSIONS)
|
||||
)
|
||||
|
||||
@app.route('/donate')
|
||||
def donate_page():
|
||||
return render_template('donate.html')
|
||||
|
||||
if not app.config.get('ADMIN_URL'):
|
||||
raise ValueError("Configuration Error: SSP_ADMIN_URL is not set.")
|
||||
|
||||
@app.route(app.config['ADMIN_URL'], methods=['GET', 'POST'])
|
||||
def admin_dashboard():
|
||||
if request.method == 'POST':
|
||||
pw = request.form.get('password', '')
|
||||
if app.config['ADMIN_PASSWORD_HASH'] and check_password_hash(app.config['ADMIN_PASSWORD_HASH'], pw):
|
||||
session['admin_logged_in'] = True
|
||||
return redirect(url_for('admin_dashboard'))
|
||||
flash('Incorrect password.', 'error')
|
||||
|
||||
if not session.get('admin_logged_in'):
|
||||
return render_template('admin.html', auth_success=False)
|
||||
|
||||
db = get_db()
|
||||
now = datetime.now()
|
||||
imgs = db.execute("SELECT id, expiry_date, view_count, max_views FROM images ORDER BY expiry_date ASC").fetchall()
|
||||
past = db.execute("SELECT id, language, expiry_date, view_count, max_views FROM pastes ORDER BY expiry_date ASC").fetchall()
|
||||
|
||||
images = [(i['id'], i['expiry_date'], get_time_left(i['expiry_date']), i['view_count'], i['max_views']) for i in imgs]
|
||||
pastes = [(p['id'], p['language'], p['expiry_date'], get_time_left(p['expiry_date']), p['view_count'], p['max_views']) for p in past]
|
||||
|
||||
return render_template('admin.html', auth_success=True, images=images, pastes=pastes)
|
||||
|
||||
@app.route('/upload/image', methods=['POST'])
|
||||
@limiter.limit("10 per hour")
|
||||
def upload_image():
|
||||
if 'file' not in request.files or request.files['file'].filename == '':
|
||||
flash('No file selected.', 'error')
|
||||
return redirect(url_for('index', _anchor='image'))
|
||||
|
||||
file = request.files['file']
|
||||
if file and allowed_file(file.filename):
|
||||
keep_exif = bool(request.form.get('keep_exif'))
|
||||
new_fn = process_and_encrypt_image(file.stream, file.filename, keep_exif)
|
||||
if not new_fn:
|
||||
flash('Error processing image.', 'error')
|
||||
return redirect(url_for('index', _anchor='image'))
|
||||
|
||||
now = datetime.now()
|
||||
expiry = now + EXPIRY_MAP.get(request.form.get('expiry', '1h'), timedelta(hours=1))
|
||||
pw = request.form.get('password') or None
|
||||
pw_hash = generate_password_hash(pw, method='pbkdf2:sha256') if pw else None
|
||||
mv = request.form.get('max_views')
|
||||
mv = int(mv) if mv and mv.isdigit() else None
|
||||
|
||||
db = get_db()
|
||||
db.execute(
|
||||
'INSERT INTO images (id, upload_date, expiry_date, password_hash, max_views, view_count) VALUES (?, ?, ?, ?, ?, ?)',
|
||||
(new_fn, now, expiry, pw_hash, mv, -1)
|
||||
)
|
||||
db.commit()
|
||||
update_stat('total_images')
|
||||
|
||||
return redirect(url_for('view_image', filename=new_fn))
|
||||
|
||||
flash('Invalid file type.', 'error')
|
||||
return redirect(url_for('index', _anchor='image'))
|
||||
|
||||
|
||||
@app.route('/upload/paste', methods=['POST'])
|
||||
@limiter.limit("20 per hour")
|
||||
def upload_paste():
|
||||
content = request.form.get('content', '').strip()
|
||||
if not content:
|
||||
flash('Paste content cannot be empty.', 'error')
|
||||
return redirect(url_for('index', _anchor='paste'))
|
||||
|
||||
now = datetime.now()
|
||||
expiry = now + EXPIRY_MAP.get(request.form.get('expiry', '1h'), timedelta(hours=1))
|
||||
pw = request.form.get('password') or None
|
||||
pw_hash = generate_password_hash(pw, method='pbkdf2:sha256') if pw else None
|
||||
mv = request.form.get('max_views')
|
||||
mv = int(mv) if mv and mv.isdigit() else None
|
||||
|
||||
paste_id = uuid.uuid4().hex
|
||||
encrypted = fernet.encrypt(content.encode('utf-8'))
|
||||
db = get_db()
|
||||
db.execute(
|
||||
'INSERT INTO pastes (id, content, language, expiry_date, password_hash, max_views, view_count) VALUES (?, ?, ?, ?, ?, ?, ?)',
|
||||
(paste_id, encrypted, request.form.get('language', 'text'), expiry, pw_hash, mv, -1)
|
||||
)
|
||||
db.commit()
|
||||
update_stat('total_pastes')
|
||||
|
||||
return redirect(url_for('view_paste', paste_id=paste_id))
|
||||
|
||||
|
||||
@app.route('/image/<filename>', methods=['GET', 'POST'])
|
||||
def view_image(filename):
|
||||
db = get_db()
|
||||
row = db.execute("SELECT * FROM images WHERE id = ?", (filename,)).fetchone()
|
||||
|
||||
if not row or datetime.now() > datetime.fromisoformat(row['expiry_date']):
|
||||
if row: # If row exists but is expired, delete it.
|
||||
db.execute("DELETE FROM images WHERE id = ?", (filename,))
|
||||
db.commit()
|
||||
abort(404)
|
||||
|
||||
pw_hash = row['password_hash']
|
||||
if pw_hash and not session.get(f'unlocked_image_{filename}'):
|
||||
if request.method == 'POST':
|
||||
if check_password_hash(pw_hash, request.form.get('password', '')):
|
||||
session[f'unlocked_image_{filename}'] = True
|
||||
return redirect(url_for('view_image', filename=filename))
|
||||
flash('Incorrect password.', 'error')
|
||||
return render_template('view_image.html', password_required=True, filename=filename)
|
||||
|
||||
return render_template('view_image.html',
|
||||
password_required=False,
|
||||
filename=filename,
|
||||
time_left=get_time_left(row['expiry_date'])
|
||||
)
|
||||
|
||||
|
||||
@app.route('/paste/<paste_id>', methods=['GET', 'POST'])
|
||||
def view_paste(paste_id):
|
||||
db = get_db()
|
||||
row = db.execute("SELECT * FROM pastes WHERE id = ?", (paste_id,)).fetchone()
|
||||
|
||||
if not row or datetime.now() > datetime.fromisoformat(row['expiry_date']):
|
||||
if row:
|
||||
db.execute("DELETE FROM pastes WHERE id = ?", (paste_id,))
|
||||
db.commit()
|
||||
abort(404)
|
||||
|
||||
pw_hash = row['password_hash']
|
||||
if pw_hash and not session.get(f'unlocked_paste_{paste_id}'):
|
||||
if request.method == 'POST':
|
||||
if check_password_hash(pw_hash, request.form.get('password', '')):
|
||||
session[f'unlocked_paste_{paste_id}'] = True
|
||||
return redirect(url_for('view_paste', paste_id=paste_id))
|
||||
flash('Incorrect password.', 'error')
|
||||
return render_template('view_paste.html', password_required=True, paste_id=paste_id)
|
||||
|
||||
if row['max_views'] is not None and row['view_count'] >= row['max_views']:
|
||||
db.execute("DELETE FROM pastes WHERE id = ?", (paste_id,))
|
||||
db.commit()
|
||||
abort(410)
|
||||
|
||||
db.execute("UPDATE pastes SET view_count = view_count + 1 WHERE id = ?", (paste_id,))
|
||||
db.commit()
|
||||
|
||||
content = fernet.decrypt(row['content']).decode('utf-8')
|
||||
try:
|
||||
lexer = get_lexer_by_name(row['language'])
|
||||
except:
|
||||
lexer = get_lexer_by_name('text')
|
||||
fmt = HtmlFormatter(style='monokai', cssclass='syntax', linenos='table')
|
||||
highlighted = highlight(content, lexer, fmt)
|
||||
|
||||
return render_template('view_paste.html',
|
||||
password_required=False,
|
||||
paste_id=paste_id,
|
||||
highlighted_content=highlighted,
|
||||
time_left=get_time_left(row['expiry_date'])
|
||||
)
|
||||
|
||||
|
||||
@app.route('/paste/<paste_id>/raw')
|
||||
def paste_raw(paste_id):
|
||||
db = get_db()
|
||||
row = db.execute("SELECT * FROM pastes WHERE id = ?", (paste_id,)).fetchone()
|
||||
|
||||
if not row or datetime.now() > datetime.fromisoformat(row['expiry_date']):
|
||||
abort(404)
|
||||
|
||||
if row['password_hash'] and not session.get(f'unlocked_paste_{paste_id}'):
|
||||
abort(403)
|
||||
|
||||
if row['max_views'] is not None and row['view_count'] >= row['max_views']:
|
||||
db.execute("DELETE FROM pastes WHERE id = ?", (paste_id,))
|
||||
db.commit()
|
||||
abort(410)
|
||||
|
||||
db.execute("UPDATE pastes SET view_count = view_count + 1 WHERE id = ?", (paste_id,))
|
||||
db.commit()
|
||||
|
||||
text = fernet.decrypt(row['content']).decode('utf-8')
|
||||
return Response(text, mimetype='text/plain')
|
||||
|
||||
|
||||
@app.route('/uploads/<filename>')
|
||||
def get_upload(filename):
|
||||
safe_fn = secure_filename(filename)
|
||||
path = os.path.join(app.config['UPLOAD_FOLDER'], safe_fn)
|
||||
db = get_db()
|
||||
|
||||
row = db.execute("SELECT * FROM images WHERE id = ?", (safe_fn,)).fetchone()
|
||||
|
||||
if not row or not os.path.exists(path) or datetime.now() > datetime.fromisoformat(row['expiry_date']):
|
||||
if row:
|
||||
db.execute("DELETE FROM images WHERE id = ?", (safe_fn,))
|
||||
db.commit()
|
||||
if os.path.exists(path): os.remove(path)
|
||||
abort(404)
|
||||
|
||||
if row['password_hash'] and not session.get(f'unlocked_image_{safe_fn}'):
|
||||
abort(403)
|
||||
|
||||
if row['max_views'] is not None and row['view_count'] >= row['max_views']:
|
||||
db.execute("DELETE FROM images WHERE id = ?", (safe_fn,))
|
||||
db.commit()
|
||||
os.remove(path)
|
||||
abort(410)
|
||||
|
||||
db.execute("UPDATE images SET view_count = view_count + 1 WHERE id = ?", (safe_fn,))
|
||||
db.commit()
|
||||
|
||||
try:
|
||||
with open(path, 'rb') as f:
|
||||
encrypted = f.read()
|
||||
data = fernet.decrypt(encrypted)
|
||||
return send_file(BytesIO(data), mimetype='image/webp')
|
||||
except Exception as e:
|
||||
app.logger.error(f"Error serving image {safe_fn}: {e}")
|
||||
abort(500)
|
||||
|
||||
@app.route('/admin/delete/image/<filename>', methods=['POST'])
|
||||
def delete_image(filename):
|
||||
if not session.get('admin_logged_in'): abort(401)
|
||||
safe = secure_filename(filename)
|
||||
path = os.path.join(app.config['UPLOAD_FOLDER'], safe)
|
||||
try:
|
||||
if os.path.exists(path): os.remove(path)
|
||||
db = get_db()
|
||||
db.execute("DELETE FROM images WHERE id = ?", (safe,))
|
||||
db.commit()
|
||||
flash(f'Image "{safe}" has been deleted.', 'success')
|
||||
except Exception as e:
|
||||
flash(f'Error deleting image file: {e}', 'error')
|
||||
return redirect(url_for('admin_dashboard'))
|
||||
|
||||
@app.route('/admin/delete/paste/<paste_id>', methods=['POST'])
|
||||
def delete_paste(paste_id):
|
||||
if not session.get('admin_logged_in'): abort(401)
|
||||
try:
|
||||
db = get_db()
|
||||
db.execute("DELETE FROM pastes WHERE id = ?", (paste_id,))
|
||||
db.commit()
|
||||
flash(f'Paste "{paste_id}" has been deleted.', 'success')
|
||||
except Exception as e:
|
||||
flash(f'Error deleting paste: {e}', 'error')
|
||||
return redirect(url_for('admin_dashboard'))
|
||||
|
||||
# --- API Routes ---
|
||||
@app.route('/api/upload/image', methods=['POST'])
|
||||
@limiter.limit("50 per hour")
|
||||
def api_upload_image():
|
||||
if 'file' not in request.files or request.files['file'].filename == '':
|
||||
return jsonify(error="No file selected"), 400
|
||||
|
||||
file = request.files['file']
|
||||
if file and allowed_file(file.filename):
|
||||
new_fn = process_and_encrypt_image(file.stream, file.filename, bool(request.form.get('keep_exif')))
|
||||
if not new_fn: return jsonify(error="Failed to process image"), 500
|
||||
|
||||
now = datetime.now()
|
||||
expiry = now + EXPIRY_MAP.get(request.form.get('expiry', '1h'), timedelta(hours=1))
|
||||
pw = request.form.get('password')
|
||||
pw_hash = generate_password_hash(pw, method='pbkdf2:sha256') if pw else None
|
||||
mv = request.form.get('max_views')
|
||||
mv = int(mv) if mv and mv.isdigit() else None
|
||||
|
||||
db = get_db()
|
||||
db.execute(
|
||||
'INSERT INTO images (id, upload_date, expiry_date, password_hash, max_views, view_count) VALUES (?, ?, ?, ?, ?, ?)',
|
||||
(new_fn, now, expiry, pw_hash, mv, -1)
|
||||
)
|
||||
db.commit()
|
||||
update_stat('total_api_uploads')
|
||||
return jsonify(success=True, url=url_for('get_upload', filename=new_fn, _external=True)), 200
|
||||
|
||||
return jsonify(error="Invalid file type"), 400
|
||||
|
||||
|
||||
@app.route('/api/upload/paste', methods=['POST'])
|
||||
@limiter.limit("100 per hour")
|
||||
def api_upload_paste():
|
||||
if not request.is_json: return jsonify(error="Request must be JSON"), 400
|
||||
|
||||
data = request.get_json()
|
||||
content = data.get('content', '').strip()
|
||||
if not content: return jsonify(error="Paste content is missing"), 400
|
||||
|
||||
now = datetime.now()
|
||||
expiry = now + EXPIRY_MAP.get(data.get('expiry', '1h'), timedelta(hours=1))
|
||||
pw = data.get('password')
|
||||
pw_hash = generate_password_hash(pw, method='pbkdf2:sha256') if pw else None
|
||||
mv = data.get('max_views')
|
||||
mv = int(mv) if mv and str(mv).isdigit() else None
|
||||
|
||||
paste_id = uuid.uuid4().hex
|
||||
encrypted = fernet.encrypt(content.encode('utf-8'))
|
||||
db = get_db()
|
||||
db.execute(
|
||||
'INSERT INTO pastes (id, content, language, expiry_date, password_hash, max_views, view_count) VALUES (?, ?, ?, ?, ?, ?, ?)',
|
||||
(paste_id, encrypted, data.get('language', 'text'), expiry, pw_hash, mv, -1)
|
||||
)
|
||||
db.commit()
|
||||
update_stat('total_api_uploads')
|
||||
return jsonify(success=True, url=url_for('view_paste', paste_id=paste_id, _external=True)), 200
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
required_vars = ['SSP_SECRET_KEY', 'SSP_ADMIN_PASSWORD_HASH', 'SSP_ADMIN_URL', 'SSP_ENCRYPTION_KEY']
|
||||
missing_vars = [var for var in required_vars if not os.getenv(var)]
|
||||
if missing_vars:
|
||||
print(f"FATAL ERROR: Required environment variables are not set: {', '.join(missing_vars)}")
|
||||
exit(1)
|
||||
|
||||
os.makedirs(app.config['UPLOAD_FOLDER'], exist_ok=True)
|
||||
with app.app_context():
|
||||
init_db()
|
||||
scheduler.add_job(cleanup_expired_content, 'interval', minutes=15)
|
||||
scheduler.start()
|
||||
|
||||
print(f"Starting Flask app with debug mode: {app.config['FLASK_DEBUG']}")
|
||||
|
||||
# Run the app. Debug mode is controlled by the SSP_FLASK_DEBUG environment variable.
|
||||
# For production, it's recommended to use a proper WSGI server like Gunicorn or uWSGI.
|
||||
app.run(debug=app.config['FLASK_DEBUG'], use_reloader=False)
|
||||
|
10
static/css/tailwind.css
Normal file
10
static/css/tailwind.css
Normal file
@ -0,0 +1,10 @@
|
||||
/*
|
||||
! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com
|
||||
*/
|
||||
|
||||
/* 1. Preflight (Tailwind's base styles) */
|
||||
*,::before,::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}::before,::after{--tw-content:''}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}
|
||||
|
||||
/* 2. Utility Classes */
|
||||
*,::before,::after{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / .5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / .5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }
|
||||
.h-6{height:1.5rem}.h-12{height:3rem}.h-20{height:5rem}.h-24{height:6rem}.w-6{width:1.5rem}.w-12{width:3rem}.w-20{width:5rem}.w-24{width:6rem}.w-full{width:100%}.max-w-2xl{max-width:42rem}.max-w-4xl{max-w:56rem}.flex-shrink-0{flex-shrink:0}.mx-auto{margin-left:auto;margin-right:auto}.my-4{margin-top:1rem;margin-bottom:1rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.mt-8{margin-top:2rem}.mt-16{margin-top:4rem}.inline-block{display:inline-block}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.list-disc{list-style-type:disc}.list-inside{list-style-position:inside}.min-h-screen{min-height:100vh}.max-h-60vh{max-height:60vh}.object-contain{object-fit:contain}.justify-center{justify-content:center}.items-center{align-items:center}.gap-8{gap:2rem}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.overflow-x-auto{overflow-x:auto}.overflow-hidden{overflow:hidden}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.25rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-gray-600{--tw-border-opacity:1;border-color:rgb(75 85 99 / var(--tw-border-opacity))}.border-gray-700{--tw-border-opacity:1;border-color:rgb(55 65 81 / var(--tw-border-opacity))}.bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81 / var(--tw-bg-opacity))}.bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-8{padding-top:2rem;padding-bottom:2rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.pt-6{padding-top:1.5rem}.text-center{text-align:center}.font-sans{font-family:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"}.text-xs{font-size:.75rem;line-height:1rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.font-bold{font-weight:700}.font-semibold{font-weight:600}.font-mono{font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace}.text-white{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity))}.text-blue-300{--tw-text-opacity:1;color:rgb(147 197 253 / var(--tw-text-opacity))}.text-blue-400{--tw-text-opacity:1;color:rgb(96 165 250 / var(--tw-text-opacity))}.text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity))}.shadow-lg{--tw-shadow:0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.ring-blue-500{--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246 / var(--tw-ring-opacity))}.hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity))}.hover\:text-blue-300:hover{--tw-text-opacity:1;color:rgb(147 197 253 / var(--tw-text-opacity))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:shadow-outline:focus{box-shadow:0 0 0 3px rgb(96 165 250 / .5);outline:none}.focus\:ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.focus\:ring-blue-500:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246 / var(--tw-ring-opacity))}@media (min-width: 768px){.md\:grid-cols-3{grid-template-columns:repeat(3, minmax(0, 1fr))}}
|
73
static/images/stormycloud.svg
Normal file
73
static/images/stormycloud.svg
Normal file
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 24.3.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg
|
||||
version="1.1"
|
||||
id="Layer_1"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
x="0px" y="0px"
|
||||
viewBox="0 135 1500 636"
|
||||
style="enable-background:new 0 135 1500 636;"
|
||||
xml:space="preserve"
|
||||
>
|
||||
<style type="text/css">
|
||||
.st0{fill:#FFFFFF;}
|
||||
.st1{fill:url(#SVGID_1_);}
|
||||
.st2{fill:url(#SVGID_2_);}
|
||||
.st3{fill:url(#SVGID_3_);}
|
||||
.st4{fill:url(#SVGID_4_);}
|
||||
.st5{fill:url(#SVGID_5_);}
|
||||
.st6{fill:#006BCC;}
|
||||
</style>
|
||||
<g>
|
||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="378.2952" y1="456.0995" x2="378.2952" y2="131.6513">
|
||||
<stop offset="0" style="stop-color:#006FCD"/>
|
||||
<stop offset="1" style="stop-color:#00A9F2"/>
|
||||
</linearGradient>
|
||||
<path class="st1" d="M600.3,324.7c-11.5-34.2-45.1-41.5-45.1-41.5c-13.7-62-73.4-64.4-73.4-64.4c-31.4-91.3-119.5-87.1-119.5-87.1
|
||||
C260.2,135,242.6,223,242.6,223c-92.5,15.4-90.1,94.4-90.1,94.4c3.5,93,81.8,100.3,81.8,100.3h33.5c1,18.1,8.6,27.7,15.9,32.8
|
||||
c5.4,3.8,11.9,5.6,18.5,5.6h162c3.5,0,7-0.3,10.4-1.2c27.6-7.2,26.7-37.2,26.7-37.2h39.4c24.4-3.3,39.5-14.9,48.7-27
|
||||
C604,372,607.9,347.1,600.3,324.7z M489.4,415.4c0,15.4-12.5,27.8-27.8,27.8H304.2c-12.1,0-21.9-9.8-21.9-21.9V228.7
|
||||
c0-15.5,12.6-28.1,28.1-28.1H405c9.8,0,19.2,3.7,26.4,10.4l43.8,40.9c9.1,8.5,14.3,20.4,14.3,32.8V415.4z"/>
|
||||
<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="432.1597" y1="283.199" x2="432.1597" y2="227.7854">
|
||||
<stop offset="0" style="stop-color:#008CE2"/>
|
||||
<stop offset="0.9017" style="stop-color:#0098E8"/>
|
||||
</linearGradient>
|
||||
<path class="st2" d="M414.1,229.4l43.6,40.8c5,4.7,1.7,13.1-5.2,13.1h-39.4c-4.9,0-8.9-4-8.9-8.9v-40.6
|
||||
C404.2,228.5,410.4,225.9,414.1,229.4z"/>
|
||||
<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="380.3181" y1="417.6981" x2="380.3181" y2="294.9461">
|
||||
<stop offset="0" style="stop-color:#006FCE"/>
|
||||
<stop offset="0.9017" style="stop-color:#0082D9"/>
|
||||
</linearGradient>
|
||||
<path class="st3" d="M425.9,376.3L385,415.6c-1.4,1.3-3.2,2.1-5.2,2.1c-2,0-3.9-0.8-5.3-2.2l-39.9-40.1c-1.8-1.8-2.6-4.1-2.6-6.4
|
||||
c0-2.7,1.2-5.4,3.5-7.2c3.7-2.9,8.9-2.5,12.2,0.9l23.6,24.6v-82.7c0-5.3,4.3-9.6,9.6-9.6h0c5.3,0,9.6,4.3,9.6,9.6v80.6l23-22
|
||||
c1.8-1.7,4-2.5,6.3-2.5c2.5,0,5,1,6.8,3C429.6,367.4,429.4,372.9,425.9,376.3z"/>
|
||||
<linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="490.3123" y1="553.3344" x2="490.3123" y2="461.3674">
|
||||
<stop offset="4.469245e-02" style="stop-color:#007BD8"/>
|
||||
<stop offset="1" style="stop-color:#007DD8"/>
|
||||
</linearGradient>
|
||||
<path class="st4" d="M468.5,520.7l34.1-37.2c0.6-0.7,1.4-1.3,2.2-1.8c5.7-3.4,29.9-17.6,39.9-20.4c0,0-50,86.7-108.6,92
|
||||
c0,0,21.3-5,30.6-29.4C467,522.7,467.7,521.6,468.5,520.7z"/>
|
||||
<linearGradient id="SVGID_5_" gradientUnits="userSpaceOnUse" x1="327.0562" y1="771.1231" x2="327.0562" y2="426.3489">
|
||||
<stop offset="0.1117" style="stop-color:#0067C7"/>
|
||||
<stop offset="1" style="stop-color:#0082DA"/>
|
||||
</linearGradient>
|
||||
<path class="st5" d="M40.5,692.5c0,0,89.9,15,139.8,78.6c0,0,22.9-70.8,57.5-100.4c1.5-1.3,2.9-2.6,4.3-3.9
|
||||
c5.8-5.6,27.6-22,79.3-17.5c0,0,121.1,15.3,198.9-60c2.6-2.6,5.4-5.1,8.1-7.5c9.3-8.3,33.6-32.7,54.2-76.2l29.8-61
|
||||
c2.6-5.3,0.8-11.7-4.2-14.9l0,0c-7.5-4.8-17.1-4.6-24.3,0.4c-8.1,5.6-19.1,16.2-32.6,36.3c-1.8,2.7-3.6,5.5-5.2,8.4
|
||||
c-7.3,12.4-35.7,57.5-71.6,76.5c0,0-54.2,34-162.2-0.4H390c0,0,37.9,1.6,54.4-15.1c11-11,6.6-29.5-8.3-33.9
|
||||
c-3-0.9-6.5-1.5-10.7-1.6l-55.7,0.9c-13.6,0.2-27.2-1.8-40-6.4c-2.5-0.9-5-1.9-7.4-3c-5.4-2.5-10.9-4.7-16.6-6.3
|
||||
c-29-8.5-104.6-22.6-157.3,39.4c0,0-22.8,27.8-39.6,75.3C108.8,600.3,85.4,664.8,40.5,692.5z"/>
|
||||
<path class="st6" d="M758.1,315h-90.7v270H737c3.1,0,6.3,0,9.4,0.1c19.9,0.3,139.1-3.4,139.1-141.8
|
||||
C885.5,443.2,890.6,317.9,758.1,315z M827.7,461.1c0,41.1-33.3,74.5-74.5,74.5h-29.3V361.8h29.3c41.1,0,74.5,33.3,74.5,74.5V461.1z"/>
|
||||
<path class="st6" d="M911.9,384.8v198.4h54.3v-98.1c0-11,2.8-21.9,8.6-31.3c8.2-13.3,23.6-26.4,51.6-19.3l8.5-49.7
|
||||
c0,0-44.1-15.5-68.7,29.7v-29.7H911.9z"/>
|
||||
<path class="st6" d="M1152.2,381.1c-8.3-1.3-16.7-1.4-24.9-0.4c-86.2,10.5-87.8,93-87.8,93c-3.4,117.7,94.8,115,94.8,115
|
||||
c101.9-0.6,101.9-96.1,101.9-96.1C1240,405.4,1180.4,385.6,1152.2,381.1z M1137.4,545.1c-24.9,0-45.1-27.2-45.1-60.6
|
||||
c0-33.5,20.2-60.6,45.1-60.6s45.1,27.1,45.1,60.6C1182.5,518,1162.3,545.1,1137.4,545.1z"/>
|
||||
<path class="st6" d="M1441.8,431.3c0,0-12.4-40.5-60.7-49.6c-11.9-2.2-24.2-1.7-35.8,2c-10.5,3.3-23.4,9.6-33.8,21.3l-0.3-20.6
|
||||
l-52.2,0.6l-0.6,262.3h53.5v-83.5c0,0,45.6,50.3,104.7,6.3C1416.5,570.2,1472.8,530.3,1441.8,431.3z M1363.4,543.6
|
||||
c-20.6,3.3-33.6-5.1-41.6-14.8c-7.7-9.3-11.5-21.2-11.5-33.2V470c0-7.3,1.4-14.5,4.3-21.1c12.1-27.1,35.9-25.1,35.9-25.1
|
||||
c43.7-2.7,47.5,48.3,47.5,48.3C1403.6,537.3,1363.4,543.6,1363.4,543.6z"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 4.9 KiB |
150
templates/admin.html
Normal file
150
templates/admin.html
Normal file
@ -0,0 +1,150 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Admin Dashboard - I2P Secure Share</title>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/tailwind.css') }}">
|
||||
<style>
|
||||
body { background-color: #1a202c; color: #cbd5e0; }
|
||||
.content-container { background-color: #2d3748; border: 1px solid #4a5568; }
|
||||
.btn { background-color: #4299e1; transition: background-color 0.3s ease; }
|
||||
.btn:hover { background-color: #3182ce; }
|
||||
.btn-danger { background-color: #e53e3e; }
|
||||
.btn-danger:hover { background-color: #c53030; }
|
||||
input { background-color: #4a5568; border: 1px solid #718096; }
|
||||
table { width: 100%; border-collapse: collapse; }
|
||||
th, td { border: 1px solid #4a5568; padding: 0.75rem; text-align: left; }
|
||||
th { background-color: #1a202c; }
|
||||
tr:nth-child(even) { background-color: #2d3748; }
|
||||
.alert-error { background-color: #e53e3e; }
|
||||
.announcement-bar { background-color: #2563eb; border-bottom: 1px solid #1e3a8a; }
|
||||
</style>
|
||||
</head>
|
||||
<body class="font-sans">
|
||||
|
||||
{% if announcement_enabled and announcement_message %}
|
||||
<div id="announcement-bar" class="announcement-bar text-white text-center p-2 relative shadow-lg">
|
||||
<span>{{ announcement_message }}</span>
|
||||
<button id="close-announcement" class="absolute top-0 right-0 mt-2 mr-4 text-white hover:text-gray-200 text-2xl leading-none">×</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="flex items-center justify-center min-h-screen py-8">
|
||||
<div class="w-full max-w-4xl mx-auto p-4">
|
||||
<header class="text-center mb-8">
|
||||
<a href="/" class="inline-block mb-4">
|
||||
<img src="{{ url_for('static', filename='images/stormycloud.svg') }}" alt="StormyCloud Logo" style="width: 550px; max-width: 100%;" class="mx-auto">
|
||||
</a>
|
||||
<h1 class="text-4xl font-bold text-white">Admin Dashboard</h1>
|
||||
</header>
|
||||
|
||||
<main class="content-container rounded-lg p-8 shadow-lg">
|
||||
{% if auth_success %}
|
||||
<h2 class="text-2xl font-semibold text-white mb-6">Active Images</h2>
|
||||
{% if images %}
|
||||
<div class="overflow-x-auto">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Filename</th>
|
||||
<th>Expires On (UTC)</th>
|
||||
<th>Time Left</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for image in images %}
|
||||
<tr>
|
||||
<td class="font-mono text-sm break-all">{{ image[0] }}</td>
|
||||
<td class="font-mono text-sm">{{ image[1] }}</td>
|
||||
<td class="font-mono text-sm">{{ image[2] }}</td>
|
||||
<td>
|
||||
<form action="{{ url_for('delete_image', filename=image[0]) }}" method="POST" onsubmit="return confirm('Are you sure you want to delete this image?');">
|
||||
<button type="submit" class="btn-danger text-white font-bold py-1 px-3 rounded text-sm">Delete</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="text-gray-400">No active images.</p>
|
||||
{% endif %}
|
||||
|
||||
<h2 class="text-2xl font-semibold text-white mt-12 mb-6">Active Pastes</h2>
|
||||
{% if pastes %}
|
||||
<div class="overflow-x-auto">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Language</th>
|
||||
<th>Expires On (UTC)</th>
|
||||
<th>Time Left</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for paste in pastes %}
|
||||
<tr>
|
||||
<td class="font-mono text-sm break-all">{{ paste[0] }}</td>
|
||||
<td class="font-mono text-sm">{{ paste[1] }}</td>
|
||||
<td class="font-mono text-sm">{{ paste[2] }}</td>
|
||||
<td class="font-mono text-sm">{{ paste[3] }}</td>
|
||||
<td>
|
||||
<form action="{{ url_for('delete_paste', paste_id=paste[0]) }}" method="POST" onsubmit="return confirm('Are you sure you want to delete this paste?');">
|
||||
<button type="submit" class="btn-danger text-white font-bold py-1 px-3 rounded text-sm">Delete</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="text-gray-400">No active pastes.</p>
|
||||
{% endif %}
|
||||
|
||||
{% else %}
|
||||
<h2 class="text-2xl font-semibold text-white mb-6">Admin Login</h2>
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
<div class="mb-4">
|
||||
{% for category, message in messages %}
|
||||
<div class="alert-{{ category }} text-white p-3 rounded-md shadow-lg" role="alert">
|
||||
{{ message }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
<form method="POST" action="{{ url_for('admin_dashboard') }}">
|
||||
<div class="mb-6">
|
||||
<label for="password" class="block text-gray-300 text-sm font-bold mb-2">Password:</label>
|
||||
<input type="password" name="password" id="password" class="w-full p-2 rounded-md text-white focus:outline-none focus:ring-2 focus:ring-blue-500" required>
|
||||
</div>
|
||||
<div><button type="submit" class="btn w-full text-white font-bold py-3 px-5 rounded-md focus:shadow-outline">Login</button></div>
|
||||
</form>
|
||||
{% endif %}
|
||||
<div class="text-center mt-8 border-t border-gray-700 pt-6">
|
||||
<a href="{{ url_for('index') }}" class="text-blue-400 hover:text-blue-300">Back to Homepage</a>
|
||||
</div>
|
||||
</main>
|
||||
<footer class="text-center text-gray-500 mt-16 border-t border-gray-700 pt-8 pb-8">
|
||||
<a href="http://stormycloud.i2p" class="hover:text-gray-400">StormyCloud</a>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
const announcementBar = document.getElementById('announcement-bar');
|
||||
const closeButton = document.getElementById('close-announcement');
|
||||
if (closeButton) {
|
||||
closeButton.addEventListener('click', () => {
|
||||
announcementBar.style.display = 'none';
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
64
templates/donate.html
Normal file
64
templates/donate.html
Normal file
@ -0,0 +1,64 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Support the Project - I2P Secure Share</title>
|
||||
<link rel="stylesheet" href="/static/css/tailwind.css">
|
||||
<style>
|
||||
body { background-color: #1a202c; color: #cbd5e0; }
|
||||
.content-container { background-color: #2d3748; border: 1px solid #4a5568; }
|
||||
.announcement-bar { background-color: #2563eb; border-bottom: 1px solid #1e3a8a; }
|
||||
.address-box { background-color: #1a202c; padding: 1rem; border-radius: 0.5rem; word-break: break-all; }
|
||||
</style>
|
||||
</head>
|
||||
<body class="font-sans">
|
||||
|
||||
{% if announcement_enabled and announcement_message %}
|
||||
<div id="announcement-bar" class="announcement-bar text-white text-center p-2 relative shadow-lg">
|
||||
<span>{{ announcement_message }}</span>
|
||||
<button id="close-announcement" class="absolute top-0 right-0 mt-2 mr-4 text-white hover:text-gray-200 text-2xl leading-none">×</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="flex items-center justify-center min-h-screen py-8">
|
||||
<div class="w-full max-w-2xl mx-auto p-4">
|
||||
<header class="text-center mb-8">
|
||||
<a href="/" class="inline-block mb-4">
|
||||
<img src="/static/images/stormycloud.svg" alt="StormyCloud Logo" style="width: 550px; max-width: 100%;" class="mx-auto">
|
||||
</a>
|
||||
<h1 class="text-3xl font-bold text-white">Support the Service</h1>
|
||||
</header>
|
||||
|
||||
<main class="content-container rounded-lg p-8 shadow-lg">
|
||||
<p class="text-center text-gray-400 mb-6">This service is developed and maintained for the I2P community free of charge. If you find it valuable, please consider a small donation to help cover server costs and support future development.</p>
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="text-2xl font-semibold text-white mb-2">Monero (XMR)</h2>
|
||||
<div class="address-box font-mono text-sm">
|
||||
45Gtj5tkhs4EsbnV7kkhMCRpbZUdqCQqR5qmLFVLAvbFCYaPL4pFbBkEBLJ7beHqkiJxdTBkPwFsT5EMu5jDrYBHPjQzPuv
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-center mt-12 border-t border-gray-700 pt-6">
|
||||
<a href="/" class="text-blue-400 hover:text-blue-300">Back to Uploader</a>
|
||||
</div>
|
||||
</main>
|
||||
<footer class="text-center text-gray-500 mt-16 border-t border-gray-700 pt-8 pb-8">
|
||||
<a href="http://stormycloud.i2p" class="hover:text-gray-400">StormyCloud</a>
|
||||
<span class="mx-2">|</span>
|
||||
<a href="/donate" class="hover:text-gray-400">Donate</a>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
const announcementBar = document.getElementById('announcement-bar');
|
||||
const closeButton = document.getElementById('close-announcement');
|
||||
if (closeButton) {
|
||||
closeButton.addEventListener('click', () => {
|
||||
announcementBar.style.display = 'none';
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
417
templates/index.html
Normal file
417
templates/index.html
Normal file
@ -0,0 +1,417 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<title>I2P Secure Share</title>
|
||||
<link rel="stylesheet" href="/static/css/tailwind.css"/>
|
||||
<style>
|
||||
body { background-color: #1a202c; color: #cbd5e0; }
|
||||
.content-container { background-color: #2d3748; border:1px solid #4a5568; border-radius:0.5rem; }
|
||||
.tab { border-bottom:2px solid transparent; cursor:pointer; }
|
||||
.tab.active { border-bottom-color:#63b3ed; color:#ffffff; }
|
||||
.btn { background-color:#4299e1; transition:background-color .3s ease; }
|
||||
.btn:hover { background-color:#3182ce; }
|
||||
select,textarea,input[type="text"],input[type="password"],input[type="number"] {
|
||||
background-color:#4a5568; border:1px solid #718096; color:#cbd5e0;
|
||||
}
|
||||
.alert-success { background-color:#38a169; }
|
||||
.alert-error { background-color:#e53e3e; }
|
||||
.announcement-bar { background-color:#2563eb; border-bottom:1px solid #1e3a8a; }
|
||||
.reveal { display:none; }
|
||||
input[type="file"] {
|
||||
width:100%; padding:0.5rem 1rem; border-radius:0.375rem;
|
||||
background-color:#4a5568; border:1px solid #718096; color:#cbd5e0; cursor:pointer;
|
||||
}
|
||||
input[type="file"]::file-selector-button {
|
||||
background-color:#2d3748; color:#cbd5e0; border:none;
|
||||
padding:0.5rem 1rem; margin-right:1rem; border-radius:0.375rem; cursor:pointer;
|
||||
transition:background-color .3s ease;
|
||||
}
|
||||
input[type="file"]::file-selector-button:hover { background-color:#3a4a5a; }
|
||||
.stat-card {
|
||||
background-color:#2d3748; border:1px solid #4a5568; border-radius:0.5rem;
|
||||
}
|
||||
.stat-value { color:#63b3ed; }
|
||||
.label-with-icon {
|
||||
display:inline-flex; align-items:center; gap:0.5rem; font-size:0.875rem; color:#cbd5e0;
|
||||
}
|
||||
.label-with-icon svg {
|
||||
width:1rem; height:1rem; color:#4299e1; flex-shrink:0;
|
||||
}
|
||||
.feature-card {
|
||||
background-color: #2d3748;
|
||||
border: 1px solid #4a5568;
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
/* API Docs Styling */
|
||||
.docs-container h3 {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 600;
|
||||
color: #ffffff;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 1rem;
|
||||
padding-bottom: 0.5rem;
|
||||
border-bottom: 1px solid #4a5568;
|
||||
}
|
||||
.docs-container p { margin-bottom: 1rem; color: #a0aec0; }
|
||||
.docs-container ul { list-style-position: inside; margin-bottom: 1rem; }
|
||||
.docs-container li { margin-bottom: 0.5rem; color: #cbd5e0;}
|
||||
.docs-container code {
|
||||
background-color:#1a202c;
|
||||
color:#f7fafc;
|
||||
padding:0.2rem 0.4rem;
|
||||
border-radius:0.25rem;
|
||||
font-family:monospace;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
.docs-container pre {
|
||||
background-color:#1a202c;
|
||||
padding:1rem;
|
||||
border-radius:0.5rem;
|
||||
overflow-x:auto;
|
||||
color:#f7fafc;
|
||||
font-family:monospace;
|
||||
}
|
||||
</style>
|
||||
<noscript>
|
||||
<style>
|
||||
.tab-nav-container{display:none;}
|
||||
.tab-content{display:none!important;}
|
||||
#image-form,#paste-form{display:block!important;margin-bottom:2rem;}
|
||||
#api-docs,#stats-content,#tos-content,.features-section{display:none!important;}
|
||||
@media(min-width:1024px){.noscript-forms-container{display:flex;gap:1.5rem;} .noscript-forms-container>div{flex:1;}}
|
||||
.reveal{display:block!important;}
|
||||
</style>
|
||||
</noscript>
|
||||
</head>
|
||||
<body class="font-sans">
|
||||
|
||||
{% if announcement_enabled and announcement_message %}
|
||||
<div id="announcement-bar" class="announcement-bar text-white text-center p-2 relative shadow-lg">
|
||||
<span>{{ announcement_message }}</span>
|
||||
<button id="close-announcement"
|
||||
class="absolute top-0 right-0 mt-2 mr-4 text-white hover:text-gray-200 text-2xl leading-none">×</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="flex items-center justify-center min-h-screen py-8">
|
||||
<div id="main-container" class="w-full max-w-2xl mx-auto p-4">
|
||||
<header class="text-center mb-8">
|
||||
<a href="/" class="inline-block mb-4">
|
||||
<img src="/static/images/stormycloud.svg"
|
||||
alt="StormyCloud Logo"
|
||||
style="width:550px;max-width:100%;"
|
||||
class="mx-auto"/>
|
||||
</a>
|
||||
<h1 class="text-4xl font-bold text-white">I2P Secure Share</h1>
|
||||
<p class="text-gray-400">Anonymously share images and text pastes.</p>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<div id="js-error-container"
|
||||
class="hidden alert-error text-white p-3 rounded-md shadow-lg mb-4"
|
||||
role="alert"></div>
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
<div class="mb-4">
|
||||
{% for category,message in messages %}
|
||||
<div class="alert-{{category}} text-white p-3 rounded-md shadow-lg"
|
||||
role="alert">{{ message }}</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
<div class="mb-4 border-b border-gray-700 tab-nav-container">
|
||||
<nav class="flex -mb-px" id="tab-nav">
|
||||
<a href="#image"
|
||||
class="tab active text-gray-300 py-4 px-6 block hover:text-white">Image Uploader</a>
|
||||
<a href="#paste"
|
||||
class="tab text-gray-300 py-4 px-6 block hover:text-white">Pastebin</a>
|
||||
<a href="#api"
|
||||
class="tab text-gray-300 py-4 px-6 block hover:text-white">API</a>
|
||||
<a href="#stats"
|
||||
class="tab text-gray-300 py-4 px-6 block hover:text-white">Stats</a>
|
||||
<a href="#tos"
|
||||
class="tab text-gray-300 py-4 px-6 block hover:text-white">Terms</a>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div class="noscript-forms-container">
|
||||
<!-- IMAGE FORM -->
|
||||
<div id="image-form" class="content-container rounded-lg p-8 shadow-lg tab-content">
|
||||
<form action="/upload/image" method="POST" enctype="multipart/form-data">
|
||||
<h2 class="text-2xl font-semibold mb-6 text-white">Upload an Image</h2>
|
||||
|
||||
<div class="mb-6">
|
||||
<label for="image-file" class="block text-gray-300 text-sm font-bold mb-2">Image File:</label>
|
||||
<input type="file" name="file" id="image-file" required>
|
||||
<p class="text-xs text-gray-500 mt-1">Max 10MB; WebP conversion.</p>
|
||||
</div>
|
||||
|
||||
<div class="mb-6">
|
||||
<label for="image-expiry" class="block text-gray-300 text-sm font-bold mb-2">Delete after:</label>
|
||||
<select name="expiry" id="image-expiry" class="w-full p-2 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
||||
<option value="15m">15 minutes</option>
|
||||
<option value="1h" selected>1 hour</option>
|
||||
<option value="2h">2 hours</option>
|
||||
<option value="4h">4 hours</option>
|
||||
<option value="8h">8 hours</option>
|
||||
<option value="12h">12 hours</option>
|
||||
<option value="24h">24 hours</option>
|
||||
<option value="48h">48 hours</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mb-6 text-gray-300" style="display:grid;grid-template-columns:repeat(3,1fr);gap:1.5rem;align-items:start;">
|
||||
<label class="label-with-icon">
|
||||
<input type="checkbox" name="keep_exif">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6M7 7h10M4 6h16M4 6a2 2 0 012-2h8l2 2h6a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6z"/></svg>
|
||||
<span>Keep EXIF Data</span>
|
||||
</label>
|
||||
<label class="label-with-icon">
|
||||
<input type="checkbox" id="image-pw-protect" name="password_protect">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 11c1.657 0 3-1.343 3-3V6a3 3 0 10-6 0v2c0 1.657 1.343 3 3 3z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 11h14a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2v-8a2 2 0 012-2z"/></svg>
|
||||
<span>Password</span>
|
||||
</label>
|
||||
<label class="label-with-icon" title="Removed after this many successful views">
|
||||
<input type="checkbox" id="image-views-protect" name="views_protect">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.477 0 8.268 2.943 9.542 7-1.274 4.057-5.065 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/></svg>
|
||||
<span>Max Views</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div id="image-pw-options" class="reveal mb-6">
|
||||
<label for="image-password" class="block text-gray-300 text-sm font-bold mb-1">Password:</label>
|
||||
<input type="password" name="password" id="image-password" class="w-full p-2 rounded-md border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500">
|
||||
</div>
|
||||
<div id="image-views-options" class="reveal mb-6">
|
||||
<label for="image-max-views" class="block text-gray-300 text-sm font-bold mb-1">Max views:</label>
|
||||
<input type="number" name="max_views" id="image-max-views" min="1" class="w-full p-2 rounded-md border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500">
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn w-full text-white font-bold py-3 px-5 rounded-md focus:shadow-outline">Upload Image</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- PASTE FORM -->
|
||||
<div id="paste-form" class="content-container rounded-lg p-8 shadow-lg hidden tab-content">
|
||||
<form action="/upload/paste" method="POST">
|
||||
<h2 class="text-2xl font-semibold mb-6 text-white">Create a Paste</h2>
|
||||
<div class="mb-6">
|
||||
<label for="paste-content" class="block text-gray-300 text-sm font-bold mb-2">Paste Content:</label>
|
||||
<textarea name="content" id="paste-content" rows="10" class="w-full p-2 rounded-md font-mono focus:outline-none focus:ring-2 focus:ring-blue-500" required></textarea>
|
||||
</div>
|
||||
<div class="mb-6">
|
||||
<label for="paste-language" class="block text-gray-300 text-sm font-bold mb-2">Language:</label>
|
||||
<select name="language" id="paste-language" class="w-full p-2 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
||||
<option value="text">Plain Text</option>
|
||||
{% for lang in languages %}
|
||||
<option value="{{ lang }}">{{ lang|capitalize }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-6">
|
||||
<label for="paste-expiry" class="block text-gray-300 text-sm font-bold mb-2">Delete after:</label>
|
||||
<select name="expiry" id="paste-expiry" class="w-full p-2 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
||||
<option value="15m">15 minutes</option>
|
||||
<option value="1h" selected>1 hour</option>
|
||||
<option value="2h">2 hours</option>
|
||||
<option value="4h">4 hours</option>
|
||||
<option value="8h">8 hours</option>
|
||||
<option value="12h">12 hours</option>
|
||||
<option value="24h">24 hours</option>
|
||||
<option value="48h">48 hours</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-6 text-gray-300" style="display:grid;grid-template-columns:repeat(2,1fr);gap:2rem;align-items:start;">
|
||||
<label class="label-with-icon">
|
||||
<input type="checkbox" id="paste-pw-protect" name="password_protect">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 11c1.657 0 3-1.343 3-3V6a3 3 0 10-6 0v2c0 1.657 1.343 3 3 3z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 11h14a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2v-8a2 2 0 012-2z"/></svg>
|
||||
<span>Password</span>
|
||||
</label>
|
||||
<label class="label-with-icon" title="Removed after this many successful views">
|
||||
<input type="checkbox" id="paste-views-protect" name="views_protect">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.477 0 8.268 2.943 9.542 7-1.274 4.057-5.065 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/></svg>
|
||||
<span>Max Views</span>
|
||||
</label>
|
||||
</div>
|
||||
<div id="paste-pw-options" class="reveal mb-6">
|
||||
<label for="paste-password" class="block text-gray-300 text-sm font-bold mb-1">Password:</label>
|
||||
<input type="password" name="password" id="paste-password" class="w-full p-2 rounded-md border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500">
|
||||
</div>
|
||||
<div id="paste-views-options" class="reveal mb-6">
|
||||
<label for="paste-max-views" class="block text-gray-300 text-sm font-bold mb-1">Max views:</label>
|
||||
<input type="number" name="max_views" id="paste-max-views" min="1" class="w-full p-2 rounded-md border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500">
|
||||
</div>
|
||||
<button type="submit" class="btn w-full text-white font-bold py-3 px-5 rounded-md focus:shadow-outline">Create Paste</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- API DOCS -->
|
||||
<div id="api-docs" class="content-container docs-container rounded-lg p-8 shadow-lg hidden tab-content">
|
||||
<h3>Introduction</h3>
|
||||
<p>The API allows programmatic uploads. All endpoints are rate-limited. No API key is required.</p>
|
||||
|
||||
<h3>Uploading an Image</h3>
|
||||
<p>Send a <code>POST</code> request with <code>multipart/form-data</code>.</p>
|
||||
<ul>
|
||||
<li><strong>Endpoint:</strong> <code>POST /api/upload/image</code></li>
|
||||
<li><strong>Parameter <code>file</code>:</strong> (Required) The image file.</li>
|
||||
<li><strong>Parameter <code>expiry</code>:</strong> (Optional) Values: <code>15m</code>, <code>1h</code>, <code>2h</code>, <code>4h</code>, <code>8h</code>, <code>12h</code>, <code>24h</code>, <code>48h</code>.</li>
|
||||
<li><strong>Parameter <code>password</code>:</strong> (Optional) A password to protect the content.</li>
|
||||
<li><strong>Parameter <code>max_views</code>:</strong> (Optional) An integer for auto-deletion after N views.</li>
|
||||
</ul>
|
||||
<pre>curl -X POST -F "file=@/path/to/image.jpg" http://{{ request.host }}/api/upload/image</pre>
|
||||
|
||||
<h3>Creating a Paste</h3>
|
||||
<p>Send a <code>POST</code> request with a JSON payload.</p>
|
||||
<ul>
|
||||
<li><strong>Endpoint:</strong> <code>POST /api/upload/paste</code></li>
|
||||
<li><strong>JSON Field <code>content</code>:</strong> (Required) The paste text.</li>
|
||||
<li><strong>JSON Field <code>language</code>:</strong> (Optional) A valid language for syntax highlighting. Defaults to 'text'.</li>
|
||||
<li><strong>JSON Field <code>expiry</code>:</strong> (Optional) Same values as image expiry.</li>
|
||||
<li><strong>JSON Field <code>password</code>:</strong> (Optional) A password to protect the content.</li>
|
||||
<li><strong>JSON Field <code>max_views</code>:</strong> (Optional) An integer for auto-deletion after N views.</li>
|
||||
</ul>
|
||||
<pre>curl -X POST -H "Content-Type: application/json" \
|
||||
-d '{"content":"Hello World", "expiry":"1h"}' \
|
||||
http://{{ request.host }}/api/upload/paste</pre>
|
||||
</div>
|
||||
|
||||
<!-- STATS -->
|
||||
<div id="stats-content" class="content-container rounded-lg p-8 shadow-lg hidden tab-content">
|
||||
<h2 class="text-3xl font-bold text-white text-center mb-8">Service Statistics</h2>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
<div class="stat-card p-6 text-center">
|
||||
<h3 class="text-xl font-semibold text-white mb-2">Total Image Uploads</h3>
|
||||
<p class="text-5xl font-bold stat-value">{{ stats.total_images }}</p>
|
||||
</div>
|
||||
<div class="stat-card p-6 text-center">
|
||||
<h3 class="text-xl font-semibold text-white mb-2">Total Paste Uploads</h3>
|
||||
<p class="text-5xl font-bold stat-value">{{ stats.total_pastes }}</p>
|
||||
</div>
|
||||
<div class="stat-card p-6 text-center">
|
||||
<h3 class="text-xl font-semibold text-white mb-2">Total API Uploads</h3>
|
||||
<p class="text-5xl font-bold stat-value">{{ stats.total_api_uploads }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- TERMS OF SERVICE -->
|
||||
<div id="tos-content" class="content-container tos-container rounded-lg p-8 shadow-lg hidden tab-content">
|
||||
<h2 class="text-3xl font-bold text-white mb-4">Terms of Service</h2>
|
||||
<p><strong>Last Updated: June 20, 2025</strong></p>
|
||||
<p>By using this service you agree to these terms. The service is provided “as-is” with a focus on privacy.</p>
|
||||
<h3 class="mt-6 text-white text-xl font-semibold mb-2">1. Privacy & Data</h3>
|
||||
<ul class="list-disc list-inside text-gray-300 mb-4">
|
||||
<li>No logs of your identity or IP.</li>
|
||||
<li>All uploads are encrypted at rest.</li>
|
||||
<li>Data auto-deletes after expiry or view limit.</li>
|
||||
<li>EXIF metadata only kept if opted-in.</li>
|
||||
</ul>
|
||||
<h3 class="mt-6 text-white text-xl font-semibold mb-2">2. Acceptable Use</h3>
|
||||
<p class="text-gray-300 mb-4">Do not upload illegal or harmful content. We reserve the right to remove content that violates these terms.</p>
|
||||
<h3 class="mt-6 text-white text-xl font-semibold mb-2">3. Liability</h3>
|
||||
<p class="text-gray-300">This free service comes with no warranties. We are not responsible for data loss.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Version Info (Moved outside the tabbed content) -->
|
||||
<div class="text-center text-xs text-gray-500 mt-6 mb-8">
|
||||
<a href="https://github.com/your-username/your-repo-name" target="_blank" rel="noopener noreferrer" class="hover:text-gray-400 transition-colors">
|
||||
Version 1.1
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- FEATURES -->
|
||||
<section class="text-center features-section">
|
||||
<h2 class="text-3xl font-bold text-white mb-8">Features</h2>
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-8">
|
||||
<div class="feature-card p-6 rounded-lg">
|
||||
<div class="flex items-center justify-center h-12 w-12 rounded-md bg-blue-500 text-white mx-auto mb-4">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" /></svg>
|
||||
</div>
|
||||
<h3 class="text-xl font-semibold text-white mb-2">Encrypted at Rest</h3>
|
||||
<p class="text-gray-400">All uploaded files and pastes are fully encrypted on the server, ensuring your data is protected.</p>
|
||||
</div>
|
||||
<div class="feature-card p-6 rounded-lg">
|
||||
<div class="flex items-center justify-center h-12 w-12 rounded-md bg-blue-500 text-white mx-auto mb-4">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 11c0 3.517-1.009 6.786-2.673 9.356 m-2.673-9.356C6.673 8.214 9.327 5.5 12 5.5 c2.673 0 5.327 2.714 5.327 5.5s-1.009 6.786-2.673 9.356m-2.673-9.356h0z" /></svg>
|
||||
</div>
|
||||
<h3 class="text-xl font-semibold text-white mb-2">Anonymous by Design</h3>
|
||||
<p class="text-gray-400">Image metadata (EXIF) is stripped and no unnecessary logs are kept. Built for the I2P network.</p>
|
||||
</div>
|
||||
<div class="feature-card p-6 rounded-lg">
|
||||
<div class="flex items-center justify-center h-12 w-12 rounded-md bg-blue-500 text-white mx-auto mb-4">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 15a4 4 0 004 4h9a5 5 0 10-.1-9.999 5.002 5.002 0 10-9.78 2.096A4.001 4.001 0 003 15z" /></svg>
|
||||
</div>
|
||||
<h3 class="text-xl font-semibold text-white mb-2">StormyCloud Infrastructure</h3>
|
||||
<p class="text-gray-400">A fast, reliable, and secure platform dedicated to the privacy of the I2P community.</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<footer class="text-center text-gray-500 mt-16 border-t border-gray-700 pt-8 pb-8">
|
||||
<a href="http://stormycloud.i2p" class="hover:text-gray-400">StormyCloud</a>
|
||||
<span class="mx-2">|</span>
|
||||
<a href="/donate" class="hover:text-gray-400">Donate</a>
|
||||
</footer>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const contentDivs = {
|
||||
'#image': document.querySelector('#image-form'),
|
||||
'#paste': document.querySelector('#paste-form'),
|
||||
'#api': document.querySelector('#api-docs'),
|
||||
'#stats': document.querySelector('#stats-content'),
|
||||
'#tos': document.querySelector('#tos-content')
|
||||
};
|
||||
const tabs = document.querySelectorAll('#tab-nav a');
|
||||
function showTab(hash) {
|
||||
if (!hash || !contentDivs[hash]) hash = '#image';
|
||||
|
||||
Object.values(contentDivs).forEach(d => {
|
||||
if(d) d.classList.add('hidden');
|
||||
});
|
||||
tabs.forEach(t => t.classList.remove('active'));
|
||||
|
||||
if(contentDivs[hash]) {
|
||||
contentDivs[hash].classList.remove('hidden');
|
||||
}
|
||||
const activeTab = document.querySelector(`#tab-nav a[href="${hash}"]`);
|
||||
if(activeTab) {
|
||||
activeTab.classList.add('active');
|
||||
}
|
||||
}
|
||||
tabs.forEach(tab => tab.addEventListener('click', e => {
|
||||
e.preventDefault();
|
||||
const h = e.target.hash;
|
||||
window.history.replaceState(null, null, ' ' + h);
|
||||
showTab(h);
|
||||
}));
|
||||
showTab(window.location.hash);
|
||||
|
||||
function toggle(cbId, tgtId) {
|
||||
const cb = document.getElementById(cbId), tgt = document.getElementById(tgtId);
|
||||
if (!cb||!tgt) return;
|
||||
cb.addEventListener('change', () => tgt.style.display = cb.checked ? 'block' : 'none');
|
||||
tgt.style.display = cb.checked ? 'block' : 'none';
|
||||
}
|
||||
toggle('image-pw-protect','image-pw-options');
|
||||
toggle('image-views-protect','image-views-options');
|
||||
toggle('paste-pw-protect','paste-pw-options');
|
||||
toggle('paste-views-protect','paste-views-options');
|
||||
|
||||
const closeBtn = document.getElementById('close-announcement');
|
||||
if (closeBtn) closeBtn.addEventListener('click', ()=>
|
||||
document.getElementById('announcement-bar').style.display = 'none'
|
||||
);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
106
templates/view_image.html
Normal file
106
templates/view_image.html
Normal file
@ -0,0 +1,106 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<title>Image Uploaded - I2P Secure Share</title>
|
||||
<link rel="stylesheet" href="/static/css/tailwind.css"/>
|
||||
<style>
|
||||
body { background-color: #1a202c; color: #cbd5e0; }
|
||||
.link-box { background-color: #2d3748; border:1px solid #4a5568; word-break:break-all; }
|
||||
.btn { background-color:#4299e1; transition:background-color .3s ease; }
|
||||
.btn:hover { background-color:#3182ce; }
|
||||
.thumbnail-container { border:2px dashed #4a5568; max-width:100%; }
|
||||
.thumbnail { max-width:100%; max-height:60vh; object-fit:contain; }
|
||||
.announcement-bar { background-color:#2563eb; border-bottom:1px solid #1e3a8a; }
|
||||
</style>
|
||||
</head>
|
||||
<body class="font-sans">
|
||||
|
||||
{% if announcement_enabled and announcement_message %}
|
||||
<div id="announcement-bar" class="announcement-bar text-white text-center p-2 relative shadow-lg">
|
||||
<span>{{ announcement_message }}</span>
|
||||
<button id="close-announcement" class="absolute top-0 right-0 mt-2 mr-4 text-white hover:text-gray-200 text-2xl leading-none">×</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="flex items-center justify-center min-h-screen py-8">
|
||||
<div class="w-full max-w-2xl mx-auto p-4">
|
||||
{% if password_required %}
|
||||
<div class="content-container rounded-lg p-8 shadow-lg">
|
||||
<h2 class="text-2xl font-semibold text-white mb-6">Enter Password to View Image</h2>
|
||||
<form method="POST">
|
||||
<div class="mb-6">
|
||||
<label for="password" class="block text-gray-300 text-sm font-bold mb-2">Password:</label>
|
||||
<input type="password" name="password" id="password"
|
||||
class="w-full p-2 rounded-md text-white bg-gray-700 border border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
required>
|
||||
</div>
|
||||
<button type="submit" class="btn w-full text-white font-bold py-3 px-5 rounded-md">Unlock Image</button>
|
||||
</form>
|
||||
</div>
|
||||
{% else %}
|
||||
<header class="text-center mb-8">
|
||||
<a href="/" class="inline-block mb-4">
|
||||
<img src="/static/images/stormycloud.svg"
|
||||
alt="StormyCloud Logo"
|
||||
style="width:550px; max-width:100%;" class="mx-auto"/>
|
||||
</a>
|
||||
<h1 class="text-3xl font-bold text-white">Image Uploaded Successfully</h1>
|
||||
<p class="text-gray-400 mt-2 text-xl">Expires in: {{ time_left }}</p>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<div class="thumbnail-container rounded-lg p-4 mb-6 flex justify-center items-center">
|
||||
<img src="/uploads/{{ filename }}"
|
||||
alt="Uploaded Image" class="thumbnail rounded-md"/>
|
||||
</div>
|
||||
|
||||
<div class="link-box rounded-lg p-4 mb-4">
|
||||
<label for="share-link" class="block text-gray-300 text-sm font-bold mb-2">Direct Image Link:</label>
|
||||
<div class="flex items-center space-x-2">
|
||||
<input type="text" id="share-link"
|
||||
class="bg-gray-700 text-white w-full p-2 border border-gray-600 rounded-md"
|
||||
value="{{ request.host_url }}uploads/{{ filename }}" readonly>
|
||||
<button id="copy-button"
|
||||
class="btn whitespace-nowrap flex-shrink-0 text-white font-bold py-3 px-5 rounded-md">
|
||||
Copy
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-center mt-8">
|
||||
<a href="/" class="text-blue-400 hover:text-blue-300">Upload another file</a>
|
||||
</div>
|
||||
<div class="text-center mt-4 text-sm">
|
||||
<p class="text-gray-500">Find this service useful? <a href="/donate" class="text-blue-400 hover:underline">Consider supporting its future.</a></p>
|
||||
</div>
|
||||
|
||||
</main>
|
||||
{% endif %}
|
||||
|
||||
<footer class="text-center text-gray-500 mt-16 border-t border-gray-700 pt-8 pb-8">
|
||||
<a href="http://stormycloud.i2p" class="hover:text-gray-400">StormyCloud</a>
|
||||
<span class="mx-2">|</span>
|
||||
<a href="/donate" class="hover:text-gray-400">Donate</a>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const copyBtn = document.getElementById('copy-button');
|
||||
if (copyBtn) {
|
||||
copyBtn.addEventListener('click', () => {
|
||||
const inp = document.getElementById('share-link');
|
||||
inp.select(); document.execCommand('copy');
|
||||
copyBtn.textContent = 'Copied!';
|
||||
setTimeout(() => copyBtn.textContent = 'Copy', 2000);
|
||||
});
|
||||
}
|
||||
const closeBtn = document.getElementById('close-announcement');
|
||||
if (closeBtn) closeBtn.addEventListener('click', () =>
|
||||
document.getElementById('announcement-bar').style.display = 'none'
|
||||
);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
114
templates/view_paste.html
Normal file
114
templates/view_paste.html
Normal file
@ -0,0 +1,114 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<title>Paste Created - I2P Secure Share</title>
|
||||
<link rel="stylesheet" href="/static/css/tailwind.css"/>
|
||||
<style>
|
||||
body { background-color: #1a202c; color: #cbd5e0; }
|
||||
.link-box { background-color: #2d3748; border:1px solid #4a5568; word-break:break-all; }
|
||||
.btn { background-color:#4299e1; transition:background-color .3s ease; }
|
||||
.btn:hover { background-color:#3182ce; }
|
||||
.code-container {
|
||||
background-color:#2d3748; border-radius:0.5rem; border:1px solid #4a5568; overflow:hidden;
|
||||
}
|
||||
.syntax pre {
|
||||
margin:0; padding:1rem; white-space:pre-wrap; word-wrap:break-word;
|
||||
}
|
||||
.announcement-bar { background-color:#2563eb; border-bottom:1px solid #1e3a8a; }
|
||||
</style>
|
||||
</head>
|
||||
<body class="font-sans">
|
||||
|
||||
{% if announcement_enabled and announcement_message %}
|
||||
<div id="announcement-bar" class="announcement-bar text-white text-center p-2 relative shadow-lg">
|
||||
<span>{{ announcement_message }}</span>
|
||||
<button id="close-announcement" class="absolute top-0 right-0 mt-2 mr-4 text-white hover:text-gray-200 text-2xl leading-none">×</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="flex items-center justify-center min-h-screen py-8">
|
||||
<div class="w-full max-w-2xl mx-auto p-4">
|
||||
{% if password_required %}
|
||||
<div class="content-container rounded-lg p-8 shadow-lg">
|
||||
<h2 class="text-2xl font-semibold text-white mb-6">Enter Password to View Paste</h2>
|
||||
<form method="POST">
|
||||
<div class="mb-6">
|
||||
<label for="password" class="block text-gray-300 text-sm font-bold mb-2">Password:</label>
|
||||
<input type="password" name="password" id="password"
|
||||
class="w-full p-2 rounded-md text-white bg-gray-700 border border-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
required>
|
||||
</div>
|
||||
<button type="submit" class="btn w-full text-white font-bold py-3 px-5 rounded-md">Unlock Paste</button>
|
||||
</form>
|
||||
</div>
|
||||
{% else %}
|
||||
<header class="text-center mb-8">
|
||||
<a href="/" class="inline-block mb-4">
|
||||
<img src="/static/images/stormycloud.svg"
|
||||
alt="StormyCloud Logo"
|
||||
style="width:550px; max-width:100%;" class="mx-auto"/>
|
||||
</a>
|
||||
<h1 class="text-3xl font-bold text-white">Paste Created Successfully</h1>
|
||||
<p class="text-gray-400 mt-2 text-xl">Expires in: {{ time_left }}</p>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<div class="code-container mb-6 syntax">
|
||||
{{ highlighted_content|safe }}
|
||||
</div>
|
||||
|
||||
<div class="link-box rounded-lg p-4 mb-4">
|
||||
<label for="share-link" class="block text-gray-300 text-sm font-bold mb-2">Shareable Link:</label>
|
||||
<div class="flex items-center space-x-2">
|
||||
<input type="text" id="share-link"
|
||||
class="bg-gray-700 text-white w-full p-2 border border-gray-600 rounded-md"
|
||||
value="{{ request.url }}" readonly>
|
||||
<button id="copy-button"
|
||||
class="btn whitespace-nowrap flex-shrink-0 text-white font-bold py-3 px-5 rounded-md">
|
||||
Copy
|
||||
</button>
|
||||
<a href="/paste/{{ paste_id }}/raw"
|
||||
target="_blank"
|
||||
class="btn whitespace-nowrap flex-shrink-0 text-white font-bold py-3 px-5 rounded-md">
|
||||
Raw
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-center mt-8">
|
||||
<a href="/" class="text-blue-400 hover:text-blue-300">Create another paste</a>
|
||||
</div>
|
||||
<div class="text-center mt-4 text-sm">
|
||||
<p class="text-gray-500">Find this service useful? <a href="/donate" class="text-blue-400 hover:underline">Consider supporting its future.</a></p>
|
||||
</div>
|
||||
|
||||
</main>
|
||||
{% endif %}
|
||||
|
||||
<footer class="text-center text-gray-500 mt-16 border-t border-gray-700 pt-8 pb-8">
|
||||
<a href="http://stormycloud.i2p" class="hover:text-gray-400">StormyCloud</a>
|
||||
<span class="mx-2">|</span>
|
||||
<a href="/donate" class="hover:text-gray-400">Donate</a>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const copyBtn = document.getElementById('copy-button');
|
||||
if (copyBtn) {
|
||||
copyBtn.addEventListener('click', () => {
|
||||
const inp = document.getElementById('share-link');
|
||||
inp.select(); document.execCommand('copy');
|
||||
copyBtn.textContent = 'Copied!';
|
||||
setTimeout(() => copyBtn.textContent = 'Copy', 2000);
|
||||
});
|
||||
}
|
||||
const closeBtn = document.getElementById('close-announcement');
|
||||
if (closeBtn) closeBtn.addEventListener('click', () =>
|
||||
document.getElementById('announcement-bar').style.display = 'none'
|
||||
);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user