File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ package silobridge
2+
3+ // fakeAPInstances contains a list of sites that we allow writers to mention
4+ // with the @handle@instance.tld syntax, plus the corresponding prefix to
5+ // insert between `https://instance.tld/` and `handle` (e.g.
6+ // https://medium.com/@handle)
7+ var fakeAPInstances = map [string ]string {
8+ "deviantart.com" : "" ,
9+ "facebook.com" : "" ,
10+ "flickr.com" : "photos/" ,
11+ "github.com" : "" ,
12+ "instagram.com" : "" ,
13+ "medium.com" : "@" ,
14+ "reddit.com" : "user/" ,
15+ "twitter.com" : "" ,
16+ "wattpad.com" : "user/" ,
17+ "youtube.com" : "user/" ,
18+ }
19+
20+ // Profile returns the full profile URL for a fake ActivityPub instance, based
21+ // on the given handle and domain. If the domain isn't recognized, an empty
22+ // string is returned.
23+ func Profile (handle , domain string ) string {
24+ prefix , ok := fakeAPInstances [domain ]
25+ if ! ok {
26+ return ""
27+ }
28+ return "https://" + domain + "/" + prefix + handle
29+ }
You can’t perform that action at this time.
0 commit comments