From c4f1e0f531b8f1c543983cf5b9c5fbf325b02a16 Mon Sep 17 00:00:00 2001 From: Jack Eilles Date: Fri, 29 Dec 2023 19:47:28 +0000 Subject: [PATCH] i dont like writing stuff on the site. --- app/routes.py | 30 ++++++++++++++++++- app/static/css/style.css | 21 ++++++++++++++ app/templates/about.html | 33 +++++++++++++++++++++ app/templates/base.html | 17 ++++++++++- app/templates/index.html | 62 ++++++++++++++++++++++++++++++++++++---- app/worker.py | 6 ++-- config.py | 4 +-- 7 files changed, 162 insertions(+), 11 deletions(-) create mode 100644 app/static/css/style.css create mode 100644 app/templates/about.html diff --git a/app/routes.py b/app/routes.py index 14085a2..e411322 100644 --- a/app/routes.py +++ b/app/routes.py @@ -64,7 +64,7 @@ def index(): # Init variables before they're passed userid = request.form.get("userid") if request.form.get("userid") 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 # We got a file or a url? @@ -96,6 +96,34 @@ def index(): 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('/') def getData(id): diff --git a/app/static/css/style.css b/app/static/css/style.css new file mode 100644 index 0000000..4845c7f --- /dev/null +++ b/app/static/css/style.css @@ -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; +} \ No newline at end of file diff --git a/app/templates/about.html b/app/templates/about.html new file mode 100644 index 0000000..00c1d93 --- /dev/null +++ b/app/templates/about.html @@ -0,0 +1,33 @@ +{% extends 'base.html' %} + +{% block content %} +

About

+

This is xygt.cc, an anonymous, no-bullshit, temporary file hosting and URL shortening solution.

+

Introduction

+

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...

+

It also helps with needing to have a file temporarily hosted somewhere for people to quickly access within a set amount of time.

+

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.

+

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.

+
+

How it works

+

For files, xygt.cc takes the file from the POST request, and writes it directly to a directory located on the server.

+

Alongside this, an entry is made into the self-hosted MongoDB database, storing the filename, file ID, retention, upload date, and expiry date.

+

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.

+
+

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.

+

It then writes an entry to the self-hosted MongoDB database, storing the URL, ID, retention, upload date, and expiry date.

+

A user can optionally add their userID and IDPass, allowing them to manage their URL from the website.

+
+

How to use

+

xygt.cc can be used in a variety of ways, either through the website, or through a POST request.

+

For example, to upload a file, you can use the following command:

+ curl -F "file=@/path/to/file" https://xygt.cc +

or for URL's

+ curl -F "url=https://example.com" https://xygt.cc +

For more information on how to use xygt.cc, please visit the FAQ.

+
+

The creator

+

xygt.cc was created by Jack Eilles, a 17 year old student from the United Kingdom.

+

I currently study a T-Level DPDD course and I am in my second year.

+

You can find out more about me at https://eilles.xyz.

+{% endblock %} \ No newline at end of file diff --git a/app/templates/base.html b/app/templates/base.html index ca56dc9..30a65f3 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -2,11 +2,26 @@ - + xygt.cc - {{ title }} + +
{% block content %}{% endblock %} +
+

xygt.cc - © Jack Eilles 2023 - Transparency - Terms of Service - Privacy Policy

\ No newline at end of file diff --git a/app/templates/index.html b/app/templates/index.html index f7bfef5..2b17fa0 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -1,12 +1,64 @@ {% extends 'base.html' %} {% block content %} -

Home

- +

xygt.cc

{% if current_user.is_authenticated %} -

Welcome, {{ current_user.user }}!

-

Logout

+
Welcome, {{ current_user.user }}!
{% else %} -

Login

+
Temporary file-hosting and URL shortening
{% endif %} +

Welcome to xygt.cc, a no-bullshit, anonymous and temporary file-hosting and URL shortening solution, similar to the likes of pastebin and 0x0.

+

Our default file retention is a minimum of 7 days and a maximum of 365 days, and is calculated using file size.

+

How do I upload files?

+

You can either use the `upload` form, or use a POST request.

+

For example, using curl:

+ curl -F "file=@/path/to/file" https://xygt.cc +

You can also add extra flags onto your command, for example:

+ curl -F "file=@/path/to/file" -F "retention=1024" -F "userid=6fd12a" -F "idpass=6ad5ec8ff9a14b45" +

You can pipe plain text into the file flag, for example:

+ echo "Hello, World!" | curl -F "file=@-" https://xygt.cc +
+
+ + + {% if current_user.is_authenticated %} + + + {% endif %} + +
+
+

How do I shorten URLs?

+

You can either use the `shorten` form, or use a POST request.

+

For example, using curl:

+ curl -F "url=https://example.com" https://xygt.cc +

You can also add extra flags onto your command, for example:

+ curl -F "url=https://example.com" -F "retention=1024" -F "userid=6fd12a" +
+
+ + + {% if current_user.is_authenticated %} + + {% endif %} + +
+
+

How do I view my files or URL's?

+

Simply use the link that is returned when you submit a POST request.

+

When you upload a file or shorten a URL, you'll simply get this in response:

+ https://xygt.cc/[id] +

Simply replace [id] with the ID that is returned.

+
+

How do I delete my files or URL's?

+

Your files or URL's can only be removed if you have linked them with your userid.

+

This is either done by appending -F 'userid=6fd12a' or by being logged in when going through the website.

+

You can then go to your dashboard and delete the ID in question using the button next to it.

+

Alternatively you can also use a POST request like this:

+ curl -F'userid=6fd12a' -F'idpass=6ad5ec8ff9a14b45' https://xygt.cc/[id]/delete +
+

Donating

+

xygt.cc is a free service, and costs me around £75 per year to run.

+

If you'd like to donate, you can do so via Liberapay:

+

liberapay placeholder

{% endblock %} \ No newline at end of file diff --git a/app/worker.py b/app/worker.py index 2afce8c..a1882e3 100644 --- a/app/worker.py +++ b/app/worker.py @@ -17,7 +17,7 @@ def uploadFile(file, ip, userid, filename, id, retention): while True: # Loop to find an available file ID id = randomHex() # Prevent conflicts if 2 of the same get made if Config.files.find_one({'id': id}) is None: - id = filename + filename=id break 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)) 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)) + else: + retention = retention # Create the file @@ -92,7 +94,7 @@ def shortenURL(url, ip, userid, id, retention): Config.url.insert_one(data) print(Config.url.find_one({"id": data["id"]})) - return id + return id, 200 def idInfo(id): # Check files and url for the ID diff --git a/config.py b/config.py index 937f590..4683608 100644 --- a/config.py +++ b/config.py @@ -53,14 +53,14 @@ class Errors: "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.", "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" ] fileTypeNotAllowed = [ "Nice try idiot. You're not uploading that onto my server.", "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.", "Stop trying to upload executables, goddamnit.", "Executables can suck my dick, you're not uploading that"