Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

feat(ap): filter featured owncast servers from normal AP follow lists

Gabe Kangas948916f71845
diff --git a/db/query.sql b/db/query.sql
index 2c5c4f5544..d4a7649f26 100644
--- a/db/query.sql
+++ b/db/query.sql
@@ -21,7 +21,16 @@ SELECT iri, inbox, shared_inbox, name, username, image, created_at FROM ap_follo
SELECT iri, name, username, image, created_at, disabled_at FROM ap_followers WHERE disabled_at is not null;
-- name: GetFederationFollowerApprovalRequests :many
-SELECT iri, inbox, shared_inbox, name, username, image, created_at FROM ap_followers WHERE approved_at IS null AND disabled_at is null;
+-- Regular (fan) follow approval requests only. Featured-streams (Owncast
+-- server) requests are excluded here and surfaced separately via
+-- GetPendingFeaturedFollowRequests so they can be approved from the featured
+-- streams admin instead of the followers admin.
+SELECT iri, inbox, shared_inbox, name, username, image, created_at FROM ap_followers WHERE approved_at IS null AND disabled_at is null AND owncast_server IS NOT 1;
+
+-- name: GetPendingFeaturedFollowRequests :many
+-- Pending requests from other Owncast servers asking to feature this server's
+-- stream in their directory. These always require explicit approval.
+SELECT iri, inbox, shared_inbox, name, username, image, created_at FROM ap_followers WHERE approved_at IS null AND disabled_at is null AND owncast_server IS 1 ORDER BY created_at DESC;
-- name: ApproveFederationFollower :exec
UPDATE ap_followers SET approved_at = ?, disabled_at = null WHERE iri = ?;
diff --git a/db/query.sql.go b/db/query.sql.go
index 141f0283ee..71ad825d07 100644
--- a/db/query.sql.go
+++ b/db/query.sql.go
@@ -319,7 +319,7 @@ func (q *Queries) GetFederatedServers(ctx context.Context) ([]FederatedServer, e
}
const getFederationFollowerApprovalRequests = `-- name: GetFederationFollowerApprovalRequests :many
-SELECT iri, inbox, shared_inbox, name, username, image, created_at FROM ap_followers WHERE approved_at IS null AND disabled_at is null
+SELECT iri, inbox, shared_inbox, name, username, image, created_at FROM ap_followers WHERE approved_at IS null AND disabled_at is null AND owncast_server IS NOT 1
`
type GetFederationFollowerApprovalRequestsRow struct {
@@ -332,6 +332,10 @@ type GetFederationFollowerApprovalRequestsRow struct {
CreatedAt sql.NullTime
}
+// Regular (fan) follow approval requests only. Featured-streams (Owncast
+// server) requests are excluded here and surfaced separately via
+// GetPendingFeaturedFollowRequests so they can be approved from the featured
+// streams admin instead of the followers admin.
func (q *Queries) GetFederationFollowerApprovalRequests(ctx context.Context) ([]GetFederationFollowerApprovalRequestsRow, error) {
rows, err := q.db.QueryContext(ctx, getFederationFollowerApprovalRequests)
if err != nil {
@@ -730,6 +734,53 @@ func (q *Queries) GetOutboxWithOffset(ctx context.Context, arg GetOutboxWithOffs
return items, nil
}
+const getPendingFeaturedFollowRequests = `-- name: GetPendingFeaturedFollowRequests :many
+SELECT iri, inbox, shared_inbox, name, username, image, created_at FROM ap_followers WHERE approved_at IS null AND disabled_at is null AND owncast_server IS 1 ORDER BY created_at DESC
+`
+
+type GetPendingFeaturedFollowRequestsRow struct {
+ Iri string
+ Inbox string
+ SharedInbox sql.NullString
+ Name sql.NullString
+ Username string
+ Image sql.NullString
+ CreatedAt sql.NullTime
+}
+
+// Pending requests from other Owncast servers asking to feature this server's
+// stream in their directory. These always require explicit approval.
+func (q *Queries) GetPendingFeaturedFollowRequests(ctx context.Context) ([]GetPendingFeaturedFollowRequestsRow, error) {
+ rows, err := q.db.QueryContext(ctx, getPendingFeaturedFollowRequests)
+ if err != nil {
+ return nil, err
+ }
+ defer rows.Close()
+ var items []GetPendingFeaturedFollowRequestsRow
+ for rows.Next() {
+ var i GetPendingFeaturedFollowRequestsRow
+ if err := rows.Scan(
+ &i.Iri,
+ &i.Inbox,
+ &i.SharedInbox,
+ &i.Name,
+ &i.Username,
+ &i.Image,
+ &i.CreatedAt,
+ ); err != nil {
+ return nil, err
+ }
+ items = append(items, i)
+ }
+ if err := rows.Close(); err != nil {
+ return nil, err
+ }
+ if err := rows.Err(); err != nil {
+ return nil, err
+ }
+ return items, nil
+}
+
const getPendingFederatedServers = `-- name: GetPendingFederatedServers :many
SELECT id, iri, name, logo_url, is_online, stream_title, stream_description, stream_tags, thumbnail_url, last_seen_online, last_status_update, added_at, followed_at, pending, username, display_name, summary, accepted_at, rejected_at, follow_status FROM federated_servers WHERE pending = true ORDER BY added_at DESC
`
diff --git a/openapi.yaml b/openapi.yaml
index 0a237f7c24..26f2e29f41 100644
--- a/openapi.yaml
+++ b/openapi.yaml
@@ -2542,6 +2542,29 @@ paths:
responses:
'204':
$ref: '#/components/responses/204'
+ /admin/federation/feature-requests:
+ get:
+ summary: Get pending requests from other servers to feature this server's stream
+ operationId: GetFeatureRequests
+ tags: ['Internal', 'Admin', 'Federation']
+ security:
+ - BasicAuth: []
+ responses:
+ '200':
+ description: List of pending feature requests
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ requests:
+ type: array
+ items:
+ $ref: '#/components/schemas/Follower'
+ '401':
+ $ref: '#/components/responses/401BasicAuth'
+ default:
+ $ref: '#/components/responses/Default'
/admin/config/notifications/discord:
post:
summary: Configure Discord notifications
diff --git a/services/activitypub/inbox/follow.go b/services/activitypub/inbox/follow.go
index e6ccc529aa..b7f0708d1f 100644
--- a/services/activitypub/inbox/follow.go
+++ b/services/activitypub/inbox/follow.go
@@ -29,6 +29,16 @@ func (s *Service) handleFollowInboxRequest(c context.Context, activity vocab.Act
followRequest := *follow
+ // Featured-streams follows (another Owncast server following us so it can
+ // list our stream in its directory) always require explicit approval,
+ // regardless of whether this server otherwise accepts follows
+ // automatically. Being featured by another server is a different
+ // relationship from gaining a fan, so the operator opts in per server. The
+ // Accept is sent later by the admin approval flow, not here.
+ if followRequest.IsOwncastServer {
+ approved = false
+ }
+
if err := s.followers.Add(followRequest, approved); err != nil {
log.Errorln("unable to save follow request", err)
return err
diff --git a/services/activitypub/persistence/followersrepository/followersrepository.go b/services/activitypub/persistence/followersrepository/followersrepository.go
index 9248356cb5..03846b0858 100644
--- a/services/activitypub/persistence/followersrepository/followersrepository.go
+++ b/services/activitypub/persistence/followersrepository/followersrepository.go
@@ -25,8 +25,11 @@ type FollowersRepository interface {
GetCount() (int64, error)
// GetFollowers returns a paginated list of followers.
GetFollowers(limit int, offset int) ([]models.Follower, int, error)
- // GetPendingFollowRequests returns pending follow requests.
+ // GetPendingFollowRequests returns pending (fan) follow requests.
GetPendingFollowRequests() ([]models.Follower, error)
+ // GetPendingFeaturedFollowRequests returns pending requests from other
+ // Owncast servers asking to feature this server's stream.
+ GetPendingFeaturedFollowRequests() ([]models.Follower, error)
// GetBlockedAndRejected returns blocked and rejected followers.
GetBlockedAndRejected() ([]models.Follower, error)
// GetUniqueDeliveryInboxes returns unique inbox URLs for delivery.
@@ -132,6 +135,32 @@ func (r *SqlFollowersRepository) GetPendingFollowRequests() ([]models.Follower,
return followers, nil
}
+// GetPendingFeaturedFollowRequests returns pending requests from other Owncast
+// servers asking to feature this server's stream in their directory.
+func (r *SqlFollowersRepository) GetPendingFeaturedFollowRequests() ([]models.Follower, error) {
+ pendingResult, err := r.datastore.GetQueries().GetPendingFeaturedFollowRequests(context.Background())
+ if err != nil {
+ return nil, err
+ }
+
+ followers := make([]models.Follower, 0)
+
+ for _, row := range pendingResult {
+ singleFollower := models.Follower{
+ Name: row.Name.String,
+ Username: row.Username,
+ Image: row.Image.String,
+ ActorIRI: row.Iri,
+ Inbox: row.Inbox,
+ SharedInbox: row.SharedInbox.String,
+ Timestamp: utils.NullTime{Time: row.CreatedAt.Time, Valid: true},
+ }
+ followers = append(followers, singleFollower)
+ }
+
+ return followers, nil
+}
+
// GetBlockedAndRejected returns blocked and rejected followers.
func (r *SqlFollowersRepository) GetBlockedAndRejected() ([]models.Follower, error) {
pendingFollowersResult, err := r.datastore.GetQueries().GetRejectedAndBlockedFollowers(context.Background())
@@ -230,6 +259,7 @@ func (r *SqlFollowersRepository) GetByIRI(iri string) (*apmodels.ActivityPubActo
FollowRequestIri: followIRI,
DisabledAt: disabledAt,
RequestObject: followRequestObject,
+ IsOwncastServer: result.OwncastServer.Bool,
}
return &follower, nil
diff --git a/test/automated/activitypub/test-featured-streams.sh b/test/automated/activitypub/test-featured-streams.sh
index d9388fad2e..d2cb2642cd 100755
--- a/test/automated/activitypub/test-featured-streams.sh
+++ b/test/automated/activitypub/test-featured-streams.sh
@@ -16,9 +16,10 @@
# 2. Instance 1 adds Instance 2 via POST /api/admin/federation/servers.
# 3. Verify Instance 2 immediately appears in Instance 1's directory listing
# as a pending follow (regression guard: the record must be persisted).
-# 4. Verify the follow transitions to "accepted" once Instance 2 returns its
-# ActivityPub Accept (regression guard: the Accept must be matched to the
-# stored record).
+# 4. Verify a featured-streams follow is NOT auto-accepted even on a public
+# server: it stays pending until Instance 2 explicitly approves being
+# featured, after which it transitions to "accepted" (the Accept must be
+# matched to the stored record).
# 5. Verify the accepted record is actually populated with the remote server's
# name, display name and logo (regression guard: a green "accepted" with a
# blank, image-less row is the broken state users hit).
@@ -293,8 +294,9 @@ configure_owncast() {
-H "Authorization: Basic ${auth}" -H "Content-Type: application/json" \
-d '{"value": true}' > /dev/null
- # Public federation so inbound follows are auto-accepted (the directory
- # flow relies on the Accept being returned without manual approval).
+ # Public federation: regular (fan) follows auto-accept. Featured-streams
+ # follows still require explicit approval regardless of this setting, which
+ # this test exercises below.
curl -s -X POST "${base_url}/api/admin/config/federation/private" \
-H "Authorization: Basic ${auth}" -H "Content-Type: application/json" \
-d '{"value": false}' > /dev/null
@@ -317,6 +319,21 @@ add_featured_server() {
-d "{\"url\": \"${target_url}\"}"
}
+# approve_featured_request WEB_PORT ACTOR_IRI -> approves a pending request from
+# another Owncast server to feature this one (reuses the follower-approval API,
+# which records the approval and returns the ActivityPub Accept).
+approve_featured_request() {
+ local web_port=$1
+ local actor_iri=$2
+ local auth
+ auth=$(get_admin_auth)
+
+ curl -s -X POST "http://localhost:${web_port}/api/admin/followers/approve" \
+ -H "Authorization: Basic ${auth}" \
+ -H "Content-Type: application/json" \
+ -d "{\"actorIRI\": \"${actor_iri}\", \"approved\": true}"
+}
+
# get_featured_servers WEB_PORT [auth] -> prints JSON body
# When the second argument is "admin" the request is authenticated; otherwise
# it hits the public, unauthenticated endpoint.
@@ -415,17 +432,47 @@ test_add_persists_pending_record() {
}
test_follow_is_accepted() {
- log_test "TEST 2: Follow transitions to accepted after remote Accept"
+ log_test "TEST 2: Featured follow requires approval, then is accepted"
+
+ local instance1_actor="${OWNCAST_URL}/federation/user/${OWNCAST_FED_USERNAME}"
+
+ # Both instances are public, so a regular fan follow would auto-accept. A
+ # featured-streams follow must NOT: instance 2 has to approve being
+ # featured first. Give the (non-)Accept time to round-trip, then confirm we
+ # are still pending.
+ sleep 8
+ local status
+ status=$(server_follow_status "$(get_featured_servers "${OWNCAST_PORT}" admin)" "${OWNCAST2_URL}")
+ if [[ "${status}" == "accepted" ]]; then
+ log_error "TEST 2 FAILED: featured follow auto-accepted without approval (status=accepted)"
+ return 1
+ fi
+ log_info "Featured follow is correctly awaiting approval (status=${status})"
+
+ # The pending request must be listed for instance 2's admin to act on.
+ local feature_requests
+ feature_requests=$(curl -s -H "Authorization: Basic $(get_admin_auth)" \
+ "http://localhost:${OWNCAST2_PORT}/api/admin/federation/feature-requests")
+ if ! echo "${feature_requests}" | jq -e --arg iri "${instance1_actor}" '.requests[]? | select(.link == $iri)' > /dev/null 2>&1; then
+ log_error "TEST 2 FAILED: instance 1's request is not listed in instance 2's feature requests"
+ log_error "Feature requests: ${feature_requests}"
+ return 1
+ fi
+ log_info "Feature request from instance 1 is listed for approval"
+
+ # Instance 2 approves instance 1's request to feature it.
+ log_info "Approving the feature request on instance 2..."
+ approve_featured_request "${OWNCAST2_PORT}" "${instance1_actor}" > /dev/null
if wait_for_follow_status "${OWNCAST_PORT}" "${OWNCAST2_URL}" "accepted" 40; then
- log_test "TEST 2 PASSED: follow to ${OWNCAST2_URL} was accepted"
+ log_test "TEST 2 PASSED: featured follow stayed pending until approved, then was accepted"
return 0
fi
- local json status
+ local json
json=$(get_featured_servers "${OWNCAST_PORT}" admin)
status=$(server_follow_status "${json}" "${OWNCAST2_URL}")
- log_error "TEST 2 FAILED: follow status is '${status}', expected 'accepted'"
+ log_error "TEST 2 FAILED: follow status is '${status}' after approval, expected 'accepted'"
log_error "Listing: ${json}"
return 1
}
@@ -549,8 +596,13 @@ test_reverse_direction() {
return 1
fi
+ # Instance 1 must approve being featured by instance 2.
+ local instance2_actor="${OWNCAST2_URL}/federation/user/${OWNCAST2_FED_USERNAME}"
+ log_info "Approving the feature request on instance 1..."
+ approve_featured_request "${OWNCAST_PORT}" "${instance2_actor}" > /dev/null
+
if wait_for_follow_status "${OWNCAST2_PORT}" "${OWNCAST_URL}" "accepted" 40; then
- log_test "TEST 6 PASSED: instance 2 followed and accepted instance 1"
+ log_test "TEST 6 PASSED: instance 2 featured instance 1; instance 1 approved and the follow was accepted"
return 0
fi
diff --git a/web/components/admin/FederatedServers/FeatureRequests.stories.tsx b/web/components/admin/FederatedServers/FeatureRequests.stories.tsx
new file mode 100644
index 0000000000..0689b58c6e
--- /dev/null
+++ b/web/components/admin/FederatedServers/FeatureRequests.stories.tsx
@@ -0,0 +1,47 @@
+import React from 'react';
+import { Meta, StoryFn } from '@storybook/react';
+import { FeatureRequests, FeatureRequestsProps } from './FeatureRequests';
+
+export default {
+ title: 'owncast/Admin/Featured Streams/FeatureRequests',
+ component: FeatureRequests,
+ parameters: {
+ docs: {
+ description: {
+ component:
+ 'Lists incoming requests from other Owncast servers asking to feature this server’s stream, with approve/reject actions. Renders nothing when there are no pending requests.',
+ },
+ },
+ },
+} as Meta<typeof FeatureRequests>;
+
+const noop = async () => {};
+
+const Template: StoryFn<FeatureRequestsProps> = args => <FeatureRequests {...args} />;
+
+export const WithRequests = Template.bind({});
+WithRequests.args = {
+ onApprove: noop,
+ onReject: noop,
+ requests: [
+ {
+ link: 'https://goodnight.example.com/federation/user/goodnight',
+ name: 'Goodnight TV',
+ username: '[email protected]',
+ image: 'https://picsum.photos/seed/20/64/64',
+ },
+ {
+ link: 'https://music.example.com/federation/user/music',
+ name: 'Music Studio Live',
+ username: '[email protected]',
+ },
+ ],
+};
+
+export const Loading = Template.bind({});
+Loading.args = {
+ onApprove: noop,
+ onReject: noop,
+ loading: true,
+ requests: [],
+};
diff --git a/web/components/admin/FederatedServers/FeatureRequests.tsx b/web/components/admin/FederatedServers/FeatureRequests.tsx
new file mode 100644
index 0000000000..7ef7780e4d
--- /dev/null
+++ b/web/components/admin/FederatedServers/FeatureRequests.tsx
@@ -0,0 +1,147 @@
+import React, { FC, useState } from 'react';
+import { List, Button, Avatar, Typography, Popconfirm, message } from 'antd';
+import { useTranslation } from 'next-export-i18n';
+import { CheckOutlined, CloseOutlined } from '@ant-design/icons';
+import { Translation } from '../../ui/Translation/Translation';
+import { Localization } from '../../../types/localization';
+import { FeatureRequest } from '../../../hooks/useFeatureRequests';
+
+const { Text, Title, Paragraph } = Typography;
+
+export interface FeatureRequestsProps {
+ requests: FeatureRequest[];
+ loading?: boolean;
+ onApprove: (actorIRI: string) => Promise<void>;
+ onReject: (actorIRI: string) => Promise<void>;
+}
+
+// FeatureRequests lists incoming requests from other Owncast servers asking to
+// feature this server's stream in their directory, with approve/reject
+// actions. It renders nothing when there are no pending requests.
+export const FeatureRequests: FC<FeatureRequestsProps> = ({
+ requests,
+ loading = false,
+ onApprove,
+ onReject,
+}) => {
+ const { t } = useTranslation();
+ const [pendingIRI, setPendingIRI] = useState<string | null>(null);
+
+ if (!loading && requests.length === 0) {
+ return null;
+ }
+
+ const handle = async (
+ actorIRI: string,
+ action: (iri: string) => Promise<void>,
+ failKey: string,
+ ) => {
+ setPendingIRI(actorIRI);
+ try {
+ await action(actorIRI);
+ } catch {
+ message.error(t(failKey));
+ } finally {
+ setPendingIRI(null);
+ }
+ };
+
+ return (
+ <div>
+ <Title level={3}>
+ <Translation
+ translationKey={Localization.Admin.FeaturedStreams.featureRequestsTitle}
+ defaultText="Requests to feature your stream"
+ />
+ </Title>
+ <Paragraph type="secondary">
+ <Translation
+ translationKey={Localization.Admin.FeaturedStreams.featureRequestsDescription}
+ defaultText="These Owncast servers have asked to show your stream in their featured streams directory. Approve a server to let it display your live status."
+ />
+ </Paragraph>
+ <List
+ loading={loading}
+ dataSource={requests}
+ rowKey="link"
+ renderItem={request => (
+ <List.Item
+ actions={[
+ <Popconfirm
+ key="approve"
+ title={
+ <Translation
+ translationKey={Localization.Admin.FeaturedStreams.confirmYes}
+ defaultText="Yes"
+ />
+ }
+ onConfirm={() =>
+ handle(
+ request.link,
+ onApprove,
+ Localization.Admin.FeaturedStreams.failedToApprove,
+ )
+ }
+ okText={
+ <Translation
+ translationKey={Localization.Admin.FeaturedStreams.confirmYes}
+ defaultText="Yes"
+ />
+ }
+ cancelText={
+ <Translation
+ translationKey={Localization.Admin.FeaturedStreams.confirmNo}
+ defaultText="No"
+ />
+ }
+ >
+ <Button
+ type="primary"
+ size="small"
+ icon={<CheckOutlined />}
+ loading={pendingIRI === request.link}
+ >
+ <Translation
+ translationKey={Localization.Admin.FeaturedStreams.approveButton}
+ defaultText="Approve"
+ />
+ </Button>
+ </Popconfirm>,
+ <Button
+ key="reject"
+ danger
+ size="small"
+ icon={<CloseOutlined />}
+ loading={pendingIRI === request.link}
+ onClick={() =>
+ handle(request.link, onReject, Localization.Admin.FeaturedStreams.failedToReject)
+ }
+ >
+ <Translation
+ translationKey={Localization.Admin.FeaturedStreams.rejectButton}
+ defaultText="Reject"
+ />
+ </Button>,
+ ]}
+ >
+ <List.Item.Meta
+ avatar={
+ request.image ? (
+ <Avatar src={request.image} />
+ ) : (
+ <Avatar>{(request.name || request.username || '?').charAt(0)}</Avatar>
+ )
+ }
+ title={
+ <a href={request.link} target="_blank" rel="noopener noreferrer">
+ {request.name || request.username || request.link}
+ </a>
+ }
+ description={<Text type="secondary">{request.username || request.link}</Text>}
+ />
+ </List.Item>
+ )}
+ />
+ </div>
+ );
+};
diff --git a/web/hooks/useFeatureRequests.tsx b/web/hooks/useFeatureRequests.tsx
new file mode 100644
index 0000000000..cd5ca09137
--- /dev/null
+++ b/web/hooks/useFeatureRequests.tsx
@@ -0,0 +1,86 @@
+import { useState, useEffect, useCallback } from 'react';
+import { message } from 'antd';
+import { useTranslation } from 'next-export-i18n';
+import { Localization } from '../types/localization';
+
+// FeatureRequest is a pending request from another Owncast server asking to
+// feature this server's stream in its directory. It matches the Follower
+// shape the backend serializes (link is the remote actor IRI).
+export interface FeatureRequest {
+ link: string;
+ name?: string;
+ username?: string;
+ image?: string;
+ timestamp?: string;
+}
+
+export interface UseFeatureRequestsResult {
+ requests: FeatureRequest[];
+ loading: boolean;
+ approve: (actorIRI: string) => Promise<void>;
+ reject: (actorIRI: string) => Promise<void>;
+ refetch: () => void;
+}
+
+const API_FEATURE_REQUESTS = '/api/admin/federation/feature-requests';
+const API_APPROVE_FOLLOWER = '/api/admin/followers/approve';
+
+// useFeatureRequests fetches pending requests from other servers to feature
+// this stream and lets the admin approve or reject them. Approval reuses the
+// follower-approval endpoint, which records the approval and returns the
+// ActivityPub Accept that completes the featured-streams handshake.
+export function useFeatureRequests(): UseFeatureRequestsResult {
+ const { t } = useTranslation();
+ const [requests, setRequests] = useState<FeatureRequest[]>([]);
+ const [loading, setLoading] = useState(true);
+
+ const fetchRequests = useCallback(async () => {
+ setLoading(true);
+ try {
+ const response = await fetch(API_FEATURE_REQUESTS, { credentials: 'include' });
+ if (!response.ok) {
+ throw new Error(`Failed to fetch feature requests: ${response.statusText}`);
+ }
+ const data = await response.json();
+ setRequests(data.requests || []);
+ } catch (err: any) {
+ message.error(err.message || t(Localization.Admin.FeaturedStreams.failedToApprove));
+ } finally {
+ setLoading(false);
+ }
+ }, [t]);
+
+ const respond = async (actorIRI: string, approved: boolean) => {
+ const response = await fetch(API_APPROVE_FOLLOWER, {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ credentials: 'include',
+ body: JSON.stringify({ actorIRI, approved }),
+ });
+
+ if (!response.ok) {
+ const errorKey = approved
+ ? Localization.Admin.FeaturedStreams.failedToApprove
+ : Localization.Admin.FeaturedStreams.failedToReject;
+ throw new Error(t(errorKey));
+ }
+
+ await fetchRequests();
+ message.success(
+ t(
+ approved
+ ? Localization.Admin.FeaturedStreams.featureRequestApproved
+ : Localization.Admin.FeaturedStreams.featureRequestRejected,
+ ),
+ );
+ };
+
+ const approve = (actorIRI: string) => respond(actorIRI, true);
+ const reject = (actorIRI: string) => respond(actorIRI, false);
+
+ useEffect(() => {
+ fetchRequests();
+ }, [fetchRequests]);
+
+ return { requests, loading, approve, reject, refetch: fetchRequests };
+}
diff --git a/web/pages/admin/config-featured.tsx b/web/pages/admin/config-featured.tsx
index b383b33fb5..4b93356770 100644
--- a/web/pages/admin/config-featured.tsx
+++ b/web/pages/admin/config-featured.tsx
@@ -8,7 +8,9 @@ import { Localization } from '../../types/localization';
import { AdminLayout } from '../../components/layouts/AdminLayout';
import { FederatedServersTable } from '../../components/admin/FederatedServers/FederatedServersTable';
import { FeatureStreamModal } from '../../components/admin/FederatedServers/FeatureStreamModal';
+import { FeatureRequests } from '../../components/admin/FederatedServers/FeatureRequests';
import { useFederatedServers } from '../../hooks/useFederatedServers';
+import { useFeatureRequests } from '../../hooks/useFeatureRequests';
import { ServerStatusContext } from '../../utils/server-status-context';
const ConfigFeatured = () => {
@@ -26,6 +28,13 @@ const ConfigFeatured = () => {
removeServer,
} = useFederatedServers(true);
+ const {
+ requests: featureRequests,
+ loading: requestsLoading,
+ approve: approveFeatureRequest,
+ reject: rejectFeatureRequest,
+ } = useFeatureRequests();
+
const handleFeatureStream = async (url: string) => {
await addServer(url);
setModalOpen(false);
@@ -55,6 +64,13 @@ const ConfigFeatured = () => {
{federationEnabled ? (
<>
<Space direction="vertical" size="large" style={{ width: '100%' }}>
+ <FeatureRequests
+ requests={featureRequests}
+ loading={requestsLoading}
+ onApprove={approveFeatureRequest}
+ onReject={rejectFeatureRequest}
+ />
+
<Button
type="primary"
icon={<PlusOutlined />}
diff --git a/web/tests/FeatureRequests.test.tsx b/web/tests/FeatureRequests.test.tsx
new file mode 100644
index 0000000000..d98caf9400
--- /dev/null
+++ b/web/tests/FeatureRequests.test.tsx
@@ -0,0 +1,74 @@
+import React from 'react';
+import { render, screen, fireEvent, waitFor } from '@testing-library/react';
+import '@testing-library/jest-dom';
+import { FeatureRequests } from '../components/admin/FederatedServers/FeatureRequests';
+import { FeatureRequest } from '../hooks/useFeatureRequests';
+
+jest.mock('next/router', () => ({
+ useRouter: () => ({ query: {}, pathname: '/', asPath: '/', push: jest.fn(), replace: jest.fn() }),
+}));
+
+jest.mock('antd', () => ({
+ ...jest.requireActual('antd'),
+ message: { success: jest.fn(), error: jest.fn() },
+}));
+
+describe('FeatureRequests', () => {
+ const requests: FeatureRequest[] = [
+ {
+ link: 'https://peer.example.com/federation/user/streamer',
+ name: 'Peer Server',
+ username: '[email protected]',
+ image: 'https://peer.example.com/logo.png',
+ },
+ ];
+
+ const onApprove = jest.fn();
+ const onReject = jest.fn();
+
+ beforeEach(() => {
+ onApprove.mockReset();
+ onReject.mockReset();
+ });
+
+ it('renders nothing when there are no requests', () => {
+ const { container } = render(
+ <FeatureRequests requests={[]} onApprove={onApprove} onReject={onReject} />,
+ );
+ expect(container).toBeEmptyDOMElement();
+ });
+
+ it('lists pending requests with approve and reject actions', () => {
+ render(<FeatureRequests requests={requests} onApprove={onApprove} onReject={onReject} />);
+
+ expect(screen.getByText('Peer Server')).toBeInTheDocument();
+ expect(screen.getByText('Approve')).toBeInTheDocument();
+ expect(screen.getByText('Reject')).toBeInTheDocument();
+ });
+
+ it('calls onReject with the actor IRI immediately', async () => {
+ onReject.mockResolvedValue(undefined);
+ render(<FeatureRequests requests={requests} onApprove={onApprove} onReject={onReject} />);
+
+ fireEvent.click(screen.getByText('Reject'));
+
+ await waitFor(() => {
+ expect(onReject).toHaveBeenCalledWith(requests[0].link);
+ });
+ expect(onApprove).not.toHaveBeenCalled();
+ });
+
+ it('calls onApprove with the actor IRI after confirmation', async () => {
+ onApprove.mockResolvedValue(undefined);
+ render(<FeatureRequests requests={requests} onApprove={onApprove} onReject={onReject} />);
+
+ fireEvent.click(screen.getByText('Approve'));
+ // Popconfirm shows a confirm button ("Yes").
+ const confirmButtons = await screen.findAllByText('Yes');
+ fireEvent.click(confirmButtons[confirmButtons.length - 1]);
+
+ await waitFor(() => {
+ expect(onApprove).toHaveBeenCalledWith(requests[0].link);
+ });
+ });
+});
diff --git a/web/types/localization.ts b/web/types/localization.ts
index 191500fded..8c0684cceb 100644
--- a/web/types/localization.ts
+++ b/web/types/localization.ts
@@ -324,6 +324,16 @@ export const Localization = {
socialFeaturesRequired: 'Admin.FeaturedStreams.socialFeaturesRequired',
socialFeaturesRequiredDesc: 'Admin.FeaturedStreams.socialFeaturesRequiredDesc',
federationSettings: 'Admin.FeaturedStreams.federationSettings',
+
+ // Incoming feature requests (servers asking to feature this stream)
+ featureRequestsTitle: 'Admin.FeaturedStreams.featureRequestsTitle',
+ featureRequestsDescription: 'Admin.FeaturedStreams.featureRequestsDescription',
+ approveButton: 'Admin.FeaturedStreams.approveButton',
+ rejectButton: 'Admin.FeaturedStreams.rejectButton',
+ featureRequestApproved: 'Admin.FeaturedStreams.featureRequestApproved',
+ featureRequestRejected: 'Admin.FeaturedStreams.featureRequestRejected',
+ failedToApprove: 'Admin.FeaturedStreams.failedToApprove',
+ failedToReject: 'Admin.FeaturedStreams.failedToReject',
},
// Logging and monitoring
diff --git a/webserver/handlers/admin/federatedservers.go b/webserver/handlers/admin/federatedservers.go
index 69bb286fe1..0050b0c155 100644
--- a/webserver/handlers/admin/federatedservers.go
+++ b/webserver/handlers/admin/federatedservers.go
@@ -52,6 +52,36 @@ func (a *Admin) GetFederatedServers(w http.ResponseWriter, r *http.Request) {
}
}
+// GetFeatureRequests returns the pending requests from other Owncast servers
+// asking to feature this server's stream in their directory. These always
+// require explicit approval (via the follower-approval endpoint) before the
+// requesting server is allowed to list us.
+func (a *Admin) GetFeatureRequests(w http.ResponseWriter, r *http.Request) {
+ requests, err := a.followersRepository.GetPendingFeaturedFollowRequests()
+ if err != nil {
+ webutils.WriteSimpleResponse(w, false, "Failed to get feature requests: "+err.Error())
+ return
+ }
+
+ // Ensure we return an empty array instead of null.
+ if requests == nil {
+ requests = []models.Follower{}
+ }
+
+ response := struct {
+ Requests interface{} `json:"requests"`
+ }{
+ Requests: requests,
+ }
+
+ w.Header().Set("Content-Type", "application/json")
+ if err := json.NewEncoder(w).Encode(response); err != nil {
+ log.Errorln("Failed to encode feature requests response:", err)
+ webutils.WriteSimpleResponse(w, false, "Failed to encode response")
+ return
+ }
+}
+
// AddFederatedServer kicks off a Follow request to another Owncast
// instance and stores a pending follow record.
func (a *Admin) AddFederatedServer(w http.ResponseWriter, r *http.Request) {
diff --git a/webserver/handlers/admin/followers.go b/webserver/handlers/admin/followers.go
index bc8c70d244..f59fbfc7d2 100644
--- a/webserver/handlers/admin/followers.go
+++ b/webserver/handlers/admin/followers.go
@@ -34,9 +34,6 @@ func (a *Admin) ApproveFollower(w http.ResponseWriter, r *http.Request) {
return
}
- // Fire fediverse engagement follow event.
- go a.webhooks.SendFediverseEngagementFollowEvent(*approval.ActorIRI)
-
localAccountName := a.configRepository.GetDefaultFederationUsername()
followRequest, err := a.followersRepository.GetByIRI(*approval.ActorIRI)
@@ -45,6 +42,12 @@ func (a *Admin) ApproveFollower(w http.ResponseWriter, r *http.Request) {
return
}
+ // Featured-streams follows are a directory relationship, not a fan
+ // follow, so don't fire the follower webhook for them.
+ if !followRequest.IsOwncastServer {
+ go a.webhooks.SendFediverseEngagementFollowEvent(*approval.ActorIRI)
+ }
+
// Send the approval to the follow requestor.
if err := requests.SendFollowAccept(a.activitypub.Workerpool(), followRequest.Inbox, followRequest.RequestObject, localAccountName, a.apBuilder, a.apSigner); err != nil {
webutils.WriteSimpleResponse(w, false, err.Error())
diff --git a/webserver/handlers/generated/generated-types.gen.go b/webserver/handlers/generated/generated-types.gen.go
index 82115a3556..975831a7d7 100644
--- a/webserver/handlers/generated/generated-types.gen.go
+++ b/webserver/handlers/generated/generated-types.gen.go
@@ -1,6 +1,6 @@
// Package generated provides primitives to interact with the openapi HTTP API.
//
-// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.6.0 DO NOT EDIT.
+// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.1 DO NOT EDIT.
package generated
import (
@@ -32,38 +32,6 @@ const (
VISIBILITYUPDATE WebhookEventType = "VISIBILITY-UPDATE"
)
-// Valid indicates whether the value is a known member of the WebhookEventType enum.
-func (e WebhookEventType) Valid() bool {
- switch e {
- case CHAT:
- return true
- case CHATACTION:
- return true
- case NAMECHANGE:
- return true
- case PING:
- return true
- case PONG:
- return true
- case STREAMSTARTED:
- return true
- case STREAMSTOPPED:
- return true
- case STREAMTITLEUPDATED:
- return true
- case SYSTEM:
- return true
- case USERJOINED:
- return true
- case USERPARTED:
- return true
- case VISIBILITYUPDATE:
- return true
- default:
- return false
- }
-}
-
// ActionMessage defines model for ActionMessage.
type ActionMessage struct {
Body *string `json:"body,omitempty"`
diff --git a/webserver/handlers/generated/generated.gen.go b/webserver/handlers/generated/generated.gen.go
index ebd2eb5f48..47bde66720 100644
--- a/webserver/handlers/generated/generated.gen.go
+++ b/webserver/handlers/generated/generated.gen.go
@@ -1,6 +1,6 @@
// Package generated provides primitives to interact with the openapi HTTP API.
//
-// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.6.0 DO NOT EDIT.
+// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.1 DO NOT EDIT.
package generated
import (
@@ -401,6 +401,9 @@ type ServerInterface interface {
// (OPTIONS /admin/federation/actions)
GetFederatedActionsOptions(w http.ResponseWriter, r *http.Request)
+ // Get pending requests from other servers to feature this server's stream
+ // (GET /admin/federation/feature-requests)
+ GetFeatureRequests(w http.ResponseWriter, r *http.Request)
// (OPTIONS /admin/federation/send)
SendFederatedMessageOptions(w http.ResponseWriter, r *http.Request)
@@ -1396,6 +1399,12 @@ func (_ Unimplemented) GetFederatedActionsOptions(w http.ResponseWriter, r *http
w.WriteHeader(http.StatusNotImplemented)
}
+// Get pending requests from other servers to feature this server's stream
+// (GET /admin/federation/feature-requests)
+func (_ Unimplemented) GetFeatureRequests(w http.ResponseWriter, r *http.Request) {
+ w.WriteHeader(http.StatusNotImplemented)
+}
+
// (OPTIONS /admin/federation/send)
func (_ Unimplemented) SendFederatedMessageOptions(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNotImplemented)
@@ -3981,7 +3990,7 @@ func (siw *ServerInterfaceWrapper) GetFederatedActions(w http.ResponseWriter, r
// ------------- Optional query parameter "offset" -------------
- err = runtime.BindQueryParameterWithOptions("form", true, false, "offset", r.URL.Query(), &params.Offset, runtime.BindQueryParameterOptions{Type: "integer", Format: ""})
+ err = runtime.BindQueryParameter("form", true, false, "offset", r.URL.Query(), &params.Offset)
if err != nil {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "offset", Err: err})
return
@@ -3989,7 +3998,7 @@ func (siw *ServerInterfaceWrapper) GetFederatedActions(w http.ResponseWriter, r
// ------------- Optional query parameter "limit" -------------
- err = runtime.BindQueryParameterWithOptions("form", true, false, "limit", r.URL.Query(), &params.Limit, runtime.BindQueryParameterOptions{Type: "integer", Format: ""})
+ err = runtime.BindQueryParameter("form", true, false, "limit", r.URL.Query(), &params.Limit)
if err != nil {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "limit", Err: err})
return
@@ -4019,6 +4028,25 @@ func (siw *ServerInterfaceWrapper) GetFederatedActionsOptions(w http.ResponseWri
handler.ServeHTTP(w, r)
}
+// GetFeatureRequests operation middleware
+func (siw *ServerInterfaceWrapper) GetFeatureRequests(w http.ResponseWriter, r *http.Request) {
+ ctx := r.Context()
+
+ ctx = context.WithValue(ctx, BasicAuthScopes, []string{})
+
+ r = r.WithContext(ctx)
+
+ handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ siw.Handler.GetFeatureRequests(w, r)
+ }))
+
+ for _, middleware := range siw.HandlerMiddlewares {
+ handler = middleware(handler)
+ }
+
+ handler.ServeHTTP(w, r)
+}
+
// SendFederatedMessageOptions operation middleware
func (siw *ServerInterfaceWrapper) SendFederatedMessageOptions(w http.ResponseWriter, r *http.Request) {
handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@@ -4152,7 +4180,7 @@ func (siw *ServerInterfaceWrapper) GetFollowersAdmin(w http.ResponseWriter, r *h
// ------------- Optional query parameter "offset" -------------
- err = runtime.BindQueryParameterWithOptions("form", true, false, "offset", r.URL.Query(), &params.Offset, runtime.BindQueryParameterOptions{Type: "integer", Format: ""})
+ err = runtime.BindQueryParameter("form", true, false, "offset", r.URL.Query(), &params.Offset)
if err != nil {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "offset", Err: err})
return
@@ -4160,7 +4188,7 @@ func (siw *ServerInterfaceWrapper) GetFollowersAdmin(w http.ResponseWriter, r *h
// ------------- Optional query parameter "limit" -------------
- err = runtime.BindQueryParameterWithOptions("form", true, false, "limit", r.URL.Query(), &params.Limit, runtime.BindQueryParameterOptions{Type: "integer", Format: ""})
+ err = runtime.BindQueryParameter("form", true, false, "limit", r.URL.Query(), &params.Limit)
if err != nil {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "limit", Err: err})
return
@@ -4686,7 +4714,7 @@ func (siw *ServerInterfaceWrapper) GetViewersOverTime(w http.ResponseWriter, r *
// ------------- Optional query parameter "windowStart" -------------
- err = runtime.BindQueryParameterWithOptions("form", true, false, "windowStart", r.URL.Query(), &params.WindowStart, runtime.BindQueryParameterOptions{Type: "string", Format: ""})
+ err = runtime.BindQueryParameter("form", true, false, "windowStart", r.URL.Query(), &params.WindowStart)
if err != nil {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "windowStart", Err: err})
return
@@ -4859,7 +4887,7 @@ func (siw *ServerInterfaceWrapper) RegisterFediverseOTPRequest(w http.ResponseWr
return
}
- err = runtime.BindQueryParameterWithOptions("form", true, true, "accessToken", r.URL.Query(), &params.AccessToken, runtime.BindQueryParameterOptions{Type: "string", Format: ""})
+ err = runtime.BindQueryParameter("form", true, true, "accessToken", r.URL.Query(), &params.AccessToken)
if err != nil {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "accessToken", Err: err})
return
@@ -4904,7 +4932,7 @@ func (siw *ServerInterfaceWrapper) StartIndieAuthFlow(w http.ResponseWriter, r *
return
}
- err = runtime.BindQueryParameterWithOptions("form", true, true, "accessToken", r.URL.Query(), &params.AccessToken, runtime.BindQueryParameterOptions{Type: "string", Format: ""})
+ err = runtime.BindQueryParameter("form", true, true, "accessToken", r.URL.Query(), &params.AccessToken)
if err != nil {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "accessToken", Err: err})
return
@@ -4936,7 +4964,7 @@ func (siw *ServerInterfaceWrapper) HandleIndieAuthRedirect(w http.ResponseWriter
return
}
- err = runtime.BindQueryParameterWithOptions("form", true, true, "state", r.URL.Query(), &params.State, runtime.BindQueryParameterOptions{Type: "string", Format: ""})
+ err = runtime.BindQueryParameter("form", true, true, "state", r.URL.Query(), &params.State)
if err != nil {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "state", Err: err})
return
@@ -4974,7 +5002,7 @@ func (siw *ServerInterfaceWrapper) HandleIndieAuthEndpointGet(w http.ResponseWri
return
}
- err = runtime.BindQueryParameterWithOptions("form", true, true, "client_id", r.URL.Query(), &params.ClientId, runtime.BindQueryParameterOptions{Type: "string", Format: ""})
+ err = runtime.BindQueryParameter("form", true, true, "client_id", r.URL.Query(), &params.ClientId)
if err != nil {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "client_id", Err: err})
return
@@ -4988,7 +5016,7 @@ func (siw *ServerInterfaceWrapper) HandleIndieAuthEndpointGet(w http.ResponseWri
return
}
- err = runtime.BindQueryParameterWithOptions("form", true, true, "redirect_uri", r.URL.Query(), &params.RedirectUri, runtime.BindQueryParameterOptions{Type: "string", Format: ""})
+ err = runtime.BindQueryParameter("form", true, true, "redirect_uri", r.URL.Query(), &params.RedirectUri)
if err != nil {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "redirect_uri", Err: err})
return
@@ -5002,7 +5030,7 @@ func (siw *ServerInterfaceWrapper) HandleIndieAuthEndpointGet(w http.ResponseWri
return
}
- err = runtime.BindQueryParameterWithOptions("form", true, true, "code_challenge", r.URL.Query(), &params.CodeChallenge, runtime.BindQueryParameterOptions{Type: "string", Format: ""})
+ err = runtime.BindQueryParameter("form", true, true, "code_challenge", r.URL.Query(), &params.CodeChallenge)
if err != nil {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "code_challenge", Err: err})
return
@@ -5016,7 +5044,7 @@ func (siw *ServerInterfaceWrapper) HandleIndieAuthEndpointGet(w http.ResponseWri
return
}
- err = runtime.BindQueryParameterWithOptions("form", true, true, "state", r.URL.Query(), &params.State, runtime.BindQueryParameterOptions{Type: "string", Format: ""})
+ err = runtime.BindQueryParameter("form", true, true, "state", r.URL.Query(), &params.State)
if err != nil {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "state", Err: err})
return
@@ -5061,7 +5089,7 @@ func (siw *ServerInterfaceWrapper) GetChatMessages(w http.ResponseWriter, r *htt
return
}
- err = runtime.BindQueryParameterWithOptions("form", true, true, "accessToken", r.URL.Query(), &params.AccessToken, runtime.BindQueryParameterOptions{Type: "string", Format: ""})
+ err = runtime.BindQueryParameter("form", true, true, "accessToken", r.URL.Query(), &params.AccessToken)
if err != nil {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "accessToken", Err: err})
return
@@ -5093,7 +5121,7 @@ func (siw *ServerInterfaceWrapper) UpdateMessageVisibility(w http.ResponseWriter
return
}
- err = runtime.BindQueryParameterWithOptions("form", true, true, "accessToken", r.URL.Query(), &params.AccessToken, runtime.BindQueryParameterOptions{Type: "string", Format: ""})
+ err = runtime.BindQueryParameter("form", true, true, "accessToken", r.URL.Query(), &params.AccessToken)
if err != nil {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "accessToken", Err: err})
return
@@ -5141,7 +5169,7 @@ func (siw *ServerInterfaceWrapper) RegisterAnonymousChatUser(w http.ResponseWrit
return
}
- err = runtime.BindStyledParameterWithOptions("simple", "X-Forwarded-User", valueList[0], &XForwardedUser, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationHeader, Explode: false, Required: false, Type: "string", Format: ""})
+ err = runtime.BindStyledParameterWithOptions("simple", "X-Forwarded-User", valueList[0], &XForwardedUser, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationHeader, Explode: false, Required: false})
if err != nil {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "X-Forwarded-User", Err: err})
return
@@ -5177,7 +5205,7 @@ func (siw *ServerInterfaceWrapper) UpdateUserEnabled(w http.ResponseWriter, r *h
return
}
- err = runtime.BindQueryParameterWithOptions("form", true, true, "accessToken", r.URL.Query(), &params.AccessToken, runtime.BindQueryParameterOptions{Type: "string", Format: ""})
+ err = runtime.BindQueryParameter("form", true, true, "accessToken", r.URL.Query(), &params.AccessToken)
if err != nil {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "accessToken", Err: err})
return
@@ -5242,7 +5270,7 @@ func (siw *ServerInterfaceWrapper) GetFollowers(w http.ResponseWriter, r *http.R
// ------------- Optional query parameter "offset" -------------
- err = runtime.BindQueryParameterWithOptions("form", true, false, "offset", r.URL.Query(), &params.Offset, runtime.BindQueryParameterOptions{Type: "integer", Format: ""})
+ err = runtime.BindQueryParameter("form", true, false, "offset", r.URL.Query(), &params.Offset)
if err != nil {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "offset", Err: err})
return
@@ -5250,7 +5278,7 @@ func (siw *ServerInterfaceWrapper) GetFollowers(w http.ResponseWriter, r *http.R
// ------------- Optional query parameter "limit" -------------
- err = runtime.BindQueryParameterWithOptions("form", true, false, "limit", r.URL.Query(), &params.Limit, runtime.BindQueryParameterOptions{Type: "integer", Format: ""})
+ err = runtime.BindQueryParameter("form", true, false, "limit", r.URL.Query(), &params.Limit)
if err != nil {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "limit", Err: err})
return
@@ -5434,7 +5462,7 @@ func (siw *ServerInterfaceWrapper) SendSystemMessageToConnectedClientOptions(w h
// ------------- Path parameter "clientId" -------------
var clientId int
- err = runtime.BindStyledParameterWithOptions("simple", "clientId", chi.URLParam(r, "clientId"), &clientId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""})
+ err = runtime.BindStyledParameterWithOptions("simple", "clientId", chi.URLParam(r, "clientId"), &clientId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "clientId", Err: err})
return
@@ -5458,7 +5486,7 @@ func (siw *ServerInterfaceWrapper) SendSystemMessageToConnectedClient(w http.Res
// ------------- Path parameter "clientId" -------------
var clientId int
- err = runtime.BindStyledParameterWithOptions("simple", "clientId", chi.URLParam(r, "clientId"), &clientId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "integer", Format: ""})
+ err = runtime.BindStyledParameterWithOptions("simple", "clientId", chi.URLParam(r, "clientId"), &clientId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "clientId", Err: err})
return
@@ -5552,7 +5580,7 @@ func (siw *ServerInterfaceWrapper) ExternalGetUserDetails(w http.ResponseWriter,
// ------------- Path parameter "userId" -------------
var userId string
- err = runtime.BindStyledParameterWithOptions("simple", "userId", chi.URLParam(r, "userId"), &userId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""})
+ err = runtime.BindStyledParameterWithOptions("simple", "userId", chi.URLParam(r, "userId"), &userId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "userId", Err: err})
return
@@ -5646,7 +5674,7 @@ func (siw *ServerInterfaceWrapper) GetUserDetails(w http.ResponseWriter, r *http
// ------------- Path parameter "userId" -------------
var userId string
- err = runtime.BindStyledParameterWithOptions("simple", "userId", chi.URLParam(r, "userId"), &userId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""})
+ err = runtime.BindStyledParameterWithOptions("simple", "userId", chi.URLParam(r, "userId"), &userId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "userId", Err: err})
return
@@ -5663,7 +5691,7 @@ func (siw *ServerInterfaceWrapper) GetUserDetails(w http.ResponseWriter, r *http
return
}
- err = runtime.BindQueryParameterWithOptions("form", true, true, "accessToken", r.URL.Query(), &params.AccessToken, runtime.BindQueryParameterOptions{Type: "string", Format: ""})
+ err = runtime.BindQueryParameter("form", true, true, "accessToken", r.URL.Query(), &params.AccessToken)
if err != nil {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "accessToken", Err: err})
return
@@ -5695,7 +5723,7 @@ func (siw *ServerInterfaceWrapper) RegisterForLiveNotifications(w http.ResponseW
return
}
- err = runtime.BindQueryParameterWithOptions("form", true, true, "accessToken", r.URL.Query(), &params.AccessToken, runtime.BindQueryParameterOptions{Type: "string", Format: ""})
+ err = runtime.BindQueryParameter("form", true, true, "accessToken", r.URL.Query(), &params.AccessToken)
if err != nil {
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "accessToken", Err: err})
return
@@ -6290,6 +6318,9 @@ func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handl
r.Group(func(r chi.Router) {
r.Options(options.BaseURL+"/admin/federation/actions", wrapper.GetFederatedActionsOptions)
})
+ r.Group(func(r chi.Router) {
+ r.Get(options.BaseURL+"/admin/federation/feature-requests", wrapper.GetFeatureRequests)
+ })
r.Group(func(r chi.Router) {
r.Options(options.BaseURL+"/admin/federation/send", wrapper.SendFederatedMessageOptions)
})
diff --git a/webserver/handlers/handler.go b/webserver/handlers/handler.go
index de486ad61b..08c741a23e 100644
--- a/webserver/handlers/handler.go
+++ b/webserver/handlers/handler.go
@@ -117,3 +117,7 @@ func (s *ServerInterfaceImpl) RemoveFederatedServer(w http.ResponseWriter, r *ht
func (s *ServerInterfaceImpl) RemoveFederatedServerOptions(w http.ResponseWriter, r *http.Request, id int) {
s.h.admin.RemoveFederatedServerOptions(w, r, id)
}
+
+func (s *ServerInterfaceImpl) GetFeatureRequests(w http.ResponseWriter, r *http.Request) {
+ s.h.middleware.RequireAdminAuth(s.h.admin.GetFeatureRequests)(w, r)
+}