<commit_before># -*- coding: utf-8 -*-
require 'sinatra'
require 'sinatra/reloader'
require 'openssl'
require 'base64'
require 'json'
set :root, File.dirname(__FILE__)
set :public_folder, Proc.new { File.join(root, "public") }

options '/*' do
  response.headers['Access-Control-Allow-Origin'] = '*'
  response.headers['Access-Control-Allow-Headers'] = '*'
end

post '/sign' do
  response.headers['Access-Control-Allow-Origin'] = '*'
  response.headers['Access-Control-Allow-Headers'] = 'X-NCMB-Timestamp'
  content_type :json
  CLIENT_KEY = '65c3eb97f9fe9e90bba279611d405121ddc1ea9beaea92ea77ee7ceb02b91247'
  json = JSON.parse(request.body.read)
  {signature: Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha256'), CLIENT_KEY, json["forEncodeString"])).strip()}.to_json
end<commit_msg>Add allow host<commit_after># -*- coding: utf-8 -*-
require 'sinatra'
require 'sinatra/reloader'
require 'openssl'
require 'base64'
require 'json'
set :root, File.dirname(__FILE__)
set :public_folder, Proc.new { File.join(root, "public") }

options '/*' do
  response.headers['Access-Control-Allow-Origin'] = '*'
  response.headers['Access-Control-Allow-Headers'] = 'X-NCMB-Timestamp'
end

post '/sign' do
  response.headers['Access-Control-Allow-Origin'] = '*'
  response.headers['Access-Control-Allow-Headers'] = 'X-NCMB-Timestamp'
  content_type :json
  CLIENT_KEY = '65c3eb97f9fe9e90bba279611d405121ddc1ea9beaea92ea77ee7ceb02b91247'
  json = JSON.parse(request.body.read)
  {signature: Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha256'), CLIENT_KEY, json["forEncodeString"])).strip()}.to_json
end
{'fraction_non_alphanumeric': 0.16605392156862744, 'fraction_numerical': 0.05514705882352941, 'mean_word_length': 6.1938325991189425, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3116904', 'n_tokens_mistral': 646, 'n_tokens_neox': 589, 'n_words': 88}