feat: gitlab feature

This commit is contained in:
xmppftw xmppftw 2026-06-23 17:13:42 +02:00
commit d54ef5f265
3 changed files with 6 additions and 3 deletions

View file

@ -14,11 +14,12 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
mod forgejo;
#[cfg(feature = "gitlab")]
mod gitlab;
mod types;
pub use crate::hooks::forgejo::ForgejoHook;
#[allow(deprecated)]
#[cfg(feature = "gitlab")]
pub use crate::hooks::gitlab::GitlabHook;
pub use crate::hooks::types::Hook;
pub use crate::hooks::types::{IssueAction, MergeRequestAction, WikiAction};

View file

@ -14,7 +14,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use crate::error::Error;
#[allow(deprecated)]
#[cfg(feature = "gitlab")]
use crate::hooks::GitlabHook;
use crate::hooks::{ForgejoHook, Hook};
@ -62,6 +62,7 @@ async fn hooks_inner(req: Request<Incoming>, secret: &str) -> Result<Hook, Error
let whole_body = req.collect().await?.aggregate();
whole_body.reader().read_to_end(&mut payload)?;
#[cfg(feature = "gitlab")]
if let Some(val) = headers.get("X-Gitlab-Token") {
if secret != val {
return Err(Error::InvalidSecret);