forked from Mirrors/doipjs
Remove gitea repo name restriction
This commit is contained in:
parent
1ffc8b4175
commit
eb72827887
1 changed files with 6 additions and 2 deletions
|
@ -15,7 +15,7 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
const E = require('../enums')
|
const E = require('../enums')
|
||||||
|
|
||||||
const reURI = /^https:\/\/(.*)\/(.*)\/gitea_proof\/?/
|
const reURI = /^https:\/\/(.*)\/(.*)\/(.*)\/?/
|
||||||
|
|
||||||
const processURI = (uri) => {
|
const processURI = (uri) => {
|
||||||
const match = uri.match(reURI)
|
const match = uri.match(reURI)
|
||||||
|
@ -41,7 +41,7 @@ const processURI = (uri) => {
|
||||||
access: E.ProofAccess.NOCORS,
|
access: E.ProofAccess.NOCORS,
|
||||||
format: E.ProofFormat.JSON,
|
format: E.ProofFormat.JSON,
|
||||||
data: {
|
data: {
|
||||||
url: `https://${match[1]}/api/v1/repos/${match[2]}/gitea_proof`,
|
url: `https://${match[1]}/api/v1/repos/${match[2]}/${match[3]}`,
|
||||||
format: E.ProofFormat.JSON
|
format: E.ProofFormat.JSON
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,10 @@ const tests = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
uri: 'https://domain.org/alice/other_proof',
|
uri: 'https://domain.org/alice/other_proof',
|
||||||
|
shouldMatch: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
uri: 'https://domain.org/alice',
|
||||||
shouldMatch: false
|
shouldMatch: false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue