This project provides image uploading, storage, and cloud synchronization services for the Custom Image Auto Uploader Obsidian plugin.
- 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
For the complete update details, please visit Changelog.
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:
-
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
-
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
andauth-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
anddatabase
Also modify
user.is-enable
anduser.register-is-enable
totrue
Start the gateway program
Access the
WebGUI
addresshttp://{IP:PORT}
for user registration configurationThe 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 itemconfig.local-fs.save-path
isstorage/uploads
,
If using gateway image resource access service,config.local-fs.httpfs-is-enable
needs to be set totrue
The correspondingaccess address prefix
ishttp://{IP:PORT}
, using single service gateway setconfig.app.upload-url-pre
Nginx is recommended for resource access
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: