mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-22 22:49:28 -07:00
feat: support forgejo
This commit is contained in:
parent
264645b381
commit
ea8eb234ad
2 changed files with 11 additions and 2 deletions
|
@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
import * as E from '../enums.js'
|
import * as E from '../enums.js'
|
||||||
|
import { fetcher } from '../index.js'
|
||||||
import { ServiceProvider } from '../serviceProvider.js'
|
import { ServiceProvider } from '../serviceProvider.js'
|
||||||
|
|
||||||
export const reURI = /^https:\/\/(.*)\/(.*)\/(.*)\/?/
|
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 = [
|
export const tests = [
|
||||||
{
|
{
|
||||||
uri: 'https://domain.org/alice/forgejo_proof',
|
uri: 'https://domain.org/alice/forgejo_proof',
|
||||||
|
|
|
@ -25,7 +25,7 @@ import * as lichess from './lichess.js'
|
||||||
import * as hackernews from './hackernews.js'
|
import * as hackernews from './hackernews.js'
|
||||||
import * as lobsters from './lobsters.js'
|
import * as lobsters from './lobsters.js'
|
||||||
import * as forem from './forem.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 gitea from './gitea.js'
|
||||||
import * as gitlab from './gitlab.js'
|
import * as gitlab from './gitlab.js'
|
||||||
import * as github from './github.js'
|
import * as github from './github.js'
|
||||||
|
@ -49,7 +49,7 @@ const _data = {
|
||||||
hackernews,
|
hackernews,
|
||||||
lobsters,
|
lobsters,
|
||||||
forem,
|
forem,
|
||||||
// forgejo,
|
forgejo,
|
||||||
gitea,
|
gitea,
|
||||||
gitlab,
|
gitlab,
|
||||||
github,
|
github,
|
||||||
|
|
Loading…
Reference in a new issue