PunGrumpy / image-logger

πŸ–ΌοΈ This is a simple image logger that logs images to a file and sending them to a discord webhook.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ–ΌοΈ Image Logger

πŸ“ Description

This is a simple image logger that logs images to a file and sending them to a discord webhook.

πŸ“š How to use

πŸ“¦ Requirements

  • Node.js v20.0.0 or higher
  • NPM v7.0.0 or higher
  • PNPM v6.0.0 or higher

πŸ“₯ Installation

pnpm install

βš™οΈ Configuration

Create a config.json you can use the config.example.json as a template.

{
  "webhooks": [
    {
      "name": "NAME OF WEBHOOK",
      "url": "URL OF WEBHOOK"
    }
  ],
  "image": [
    {
      "name": "NAME OF IMAGE",
      "path": "URL OF IMAGE or PATH OF IMAGE" // src/assets/IMAGE_NAME.png
    },
    {
      "name": "NAME OF IMAGE",
      "path": "URL OF IMAGE or PATH OF IMAGE" // src/assets/IMAGE_NAME.png
    }
  ]
}

You can also use enviroment variables to configure the project.

HEALTHCHECK_USER_AGENT=USER AGENT FOR HEALTHCHECK # Edit on Dockerfile

and then update your environment variables on your machine.

export HEALTHCHECK_USER_AGENT="USER AGENT FOR HEALTHCHECK"

Note: You can add as webhooks url on config.json as you want.

πŸ–ΌοΈ Preparing images

  1. Create a folder called assets or whatever you want in the src folder.
  2. Add your images to the folder.
  3. Add the images path to the config.json file.

πŸ“ Post Image

You can POST images to the /image endpoint.

🚌 Deploying

πŸ’» Local

pnpm start

🐳 Docker

docker compose up -d

β–² Vercel

You can using the Vercel platform to deploy this project.

Note: Don't forget to add the config and image to the project before deploying.

πŸ“ API

πŸ–ΌοΈ Post Image

curl -X POST -H "Content-Type: application/json" -d '{"image": "IMAGE URL", "imageName": "IMAGE NAME"}' http://localhost:3000/image

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

About

πŸ–ΌοΈ This is a simple image logger that logs images to a file and sending them to a discord webhook.

License:MIT License


Languages

Language:JavaScript 99.0%Language:Dockerfile 1.0%