<commit_before>const path = require("path");
const spawn = require("child_process").spawn;
const crypto = require('crypto');

const syncCommand = path.join(__dirname, "..", "sync.sh");
const secret = process.env.G_GREYMIND_SECRET || "";

var LOCK = false;

doesSignatureMatch = (req) => {
    const headerSignatureKey = "X-Hub-Signature";
    const headerSignature = req.header(headerSignatureKey);
    const body = JSON.stringify(req.body);

    const algorithm = "sha1";
    const hmac = crypto.createHmac(algorithm, secret);

    hmac.update(JSON.stringify(body));
    const digest = `${algorithm}-${hmac.digest("hex")}`;

    console.log(`[${headerSignatureKey}] ${headerSignature}`);
    console.log(`[Digest] ${digest}`);

    return headerSignature === digest;
}

sync = (req) => {
    if (LOCK || !doesSignatureMatch(req)) {
        console.warn("Deploy in progress or security error!");
        return;
    }

    console.log("Deploying...");

    return;<commit_msg>Uhh .. remove double stringify<commit_after>const path = require("path");
const spawn = require("child_process").spawn;
const crypto = require('crypto');

const syncCommand = path.join(__dirname, "..", "sync.sh");
const secret = process.env.G_GREYMIND_SECRET || "";

var LOCK = false;

doesSignatureMatch = (req) => {
    const headerSignatureKey = "X-Hub-Signature";
    const headerSignature = req.header(headerSignatureKey);
    const body = JSON.stringify(req.body);

    const algorithm = "sha1";
    const hmac = crypto.createHmac(algorithm, secret);

    hmac.update(body);
    const digest = `${algorithm}-${hmac.digest("hex")}`;

    console.log(`[${headerSignatureKey}] ${headerSignature}`);
    console.log(`[Digest] ${digest}`);

    return headerSignature === digest;
}

sync = (req) => {
    if (LOCK || !doesSignatureMatch(req)) {
        console.warn("Deploy in progress or security error!");
        return;
    }

    console.log("Deploying...");

    return;
{'fraction_non_alphanumeric': 0.16845878136200718, 'fraction_numerical': 0.0010240655401945725, 'mean_word_length': 3.9846938775510203, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2679718', 'n_tokens_mistral': 605, 'n_tokens_neox': 589, 'n_words': 126}