Code Monkey home page Code Monkey logo

faser's Introduction

Faser

Go Report Card Chat on Discord

Faser (favicon server) is a self-hosted, cached favicon server that returns an image for a domain or URL.

Installation

Please see the docker-compose.yml example below for reference. You can set the following environment variables:

Variable Description
FASER_LOG_LEVEL debug, info, warn
FASER_CACHE_DIR Sets the favicon cache directory. /app/cache inside the container volume.
FASER_CACHE_MAX_AGE Sets the maximum time a favicon will be cached (in seconds).
FASER_CACHE_MAX_ENTRIES Sets the maximum number of favicons stored (not including scaled images).
FASER_DEFAULT_FAVICON Sets the default favicon path. default.svg inside the container volume.
FASER_DEFAULT_FAVICON_DIR Sets the fallback favicon path. /app/static inside the container volume.
FASER_CORS_LOG_LEVEL debug, info
FASER_CORS_ORIGINS Sets the allowed origins (* by default).
FASER_SERVER_HOST Sets the host ip:port (:8080 by default).
FASER_SERVER_WRITE_TIMEOUT Sets the HTTP write timeout in seconds (5 by default).
FASER_SERVER_READ_TIMEOUT Sets the HTTP read timeout in seconds (5 by default).
FASER_SERVER_TLS true, false
FASER_SERVER_TLS_CERT Path for the TLS certificate.
FASER_SERVER_TLS_KEY Path for the TLS private key.

Usage

Once you have the server up and running, you can make a request to it:

example.com/?url=github.com&size=64

This request will return the favicon for github.com scaled to a maximum of 64px width and height. The size parameter is optional. If you don't provide it, the maximum size will be returned. Make sure that you still set the maximum sizes on your end, as the favicon might not have the exact size you specified (if it's a svg for example).

In case the favicon cannot be downloaded, the default favicon is returned. You can also select a favicon if you know its filename by adding the fallback query parameter.

example.com/?url=github.com&size=64&fallback=my-favicon.svg

Example Docker Compose

version: "3"

services:
  faser:
    image: pirsch/faser
    container_name: faser
    restart: unless-stopped
    ports:
      - "8080:8080"
    volumes:
      - ./data:/app/data

Changelog

See CHANGELOG.md.

Contributing

See CONTRIBUTING.md.

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.