fix: add default main branch to sourcehut provider

This commit is contained in:
quaff 2024-10-16 00:58:22 -07:00
parent 65ca35f197
commit 95a08fe464
No known key found for this signature in database
GPG key ID: E1BF1FDE24A291D4
7 changed files with 39 additions and 24 deletions

15
dist/doip.core.js vendored
View file

@ -6427,6 +6427,7 @@ var doip = (function (exports, openpgp$2, fetcher) {
}); });
/* /*
Copyright 2022 tianruiwei
Copyright 2024 quaff Copyright 2024 quaff
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
@ -6450,7 +6451,7 @@ var doip = (function (exports, openpgp$2, fetcher) {
*/ */
const reURI = /^https:\/\/git\.sr\.ht\/~([^~]*)\/(.*)\/?/; const reURI = /^https:\/\/git\.sr\.ht\/~([^~/]*)\/([^/]*)(\/tree\/([^/]*))?\/?/;
/** /**
* @function * @function
@ -6458,7 +6459,7 @@ var doip = (function (exports, openpgp$2, fetcher) {
* @returns {ServiceProvider} The service provider information based on the claim URI * @returns {ServiceProvider} The service provider information based on the claim URI
*/ */
function processURI (uri) { function processURI (uri) {
const match = uri.match(reURI); const [, username, repo, , branch] = uri.match(reURI);
return new ServiceProvider({ return new ServiceProvider({
about: { about: {
@ -6467,8 +6468,8 @@ var doip = (function (exports, openpgp$2, fetcher) {
homepage: 'https://sourcehut.org' homepage: 'https://sourcehut.org'
}, },
profile: { profile: {
display: match[1], display: username,
uri: `https://sr.ht/~${match[1]}`, uri: `https://sr.ht/~${username}`,
qr: null qr: null
}, },
claim: { claim: {
@ -6481,7 +6482,7 @@ var doip = (function (exports, openpgp$2, fetcher) {
fetcher: Fetcher.HTTP, fetcher: Fetcher.HTTP,
accessRestriction: ProofAccessRestriction.NONE, accessRestriction: ProofAccessRestriction.NONE,
data: { data: {
url: `https://git.sr.ht/~${match[1]}/${match[2]}/blob/main/proof.md`, url: `https://git.sr.ht/~${username}/${repo}/blob/${branch ?? 'main'}/proof.md`,
format: ProofFormat.TEXT format: ProofFormat.TEXT
} }
}, },
@ -6509,6 +6510,10 @@ var doip = (function (exports, openpgp$2, fetcher) {
uri: 'https://git.sr.ht/~alice/keyoxide_proof/', uri: 'https://git.sr.ht/~alice/keyoxide_proof/',
shouldMatch: true shouldMatch: true
}, },
{
uri: 'https://git.sr.ht/~alice/proof_repo/tree/master',
shouldMatch: true
},
{ {
uri: 'https://domain.org/alice/keyoxide_proof', uri: 'https://domain.org/alice/keyoxide_proof',
shouldMatch: false shouldMatch: false

File diff suppressed because one or more lines are too long

15
dist/doip.fetchers.js vendored
View file

@ -11433,6 +11433,7 @@ var doipFetchers = (function (exports) {
}); });
/* /*
Copyright 2022 tianruiwei
Copyright 2024 quaff Copyright 2024 quaff
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
@ -11456,7 +11457,7 @@ var doipFetchers = (function (exports) {
*/ */
const reURI$1 = /^https:\/\/git\.sr\.ht\/~([^~]*)\/(.*)\/?/; const reURI$1 = /^https:\/\/git\.sr\.ht\/~([^~/]*)\/([^/]*)(\/tree\/([^/]*))?\/?/;
/** /**
* @function * @function
@ -11464,7 +11465,7 @@ var doipFetchers = (function (exports) {
* @returns {ServiceProvider} The service provider information based on the claim URI * @returns {ServiceProvider} The service provider information based on the claim URI
*/ */
function processURI (uri) { function processURI (uri) {
const match = uri.match(reURI$1); const [, username, repo, , branch] = uri.match(reURI$1);
return new ServiceProvider({ return new ServiceProvider({
about: { about: {
@ -11473,8 +11474,8 @@ var doipFetchers = (function (exports) {
homepage: 'https://sourcehut.org' homepage: 'https://sourcehut.org'
}, },
profile: { profile: {
display: match[1], display: username,
uri: `https://sr.ht/~${match[1]}`, uri: `https://sr.ht/~${username}`,
qr: null qr: null
}, },
claim: { claim: {
@ -11487,7 +11488,7 @@ var doipFetchers = (function (exports) {
fetcher: Fetcher.HTTP, fetcher: Fetcher.HTTP,
accessRestriction: ProofAccessRestriction.NONE, accessRestriction: ProofAccessRestriction.NONE,
data: { data: {
url: `https://git.sr.ht/~${match[1]}/${match[2]}/blob/main/proof.md`, url: `https://git.sr.ht/~${username}/${repo}/blob/${branch ?? 'main'}/proof.md`,
format: ProofFormat.TEXT format: ProofFormat.TEXT
} }
}, },
@ -11515,6 +11516,10 @@ var doipFetchers = (function (exports) {
uri: 'https://git.sr.ht/~alice/keyoxide_proof/', uri: 'https://git.sr.ht/~alice/keyoxide_proof/',
shouldMatch: true shouldMatch: true
}, },
{
uri: 'https://git.sr.ht/~alice/proof_repo/tree/master',
shouldMatch: true
},
{ {
uri: 'https://domain.org/alice/keyoxide_proof', uri: 'https://domain.org/alice/keyoxide_proof',
shouldMatch: false shouldMatch: false

File diff suppressed because one or more lines are too long

View file

@ -11419,6 +11419,7 @@ var doipFetchers = (function (exports) {
}); });
/* /*
Copyright 2022 tianruiwei
Copyright 2024 quaff Copyright 2024 quaff
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
@ -11442,7 +11443,7 @@ var doipFetchers = (function (exports) {
*/ */
const reURI$1 = /^https:\/\/git\.sr\.ht\/~([^~]*)\/(.*)\/?/; const reURI$1 = /^https:\/\/git\.sr\.ht\/~([^~/]*)\/([^/]*)(\/tree\/([^/]*))?\/?/;
/** /**
* @function * @function
@ -11450,7 +11451,7 @@ var doipFetchers = (function (exports) {
* @returns {ServiceProvider} The service provider information based on the claim URI * @returns {ServiceProvider} The service provider information based on the claim URI
*/ */
function processURI (uri) { function processURI (uri) {
const match = uri.match(reURI$1); const [, username, repo, , branch] = uri.match(reURI$1);
return new ServiceProvider({ return new ServiceProvider({
about: { about: {
@ -11459,8 +11460,8 @@ var doipFetchers = (function (exports) {
homepage: 'https://sourcehut.org' homepage: 'https://sourcehut.org'
}, },
profile: { profile: {
display: match[1], display: username,
uri: `https://sr.ht/~${match[1]}`, uri: `https://sr.ht/~${username}`,
qr: null qr: null
}, },
claim: { claim: {
@ -11473,7 +11474,7 @@ var doipFetchers = (function (exports) {
fetcher: Fetcher.HTTP, fetcher: Fetcher.HTTP,
accessRestriction: ProofAccessRestriction.NONE, accessRestriction: ProofAccessRestriction.NONE,
data: { data: {
url: `https://git.sr.ht/~${match[1]}/${match[2]}/blob/main/proof.md`, url: `https://git.sr.ht/~${username}/${repo}/blob/${branch ?? 'main'}/proof.md`,
format: ProofFormat.TEXT format: ProofFormat.TEXT
} }
}, },
@ -11501,6 +11502,10 @@ var doipFetchers = (function (exports) {
uri: 'https://git.sr.ht/~alice/keyoxide_proof/', uri: 'https://git.sr.ht/~alice/keyoxide_proof/',
shouldMatch: true shouldMatch: true
}, },
{
uri: 'https://git.sr.ht/~alice/proof_repo/tree/master',
shouldMatch: true
},
{ {
uri: 'https://domain.org/alice/keyoxide_proof', uri: 'https://domain.org/alice/keyoxide_proof',
shouldMatch: false shouldMatch: false

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
/* /*
Copyright 2024 quaff
Copyright 2022 tianruiwei Copyright 2022 tianruiwei
Copyright 2024 quaff
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -56,7 +56,7 @@ export function processURI (uri) {
fetcher: E.Fetcher.HTTP, fetcher: E.Fetcher.HTTP,
accessRestriction: E.ProofAccessRestriction.NONE, accessRestriction: E.ProofAccessRestriction.NONE,
data: { data: {
url: `https://git.sr.ht/~${username}/${repo}/blob/${branch}/proof.md`, url: `https://git.sr.ht/~${username}/${repo}/blob/${branch ?? 'main'}/proof.md`,
format: E.ProofFormat.TEXT format: E.ProofFormat.TEXT
} }
}, },