Skip to content

Commit

Permalink
🔀 Merge pull request #6 from Fedodo/dev
Browse files Browse the repository at this point in the history
✨ Added webfinger api
  • Loading branch information
LNA-DEV authored Jun 26, 2023
2 parents 37aa66c + bc338d5 commit dccbdc7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions lib/APIs/ActivityPubRelated/webfinger_api.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import 'dart:convert';
import 'package:activitypub/Extensions/url_extensions.dart';
import 'package:http/http.dart' as http;

class WebfingerApi {
Future<String> getUser(String fullUserName) async {
String domain = fullUserName.split("@")[1];

var resp = await http.get(Uri.parse(
"https://$domain/.well-known/webfinger?resource=acct:$fullUserName")
.asProxyUri());

var result = jsonDecode(resp.body);
var links = result["links"];
var profileId = links.first["href"];

return profileId;
}
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: activitypub
description: A library for the ActivityPub standard. Created an also used by Fedodo.
version: 1.1.5
version: 1.2.0
repository: https://github.com/Fedodo/Fedodo.Pub.ActivityPub

environment:
Expand Down

0 comments on commit dccbdc7

Please sign in to comment.