Skip to content

Repository files navigation

Image Uploader

English · 简体中文

A lightweight image upload service built on Nitro, backed by a third-party image hosting API. After logging in, you can upload images through the REST API, the project-local CLI, or a global CLI command available anywhere on your machine.

Features

  • Two login methods — scan with the Bilibili app or submit login credentials manually
  • REST APIPOST /api/upload for programmatic uploads, cookie-based auth
  • CLI upload — batch upload a file or a whole directory, with concurrency control and a progress bar

Requirements

  • Node.js 20.12 or later
  • pnpm (any recent version)

Getting Started

git clone <this-repo-url>
cd image-uploader
pnpm install
pnpm dev

The dev server starts on Nitro's default port. Open the root URL in your browser to see the live API reference page.

API

Method Path Description
POST /api/auth/certificate Validate login credentials and set the auth cookies
GET /api/qrcode/generate Generate a login QR code
GET /api/qrcode/poll?qrcode_key= Poll scan status; sets the auth cookie on success
GET /api/myinfo Get the currently logged-in account's info
POST /api/upload Upload an image (multipart/form-data, field name file)
POST /api/auth/logout Log out and clear the authentication cookies

CLI

Project-local

Run uploads from inside this repo without any extra setup:

pnpm upload -f avatar.png
pnpm upload -d ./images

Run pnpm upload --help for all available flags.

Global command

Want to run k3img from any directory, not just this repo? See the dedicated global CLI setup guide.

Deploying

pnpm build

This project targets the vercel preset (see nitro.config.ts). See the Nitro deployment docs for other presets.

License

See LICENSE.

About

图床后端服务,提供图片上传等接口

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages