Added error display for users

This commit is contained in:
Jesper Wrang 2017-09-12 00:22:59 +02:00
parent ea95f47398
commit 81ba2b8343
4 changed files with 17 additions and 13 deletions

View file

@ -39,7 +39,7 @@ add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
```
In the same file you also want to change `gzip on` to `gzip off`. (read more [here](https://github.com/h5bp/server-configs-nginx/issues/72))
In the same file you also want to change `gzip on` to `gzip off` (read more [here](https://github.com/h5bp/server-configs-nginx/issues/72)).
## Nginx server config
Copy the ssl config and create a soft link. Create folder for logs and also remove the default config
@ -50,7 +50,7 @@ sudo mkdir /var/log/nginx/removeddit
sudo rm /etc/nginx/sites-enabled/default
```
Change the "server_name" in the config to your domain name.
Change both the "server_name" in the config to your domain name.
## SSL with Let's encrypt
Read the full guide [here](https://certbot.eff.org/#ubuntutyakkety-nginx). Start of by installing the Let's Encrypt client [certbot](https://certbot.eff.org/)
@ -64,7 +64,7 @@ sudo apt install -y python-certbot-nginx
Copy the Let's Encrypt config file for our site
```
sudo mkdir /etc/letsencrypt/configs
cp /var/www/removeddit/config/letsencrypt /etc/letsencrypt/config/removeddit.com.conf
cp /var/www/removeddit/config/letsencrypt /etc/letsencrypt/configs/removeddit.com.conf
```
In this config file you change the domains you want and a email for when the certificates are close to expiring.
@ -72,7 +72,7 @@ In this config file you change the domains you want and a email for when the cer
This is when the webmasters start praying to God Almighty, for only He can deside the fate of the certbot.
Forgive me, Father, for I have sinned. Just don't fuck up certs you asshole.
```
sudo certbot --nginx certonly
sudo certbot --config /etc/letsencrypt/configs/removeddit.com.conf certonly
```
You'll now have a valid SSL certificate (hopefully)! You might have to edit the path for `ssl_certificate` and `ssl_certificate_key` in `/etc/nginx/sites-available/removeddit.com` depending on where the certs are located. (Should be in `/etc/letsencrypt/live/`)

View file

@ -4,7 +4,7 @@ server {
root /var/www/removeddit;
index index.html;
server_name removeddit.com;
server_name removeddit.com www.removeddit.com;
access_log /var/log/nginx/removeddit/access.log;
error_log /var/log/nginx/removeddit/error.log;
@ -28,6 +28,7 @@ server {
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name removeddit.com www.removeddit.com;
location / {
return 301 https://$host$request_uri;
@ -36,4 +37,4 @@ server {
location ~ /.well-known {
allow all;
}
}
}

BIN
static/error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -3,6 +3,12 @@
const markdown = SnuOwnd.getParser()
const htmlParser = new DOMParser();
const mainDiv = document.getElementById("main")
const loadingText = document.getElementById("loading-text")
const statusImage = document.getElementById("loading-image")
const doneImageSrc = "/static/done.png"
const errorImageSrc = "/static/error.png"
const pathname = window.location.pathname.split("/")
// Just fucking crach if the user is retarded
@ -20,12 +26,6 @@ const redditSingleCommentURL = `https://oauth.reddit.com/r/${subreddit}/api/info
const pushshiftIDsURL = `https://api.pushshift.io/reddit/submission/comment_ids/${threadID}`
const pushshiftCommentsURL = "https://api.pushshift.io/reddit/comment/search?ids="
const mainDiv = document.getElementById("main")
const loadingText = document.getElementById("loading-text")
const statusImage = document.getElementById("loading-image")
const doneImageSrc = "/static/done.png"
const errorImageSrc = "/static/error.png"
// I actually haven't found a better way of doing this...
// Imgur has image-links with no indication that they are actually images
const imageHosts = ["i.redd.it", "flickr.com", "i.imgur.com", "imgur.com", "m.imgur.com"]
@ -57,7 +57,10 @@ let redditInit = {
headers: { "Authorization": "" }
}
loadPage()
// Start loading the page
if(threadID !== undefined) {
loadPage()
}
// Maybe a little to long a function...
async function loadPage() {