Skip to content

Commit

Permalink
add following and followers routes
Browse files Browse the repository at this point in the history
  • Loading branch information
pessi-v committed Jun 27, 2024
1 parent d2d9416 commit ad9441a
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 8 deletions.
13 changes: 8 additions & 5 deletions app/assets/stylesheets/components/_item-c.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
.item-c {
grid-column-start: 5;
grid-column-end: 7;
grid-row-start: 1;
grid-row-end: 9;

@include media(tabletAndUp) {
grid-column-start: 5;
grid-column-end: 7;
grid-row-start: 1;
grid-row-end: 9;
}

display: flex;
flex-direction: column;
justify-content: space-between;
row-gap: var(--space-m);
}

.one_third {
Expand Down
3 changes: 3 additions & 0 deletions app/assets/stylesheets/layouts/_page_grid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
height: auto;
// border-bottom: 1px dashed var(--color-glint);
// padding: var(--space-l);
display: flex;
flex-direction: column;
row-gap: var(--space-m);

@include media(tabletAndUp) {
display: grid;
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/mixins/_media.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@mixin media($query) {
@if $query == tabletAndUp {
@media (min-width: 50rem) { @content; }
@media (min-width: 70rem) { @content; }
}
}
26 changes: 24 additions & 2 deletions app/controllers/federation_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ def fediverse_user
"memorial": false, # Mastodon only: a digital "tombstone"
"icon": {
"type": "Image",
"mediaType": "image/png",
"mediaType": "image/jpg",
"url": "#{ENV.fetch('APP_URL')}/waves.jpg"
},
"image": {
"type": "Image",
"mediaType": "image/png",
"mediaType": "image/jpg",
"url": "#{ENV.fetch('APP_URL')}/waves.jpg"
},
"publicKey": {
Expand Down Expand Up @@ -78,6 +78,28 @@ def fediverse_user
}), content_type: 'application/activity+json'
end

def following
render json: JSON.generate(
{
"@context": "https://www.w3.org/ns/activitystreams",
"id": "#{ENV.fetch('APP_URL')}/following",
"type": "OrderedCollection",
"totalItems": 1,
"first": "#{ENV.fetch('APP_URL')}/following_accts"
}), content_type: 'application/activity+json'
end

def followers
render json: JSON.generate(
{
"@context": "https://www.w3.org/ns/activitystreams",
"id": "#{ENV.fetch('APP_URL')}/followers",
"type": "OrderedCollection",
"totalItems": 1000000,
"first": "#{ENV.fetch('APP_URL')}/follower_accts"
}), content_type: 'application/activity+json'
end

def outbox
response.headers['Access-Control-Allow-Origin'] = "*"

Expand Down
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@
# get "@aggregator", to: 'federation#fediverse_user'
get "outbox", to: 'federation#outbox', as: :fediverse_outbox
post "inbox", to: 'federation#inbox', as: :fediverse_inbox
get 'following', to: 'federation#following', as: :fediverse_following
get 'followers', to: 'federation#followers', as: :fediverse_followers
end

0 comments on commit ad9441a

Please sign in to comment.