<commit_before>import bodyParser from 'body-parser';
import compress from 'compression';
import { fileURLToPath } from 'url';
import helmet from 'helmet';
import express from 'express';
import cors from 'cors';
import axios from 'axios';
import querystring from 'querystring';
import crypto from 'crypto';

function init(app) {

  app.use(requireHTTPS);
  app.set('trust proxy', true);

  if (isProduction()) {
    app.use(helmet.xssFilter());
    app.use(helmet.noSniff());
    app.use(helmet.frameguard({ action: 'sameorigin' }));
  }

  app.use(cors());

  const dayInMs = 24 * 60 * 60 * 1000;
  app.use(bodyParser.urlencoded({ extended: true }));
  app.use(bodyParser.json({
    verify(req, res, buf) {
      req.bodyHash = req.body ? crypto.createHash('sha256').update(buf).digest('hex') : '';
    },
  }));

  app.use(compress());

  app.use('/api/', (req, res, next) => {
    const id = req.query.id || req.body.deviceId || req.body.id || req.body.wallet_id;
    if (!id) return next();
    const [, app, store, version] = req.get('X-Release') !== undefined ?
      req.get('X-Release').match(/(.+)\.(.+)@(.+)/i) || [] : [];<commit_msg>fix(server): id param in API<commit_after>import bodyParser from 'body-parser';
import compress from 'compression';
import { fileURLToPath } from 'url';
import helmet from 'helmet';
import express from 'express';
import cors from 'cors';
import axios from 'axios';
import querystring from 'querystring';
import crypto from 'crypto';

function init(app) {

  app.use(requireHTTPS);
  app.set('trust proxy', true);

  if (isProduction()) {
    app.use(helmet.xssFilter());
    app.use(helmet.noSniff());
    app.use(helmet.frameguard({ action: 'sameorigin' }));
  }

  app.use(cors());

  const dayInMs = 24 * 60 * 60 * 1000;
  app.use(bodyParser.urlencoded({ extended: true }));
  app.use(bodyParser.json({
    verify(req, res, buf) {
      req.bodyHash = req.body ? crypto.createHash('sha256').update(buf).digest('hex') : '';
    },
  }));

  app.use(compress());

  app.use('/api/', (req, res, next) => {
    const id = req.query.id || req.body.deviceId || req.body.id || req.body.wallet_id;
    if (!id || !/^[a-f0-9]{64}$/.test(id)) return next();
    const [, app, store, version] = req.get('X-Release') !== undefined ?
      req.get('X-Release').match(/(.+)\.(.+)@(.+)/i) || [] : [];
{'fraction_non_alphanumeric': 0.20463320463320464, 'fraction_numerical': 0.01287001287001287, 'mean_word_length': 3.8381742738589213, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1162449', 'n_tokens_mistral': 851, 'n_tokens_neox': 804, 'n_words': 181}