mirror of
https://github.com/jackeilles/xygt.git
synced 2024-11-09 16:32:37 +01:00
i dont like writing stuff on the site.
This commit is contained in:
parent
7ecf3c4caf
commit
c4f1e0f531
7 changed files with 162 additions and 11 deletions
|
@ -64,7 +64,7 @@ def index():
|
||||||
# Init variables before they're passed
|
# Init variables before they're passed
|
||||||
userid = request.form.get("userid") if request.form.get("userid") else None
|
userid = request.form.get("userid") if request.form.get("userid") else None
|
||||||
filename = request.form.get("filename") if request.form.get("filename") else None
|
filename = request.form.get("filename") if request.form.get("filename") else None
|
||||||
retention = request.form.get("retention") if request.form.get("retention") else None
|
retention = int(request.form.get("retention")) if request.form.get("retention") else None
|
||||||
id = request.form.get("filename") if Config.files.find_one({"id": filename}) is None else None
|
id = request.form.get("filename") if Config.files.find_one({"id": filename}) is None else None
|
||||||
|
|
||||||
# We got a file or a url?
|
# We got a file or a url?
|
||||||
|
@ -96,6 +96,34 @@ def index():
|
||||||
|
|
||||||
result, status = worker.shortenURL(url, ip, userid, id, retention)
|
result, status = worker.shortenURL(url, ip, userid, id, retention)
|
||||||
|
|
||||||
|
result = "https://xygt.cc/{}".format(result)
|
||||||
|
|
||||||
|
return result, status
|
||||||
|
|
||||||
|
@app.route('/about')
|
||||||
|
def about():
|
||||||
|
return render_template('about.html')
|
||||||
|
|
||||||
|
@app.route('/tos')
|
||||||
|
def tos():
|
||||||
|
return "placeholder"
|
||||||
|
|
||||||
|
@app.route('/privacy')
|
||||||
|
def privacy():
|
||||||
|
return "placeholder"
|
||||||
|
|
||||||
|
@app.route('/faq')
|
||||||
|
def faq():
|
||||||
|
return "placeholder"
|
||||||
|
|
||||||
|
@app.route('/contact')
|
||||||
|
def contact():
|
||||||
|
return "placeholder"
|
||||||
|
|
||||||
|
@app.route('/transparency')
|
||||||
|
def transparency():
|
||||||
|
return "placeholder"
|
||||||
|
|
||||||
@app.route('/<id>')
|
@app.route('/<id>')
|
||||||
def getData(id):
|
def getData(id):
|
||||||
|
|
||||||
|
|
21
app/static/css/style.css
Normal file
21
app/static/css/style.css
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
body {
|
||||||
|
background-color: #000;
|
||||||
|
color: #fff;
|
||||||
|
font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul li {
|
||||||
|
display: inline;
|
||||||
|
margin: 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #fff;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: #fff;
|
||||||
|
text-decoration: double underline;
|
||||||
|
}
|
33
app/templates/about.html
Normal file
33
app/templates/about.html
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1>About</h1>
|
||||||
|
<p>This is xygt.cc, an anonymous, no-bullshit, temporary file hosting and URL shortening solution.</p>
|
||||||
|
<h3>Introduction</h3>
|
||||||
|
<p>xygt.cc was created to help with the problem of massive walls of pasted text being spammed into support chats in Discord, IRC, Slack, etc...</p>
|
||||||
|
<p>It also helps with needing to have a file temporarily hosted somewhere for people to quickly access within a set amount of time.</p>
|
||||||
|
<p>xygt.cc is a free service, and will always be free, with optional donations available with small perks that don't greatly disadvantage paid users.</p>
|
||||||
|
<p>By anonymous and no-bullshit, no data is collected that doesn't need to be collected, and data we do collect can not directly identify you.</p>
|
||||||
|
<br>
|
||||||
|
<h3>How it works</h3>
|
||||||
|
<p>For files, xygt.cc takes the file from the POST request, and writes it directly to a directory located on the server.</p>
|
||||||
|
<p>Alongside this, an entry is made into the self-hosted MongoDB database, storing the filename, file ID, retention, upload date, and expiry date.</p>
|
||||||
|
<p>Optionally a user can also add their userID and IDPass, which will allow them to manage their file from the website and access features after donating.</p>
|
||||||
|
<br>
|
||||||
|
<p>For URL's, xygt.cc takes the URL from the POST request, and first validates it to ensure that the domain is valid and the host is up.</p>
|
||||||
|
<p>It then writes an entry to the self-hosted MongoDB database, storing the URL, ID, retention, upload date, and expiry date.</p>
|
||||||
|
<p>A user can optionally add their userID and IDPass, allowing them to manage their URL from the website.</p>
|
||||||
|
<br>
|
||||||
|
<h3>How to use</h3>
|
||||||
|
<p>xygt.cc can be used in a variety of ways, either through the website, or through a POST request.</p>
|
||||||
|
<p>For example, to upload a file, you can use the following command:</p>
|
||||||
|
<code>curl -F "file=@/path/to/file" https://xygt.cc</code>
|
||||||
|
<p>or for URL's</p>
|
||||||
|
<code>curl -F "url=https://example.com" https://xygt.cc</code>
|
||||||
|
<p>For more information on how to use xygt.cc, please visit the <a href="faq#usage">FAQ</a>.</p>
|
||||||
|
<br>
|
||||||
|
<h3>The creator</h3>
|
||||||
|
<p>xygt.cc was created by Jack Eilles, a 17 year old student from the United Kingdom.</p>
|
||||||
|
<p>I currently study a T-Level DPDD course and I am in my second year.</p>
|
||||||
|
<p>You can find out more about me at <a href="https://eilles.xyz">https://eilles.xyz</a>.</p>
|
||||||
|
{% endblock %}
|
|
@ -2,11 +2,26 @@
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta ref="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>xygt.cc - {{ title }}</title>
|
<title>xygt.cc - {{ title }}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<ul>
|
||||||
|
<li><a href="{{ url_for('index') }}">Home</a></li>
|
||||||
|
<li><a href="{{ url_for('about') }}">About</a></li>
|
||||||
|
<li><a href="{{ url_for('faq') }}">FAQ</a></li>
|
||||||
|
<li><a href="{{ url_for('contact') }}">Contact</a></li>
|
||||||
|
{% if current_user.is_authenticated %}
|
||||||
|
<li><a href="{{ url_for('logout') }}">Logout</a></li>
|
||||||
|
{% else %}
|
||||||
|
<li><a href="{{ url_for('login') }}">Login</a></li>
|
||||||
|
<li><a href="{{ url_for('register') }}">Register</a></li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
<hr>
|
||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
|
<hr>
|
||||||
|
<p>xygt.cc - © Jack Eilles 2023 - <a href="{{ url_for('transparency') }}">Transparency</a> - <a href="{{ url_for('tos') }}">Terms of Service</a> - <a href="{{ url_for('privacy') }}">Privacy Policy</a> </p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -1,12 +1,64 @@
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Home</h1>
|
<h1>xygt.cc</h1>
|
||||||
<!-- Check if the user is logged in -->
|
|
||||||
{% if current_user.is_authenticated %}
|
{% if current_user.is_authenticated %}
|
||||||
<p>Welcome, {{ current_user.user }}!</p>
|
<h5>Welcome, {{ current_user.user }}!</h5>
|
||||||
<p><a href="{{ url_for('logout') }}">Logout</a></p>
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<p><a href="{{ url_for('login') }}">Login</a></p>
|
<h5>Temporary file-hosting and URL shortening</h5>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<p>Welcome to xygt.cc, a no-bullshit, anonymous and temporary file-hosting and URL shortening solution, similar to the likes of pastebin and 0x0.</p>
|
||||||
|
<p>Our default file retention is a minimum of 7 days and a maximum of 365 days, and is calculated using file size.</p>
|
||||||
|
<h3>How do I upload files?</h3>
|
||||||
|
<p>You can either use the `upload` form, or use a POST request.</p>
|
||||||
|
<p>For example, using curl:</p>
|
||||||
|
<code>curl -F "file=@/path/to/file" https://xygt.cc</code>
|
||||||
|
<p>You can also add extra <a href="faq#flags">flags</a> onto your command, for example:</p>
|
||||||
|
<code>curl -F "file=@/path/to/file" -F "retention=1024" -F "userid=6fd12a" -F "idpass=6ad5ec8ff9a14b45"</code>
|
||||||
|
<p>You can pipe plain text into the file flag, for example:</p>
|
||||||
|
<code>echo "Hello, World!" | curl -F "file=@-" https://xygt.cc</code>
|
||||||
|
<br>
|
||||||
|
<form action="/" method="post" enctype="multipart/form-data">
|
||||||
|
<input type="file" name="file" id="file">
|
||||||
|
<input type="number" name="retention" placeholder="Retention (in seconds)">
|
||||||
|
{% if current_user.is_authenticated %}
|
||||||
|
<input type="hidden" name="userid" value="{{ current_user.id }}">
|
||||||
|
<input type="hidden" name="idpass" value="{{ current_user.idpass }}">
|
||||||
|
{% endif %}
|
||||||
|
<input type="submit" value="Upload">
|
||||||
|
</form>
|
||||||
|
<br>
|
||||||
|
<h3>How do I shorten URLs?</h3>
|
||||||
|
<p>You can either use the `shorten` form, or use a POST request.</p>
|
||||||
|
<p>For example, using curl:</p>
|
||||||
|
<code>curl -F "url=https://example.com" https://xygt.cc</code>
|
||||||
|
<p>You can also add extra <a href="faq#flags">flags</a> onto your command, for example:</p>
|
||||||
|
<code>curl -F "url=https://example.com" -F "retention=1024" -F "userid=6fd12a"</code>
|
||||||
|
<br>
|
||||||
|
<form action="/" method="post">
|
||||||
|
<input type="url" name="url" placeholder="URL to shorten">
|
||||||
|
<input type="number" name="retention" placeholder="Retention (in seconds)">
|
||||||
|
{% if current_user.is_authenticated %}
|
||||||
|
<input type="hidden" name="userid" value="{{ current_user.id }}">
|
||||||
|
{% endif %}
|
||||||
|
<input type="submit" value="Shorten!">
|
||||||
|
</form>
|
||||||
|
<br>
|
||||||
|
<h3>How do I view my files or URL's?</h3>
|
||||||
|
<p>Simply use the link that is returned when you submit a POST request.</p>
|
||||||
|
<p>When you upload a file or shorten a URL, you'll simply get this in response:</p>
|
||||||
|
<code>https://xygt.cc/[id]</code>
|
||||||
|
<p>Simply replace [id] with the ID that is returned.</p>
|
||||||
|
<br>
|
||||||
|
<h3>How do I delete my files or URL's?</h3>
|
||||||
|
<p>Your files or URL's can only be removed if you have linked them with your userid.</p>
|
||||||
|
<p>This is either done by appending <code>-F 'userid=6fd12a'</code> or by being logged in when going through the website.</p>
|
||||||
|
<p>You can then go to your <a href="dashboard">dashboard</a> and delete the ID in question using the button next to it.</p>
|
||||||
|
<p>Alternatively you can also use a POST request like this:</p>
|
||||||
|
<code>curl -F'userid=6fd12a' -F'idpass=6ad5ec8ff9a14b45' https://xygt.cc/[id]/delete</code>
|
||||||
|
<br>
|
||||||
|
<h3>Donating</h3>
|
||||||
|
<p>xygt.cc is a free service, and costs me around £75 per year to run.</p>
|
||||||
|
<p>If you'd like to donate, you can do so via Liberapay:</p>
|
||||||
|
<p>liberapay placeholder</p>
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -17,7 +17,7 @@ def uploadFile(file, ip, userid, filename, id, retention):
|
||||||
while True: # Loop to find an available file ID
|
while True: # Loop to find an available file ID
|
||||||
id = randomHex() # Prevent conflicts if 2 of the same get made
|
id = randomHex() # Prevent conflicts if 2 of the same get made
|
||||||
if Config.files.find_one({'id': id}) is None:
|
if Config.files.find_one({'id': id}) is None:
|
||||||
id = filename
|
filename=id
|
||||||
break
|
break
|
||||||
|
|
||||||
if userid == None:
|
if userid == None:
|
||||||
|
@ -32,6 +32,8 @@ def uploadFile(file, ip, userid, filename, id, retention):
|
||||||
retention = (Config.minretention+(-Config.maxretention + Config.minretention)*pow((fileSize / Config.maxFileSize -1), 3))
|
retention = (Config.minretention+(-Config.maxretention + Config.minretention)*pow((fileSize / Config.maxFileSize -1), 3))
|
||||||
elif retention > (Config.minretention+(-Config.maxretention + Config.minretention)*pow((fileSize / Config.maxFileSize -1), 3)):
|
elif retention > (Config.minretention+(-Config.maxretention + Config.minretention)*pow((fileSize / Config.maxFileSize -1), 3)):
|
||||||
retention = (Config.minretention+(-Config.maxretention + Config.minretention)*pow((fileSize / Config.maxFileSize -1), 3))
|
retention = (Config.minretention+(-Config.maxretention + Config.minretention)*pow((fileSize / Config.maxFileSize -1), 3))
|
||||||
|
else:
|
||||||
|
retention = retention
|
||||||
|
|
||||||
|
|
||||||
# Create the file
|
# Create the file
|
||||||
|
@ -92,7 +94,7 @@ def shortenURL(url, ip, userid, id, retention):
|
||||||
Config.url.insert_one(data)
|
Config.url.insert_one(data)
|
||||||
print(Config.url.find_one({"id": data["id"]}))
|
print(Config.url.find_one({"id": data["id"]}))
|
||||||
|
|
||||||
return id
|
return id, 200
|
||||||
|
|
||||||
def idInfo(id):
|
def idInfo(id):
|
||||||
# Check files and url for the ID
|
# Check files and url for the ID
|
||||||
|
|
|
@ -53,14 +53,14 @@ class Errors:
|
||||||
"Your file is too large, get it under 256mb first.",
|
"Your file is too large, get it under 256mb first.",
|
||||||
"I don't know what the hell you're trying to upload but it's over 256mb, so no.",
|
"I don't know what the hell you're trying to upload but it's over 256mb, so no.",
|
||||||
"Your file is over 256mb, remember, we don't store your files forever!",
|
"Your file is over 256mb, remember, we don't store your files forever!",
|
||||||
"File is too big, 265mb is the limit.",
|
"File is too big, 256mb is the limit.",
|
||||||
"nuh uh, too big"
|
"nuh uh, too big"
|
||||||
]
|
]
|
||||||
|
|
||||||
fileTypeNotAllowed = [
|
fileTypeNotAllowed = [
|
||||||
"Nice try idiot. You're not uploading that onto my server.",
|
"Nice try idiot. You're not uploading that onto my server.",
|
||||||
"No executables allowed, NO EXCEPTIONS.",
|
"No executables allowed, NO EXCEPTIONS.",
|
||||||
"So bud... what you trying to do there? You can't upload executables you know.",
|
"So bud... what you trying to do there? You can't upload executables you knob.",
|
||||||
"Nah, not getting that on here today.",
|
"Nah, not getting that on here today.",
|
||||||
"Stop trying to upload executables, goddamnit.",
|
"Stop trying to upload executables, goddamnit.",
|
||||||
"Executables can suck my dick, you're not uploading that"
|
"Executables can suck my dick, you're not uploading that"
|
||||||
|
|
Loading…
Reference in a new issue