Sha256: c99297481b304ea13cab99cd86a4722070df5ea9f438281004baa2e049a6f790

Contents?: true

Size: 819 Bytes

Versions: 11

Compression:

Stored size: 819 Bytes

Contents

class BrandIconHandler < BaseHandler
    def mount
        @server.mount_proc("/brand/icon") do |req, res|
            begin
                brand_key = req.query['brand_key']
                filepath = FilePath.launcher_icon(brand_key)
                if File.exist?(filepath)
                    res.body = File.binread(filepath) # Use binread for binary files
                    res['Content-Type'] = 'image/png' # Adjust as necessary
                else
                    res.status = 404
                    res.body = JSON.generate({ error: "Icon not found for brand: #{brand_key}" })
                    res['Content-Type'] = 'application/json'
                end
            rescue StandardError => e
                handle_error(res, e, "Error fetching brand icon")
            end
        end
    end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
solara-0.7.4 solara/lib/core/dashboard/handler/brand_icon_handler.rb
solara-0.7.3 solara/lib/core/dashboard/handler/brand_icon_handler.rb
solara-0.7.2 solara/lib/core/dashboard/handler/brand_icon_handler.rb
solara-0.7.1 solara/lib/core/dashboard/handler/brand_icon_handler.rb
solara-0.7.0 solara/lib/core/dashboard/handler/brand_icon_handler.rb
solara-0.6.0 solara/lib/core/dashboard/handler/brand_icon_handler.rb
solara-0.5.0 solara/lib/core/dashboard/handler/brand_icon_handler.rb
solara-0.4.0 solara/lib/core/dashboard/handler/brand_icon_handler.rb
solara-0.3.0 solara/lib/core/dashboard/handler/brand_icon_handler.rb
solara-0.2.4 solara/lib/core/dashboard/handler/brand_icon_handler.rb
solara-0.2.3 solara/lib/core/dashboard/handler/brand_icon_handler.rb