Skip to content
7 changes: 7 additions & 0 deletions src/AppViewLite.Web/ApiCompat/AppBskyActor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ public async Task<IResult> GetProfile(string actor)
return profile.ToApiCompatProfileDetailed().ToJsonResponse();
}

[HttpGet("app.bsky.actor.getProfiles")]
public async Task<IResult> GetProfiles([FromQuery]string[] actors)
{
var profiles = await Task.WhenAll(actors.Select(did => apis.GetFullProfileAsync(did, ctx, 0)));
return new GetProfilesOutput(profiles.Select(p => p.ToApiCompatProfileDetailed()).ToList()).ToJsonResponse();
}

[HttpGet("app.bsky.actor.searchActorsTypeahead")]
public Task<IResult> SearchActorsTypeahead(string q, int limit)
{
Expand Down
26 changes: 26 additions & 0 deletions src/AppViewLite.Web/ApiCompat/AppBskyFeed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,32 @@ public async Task<IResult> GetFeedGenerator(string feed)
}.ToJsonResponse();
}

[HttpGet("app.bsky.feed.getFeedGenerators")]
public async Task<IResult> GetFeedGenerators([FromQuery]string[] feeds)
{
var feedGenerators = await Task.WhenAll(feeds.Select(async feed => {
var uri = await apis.ResolveUriAsync(feed, ctx);
var feedDid = uri.Did!.Handler!;
var feedRKey = uri.Rkey;
try
{
var generator = await apis.GetFeedGeneratorAsync(feedDid, feedRKey, ctx);
var creator = await apis.GetProfileAsync(feedDid, ctx);
return generator.ToApiCompatGeneratorView(creator);
}
catch (Exception ex)
{
Console.Error.WriteLine("Could not check with PDS if account is actually still deactivated", ex);
return null;
}
}));

return new GetFeedGeneratorsOutput
{
Feeds = feedGenerators.Where(f => f != null).ToList(),
}.ToJsonResponse();
}

[HttpGet("app.bsky.feed.getFeed")]
public async Task<IResult> GetFeed(string feed, int limit, string? cursor)
{
Expand Down
11 changes: 11 additions & 0 deletions src/AppViewLite.Web/ApiCompat/AppBskyGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using AppViewLite;

#pragma warning disable CS1998

Expand Down Expand Up @@ -54,6 +55,16 @@ public async Task<IResult> GetActorStarterPacks(string actor, string? cursor, in
StarterPacks = []
}.ToJsonResponse();
}
[HttpGet("app.bsky.graph.getList")]
public async Task<IResult> GetActorStarterPacks(string list, string? cursor, int? limit)
{
// stub empty for now
return new FishyFlip.Lexicon.App.Bsky.Graph.GetListOutput
{
List = ApiCompatUtils.ToApiCompatListView(),
Items = [ApiCompatUtils.ToApiCompatListItemView()],
}.ToJsonResponse();
}
}
}

2 changes: 1 addition & 1 deletion src/AppViewLite.Web/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ await PluggableProtocol.RetryInfiniteLoopAsync("PlcDirectory", async ct =>
var handler = new JwtSecurityTokenHandler();
var unverifiedJwtToken = authorization.Substring(7).Trim();
var parsedUnverifiedJwtToken = handler.ReadJwtToken(unverifiedJwtToken);
var unverifiedDid = parsedUnverifiedJwtToken.Subject;
var unverifiedDid = parsedUnverifiedJwtToken.Issuer;
return unverifiedJwtToken + "=" + unverifiedDid;
}
return null;
Expand Down
50 changes: 50 additions & 0 deletions src/AppViewLite/ApiCompatUtils.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using AppViewLite.Models;
using FishyFlip.Lexicon;
using FishyFlip.Lexicon.App.Bsky.Actor;
using FishyFlip.Lexicon.App.Bsky.Graph;
using FishyFlip.Lexicon.App.Bsky.Embed;
using FishyFlip.Lexicon.App.Bsky.Feed;
using FishyFlip.Lexicon.App.Bsky.Richtext;
Expand Down Expand Up @@ -306,6 +307,55 @@ public static GeneratorView ToApiCompatGeneratorView(this BlueskyFeedGenerator f
};
}

public static ListView ToApiCompatListView()
{
return new ListView
{
Cid = GetSyntheticCid(new FishyFlip.Models.ATUri("at://did:web:bad-example.com/com.example.bad/33333")),
Creator = new ProfileView
{
DisplayName = "[stub]",
Labels = [],
CreatedAt = DummyDate,
Avatar = "https://bad-example.com/stub",
Did = new FishyFlip.Models.ATDid("did:plc:hdhoaan3xa3jiuq4fg4mefid"),
Handle = new FishyFlip.Models.ATHandle("stub.bad-example.com"),
Viewer = new FishyFlip.Lexicon.App.Bsky.Actor.ViewerState
{
Muted = false,
BlockedBy = false,
},
},
ListItemCount = 0,
Name = "[stub]",
Purpose = "app.bsky.graph.defs#curatelist",
Uri = new FishyFlip.Models.ATUri("at://did:web:bad-example.com/com.example.bad/33333"),
IndexedAt = DummyDate,
};
}

public static ListItemView ToApiCompatListItemView()
{
return new FishyFlip.Lexicon.App.Bsky.Graph.ListItemView
{
Subject = new FishyFlip.Lexicon.App.Bsky.Actor.ProfileView
{
DisplayName = "[stub]",
Labels = [],
CreatedAt = DummyDate,
Avatar = "https://bad-example.com/stub",
Did = new FishyFlip.Models.ATDid("did:plc:hdhoaan3xa3jiuq4fg4mefid"),
Handle = new FishyFlip.Models.ATHandle("stub.bad-example.com"),
Viewer = new FishyFlip.Lexicon.App.Bsky.Actor.ViewerState
{
Muted = false,
BlockedBy = false,
},
},
Uri = new FishyFlip.Models.ATUri("at://did:web:bad-example.com/com.example.bad/33333"),
};
}


}
}
Expand Down