# picgo-plugin-nodeimage

A [PicGo](https://github.com/Molunerfinn/PicGo) plugin for [NodeImage](https://nodeimage.com) image hosting service.

> **Note**: This project was built entirely with AI coding ([Claude Code](https://claude.ai)). While functional, use at your own risk. Issues and stars are welcome!

[![GitHub issues](https://img.shields.io/github/issues/xshenhan/picgo-plugin-nodeimage)](https://github.com/xshenhan/picgo-plugin-nodeimage/issues)
[![GitHub stars](https://img.shields.io/github/stars/xshenhan/picgo-plugin-nodeimage)](https://github.com/xshenhan/picgo-plugin-nodeimage/stargazers)

## Features

- Upload images to NodeImage
- TLS 1.3 support (via system curl)
- Cross-platform (macOS / Linux / Windows)
- GUI configuration

## Installation

### GUI

1. Open PicGo
2. Go to **Plugin Settings**
3. Search for `nodeimage`
4. Click Install

### CLI

```bash
picgo install nodeimage
```

## Configuration

### GUI

1. Open PicGo -> **PicBed Settings**
2. Find **NodeImage**
3. Enter your **API Key**
4. Click "Confirm" and set as default

### CLI

```bash
picgo set uploader nodeimage
```

Or manually edit `~/.picgo/config.json`:

```json
{
  "picBed": {
    "uploader": "nodeimage",
    "current": "nodeimage",
    "nodeimage": {
      "apiKey": "your-api-key-here"
    }
  }
}
```

## Get API Key

1. Visit [NodeImage](https://nodeimage.com)
2. Register and login
3. Get your API Key from user settings

## System Requirements

This plugin uses system `curl` command to support TLS 1.3:

| Platform | Status |
|----------|--------|
| macOS | Supported by default |
| Linux | Supported by default |
| Windows 10/11 | Supported by default |
| Windows 7/8 | Requires [curl](https://curl.se/windows/) installation |

## Technical Details

### Why curl?

PicGo is built on Electron with an older Node.js version. Its HTTP client (axios) doesn't support TLS 1.3, but NodeImage server only accepts TLS 1.3 connections.

This plugin uses system `curl` to bypass this limitation, as modern operating systems' curl supports TLS 1.3.

Related Issue: [PicGo#1194](https://github.com/Molunerfinn/PicGo/issues/1194)

### API Endpoint

This plugin uses the NodeImage upload API:

- **Endpoint**: `POST https://api.nodeimage.com/api/upload`
- **Authentication**: `X-API-Key` Header
- **Response**:
```json
{
  "success": true,
  "message": "Image uploaded successfully",
  "image_id": "xxx",
  "filename": "xxx.png",
  "links": {
    "direct": "https://cdn.nodeimage.com/i/xxx.png",
    "markdown": "![image](https://cdn.nodeimage.com/i/xxx.png)"
  }
}
```

## Development

```bash
# Clone the repo
git clone https://github.com/xshenhan/picgo-plugin-nodeimage.git
cd picgo-plugin-nodeimage

# Install locally to PicGo
cd ~/.picgo
npm install /path/to/picgo-plugin-nodeimage

# Restart PicGo to test
```

## Contributing

This project was created with AI assistance. Contributions are welcome!

- Found a bug? [Open an issue](https://github.com/xshenhan/picgo-plugin-nodeimage/issues)
- Like this project? Give it a star!
- Want to improve it? PRs are welcome!

## Disclaimer

This software is provided "as is", without warranty of any kind. Use at your own risk.

## License

MIT
