acl: remove native

Signed-off-by: dzdidi <deniszalessky@gmail.com>
This commit is contained in:
dzdidi
2024-01-28 21:12:56 +00:00
parent a0b2d1fc24
commit 58cbbdb6e2

View File

@@ -147,7 +147,7 @@ module.exports = class RPC {
async parseReq(publicKey, req) { async parseReq(publicKey, req) {
if (!req) throw new Error('Request is empty') if (!req) throw new Error('Request is empty')
let request = JSON.parse(req.toString()) const request = JSON.parse(req.toString())
const parsed = { const parsed = {
repoName: request.body.url?.split('/')?.pop(), repoName: request.body.url?.split('/')?.pop(),
branch: request.body.data?.split('#')[0], branch: request.body.data?.split('#')[0],
@@ -159,10 +159,7 @@ module.exports = class RPC {
async authenticate (publicKey, request) { async authenticate (publicKey, request) {
if (!process.env.GIT_PEAR_AUTH) return publicKey.toString('hex') if (!process.env.GIT_PEAR_AUTH) return publicKey.toString('hex')
if (process.env.GIT_PEAR_AUTH === 'naitive') return publicKey.toString('hex') if (!request.header) throw new Error('You are not allowed to access this repo')
if (process.env.GIT_PEAR_AUTH !== 'naitive' && !request.header) {
throw new Error('You are not allowed to access this repo')
}
return (await auth.getId({ ...request.body, payload: request.header })).userId return (await auth.getId({ ...request.body, payload: request.header })).userId
} }