mirror of
https://github.com/aljazceru/gitpear.git
synced 2025-12-17 14:14:22 +01:00
@@ -26,24 +26,3 @@ module.exports = {
|
|||||||
getId,
|
getId,
|
||||||
getToken
|
getToken
|
||||||
}
|
}
|
||||||
|
|
||||||
// ;(async () => {
|
|
||||||
// const repo = 'gitpear'
|
|
||||||
// const url = `pear://d1672d338b8e24223cd0dc6c6b5e04ebabf091fc2b470204abdb98fa5fc59072/${repo}`
|
|
||||||
// const commit = '1837a4bae8497f71fb8f01305c3ace1e3dedcdba'
|
|
||||||
// const method = 'push'
|
|
||||||
// const branch = 'test'
|
|
||||||
// const data = `${branch}#${commit}`
|
|
||||||
//
|
|
||||||
// let payload
|
|
||||||
// let npub
|
|
||||||
//
|
|
||||||
// payload = await getToken({ url, method, data })
|
|
||||||
// npub = await getId({ payload, url, method, data })
|
|
||||||
//
|
|
||||||
// payload = await getToken({url, method: 'get-repos'})
|
|
||||||
// npub = await getId({ payload, url, method: 'get-repos' })
|
|
||||||
//
|
|
||||||
// payload = await getToken({url, method: 'get-refs', data: { repo }})
|
|
||||||
// npub = await getId({ payload, url, method: 'get-refs', data: { repo }})
|
|
||||||
// })()
|
|
||||||
|
|||||||
@@ -157,9 +157,9 @@ module.exports = class RPC {
|
|||||||
return parsed
|
return parsed
|
||||||
}
|
}
|
||||||
|
|
||||||
async authenticate (publicKey, req) {
|
async authenticate (publicKey, request) {
|
||||||
if (!process.env.GIT_PEAR_AUTH) return publicKey
|
if (!process.env.GIT_PEAR_AUTH) return publicKey.toString('hex')
|
||||||
if (process.env.GIT_PEAR_AUTH === 'naitive') return publicKey
|
if (process.env.GIT_PEAR_AUTH === 'naitive') return publicKey.toString('hex')
|
||||||
if (process.env.GIT_PEAR_AUTH !== 'naitive' && !request.header) {
|
if (process.env.GIT_PEAR_AUTH !== 'naitive' && !request.header) {
|
||||||
throw new Error('You are not allowed to access this repo')
|
throw new Error('You are not allowed to access this repo')
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user