<commit_before>module ActionDispatch::Routing
  class Mapper

    def mount_push_type(options = {})
      opts = {
        path:   '/push_type',
        home:   PushType.config.home_node,
        actions: {
          node: 'push_type/front_end#node'
        }
      }.deep_merge!(options)

      mount PushType::Core::Engine => opts[:path]
      get '*permalink' => opts[:actions][:node], as: 'node'
      root to: opts[:actions][:node], permalink: opts[:home]
    end
    
  end
end<commit_msg>Added route for better media URLs.<commit_after>module ActionDispatch::Routing
  class Mapper

    def mount_push_type(options = {})
      opts = {
        path:   '/push_type',
        home:   PushType.config.home_node,
        actions: {
          node: 'push_type/front_end#node'
        }
      }.deep_merge!(options)

      # Mount the PushType engine at the specified path.
      mount PushType::Core::Engine => opts[:path]

      # Use a Dragonfly endpoint to provide better URLs for accessing assets
      get 'media/*file_uid' => Dragonfly.app.endpoint { |params, app|
        params.reverse_merge! style: 'original'
        asset = PushType::Asset.find_by_file_uid( [params[:file_uid], params[:format]].join('.') )
        params[:style] == 'original' ? asset.file : asset.file.thumb(params[:style])
      }, as: 'media'

      # A catch-all root for the nodes
      get '*permalink' => opts[:actions][:node], as: 'node'
      root to: opts[:actions][:node], permalink: opts[:home]
    end
    
  end
end
{'fraction_non_alphanumeric': 0.1365142478462558, 'fraction_numerical': 0.0, 'mean_word_length': 2.728395061728395, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '4313107', 'n_tokens_mistral': 478, 'n_tokens_neox': 463, 'n_words': 109}