mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-11 14:30:35 +00:00
Compare commits
3 Commits
tootbutton
...
feature/ex
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8375ed1cfd | ||
|
|
3d80ba01d7 | ||
|
|
f02150468b |
8
app/controllers/api/v1/extensions_controller.rb
Normal file
8
app/controllers/api/v1/extensions_controller.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
require 'mastodon/extension'
|
||||
|
||||
class Api::V1::ExtensionsController < Api::BaseController
|
||||
def index
|
||||
render json: Mastodon::Extension.all
|
||||
end
|
||||
end
|
||||
@@ -27,7 +27,11 @@ class ActivityPub::ActorSerializer < ActiveModel::Serializer
|
||||
class EndpointsSerializer < ActiveModel::Serializer
|
||||
include RoutingHelper
|
||||
|
||||
attributes :shared_inbox
|
||||
attributes :extensions, :shared_inbox
|
||||
|
||||
def extensions
|
||||
api_v1_extensions_url
|
||||
end
|
||||
|
||||
def shared_inbox
|
||||
inbox_url
|
||||
|
||||
@@ -238,6 +238,8 @@ Rails.application.routes.draw do
|
||||
post :unmute
|
||||
end
|
||||
end
|
||||
|
||||
resources :extensions, only: :index
|
||||
end
|
||||
|
||||
namespace :web do
|
||||
|
||||
17
lib/mastodon/extensions.rb
Normal file
17
lib/mastodon/extensions.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
class Mastodon::Extension
|
||||
@@extensions = []
|
||||
|
||||
def self.register url
|
||||
@extensions << Extension.new(url)
|
||||
end
|
||||
|
||||
def self.all
|
||||
@extensions
|
||||
end
|
||||
|
||||
def initialize url
|
||||
@url = url
|
||||
end
|
||||
|
||||
attr_reader :url
|
||||
end
|
||||
Reference in New Issue
Block a user