Sha256: 693ce026b01fb8c7ea197d07ea50524f8ef61a64038f1e67e63c8d85c62845e5

Contents?: true

Size: 598 Bytes

Versions: 7

Compression:

Stored size: 598 Bytes

Contents

# frozen_string_literal: true

require_dependency 'scribo/application_controller'
module Scribo
  module Api
    class SitesController < ApplicationController
      skip_before_action :verify_authenticity_token

      def import
        sgid = request.authorization&.split&.last
        head(400) && return unless sgid

        scribable = ::GlobalID::Locator.locate_signed(sgid, for: 'scribo')

        head(401) && return unless scribable

        params[:files].each do |file|
          Scribo::SiteImportService.new(file.path, scribable: scribable).call
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
scribo-1.0.44 app/controllers/scribo/api/sites_controller.rb
scribo-1.0.43 app/controllers/scribo/api/sites_controller.rb
scribo-1.0.42 app/controllers/scribo/api/sites_controller.rb
scribo-1.0.41 app/controllers/scribo/api/sites_controller.rb
scribo-1.0.40 app/controllers/scribo/api/sites_controller.rb
scribo-1.0.39 app/controllers/scribo/api/sites_controller.rb
scribo-1.0.38 app/controllers/scribo/api/sites_controller.rb