A simple local pastebin cum link-shortener client made in Godot. Dead simple. Almost fatally so.
After the applet loads:
- Select the random file name algorithm you would like and how long the link should be
- Select whether you're pasting text or using it like a link shortener
- Define a custom file name if you wish
- Paste the content or the link you're trying to shorten.
- Click Submit.
- The prompts on the screen should tell you whether the request was successful or not.
In theory any API end point could be made to work if you configure the client right.
- Get Python Flask and Python Gunicorn (
flask
andgunicorn
) - Get Python Flask CORS (
flask-cors
) - Script your API, or use this example API
If you want maximum compatibility with the client without having to rescript it:
- The client sends out a dictionary in the Request that contains
filename
,content
andis_link
.filename
is the name of the paste.content
is the paste content itself, or the link to redirect to ifis_link
is enabled. - The server sends back a dictionary containing
error
,success
,filename
,link
andcode
.code
can be used to pre-write error messages.error
contains an apt description of an error. If no error took place, this is empty.success
notifies that the request took place successfully.filename
returns the file name in case of an error.link
returns the link of the pasted URL.
- Get Godot
4.4
. - Clone this repository using
git clone https://github.com/WinnerWind/godot-pastebin/
- Open Godot in that folder.
- Create folder
secrets
in the project root. - Create file
url.txt
in yoursecrets
folder. - Put the URL as it is in that file.
- Export for web, for desktop, for whatever.
Simply host the directory in which all your pastes are outputted. An example way of doing this using NGINX is:
server {
server_name pastes.example.com;
location / {
root /path/to/paste;
rewrite ^(/.*)\.html(\?.*)?$ $1$2 permanent; #Gets rid of trailing .html
try_files $uri $uri.html $uri/ =404;
}
}
By default the client ships with 3 themes. The main.tscn
comes with a Theme Generator node which can be used to re-color the current theme with minimal effort.