Expose an /api/v1/extensions endpoint.
We don't have any extensions listed or link this in the "endpoints" field on actors yet. The endpoint also doesn't currently provide a way to expose any additional metadata about an extension beyond its URL (in part because the SWICG proposal currently doesn't include that). We can add extensions to the endpoint's response by calling Mastodon::Extension::register with the extension URL.feature/extensions-endpoint
parent
169d83f532
commit
f02150468b
|
@ -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
|
|
@ -238,6 +238,8 @@ Rails.application.routes.draw do
|
|||
post :unmute
|
||||
end
|
||||
end
|
||||
|
||||
resources :extensions, only: :list
|
||||
end
|
||||
|
||||
namespace :web do
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue