<commit_before>class AppController < ApplicationController

  before_action :authorize_account, :find_app, :find_app_control_action
  before_action :process_headers

  attr_reader :app_control

  def index
    content = @app_action.run(@app_control)
    render plain: content if @app_control && !@app_control.done?
  rescue Exception => ex
    Setup::SystemNotification.create_from(ex, "Handling action #{@app.custom_title} -> #{@app_action}")
    render plain: ex.message, status: :internal_server_error if @app_control && !@app_control.done?
  end

  def cors_check
    process_headers
    render nothing: true
  end

  protected

  def process_headers
    headers.delete('X-Frame-Options')
    headers['Access-Control-Allow-Origin'] = '*'
    headers['Access-Control-Allow-Credentials'] = false
    headers['Access-Control-Allow-Headers'] = '*'
    headers['Access-Control-Allow-Methods'] = Setup::Webhook::METHODS.join(',')
    headers['Access-Control-Max-Age'] = '1728000'
  end<commit_msg>Skipping app resolution for preflight requests<commit_after>class AppController < ApplicationController

  before_action :authorize_account, :find_app, :find_app_control_action, except: :cors_check
  before_action :process_headers

  attr_reader :app_control

  def index
    content = @app_action.run(@app_control)
    render plain: content if @app_control && !@app_control.done?
  rescue Exception => ex
    Setup::SystemNotification.create_from(ex, "Handling action #{@app.custom_title} -> #{@app_action}")
    render plain: ex.message, status: :internal_server_error if @app_control && !@app_control.done?
  end

  def cors_check
    process_headers
    render nothing: true
  end

  protected

  def process_headers
    headers.delete('X-Frame-Options')
    headers['Access-Control-Allow-Origin'] = request.headers['Origin'] || ::Cenit.homepage
    headers['Access-Control-Allow-Credentials'] = false
    headers['Access-Control-Allow-Headers'] = '*'
    headers['Access-Control-Allow-Methods'] = request.headers['Access-Control-Request-Method'] || Setup::Webhook::METHODS.join(',')
    headers['Access-Control-Max-Age'] = '1728000'
  end
{'fraction_non_alphanumeric': 0.1253507951356408, 'fraction_numerical': 0.006548175865294668, 'mean_word_length': 4.9088397790055245, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7465643', 'n_tokens_mistral': 665, 'n_tokens_neox': 645, 'n_words': 125}