From e5f68c3c5582ab167c179c37c93e6ce7c35d438c Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Mon, 9 Nov 2020 12:30:54 -0600 Subject: [PATCH] Removed unused Instances api routes from ruby MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Removed: - unused Instances api routes from ruby --- .../api/v1/instances/activity_controller.rb | 38 ------------------- .../api/v1/instances/peers_controller.rb | 18 --------- .../api/v1/instances_controller.rb | 10 ----- config/routes.rb | 4 -- 4 files changed, 70 deletions(-) delete mode 100644 app/controllers/api/v1/instances/activity_controller.rb delete mode 100644 app/controllers/api/v1/instances/peers_controller.rb delete mode 100644 app/controllers/api/v1/instances_controller.rb diff --git a/app/controllers/api/v1/instances/activity_controller.rb b/app/controllers/api/v1/instances/activity_controller.rb deleted file mode 100644 index 43195fc6..00000000 --- a/app/controllers/api/v1/instances/activity_controller.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -class Api::V1::Instances::ActivityController < Api::BaseController - before_action :require_enabled_api! - skip_before_action :set_cache_headers - - respond_to :json - - def show - render json: {}, content_type: 'application/json' - end - - private - - def activity - weeks = [] - - 12.times do |i| - day = i.weeks.ago.to_date - week_id = day.cweek - week = Date.commercial(day.cwyear, week_id) - - weeks << { - week: week.to_time.to_i.to_s, - statuses: Redis.current.get("activity:statuses:local:#{week_id}") || '0', - #(Rjc) 2019-07-02: Make this an instance option in Admin panel - # logins: 0, # Redis.current.pfcount("activity:logins:#{week_id}").to_s, - registrations: Redis.current.get("activity:accounts:local:#{week_id}") || '0', - } - end - - weeks - end - - def require_enabled_api! - head 404 unless Setting.activity_api_enabled - end -end diff --git a/app/controllers/api/v1/instances/peers_controller.rb b/app/controllers/api/v1/instances/peers_controller.rb deleted file mode 100644 index 2ad7c58f..00000000 --- a/app/controllers/api/v1/instances/peers_controller.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class Api::V1::Instances::PeersController < Api::BaseController - before_action :require_enabled_api! - skip_before_action :set_cache_headers - - respond_to :json - - def index - render json: {}, content_type: 'application/json' - end - - private - - def require_enabled_api! - head 404 unless Setting.peers_api_enabled - end -end diff --git a/app/controllers/api/v1/instances_controller.rb b/app/controllers/api/v1/instances_controller.rb deleted file mode 100644 index ef28e963..00000000 --- a/app/controllers/api/v1/instances_controller.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -class Api::V1::InstancesController < Api::BaseController - respond_to :json - skip_before_action :set_cache_headers - - def show - render json: {}, content_type: 'application/json' - end -end diff --git a/config/routes.rb b/config/routes.rb index 46b3107e..e19f28cf 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -371,10 +371,6 @@ Rails.application.routes.draw do resources :apps, only: [:create] - resource :instance, only: [:show] do - resources :peers, only: [:index], controller: 'instances/peers' - resource :activity, only: [:show], controller: 'instances/activity' - end resource :domain_blocks, only: [:show, :create, :destroy]