Sha256: ec2a79fe0bf16042e6c4b681c7274dd9d88d1bba01b1f4962c42588a1e1dcee1

Contents?: true

Size: 785 Bytes

Versions: 4

Compression:

Stored size: 785 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.read(filepath)
                    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

4 entries across 4 versions & 1 rubygems

Version Path
solara-0.2.2 solara/lib/core/dashboard/handler/brand_icon_handler.rb
solara-0.2.1 solara/lib/core/dashboard/handler/brand_icon_handler.rb
solara-0.2.0 solara/lib/core/dashboard/handler/brand_icon_handler.rb
solara-0.1.0 solara/lib/core/dashboard/handler/brand_icon_handler.rb