From 3944150e6208666c85bf37d65cd1cb5a297fb2c3 Mon Sep 17 00:00:00 2001
From: Riccardo Spagni <ric@spagni.net>
Date: Fri, 2 Jun 2017 13:35:51 +0200
Subject: [PATCH] add GUI to downloads page, add sample nginx config file

---
 _config/nginx.conf  | 243 ++++++++++++++++++++++++++++++++++++++++++++
 _data/downloads.yml |  26 +++--
 downloads/index.md  |  43 ++++++--
 3 files changed, 295 insertions(+), 17 deletions(-)
 create mode 100644 _config/nginx.conf

diff --git a/_config/nginx.conf b/_config/nginx.conf
new file mode 100644
index 00000000..36e0dffd
--- /dev/null
+++ b/_config/nginx.conf
@@ -0,0 +1,243 @@
+# This is included as an example of a config file that works for the site. This is important so that anyone can re-host it in the event of something going wrong with the main site.
+# The main takeaways from this config file are the redirects, everything is relatively bog standard.
+
+server {
+    listen       80;
+    listen       443 ssl http2;
+
+    ssl_certificate      /etc/ssl/certs/ssl-cert-snakeoil.pem;
+    ssl_certificate_key  /etc/ssl/private/ssl-cert-snakeoil.key;
+
+    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
+    ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
+    ssl_prefer_server_ciphers   on;
+
+    # Specify this vhost's domain name
+    server_name updates.getmonero.org downloads.getmonero.org downloads.monero.cc;
+    root /var/www/downloads.getmonero.org/webroot;
+    index index.php index.html index.htm;
+
+    # Specify log locations for current site
+    access_log off;
+    error_log /var/log/nginx/default-site.log warn;
+
+    # Let's not give away too much info:
+    error_page 403 = 404;
+
+    # These are the restrictions I generally have on
+    # Disable logging for favicon
+    location = /favicon.ico {
+        log_not_found off;
+        access_log off;
+    }
+
+    # Disable logging for robots.txt
+    location = /robots.txt {
+        allow all;
+        log_not_found off;
+        access_log off;
+    }
+
+    location ~* \.(ico|css|js|gif|jpe?g|png)$
+    {
+        expires 31536000s;
+        access_log off;
+        log_not_found off;
+        add_header Pragma public;
+        add_header Cache-Control "max-age=31536000, public";
+    }
+
+    # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
+    location ~ /\. {
+        deny all;
+        access_log off;
+        log_not_found off;
+    }
+    # End of general restrictions
+
+    # Downloads!
+    location /win64 {
+        rewrite ^ /cli/monero-win-x64-v0.10.3.1.zip redirect;
+    }
+
+    location /win32 {
+        rewrite ^ /cli/monero-win-x86-v0.10.3.1.zip redirect;
+    }
+
+    location /mac64 {
+        rewrite ^ /cli/monero-mac-x64-v0.10.3.1.tar.bz2 redirect;
+    }
+
+    location /linux64 {
+        rewrite ^ /cli/monero-linux-x64-v0.10.3.1.tar.bz2 redirect;
+    }
+
+    location /linux32 {
+        rewrite ^ /cli/monero-linux-x86-v0.10.3.1.tar.bz2 redirect;
+    }
+
+    location /linuxarm7 {
+        rewrite ^ /cli/monero-linux-armv7-v0.10.3.1.tar.bz2 redirect;
+    }
+
+    location /linuxarm8 {
+        rewrite ^ /cli/monero-linux-armv8-v0.10.3.1.tar.bz2 redirect;
+    }
+
+    location /freebsd64 {
+        rewrite ^ /cli/monero-freebsd-x64-v0.10.3.1.tar.bz2 redirect;
+    }
+
+    location /dragonflybsd64 {
+        rewrite ^ /cli/monero-dragonflybsd-x64-v0.10.3.1.tar.bz2 redirect;
+    }
+    
+    # GUI downloads
+    location /gui/win64 {
+        rewrite ^ /gui/monero-win-x64-v0.10.3.1.zip redirect;
+    }
+
+    location /gui/mac64 {
+        rewrite ^ /gui/monero-mac-x64-v0.10.3.1.tar.bz2 redirect;
+    }
+
+    location /gui/linux64 {
+        rewrite ^ /gui/monero-linux-x64-v0.10.3.1.tar.bz2 redirect;
+    }
+
+    location /gui/inux32 {
+        rewrite ^ /gui/monero-linux-x86-v0.10.3.1.tar.bz2 redirect;
+    }
+
+    # Other download redirects
+    location /cli/win64 {
+        rewrite ^ /win64 permanent;
+    }
+
+    location /cli/win32 {
+        rewrite ^ /win32 permanent;
+    }
+
+    location /cli/mac64 {
+        rewrite ^ /mac64 permanent;
+    }
+
+    location /cli/linux64 {
+        rewrite ^ /linux64 permanent;
+    }
+
+    location /cli/linux32 {
+        rewrite ^ /linux32 permanent;
+    }
+
+    location /cli/linuxarm7 {
+        rewrite ^ /linuxarm7 permanent;
+    }
+
+    location /cli/linuxarm8 {
+        rewrite ^ /linuxarm8 permanent;
+    }
+
+    location /cli/freebsd64 {
+        rewrite ^ /freebsd64 permanent;
+    }
+
+    location /cli/dragonflybsd64 {
+        rewrite ^ /dragonflybsd64 permanent;
+    }
+
+    location /win {
+        rewrite ^ /win64 permanent;
+    }
+
+    location /mac {
+        rewrite ^ /mac64 permanent;
+    }
+
+    location /linux {
+        rewrite ^ /linux64 permanent;
+    }
+
+    location /freebsd {
+        rewrite ^ /freebsd64 permanent;
+    }
+
+    location /dragonflybsd {
+        rewrite ^ /dragonflybsd64 permanent;
+    }
+
+    location /arm {
+        rewrite ^ /linuxarm7 permanent;
+    }
+
+    location /arm64 {
+        rewrite ^ /linuxarm8 permanent;
+    }
+
+    location /arm7 {
+        rewrite ^ /linuxarm7 permanent;
+    }
+
+    location /arm8 {
+        rewrite ^ /linuxarm8 permanent;
+    }
+
+    location /monero.win.x64.latest.zip {
+        rewrite ^ /win64 permanent;
+    }
+
+    location /monero.win.x32.latest.zip {
+        rewrite ^ /win32 permanent;
+    }
+
+    location /monero.mac.x64.latest.tar.bz2 {
+        rewrite ^ /mac64 permanent;
+    }
+
+    location /monero.linux.x64.latest.tar.bz2 {
+        rewrite ^ /linux64 permanent;
+    }
+
+    location /monero.linux.x86.latest.tar.bz2 {
+        rewrite ^ /linux86 permanent;
+    }
+
+    location /monero.linux.arm7.latest.tar.bz2 {
+        rewrite ^ /linuxarm7 permanent;
+    }
+
+    location /monero.linux.arm8.latest.tar.bz2 {
+        rewrite ^ /linuxarm8 permanent;
+    }
+
+    location /monero.freebsd.x64.latest.tar.bz2 {
+        rewrite ^ /freebsd64 permanent;
+    }
+
+    location /monero.dragonflybsd.x64.latest.tar.bz2 {
+        rewrite ^ /dragonflybsd64 permanent;
+    }
+
+    location / {
+        try_files $uri $uri/ $uri.php $uri.htm $uri.html =404;
+        index index.html index.htm index.php;
+    }
+
+    # Block for processing PHP files
+    # Specifically matches URIs ending in .php
+    location ~ \.php$ {
+        try_files $uri =404;
+
+        # Fix for server variables that behave differently under nginx/php-fpm than typically expected
+        fastcgi_split_path_info ^(.+\.php)(/.+)$;
+        # Include the standard fastcgi_params file included with nginx
+        include fastcgi_params;
+        fastcgi_param  PATH_INFO        $fastcgi_path_info;
+        fastcgi_index index.php;
+        # Override the SCRIPT_FILENAME variable set by fastcgi_params
+        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
+        # Pass to upstream PHP-FPM; This must match whatever you name your upstream connection
+        fastcgi_pass phpfpm;
+    }
+
+}
\ No newline at end of file
diff --git a/_data/downloads.yml b/_data/downloads.yml
index 07358175..89743355 100644
--- a/_data/downloads.yml
+++ b/_data/downloads.yml
@@ -1,7 +1,9 @@
 - platform: Windows, 64-bit
   icon: windows.svg
   cli_url: win64
-  hash: 2fbda6f6b1051053703e40cf77b6c6e11334509ad03a3c22d89b6bcb05615910
+  cli_hash: 2fbda6f6b1051053703e40cf77b6c6e11334509ad03a3c22d89b6bcb05615910
+  gui_url: win64
+  gui_hash: 0eddd423f5f0df236303d8b9225842142b331093eb69e6183f3f694238c371a7
   version: 0.10.3.1
   tag: Wolfram Warptangent
   blockchain: win
@@ -9,7 +11,7 @@
 - platform: Windows, 32-bit
   icon: windows.svg
   cli_url: win32
-  hash: da628a45adfcb8be44df06ac904711d644d608c4eb6479a5d256062a5f6d74de
+  cli_hash: da628a45adfcb8be44df06ac904711d644d608c4eb6479a5d256062a5f6d74de
   version: 0.10.3.1
   tag: Wolfram Warptangent
   blockchain: win
@@ -17,7 +19,9 @@
 - platform: Mac OS X, 64-bit
   icon: apple.svg
   cli_url: mac64
-  hash: fd17d55a8c9e901ff4064c39d9e14786cdd077aff9b3bb556e60d3a5e322050c
+  cli_hash: fd17d55a8c9e901ff4064c39d9e14786cdd077aff9b3bb556e60d3a5e322050c
+  gui_url: mac64
+  gui_hash: c80ca68037158216a080e59e90b0a70761cff2f317d3c9cd0eeb661e8e2a1f99
   version: 0.10.3.1
   tag: Wolfram Warptangent
   blockchain: mac
@@ -25,7 +29,9 @@
 - platform: Linux, 64-bit
   icon: linux.svg
   cli_url: linux64
-  hash: 8db80f8cc4f80d4106db807432828df730a59eac78972ea81652aa6b9bac04ad
+  cli_hash: 8db80f8cc4f80d4106db807432828df730a59eac78972ea81652aa6b9bac04ad
+  gui_url: linux64
+  gui_hash: 4915473265d58720fd8f019e536c2b7fb02648ab51a8087e84aa1e2434788452
   version: 0.10.3.1
   tag: Wolfram Warptangent
   blockchain: linux
@@ -33,7 +39,9 @@
 - platform: Linux, 32-bit
   icon: linux.svg
   cli_url: linux32
-  hash: abc99f3928f4083bd1a380a869253e07bee9950e0aeb6388e9493bc0f0ec3f53
+  cli_hash: abc99f3928f4083bd1a380a869253e07bee9950e0aeb6388e9493bc0f0ec3f53
+  gui_url: linux32
+  gui_hash: 092b49080c3380666845f7f39823b09f4960ea1e250b84b150856ef33ca30690
   version: 0.10.3.1
   tag: Wolfram Warptangent
   blockchain: linux
@@ -41,7 +49,7 @@
 - platform: ARMv7
   icon: arm.svg
   cli_url: linuxarm7
-  hash: 8473fa20e0db4a3d3e46120cdf92c55be6a159478c511e21f7b77aa05d6c1910
+  cli_hash: 8473fa20e0db4a3d3e46120cdf92c55be6a159478c511e21f7b77aa05d6c1910
   version: 0.10.3.1
   tag: Wolfram Warptangent
   blockchain: arm
@@ -49,7 +57,7 @@
 - platform: ARMv8
   icon: arm.svg
   cli_url: linuxarm8
-  hash: 451f65e4846b92d54859e22a5d92124557b397b4208d8752d5289d0262573c3c
+  cli_hash: 451f65e4846b92d54859e22a5d92124557b397b4208d8752d5289d0262573c3c
   version: 0.10.3.1
   tag: Wolfram Warptangent
   blockchain: arm
@@ -57,7 +65,7 @@
 - platform: FreeBSD, 64-bit
   icon: freebsd.svg
   cli_url: freebsd64
-  hash: 4c66a76752e18ae70b5fb1c728f0d2780eb129a6c8c7d0dee7ba02e05d91efae
+  cli_hash: 4c66a76752e18ae70b5fb1c728f0d2780eb129a6c8c7d0dee7ba02e05d91efae
   version: 0.10.3.1
   tag: Wolfram Warptangent
   blockchain: freebsd
@@ -65,5 +73,5 @@
 - platform: Source Code
   icon: github.svg
   cli_url: https://github.com/monero-project/bitmonero
-  hash: source
+  cli_hash: source
   version: Bleeding edge (possibly unstable)
\ No newline at end of file
diff --git a/downloads/index.md b/downloads/index.md
index f793a7e2..4874dd53 100644
--- a/downloads/index.md
+++ b/downloads/index.md
@@ -21,7 +21,7 @@ Note: the SHA256 hashes are listed by the downloads for convenience, but a GPG-s
 
 {% for data_downloads in site.data.downloads %}
 
-{% if data_downloads.hash == "source" %}
+{% if data_downloads.cli_hash == "source" %}
 
 <div class="col-lg-6" style="padding-bottom: 5px;">
 
@@ -36,32 +36,59 @@ Note: the SHA256 hashes are listed by the downloads for convenience, but a GPG-s
 
 </div>
 
-{% elsif data_downloads.hash == "none" %}
+{% elsif data_downloads.gui_hash == nil and data_downloads.cli_hash != nil %}
 
 <div class="col-lg-6" style="padding-bottom: 5px;">
 
 <h4 id="{{ data_downloads.platform | slugify }}">
-  <img src="//static.getmonero.org/images/platforms/{{ data_downloads.icon }}" style="height: 30px;"> {{ data_downloads.platform }}
+ <a href="//downloads.getmonero.org/cli/{{ data_downloads.cli_url }}">
+  <img src="//static.getmonero.org/images/platforms/{{ data_downloads.icon }}" style="height: 30px;"> {{ data_downloads.platform }} (Command-line Tools Only)
+ </a>
 </h4>
 
-<br>
-<strong>Coming Soon</strong><br>
+<strong>Current Version:</strong> {{ data_downloads.version }} <em>{{ data_downloads.tag }}</em><br>
+<strong>SHA256 Hash:</strong> {{ data_downloads.cli_hash }}<br>
 <hr>
 
 </div>
 
-{% else %}
+{% elsif data_downloads.gui_hash != nil and data_downloads.cli_hash == nil %}
 
 <div class="col-lg-6" style="padding-bottom: 5px;">
 
+<h4 id="{{ data_downloads.platform | slugify }}">
+ <a href="//downloads.getmonero.org/gui/{{ data_downloads.gui_url }}">
+  <img src="//static.getmonero.org/images/platforms/{{ data_downloads.icon }}" style="height: 30px;"> {{ data_downloads.platform }} (Beta 2)
+ </a>
+</h4>
+
+<strong>Current Version:</strong> {{ data_downloads.version }} <em>{{ data_downloads.tag }}</em><br>
+<strong>SHA256 Hash:</strong> {{ data_downloads.gui_hash }}<br>
+<hr>
+
+</div>
+
+{% elsif data_downloads.gui_hash != nil and data_downloads.cli_hash != nil %}
+
+<div class="col-lg-6" style="padding-bottom: 5px;">
+
+<h4 id="{{ data_downloads.platform | slugify }}">
+ <a href="//downloads.getmonero.org/gui/{{ data_downloads.gui_url }}">
+  <img src="//static.getmonero.org/images/platforms/{{ data_downloads.icon }}" style="height: 30px;"> {{ data_downloads.platform }} (Beta 2)
+ </a>
+</h4>
+
 <h4 id="{{ data_downloads.platform | slugify }}">
  <a href="//downloads.getmonero.org/cli/{{ data_downloads.cli_url }}">
-  <img src="//static.getmonero.org/images/platforms/{{ data_downloads.icon }}" style="height: 30px;"> {{ data_downloads.platform }}
+  <img src="//static.getmonero.org/images/platforms/{{ data_downloads.icon }}" style="height: 30px;"> {{ data_downloads.platform }} (Command-Line Tools Only)
  </a>
 </h4>
 
 <strong>Current Version:</strong> {{ data_downloads.version }} <em>{{ data_downloads.tag }}</em><br>
-<strong>SHA256 Hash:</strong> {{ data_downloads.hash }}<br>
+<strong>SHA256 Hash (GUI):</strong> {{ data_downloads.gui_hash }}<br>
+<strong>SHA256 Hash (CLI):</strong> {{ data_downloads.cli_hash }}<br>
+
+
 <hr>
 
 </div>
-- 
GitLab