about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-11-06 18:35:46 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-11-06 18:35:46 +0100
commit3ab193bc3f40c0336a16dd21c3f3dc66eb86a842 (patch)
tree9c54d60768da30e3726936ef88d69874802fbceb
parent93212bc2c45eb06bdb1eb1f05a69701001a2a1fb (diff)
Adding optional S3, fail-mastodon
-rw-r--r--Gemfile1
-rw-r--r--Gemfile.lock8
-rw-r--r--config/initializers/paperclip.rb10
-rw-r--r--public/500.html71
-rw-r--r--public/oops.pngbin0 -> 120305 bytes
5 files changed, 42 insertions, 48 deletions
diff --git a/Gemfile b/Gemfile
index 917b3d294..fc5dce72b 100644
--- a/Gemfile
+++ b/Gemfile
@@ -18,6 +18,7 @@ gem 'font-awesome-rails'
 
 gem 'paperclip', '~> 4.3'
 gem 'paperclip-av-transcoder'
+gem 'aws-sdk', '~> 2.3'
 
 gem 'http'
 gem 'httplog'
diff --git a/Gemfile.lock b/Gemfile.lock
index ae163a1b2..f3ec10c0a 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -44,6 +44,12 @@ GEM
     ast (2.3.0)
     av (0.9.0)
       cocaine (~> 0.5.3)
+    aws-sdk (2.6.18)
+      aws-sdk-resources (= 2.6.18)
+    aws-sdk-core (2.6.18)
+      jmespath (~> 1.0)
+    aws-sdk-resources (2.6.18)
+      aws-sdk-core (= 2.6.18)
     babel-source (5.8.35)
     babel-transpiler (0.7.0)
       babel-source (>= 4.0, < 6)
@@ -139,6 +145,7 @@ GEM
     jbuilder (2.6.0)
       activesupport (>= 3.0.0, < 5.1)
       multi_json (~> 1.2)
+    jmespath (1.3.1)
     jquery-rails (4.1.1)
       rails-dom-testing (>= 1, < 3)
       railties (>= 4.2.0)
@@ -374,6 +381,7 @@ PLATFORMS
 DEPENDENCIES
   active_record_query_trace
   addressable
+  aws-sdk (~> 2.3)
   better_errors
   binding_of_caller
   browserify-rails
diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb
new file mode 100644
index 000000000..73eb3356b
--- /dev/null
+++ b/config/initializers/paperclip.rb
@@ -0,0 +1,10 @@
+if ENV['S3_ENABLED'] == 'true'
+  Paperclip::Attachment.default_options[:storage] = :s3
+
+  Paperclip::Attachment.default_options[:s3_credentials] = {
+    bucket: ENV.fetch('S3_BUCKET'),
+    access_key_id: ENV.fetch('AWS_ACCESS_KEY_ID'),
+    secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY'),
+    s3_region: ENV.fetch('S3_REGION')
+  }
+end
diff --git a/public/500.html b/public/500.html
index af46b8a5a..aa18fc722 100644
--- a/public/500.html
+++ b/public/500.html
@@ -2,66 +2,41 @@
 <html lang="en">
 <head>
   <meta charset="utf-8">
-  <title>We're sorry, but something went wrong (500)</title>
+  <title>We're sorry, but something went wrong</title>
   <meta name="viewport" content="width=device-width,initial-scale=1">
+  <link href="https://fonts.googleapis.com/css?family=Roboto:400" rel="stylesheet">
   <style>
-  body {
-    background-color: #EFEFEF;
-    color: #2E2F30;
-    text-align: center;
-    font-family: arial, sans-serif;
-    margin: 0;
-  }
+    body {
+      font-family: 'Roboto', sans-serif;
+      background: #282c37;
+      color: #9baec8;
+      text-align: center;
+      margin: 0;
+      padding: 20px;
+    }
 
-  div.dialog {
-    width: 95%;
-    max-width: 33em;
-    margin: 4em auto 0;
-  }
+    .dialog img {
+      display: block;
+      margin: 20px auto;
+      margin-top: 50px;
+      max-width: 600px;
+      height: auto;
+    }
 
-  div.dialog > div {
-    border: 1px solid #CCC;
-    border-right-color: #999;
-    border-left-color: #999;
-    border-bottom-color: #BBB;
-    border-top: #B00100 solid 4px;
-    border-top-left-radius: 9px;
-    border-top-right-radius: 9px;
-    background-color: white;
-    padding: 7px 12% 0;
-    box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
-  }
-
-  h1 {
-    font-size: 100%;
-    color: #730E15;
-    line-height: 1.5em;
-  }
-
-  div.dialog > p {
-    margin: 0 0 1em;
-    padding: 1em;
-    background-color: #F7F7F7;
-    border: 1px solid #CCC;
-    border-right-color: #999;
-    border-left-color: #999;
-    border-bottom-color: #999;
-    border-bottom-left-radius: 4px;
-    border-bottom-right-radius: 4px;
-    border-top-color: #DADADA;
-    color: #666;
-    box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
-  }
+    .dialog h1 {
+      font: 20px/28px 'Roboto', sans-serif;
+      font-weight: 400;
+    }
   </style>
 </head>
 
 <body>
-  <!-- This file lives in public/500.html -->
   <div class="dialog">
+    <img src="oops.png" alt="Mastodon" />
+
     <div>
       <h1>We're sorry, but something went wrong.</h1>
     </div>
-    <p>If you are the application owner check the logs for more information.</p>
   </div>
 </body>
 </html>
diff --git a/public/oops.png b/public/oops.png
new file mode 100644
index 000000000..0abddad3e
--- /dev/null
+++ b/public/oops.png
Binary files differ