From 334446cee2d96bd202ca955498ee8de00293adf2 Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Wed, 29 Mar 2023 13:05:56 +0200 Subject: [PATCH] feat: Add markers to service provider configs --- src/claimDefinitions/activitypub.js | 1 + src/claimDefinitions/discourse.js | 1 + src/claimDefinitions/dns.js | 1 + src/claimDefinitions/forem.js | 1 + src/claimDefinitions/forgejo.js | 32 ++++++++++++++++++++++++++ src/claimDefinitions/gitea.js | 17 ++++++++++++++ src/claimDefinitions/github.js | 1 + src/claimDefinitions/gitlab.js | 1 + src/claimDefinitions/hackernews.js | 1 + src/claimDefinitions/index.js | 2 +- src/claimDefinitions/irc.js | 1 + src/claimDefinitions/keybase.js | 1 + src/claimDefinitions/liberapay.js | 1 + src/claimDefinitions/lichess.js | 1 + src/claimDefinitions/lobsters.js | 1 + src/claimDefinitions/matrix.js | 1 + src/claimDefinitions/opencollective.js | 1 + src/claimDefinitions/owncast.js | 1 + src/claimDefinitions/reddit.js | 1 + src/claimDefinitions/stackexchange.js | 1 + src/claimDefinitions/telegram.js | 1 + src/claimDefinitions/twitter.js | 1 + src/claimDefinitions/xmpp.js | 1 + 23 files changed, 70 insertions(+), 1 deletion(-) diff --git a/src/claimDefinitions/activitypub.js b/src/claimDefinitions/activitypub.js index e6712bc..a3bb451 100644 --- a/src/claimDefinitions/activitypub.js +++ b/src/claimDefinitions/activitypub.js @@ -32,6 +32,7 @@ const processURI = (uri) => { uri: uri, qr: null }, + markers: [], proof: { uri: uri, request: { diff --git a/src/claimDefinitions/discourse.js b/src/claimDefinitions/discourse.js index 9f0157c..c8d99ec 100644 --- a/src/claimDefinitions/discourse.js +++ b/src/claimDefinitions/discourse.js @@ -29,6 +29,7 @@ const processURI = (uri) => { regularExpression: reURI, isAmbiguous: true }, + markers: [], profile: { display: `${match[2]}@${match[1]}`, uri: uri, diff --git a/src/claimDefinitions/dns.js b/src/claimDefinitions/dns.js index cc7a418..a596c8e 100644 --- a/src/claimDefinitions/dns.js +++ b/src/claimDefinitions/dns.js @@ -34,6 +34,7 @@ const processURI = (uri) => { uri: `https://${match[1]}`, qr: null }, + markers: [], proof: { uri: null, request: { diff --git a/src/claimDefinitions/forem.js b/src/claimDefinitions/forem.js index a5a9aa3..a68f8f5 100644 --- a/src/claimDefinitions/forem.js +++ b/src/claimDefinitions/forem.js @@ -34,6 +34,7 @@ const processURI = (uri) => { uri: `https://${match[1]}/${match[2]}`, qr: null }, + markers: [], proof: { uri: uri, request: { diff --git a/src/claimDefinitions/forgejo.js b/src/claimDefinitions/forgejo.js index 7cae15e..6876cb0 100644 --- a/src/claimDefinitions/forgejo.js +++ b/src/claimDefinitions/forgejo.js @@ -34,6 +34,38 @@ const processURI = (uri) => { uri: `https://${match[1]}/${match[2]}`, qr: null }, + markers: [ + { + request: { + fetcher: E.Fetcher.HTTP, + access: E.ProofAccess.NOCORS, + format: E.ProofFormat.JSON, + data: { + url: `https://${match[1]}/api/v1/version`, + format: E.ProofFormat.JSON + } + }, + test: { + type: E.MarkerTestType.HTTP_ENDPOINT_MUST_EXIST, + inverse: false + } + }, + { + request: { + fetcher: E.Fetcher.HTTP, + access: E.ProofAccess.NOCORS, + format: E.ProofFormat.JSON, + data: { + url: `https://${match[1]}/api/forgejo/v1/version`, + format: E.ProofFormat.JSON + } + }, + test: { + type: E.MarkerTestType.HTTP_ENDPOINT_MUST_EXIST, + inverse: false + } + } + ], proof: { uri: uri, request: { diff --git a/src/claimDefinitions/gitea.js b/src/claimDefinitions/gitea.js index 83539e2..c6ce358 100644 --- a/src/claimDefinitions/gitea.js +++ b/src/claimDefinitions/gitea.js @@ -34,6 +34,23 @@ const processURI = (uri) => { uri: `https://${match[1]}/${match[2]}`, qr: null }, + markers: [ + { + request: { + fetcher: E.Fetcher.HTTP, + access: E.ProofAccess.NOCORS, + format: E.ProofFormat.JSON, + data: { + url: `https://${match[1]}/api/v1/version`, + format: E.ProofFormat.JSON + } + }, + test: { + type: E.MarkerTestType.HTTP_ENDPOINT_MUST_EXIST, + inverse: false + } + } + ], proof: { uri: uri, request: { diff --git a/src/claimDefinitions/github.js b/src/claimDefinitions/github.js index bfe1c77..516c18b 100644 --- a/src/claimDefinitions/github.js +++ b/src/claimDefinitions/github.js @@ -34,6 +34,7 @@ const processURI = (uri) => { uri: `https://github.com/${match[1]}`, qr: null }, + markers: [], proof: { uri: uri, request: { diff --git a/src/claimDefinitions/gitlab.js b/src/claimDefinitions/gitlab.js index 16976c1..254e89a 100644 --- a/src/claimDefinitions/gitlab.js +++ b/src/claimDefinitions/gitlab.js @@ -34,6 +34,7 @@ const processURI = (uri) => { uri: `https://${match[1]}/${match[2]}`, qr: null }, + markers: [], proof: { uri: uri, request: { diff --git a/src/claimDefinitions/hackernews.js b/src/claimDefinitions/hackernews.js index 5068177..83edcb0 100644 --- a/src/claimDefinitions/hackernews.js +++ b/src/claimDefinitions/hackernews.js @@ -34,6 +34,7 @@ const processURI = (uri) => { uri: uri, qr: null }, + markers: [], proof: { uri: `https://hacker-news.firebaseio.com/v0/user/${match[1]}.json`, request: { diff --git a/src/claimDefinitions/index.js b/src/claimDefinitions/index.js index 4e11d8c..014ca33 100644 --- a/src/claimDefinitions/index.js +++ b/src/claimDefinitions/index.js @@ -27,7 +27,7 @@ const data = { hackernews: require('./hackernews'), lobsters: require('./lobsters'), forem: require('./forem'), - // forgejo: require('./forgejo'), + forgejo: require('./forgejo'), gitea: require('./gitea'), gitlab: require('./gitlab'), github: require('./github'), diff --git a/src/claimDefinitions/irc.js b/src/claimDefinitions/irc.js index a79d460..64ca80f 100644 --- a/src/claimDefinitions/irc.js +++ b/src/claimDefinitions/irc.js @@ -34,6 +34,7 @@ const processURI = (uri) => { uri: uri, qr: null }, + markers: [], proof: { uri: null, request: { diff --git a/src/claimDefinitions/keybase.js b/src/claimDefinitions/keybase.js index 1d2d734..7e55820 100644 --- a/src/claimDefinitions/keybase.js +++ b/src/claimDefinitions/keybase.js @@ -34,6 +34,7 @@ const processURI = (uri) => { uri: uri, qr: null }, + markers: [], proof: { uri: `https://keybase.io/_/api/1.0/user/lookup.json?username=${match[1]}`, request: { diff --git a/src/claimDefinitions/liberapay.js b/src/claimDefinitions/liberapay.js index e5a23bf..d1d66c8 100644 --- a/src/claimDefinitions/liberapay.js +++ b/src/claimDefinitions/liberapay.js @@ -34,6 +34,7 @@ const processURI = (uri) => { uri: uri, qr: null }, + markers: [], proof: { uri: uri, request: { diff --git a/src/claimDefinitions/lichess.js b/src/claimDefinitions/lichess.js index 9e6a57a..1cf8fa0 100644 --- a/src/claimDefinitions/lichess.js +++ b/src/claimDefinitions/lichess.js @@ -34,6 +34,7 @@ const processURI = (uri) => { uri: uri, qr: null }, + markers: [], proof: { uri: `https://lichess.org/api/user/${match[1]}`, request: { diff --git a/src/claimDefinitions/lobsters.js b/src/claimDefinitions/lobsters.js index 3b89f15..c44f71c 100644 --- a/src/claimDefinitions/lobsters.js +++ b/src/claimDefinitions/lobsters.js @@ -34,6 +34,7 @@ const processURI = (uri) => { uri: uri, qr: null }, + markers: [], proof: { uri: `https://lobste.rs/u/${match[1]}.json`, request: { diff --git a/src/claimDefinitions/matrix.js b/src/claimDefinitions/matrix.js index c93069d..53ede84 100644 --- a/src/claimDefinitions/matrix.js +++ b/src/claimDefinitions/matrix.js @@ -50,6 +50,7 @@ const processURI = (uri) => { uri: profileUrl, qr: null }, + markers: [], proof: { uri: eventUrl, request: { diff --git a/src/claimDefinitions/opencollective.js b/src/claimDefinitions/opencollective.js index 737e330..6af72c8 100644 --- a/src/claimDefinitions/opencollective.js +++ b/src/claimDefinitions/opencollective.js @@ -34,6 +34,7 @@ const processURI = (uri) => { uri: uri, qr: null }, + markers: [], proof: { uri: uri, request: { diff --git a/src/claimDefinitions/owncast.js b/src/claimDefinitions/owncast.js index 6631c3f..3843822 100644 --- a/src/claimDefinitions/owncast.js +++ b/src/claimDefinitions/owncast.js @@ -34,6 +34,7 @@ const processURI = (uri) => { uri: uri, qr: null }, + markers: [], proof: { uri: `${uri}/api/config`, request: { diff --git a/src/claimDefinitions/reddit.js b/src/claimDefinitions/reddit.js index 6fde6ed..d192f31 100644 --- a/src/claimDefinitions/reddit.js +++ b/src/claimDefinitions/reddit.js @@ -34,6 +34,7 @@ const processURI = (uri) => { uri: `https://www.reddit.com/user/${match[1]}`, qr: null }, + markers: [], proof: { uri: uri, request: { diff --git a/src/claimDefinitions/stackexchange.js b/src/claimDefinitions/stackexchange.js index 6a99772..2b31992 100644 --- a/src/claimDefinitions/stackexchange.js +++ b/src/claimDefinitions/stackexchange.js @@ -36,6 +36,7 @@ const processURI = (uri) => { uri: uri, qr: null }, + markers: [], proof: { uri: `https://${domain}.com/users/${id}?tab=profile`, request: { diff --git a/src/claimDefinitions/telegram.js b/src/claimDefinitions/telegram.js index 84d64fa..a8e5f78 100644 --- a/src/claimDefinitions/telegram.js +++ b/src/claimDefinitions/telegram.js @@ -34,6 +34,7 @@ const processURI = (uri) => { uri: `https://t.me/${match[1]}`, qr: `https://t.me/${match[1]}` }, + markers: [], proof: { uri: `https://t.me/${match[2]}`, request: { diff --git a/src/claimDefinitions/twitter.js b/src/claimDefinitions/twitter.js index 5d873e9..cf48f36 100644 --- a/src/claimDefinitions/twitter.js +++ b/src/claimDefinitions/twitter.js @@ -34,6 +34,7 @@ const processURI = (uri) => { uri: `https://twitter.com/${match[1]}`, qr: null }, + markers: [], proof: { uri: uri, request: { diff --git a/src/claimDefinitions/xmpp.js b/src/claimDefinitions/xmpp.js index 93714b3..92c2c9d 100644 --- a/src/claimDefinitions/xmpp.js +++ b/src/claimDefinitions/xmpp.js @@ -34,6 +34,7 @@ const processURI = (uri) => { uri: uri, qr: uri }, + markers: [], proof: { uri: null, request: {