This commit is contained in:
Dominic Harris 2022-03-13 17:48:40 -04:00
parent 4a2f320fa5
commit defb5fea3b
No known key found for this signature in database
GPG Key ID: 93CCF85F3E2A4F65
23 changed files with 45 additions and 24 deletions

0
.github/ISSUE_TEMPLATE/01_bug-report.md vendored Normal file → Executable file
View File

0
.github/ISSUE_TEMPLATE/02_feature-request.md vendored Normal file → Executable file
View File

0
.github/ISSUE_TEMPLATE/03_public_instance.md vendored Normal file → Executable file
View File

0
.gitignore vendored Normal file → Executable file
View File

0
LICENSE Normal file → Executable file
View File

2
README.md Normal file → Executable file
View File

@ -55,7 +55,7 @@ Backend: <a href="https://actix.rs/"><img src="https://pool.jortage.com/voringme
### Steps
1. `git clone https://github.com/Domterion/zer0bin && cd zer0bin`
2. `cp example.nginx /etc/nginx/sites-avaliable/yoursite.tld`, edit as appropriate, `sudo cp /etc/nginx/sites-avaliable/yoursite.tld /etc/nginx/sites-enabled/yoursite.tld && systemctl nginx restart`
2. `cp example.nginx /etc/nginx/sites-avaliable/yoursite.tld`, edit as appropriate, `sudo ln -s /etc/nginx/sites-avaliable/yoursite.tld /etc/nginx/sites-enabled/yoursite.tld && systemctl nginx restart`
3. `psql -d postgres`
4. `CREATE DATABASE zer0bin;` and `\c zer0bin`
5. Paste contents of `schema.sql` and `\q`

0
backend/Cargo.lock generated Normal file → Executable file
View File

0
backend/Cargo.toml Normal file → Executable file
View File

0
backend/config.example.json Normal file → Executable file
View File

0
backend/src/config.rs Normal file → Executable file
View File

0
backend/src/main.rs Normal file → Executable file
View File

0
backend/src/models.rs Normal file → Executable file
View File

50
example.nginx Normal file → Executable file
View File

@ -8,41 +8,61 @@ server {
}
server {
add_header Access-Control-Allow-Origin *;
listen 80;
server_name example.tld www.example.tld;
server_name example.tld;
root /location/to/zer0bin/frontend/dist;
index index.html;
rewrite ^/~/(.*)$ /index.html;
location / {
index index.html;
}
location ~ \.(css|js|html) {
try_files $uri =404;
}
location ^~ /.well-known/ {
alias /var/www/.well-known/;
}
location /api/ {
}
location /api/ {
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Origin' '*';
proxy_pass http://localhost:8000/;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
}
server {
add_header Access-Control-Allow-Origin *;
listen 443 ssl;
server_name example.tld www.example.tld;
listen 443;
server_name example.tld;
root /location/to/zer0bin/frontend/dist;
index index.html;
rewrite ^/~/(.*)$ /index.html;
location / {
index index.html;
}
location ~ \.(css|js|html) {
try_files $uri =404;
}
location ^~ /.well-known/ {
alias /var/www/.well-known/;
}
location /api/ {
}
location /api/ {
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Origin' '*';
proxy_pass http://localhost:8000/;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
#ssl_certificate /etc/letsencrypt/live/example.tld/fullchain.pem;
#ssl_certificate_key /etc/letsencrypt/live/example.tld/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
}

0
frontend/config.example.json Normal file → Executable file
View File

0
frontend/css/rosepine.min.css vendored Normal file → Executable file
View File

5
frontend/css/style.css Normal file → Executable file
View File

@ -25,7 +25,7 @@ pre {
text-align: end;
user-select: none;
font-size: 15px;
padding-right: 15px;
padding-right: 8px;
}
#code-view-pre {
@ -83,7 +83,7 @@ a:visited {
color: #c4a7e7;
}
a:hover :not(.logo){
a:hover :not(.logo) {
color: #9ccfd8;
}
@ -165,4 +165,3 @@ a:hover :not(.logo){
background-position: 100% 0;
}
}

0
frontend/favicon.ico Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

4
frontend/index.html Normal file → Executable file
View File

@ -35,7 +35,7 @@
/>
<!-- We cant move this, we can split the on document stuff into here but yeah -->
<script type="module" src="src/index.js"></script>
<script defer type="module" src="src/index.js"></script>
</head>
<body>
@ -47,7 +47,7 @@
<button id="save-button" class="btn"></button>
<button id="new-button" class="btn"></button>
<a href="https://github.com/Domterion/zer0bin">
<button class="btn" id="github-button"></button>
<button class="btn" id="github-button"></button>
</a>
</div>
</div>

0
frontend/package.json Normal file → Executable file
View File

8
frontend/src/index.js Normal file → Executable file
View File

@ -1,4 +1,4 @@
const $ = require( "jquery" );
const $ = require("jquery");
const config = require("../config.json");
const apiUrl = config.api_url;
@ -155,7 +155,7 @@ saveButton.click(function () {
if (err) {
addMessage(err["data"]["message"]);
} else {
window.history.pushState(null, null, `/${res["data"]["id"]}`);
window.history.pushState(null, null, `/~/${res["data"]["id"]}`);
viewPaste(editor.val());
}
});
@ -171,7 +171,9 @@ function handlePopstate(event) {
if (path == "/") {
newPaste();
} else {
const id = path.substring(1, path.length);
const split = path.split("/");
const id = split[split.length - 1];
getPaste(id, function (err, res) {
if (err) {

0
schema.sql Normal file → Executable file
View File

0
zer0bin.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 710 B

After

Width:  |  Height:  |  Size: 710 B

0
zero.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB