about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-03-25 16:10:14 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-03-25 16:10:14 +0100
commit5764d52b04b04381d52896737eb2ffdfe1f87cfd (patch)
treecf8d3b6a1706df893bea320ac590ed0e73afc94f
parentbb98ee489d096c438d3e299deb15e47dfe9b5bff (diff)
Fix Sidekiq pooling issues. Remove API docs from homepage, replace with
a basic home timeline
-rw-r--r--app/assets/stylesheets/dashboard.scss150
-rw-r--r--app/controllers/home_controller.rb1
-rw-r--r--app/views/home/index.html.haml112
-rw-r--r--app/views/layouts/dashboard.html.haml5
-rw-r--r--config/database.yml2
-rw-r--r--config/initializers/sidekiq.rb9
6 files changed, 90 insertions, 189 deletions
diff --git a/app/assets/stylesheets/dashboard.scss b/app/assets/stylesheets/dashboard.scss
index d8f26f6c5..8d451e174 100644
--- a/app/assets/stylesheets/dashboard.scss
+++ b/app/assets/stylesheets/dashboard.scss
@@ -124,97 +124,97 @@
     background: #d9e1e8;
     border-radius: 0 4px 4px 0;
 
-    .dashboard__content__content {
-      padding: 20px;
-      color: #282c37;
-      line-height: 18px;
-
-      h3 {
-        font-size: 14px;
-        font-weight: 500;
-        margin-bottom: 15px;
-      }
+    .dashboard__top-bar {
+      border-radius: 0 4px 0 0;
+    }
+  }
+}
 
-      p {
-        margin-bottom: 15px;
-      }
+.dashboard__content__content {
+  padding: 20px;
+  color: #282c37;
+  line-height: 18px;
 
-      samp {
-        font-family: 'Roboto Mono', monospace;
-      }
+  h3 {
+    font-size: 14px;
+    font-weight: 500;
+    margin-bottom: 15px;
+  }
 
-      ul {
-        list-style: circle;
-        padding-left: 15px;
-        margin-bottom: 15px;
-      }
+  p {
+    margin-bottom: 15px;
+  }
 
-      .table {
-        width: 100%;
+  samp {
+    font-family: 'Roboto Mono', monospace;
+  }
 
-        th {
-          font-weight: 500;
-          text-align: left;
-          border-bottom: 1px solid lighten(#282c37, 55%);
-        }
+  ul {
+    list-style: circle;
+    padding-left: 15px;
+    margin-bottom: 15px;
+  }
 
-        th, td {
-          padding: 5px 0;
-          line-height: 18px;
-        }
-      }
+  .table {
+    width: 100%;
 
-      a {
-        color: #2b90d9;
-        text-decoration: underline;
+    th {
+      font-weight: 500;
+      text-align: left;
+      border-bottom: 1px solid lighten(#282c37, 55%);
+    }
 
-        &:hover {
-          text-decoration: none;
-        }
-      }
+    th, td {
+      padding: 5px 0;
+      line-height: 18px;
+    }
+  }
 
-      .btn {
-        display: inline-block;
-        border: 0;
-        background: #2b90d9;
-        border-radius: 16px;
-        padding: 6px 16px;
-        font-size: 12px;
-        font-weight: 500;
-        color: #fff;
-        cursor: pointer;
-        font-family: 'Roboto', sans-serif;
-        text-decoration: none;
+  a {
+    color: #2b90d9;
+    text-decoration: underline;
 
-        &:hover {
-          background: lighten(#2b90d9, 5%);
-        }
+    &:hover {
+      text-decoration: none;
+    }
+  }
 
-        &.btn-iconized {
-          font-size: 16px;
-          font-weight: 400;
-          width: 24px;
-          text-align: center;
-          padding: 10px 7px;
-          border-radius: 100px;
-          box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
-        }
-      }
+  .btn {
+    display: inline-block;
+    border: 0;
+    background: #2b90d9;
+    border-radius: 16px;
+    padding: 6px 16px;
+    font-size: 12px;
+    font-weight: 500;
+    color: #fff;
+    cursor: pointer;
+    font-family: 'Roboto', sans-serif;
+    text-decoration: none;
 
-      hr {
-        clear: both;
-        border: 0;
-        padding: 0;
-        width: 100%;
-        height: 0;
-        margin: 30px 0;
-      }
+    &:hover {
+      background: lighten(#2b90d9, 5%);
     }
 
-    .dashboard__top-bar {
-      border-radius: 0 4px 0 0;
+    &.btn-iconized {
+      font-size: 16px;
+      font-weight: 400;
+      width: 24px;
+      text-align: center;
+      padding: 10px 7px;
+      border-radius: 100px;
+      box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
     }
   }
+
+  hr {
+    clear: both;
+    border: 0;
+    padding: 0;
+    width: 100%;
+    height: 0;
+    margin: 30px 0;
+  }
 }
 
 .simple_form {
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index c65377082..9b0b36a86 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -4,5 +4,6 @@ class HomeController < ApplicationController
   before_action :authenticate_user!
 
   def index
+    @timeline = Feed.new(:home, current_user.account).get(10, params[:max_id])
   end
 end
diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml
index 70f91d4a3..a663bf37b 100644
--- a/app/views/home/index.html.haml
+++ b/app/views/home/index.html.haml
@@ -4,111 +4,7 @@
   .form-actions
     = f.button :submit, 'Post update'
 
-%hr/
-
-%h3 OAuth2
-%p All API methods require a valid access token.
-
-%h3 Statuses
-%ul.api-descriptions
-  %li
-    .address
-      %samp.method GET
-      %samp /api/statuses/home
-    .description
-      Returns user's home timeline
-  %li
-    .address
-      %samp.method GET
-      %samp /api/statuses/mentions
-    .description
-      Returns user's mentions timeline
-  %li
-    .address
-      %samp.method POST
-      %samp /api/statuses
-    .options
-      Options:
-      = succeed ',' do
-        %samp status
-      %samp in_reply_to_id
-    .description
-      Creates a new status, optionally as a response to another, from user's account. Returns the new status.
-  %li
-    .address
-      %samp.method GET
-      %samp /api/statuses/:id
-    .description
-      Returns a single status
-  %li
-    .address
-      %samp.method POST
-      %samp /api/statuses/:id/reblog
-    .description
-      Reblogs a status from user's account. Returns the target status.
-  %li
-    .address
-      %samp.method POST
-      %samp /api/statuses/:id/favourite
-    .description
-      Favourites a status from user's account. Returns the target status.
-
-%h3 Accounts
-%ul.api-descriptions
-  %li
-    .address
-      %samp.method GET
-      %samp /api/accounts/:id
-    .description
-      Returns a single account
-  %li
-    .address
-      %samp.method GET
-      %samp /api/accounts/:id/statuses
-    .description
-      Returns an account's statuses
-  %li
-    .address
-      %samp.method GET
-      %samp /api/accounts/:id/followers
-    .description
-      Returns accounts following an account
-  %li
-    .address
-      %samp.method GET
-      %samp /api/accounts/:id/following
-    .description
-      Returns the accounts the target account follows
-  %li
-    .address
-      %samp.method POST
-      %samp /api/accounts/:id/follow
-    .description
-      Follows target account from the user's account. Returns the target account.
-  %li
-    .address
-      %samp.method POST
-      %samp /api/accounts/:id/unfollow
-    .description
-      Unfollows target account from the user's account. Returns the target account.
-  %li
-    .address
-      %samp.method GET
-      %samp /api/accounts/lookup
-    .options
-      Options:
-      %samp usernames
-    .description
-      Returns accounts for a comma-separated list of usernames
-
-%h3 Follows
-%ul.api-descriptions
-  %li
-    .address
-      %samp.method POST
-      %samp /api/follows
-    .options
-      Options:
-      %samp uri
-    .description
-      Follows a user, regardless of where they are, from user's account. URI assumed to be of username@domain form. Returns the target account.
+- content_for :raw_content do
+  .activity-stream.activity-stream-embedded
+    - @timeline.each do |status|
+      = render partial: 'stream_entries/status', locals: { status: status }
diff --git a/app/views/layouts/dashboard.html.haml b/app/views/layouts/dashboard.html.haml
index 5640213b2..7336cdcc4 100644
--- a/app/views/layouts/dashboard.html.haml
+++ b/app/views/layouts/dashboard.html.haml
@@ -21,13 +21,18 @@
           = link_to settings_path do
             = fa_icon 'user'
             Edit profile
+
     .dashboard__content
       .dashboard__top-bar
         = content_for?(:page_title) ? yield(:page_title) : 'Mastodon'
         %ul
           %li= link_to fa_icon('gear'), edit_registration_path(current_user), title: 'Change password'
           %li= link_to fa_icon('sign-out'), destroy_user_session_path, method: :delete, title: 'Sign out'
+
       .dashboard__content__content= yield
+
+      = yield(:raw_content)
+
   .footer
     .domain= Rails.configuration.x.local_domain
 
diff --git a/config/database.yml b/config/database.yml
index 6dbea4e04..da88c65a0 100644
--- a/config/database.yml
+++ b/config/database.yml
@@ -1,6 +1,6 @@
 default: &default
   adapter: postgresql
-  pool: 10
+  pool: 15
   timeout: 5000
   encoding: unicode
 
diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb
index d9eed4a9d..153173974 100644
--- a/config/initializers/sidekiq.rb
+++ b/config/initializers/sidekiq.rb
@@ -1,11 +1,10 @@
-redis_conn = proc {
-  $redis.dup
-}
+host = ENV['REDIS_HOST'] || 'localhost'
+port = ENV['REDIS_PORT'] || 6379
 
 Sidekiq.configure_server do |config|
-  config.redis = ConnectionPool.new(size: 5, &redis_conn)
+  config.redis = { host: host, port: port }
 end
 
 Sidekiq.configure_client do |config|
-  config.redis = ConnectionPool.new(size: 5, &redis_conn)
+  config.redis = { host: host, port: port }
 end