diff --git a/spug_api/apps/apis/deploy.py b/spug_api/apps/apis/deploy.py index 006839d..22296d0 100644 --- a/spug_api/apps/apis/deploy.py +++ b/spug_api/apps/apis/deploy.py @@ -37,17 +37,19 @@ def auto_deploy(request, deploy_id, kind): def _is_valid_token(request): api_key = AppSetting.get_default('api_key') + + # Gitlab Gitee Aliyun(Codeup) token = request.headers.get('X-Gitlab-Token') token = token or request.headers.get('X-Gitee-Token') token = token or request.headers.get('X-Codeup-Token') if token: return token == api_key + + # Gogs Github token = request.headers.get('X-Gogs-Signature') + token = token or request.headers.get('X-Hub-Signature-256', '').replace('sha256=', '') if token: return token == hmac.new(api_key.encode(), request.body, hashlib.sha256).hexdigest() - token = request.headers.get('X-Hub-Signature', '').split('=')[-1] - if token: - return token == hmac.new(api_key.encode(), request.body, hashlib.sha1).hexdigest() return False diff --git a/spug_web/src/pages/deploy/app/AutoDeploy.js b/spug_web/src/pages/deploy/app/AutoDeploy.js index 424cf0f..815073c 100644 --- a/spug_web/src/pages/deploy/app/AutoDeploy.js +++ b/spug_web/src/pages/deploy/app/AutoDeploy.js @@ -57,7 +57,7 @@ export default observer(function AutoDeploy() { title="Webhook" footer={null} onCancel={() => store.autoVisible = false}> - +
setType(e.target.value)}> @@ -66,13 +66,13 @@ export default observer(function AutoDeploy() { {store.deploy.extend === '1' ? ( - + ) : ( - + ) : ( - +
copyToClipBoard(url)}>{url}
)}