* Add default preview images * Update application.rb * Adds app assets path in API mode * Cleans up file * Create assets.rb An initializer for font assets (for image generation) * Updates to Canvas and Coordinator * Update parties_controller.rb * Adds retry header if generation is still in progress * Streams S3 content instead of redirecting to prevent 302 * Update coordinator.rbs * Create previews.rake A rake task for generating images offline * Add commands to build phase
78 lines
1.9 KiB
Text
78 lines
1.9 KiB
Text
# sig/services/preview_service/coordinator.rbs
|
|
|
|
module PreviewService
|
|
class Coordinator
|
|
PREVIEW_FOLDER: String
|
|
PREVIEW_WIDTH: Integer
|
|
PREVIEW_HEIGHT: Integer
|
|
PREVIEW_EXPIRY: ActiveSupport::Duration
|
|
GENERATION_TIMEOUT: ActiveSupport::Duration
|
|
LOCAL_STORAGE_PATH: Pathname
|
|
|
|
@party: Party
|
|
@image_fetcher: ImageFetcherService
|
|
@grid_service: Grid
|
|
@canvas_service: Canvas
|
|
@aws_service: AwsService
|
|
|
|
def initialize: (party: Party) -> void
|
|
|
|
def get_s3_object: () -> Aws::S3::Types::GetObjectOutput
|
|
|
|
def preview_url: () -> String
|
|
|
|
def generate_preview: () -> bool
|
|
|
|
def force_regenerate: () -> bool
|
|
|
|
def delete_preview: () -> void
|
|
|
|
def should_generate?: () -> bool
|
|
|
|
def generation_in_progress?: () -> bool
|
|
|
|
def create_preview_image: () -> MiniMagick::Image
|
|
|
|
private
|
|
|
|
def setup_storage: () -> void
|
|
|
|
def add_job_icon: (image: MiniMagick::Image, job_icon: MiniMagick::Image) -> MiniMagick::Image
|
|
|
|
def organize_and_draw_weapons: (image: MiniMagick::Image, grid_layout: Hash[Symbol, untyped]) -> MiniMagick::Image
|
|
|
|
def draw_mainhand_weapon: (image: MiniMagick::Image, weapon_image: MiniMagick::Image) -> MiniMagick::Image
|
|
|
|
def save_preview: (image: MiniMagick::Image) -> void
|
|
|
|
def upload_to_s3: (image: MiniMagick::Image) -> void
|
|
|
|
def save_to_local_storage: (image: MiniMagick::Image) -> void
|
|
|
|
def preview_filename: () -> String
|
|
|
|
def local_preview_path: () -> Pathname
|
|
|
|
def local_preview_url: () -> String
|
|
|
|
def preview_key: () -> String
|
|
|
|
def preview_exists?: () -> bool
|
|
|
|
def generate_s3_url: () -> String
|
|
|
|
def set_generation_in_progress: () -> void
|
|
|
|
def clear_generation_in_progress: () -> void
|
|
|
|
def schedule_generation: () -> void
|
|
|
|
def default_preview_url: () -> String
|
|
|
|
def delete_s3_preview: () -> void
|
|
|
|
def delete_local_previews: () -> void
|
|
|
|
def handle_preview_generation_error: (error: Exception) -> void
|
|
end
|
|
end
|