Skip to content

image upload api gateway for obsidian-custom-image-auto-uploader ; 该项目为 Custom Image Auto Uploader Obsidian 插件提供图片上传、存储与云同步服务。

License

Notifications You must be signed in to change notification settings

haierkeys/obsidian-image-api-gateway

Repository files navigation

中文文档 / English Document

Obsidian Image API Gateway

version license

This project provides image uploading, storage, and cloud synchronization services for the Custom Image Auto Uploader Obsidian plugin.

Feature List

  • Support for image uploading
  • Support for token authorization to enhance API security
  • Support for image HTTP access (basic feature, Nginx recommended as an alternative)
  • Storage support:
    • Save to both local and cloud storage for easy migration
    • Local storage support (tested for NAS)
    • Support for Alibaba Cloud OSS storage (implemented but not tested)
    • Support for Cloudflare R2 storage (implemented and tested)
    • Support for Amazon S3 (implemented and tested)
    • Added MinIO storage support (v1.5+)
    • Support for WebDAV storage (v2.5+)
  • Provide Docker installation support for use on home NAS or remote servers
  • Provide public service API & Web interface for offering public services User Public Interface & Web Interface

Changelog

For the complete update details, please visit Changelog.

Price

This software is open source and free. If you would like to show appreciation or help support continued development, you can support me in the following ways:

BuyMeACoffee

Quick Start

Installation

  • Directory Setup

    # Create the directories needed for the project
    mkdir -p /data/image-api
    cd /data/image-api
    
    mkdir -p ./config && mkdir -p ./storage/logs && mkdir -p ./storage/uploads

    If you do not download the configuration file on the first startup, the program will automatically generate a default configuration at config/config.yaml

    If you want to download a default configuration from the network, use the following command

    # Download default configuration file from the open-source repository to the configuration directory
    wget -P ./config/ https://raw.githubusercontent.com/haierkeys/obsidian-image-api-gateway/main/config/config.yaml
  • Binary Installation

    Download the latest version from Releases, extract, and execute:

    ./image-api run -c config/config.yaml
  • Containerized Installation (Docker Method)

    Docker Command:

    # Pull the latest container image
    docker pull haierkeys/obsidian-image-api-gateway:latest
    
    # Create and start the container
    docker run -tid --name image-api \
            -p 9000:9000 -p 9001:9001 \
            -v /data/image-api/storage/:/api/storage/ \
            -v /data/image-api/config/:/api/config/ \
            haierkeys/obsidian-image-api-gateway:latest

    Docker Compose Use containrrr/watchtower to monitor the image and automatically update the project The content of docker-compose.yaml is as follows

    # docker-compose.yaml
    services:
      image-api:
        image: haierkeys/obsidian-image-api-gateway:latest  # Your application image
        container_name: image-api
        ports:
          - "9000:9000"  # Map port 9000
          - "9001:9001"  # Map port 9001
        volumes:
          - /data/image-api/storage/:/api/storage/  # Map storage directory
          - /data/image-api/config/:/api/config/    # Map configuration directory
        restart: always

    Execute docker compose

    Register the docker container as a service

    docker compose up -d

    Deregister and destroy the docker container

    docker compose down

Usage

  • Using Single Service Gateway

    Supports Local Storage, OSS, Cloudflare R2, Amazon S3, MinIO, WebDAV

    Need to modify config.yaml

    Modify the two options http-port and auth-token

    Start the gateway program

    The API gateway address is http://{IP:PORT}/api/upload

    The API access token is the content of auth-token

  • Using Multi-User Open Gateway

    Supports Local Storage, OSS, Cloudflare R2, Amazon S3, MinIO (v2.3+), WebDAV (v2.5+)

    Need to modify in config.yaml

    http-port and database

    Also modify user.is-enable and user.register-is-enable to true

    Start the gateway program

    Access the WebGUI address http://{IP:PORT} for user registration configuration

    Image

    The API gateway address is http://{IP:PORT}/api/user/upload

    Click to copy API configuration in WebGUI to get configuration information

  • Storage Type Description

    Storage Type Description
    Server Local Storage The default save path is: /data/storage/uploads related configuration item config.local-fs.save-path is storage/uploads,
    If using gateway image resource access service, config.local-fs.httpfs-is-enable needs to be set to true
    The corresponding access address prefix is http://{IP:PORT}, using single service gateway set config.app.upload-url-pre
    Nginx is recommended for resource access

Configuration Description

The default configuration file name is config.yaml, please place it in the root directory or config directory.

For more configuration details, please refer to:

Other Resources

About

image upload api gateway for obsidian-custom-image-auto-uploader ; 该项目为 Custom Image Auto Uploader Obsidian 插件提供图片上传、存储与云同步服务。

Topics

Resources

License

Stars

Watchers

Forks

Packages