Files
once-campfire/config/routes.rb
T
Kevin McConnell 30fe6ab121 Add IP-based user banning
This adds the ability to ban a user by their IP address.

When an admin is viewing a user profile, a new "Ban user" button is
present. Clicking on that will:

- Create a ban on the IP addresses that were tracked for that user's
  sessions
- Remove all the messages authored by that user
- Log the user out immediately

In addition, that user will no longer be shown in most user lists in the
app. They are still shown to admins, in account settings. Viewing their
profile from there will now show a "Remove ban" button which can be used
to restore their access (it doesn't restore their messages though --
those are already gone -- it just removes the blocks so they can log in
again).
2025-11-26 14:30:38 +00:00

99 lines
2.3 KiB
Ruby

Rails.application.routes.draw do
root "welcome#show"
resource :first_run
resource :session do
scope module: "sessions" do
resources :transfers, only: %i[ show update ]
end
end
resource :account do
scope module: "accounts" do
resources :users
resources :bots do
scope module: "bots" do
resource :key, only: :update
end
end
resource :join_code, only: :create
resource :logo, only: %i[ show destroy ]
resource :custom_styles, only: %i[ edit update ]
end
end
direct :fresh_account_logo do |options|
route_for :account_logo, v: Current.account&.updated_at&.to_fs(:number), size: options[:size]
end
get "join/:join_code", to: "users#new", as: :join
post "join/:join_code", to: "users#create"
resources :qr_code, only: :show
resources :users, only: :show do
scope module: "users" do
resource :avatar, only: %i[ show destroy ]
resource :ban, only: %i[ create destroy ]
scope defaults: { user_id: "me" } do
resource :sidebar, only: :show
resource :profile
resources :push_subscriptions do
scope module: "push_subscriptions" do
resources :test_notifications, only: :create
end
end
end
end
end
namespace :autocompletable do
resources :users, only: :index
end
direct :fresh_user_avatar do |user, options|
route_for :user_avatar, user.avatar_token, v: user.updated_at.to_fs(:number)
end
resources :rooms do
resources :messages
post ":bot_key/messages", to: "messages/by_bots#create", as: :bot_messages
scope module: "rooms" do
resource :refresh, only: :show
resource :settings, only: :show
resource :involvement, only: %i[ show update ]
end
get "@:message_id", to: "rooms#show", as: :at_message
end
namespace :rooms do
resources :opens
resources :closeds
resources :directs
end
resources :messages do
scope module: "messages" do
resources :boosts
end
end
resources :searches, only: %i[ index create ] do
delete :clear, on: :collection
end
resource :unfurl_link, only: :create
get "webmanifest" => "pwa#manifest"
get "service-worker" => "pwa#service_worker"
get "up" => "rails/health#show", as: :rails_health_check
end