diff --git a/src/serviceProviders/forgejo.js b/src/serviceProviders/forgejo.js index 7996462..97b0b80 100644 --- a/src/serviceProviders/forgejo.js +++ b/src/serviceProviders/forgejo.js @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ import * as E from '../enums.js' +import { fetcher } from '../index.js' import { ServiceProvider } from '../serviceProvider.js' export const reURI = /^https:\/\/(.*)\/(.*)\/(.*)\/?/ @@ -63,6 +64,14 @@ export function processURI (uri) { }) } +export const functions = { + validate: async (/** @type {ServiceProvider} */ claimData, proofData, opts) => { + const url = `https://${new URL(claimData.proof.request.uri).hostname}/api/forgejo/v1/version` + const forgejoData = await fetcher.http.fn({ url, format: E.ProofFormat.JSON }, opts) + return forgejoData && 'version' in forgejoData + } +} + export const tests = [ { uri: 'https://domain.org/alice/forgejo_proof', diff --git a/src/serviceProviders/index.js b/src/serviceProviders/index.js index 7879203..7229f24 100644 --- a/src/serviceProviders/index.js +++ b/src/serviceProviders/index.js @@ -25,7 +25,7 @@ import * as lichess from './lichess.js' import * as hackernews from './hackernews.js' import * as lobsters from './lobsters.js' import * as forem from './forem.js' -// import * as forgejo from './forgejo.js' +import * as forgejo from './forgejo.js' import * as gitea from './gitea.js' import * as gitlab from './gitlab.js' import * as github from './github.js' @@ -49,7 +49,7 @@ const _data = { hackernews, lobsters, forem, - // forgejo, + forgejo, gitea, gitlab, github,