awkj 690f151592 feat: add REST API v1 with admin toggle and OpenAPI spec (#702)
Adds an HTTP REST API under /api/v1 with bearer-token auth, served
alongside the existing web UI. The API exposes seven endpoints:

  GET    /api/v1/user
  GET    /api/v1/gists
  POST   /api/v1/gists
  GET    /api/v1/gists/:uuid
  PATCH  /api/v1/gists/:uuid
  DELETE /api/v1/gists/:uuid
  GET    /api/v1/gists/:uuid/files/:filename/raw

Auth reuses the existing AccessToken model (extended with a new
ScopeUser permission for /user) and accepts both 'Authorization: Bearer
og_...' and the legacy 'Token og_...' header.

The API is gated by a new 'api-enabled' admin setting (default off) so
deployments must explicitly opt in from Admin Panel → Configuration.
When disabled, requests get a 503 with an actionable hint, and the
access-token settings page shows a banner pointing admins straight to
the toggle.

An embedded OpenAPI 3.1 spec is served at GET /api/v1/openapi.yaml;
import it into Postman / Insomnia / Bruno / openapi-generator for
interactive testing or client generation.

Other UX polish bundled in:
- Settings access-token form now exposes the new User scope and uses
  the existing locale.Tr lookups (translations backfilled for zh-CN).
- Language switcher distinguishes 简体中文 vs 繁體中文 instead of both
  appearing as '中文'.
- Settings page header tabs translated for zh-CN.
- POST /gists cleans up the on-disk repo when commit/create fails
  (previously orphaned).
- visibility=public list excludes private/unlisted gists (regression
  guard added).
- Content-Disposition filename in raw responses is RFC-escaped.

Docs: docs/usage/api.md walks through enabling the API, creating a
token, the seven endpoints with curl examples, error codes and v1
limitations.
2026-05-22 04:12:33 +08:00
2024-09-28 01:31:18 +02:00
2023-04-06 13:55:04 +02:00
2023-09-03 00:30:57 +02:00
2026-04-28 16:37:03 +07:00
2026-03-12 00:55:23 +08:00
2026-01-27 15:02:37 +08:00
2023-03-14 16:22:52 +01:00
2026-04-28 16:37:03 +07:00

Opengist

Opengist

Opengist is a self-hosted Pastebin powered by Git. All snippets are stored in a Git repository and can be read and/or modified using standard Git commands, or with the web interface. It is similar to GitHub Gist, but open-source and could be self-hosted.

Home PageDocumentationDiscordDemo

GitHub release (latest SemVer) License Go CI Go Report Card Translate

Features

  • Create public, unlisted or private snippets
  • Init / Clone / Pull / Push snippets via Git over HTTP or SSH
  • Syntax highlighting ; markdown & CSV support
  • Search code in snippets; browse users snippets, likes and forks
  • Add topics to snippets
  • Embed snippets in other websites
  • Revisions history
  • Like / Fork snippets
  • Download raw files or as a ZIP archive
  • OAuth2 login with GitHub, GitLab, Gitea, and OpenID Connect
  • Restrict or unrestrict snippets visibility to anonymous users
  • Docker support / Helm Chart
  • More...

Quick start

With Docker

Docker images are available for each release :

docker pull ghcr.io/thomiceli/opengist:1.12

It can be used in a docker-compose.yml file :

  1. Create a docker-compose.yml file with the following content
  2. Run docker compose up -d
  3. Opengist is now running on port 6157, you can browse http://localhost:6157
services:
  opengist:
    image: ghcr.io/thomiceli/opengist:1.12
    container_name: opengist
    restart: unless-stopped
    ports:
      - "6157:6157" # HTTP port
      - "2222:2222" # SSH port, can be removed if you don't use SSH
    volumes:
      - "$HOME/.opengist:/opengist"

You can define which user/group should run the container and own the files by setting the UID and GID environment variables :

services:
  opengist:
    # ...
    environment:
      UID: 1001
      GID: 1001

Via binary

Download the archive for your system from the release page here, and extract it.

# example for linux amd64
wget https://github.com/thomiceli/opengist/releases/download/v1.12.2/opengist1.12.2-linux-amd64.tar.gz

tar xzvf opengist1.12.2-linux-amd64.tar.gz
cd opengist
chmod +x opengist
./opengist # with or without `--config config.yml`

Opengist is now running on port 6157, you can browse http://localhost:6157

From source

Requirements: Git (2.28+), Go (1.23+), Node.js (16+), Make (optional, but easier)

git clone https://github.com/thomiceli/opengist
cd opengist
make
./opengist

Opengist is now running on port 6157, you can browse http://localhost:6157


To create and run a development environment, see run-development.md.

Documentation

The documentation is available at https://opengist.io/ or in the /docs directory.

License

Opengist is licensed under the AGPL-3.0 license.

Languages
Go 92.2%
TypeScript 6.4%
Shell 0.6%
Makefile 0.3%
Go Template 0.3%
Other 0.2%