5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 14:31:42 +00:00

fix: fix in es.yml & en.yml and missing end #13903
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
jazzari 2023-08-16 15:43:57 -03:00
parent cefd053d1d
commit 114fe4b2d5
3 changed files with 8 additions and 7 deletions

View file

@ -38,12 +38,12 @@ module Api
request.headers['X-Gitlab-Token']
# Github
elsif request.headers['X-HUB-SIGNATURE-256']
token_from_signature(request.env['HTTP_X_HUB_SIGNATURE_256'])
token_from_signature(request.env['HTTP_X_HUB_SIGNATURE_256'], 'sha256=')
# Gitea
elsif request.headers['HTTP_X_GITEA_SIGNATURE']
token_from_signature(request.env['HTTP_X_GITEA_SIGNATURE'])
else
raise ActiveRecord::RecordNotFound
raise ActiveRecord::RecordNotFound, 'proveedor no soportado'
end
end
end
@ -51,10 +51,10 @@ module Api
# valida token a partir de firma de webhook
#
# @return [String, Boolean]
def token_from_signature(signature)
def token_from_signature(signature. prepend = '')
payload = request.body.read
site.roles.where(temporal: false, rol: 'usuarie').pluck(:token).find do |token|
new_signature = 'sha256=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), token, payload)
new_signature = prepend + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), token, payload)
ActiveSupport::SecurityUtils.secure_compare(new_signature, signature)
end.tap do |t|
raise ActiveRecord::RecordNotFound, 'token no encontrado' if t.nil?
@ -69,7 +69,8 @@ module Api
# respuesta de error a plataformas
def platforms_answer(exception)
head :forbidden
ExceptionNotifier.notify_exception(exception, data: { params: params.to_h })
ExceptionNotifier.notify_exception(exception, env: request.env)
end
end
end
end

View file

@ -466,7 +466,7 @@ en:
success: 'Site upgrade has been completed. Your next build will run this upgrade :)'
error: "There was an error when trying to upgrade your site. This could be due to conflicts that couldn't be solved automatically. A report of the issue has already been sent to our admins. Sorry for the inconvenience! :("
message: 'Skeleton upgrade'
webhooks_controller:
webhooks:
pull:
message: 'Webhooks pull'
footer:

View file

@ -474,7 +474,7 @@ es:
success: 'Ya se incorporaron los cambios en el sitio, se aplicarán en la próxima compilación que hagas :)'
error: 'Hubo un error al incorporar los cambios en el sitio. Esto puede deberse a conflictos entre cambios que no se pueden resolver automáticamente. Hemos enviado un reporte del problema a les administradores de Sutty para que estén al tanto de la situación. ¡Lo sentimos! :('
message: 'Actualización del esqueleto'
webhooks_controller:
webhooks:
pull:
message: 'Traer los cambios a partir de un evento remoto'
footer: