Commit Graph

27 Commits

Author SHA1 Message Date
Thomas 5ae2942bfa UI rework (#757) 2026-07-27 03:41:17 +02:00
Thomas dd6b7803ab Archive gists (#739) 2026-06-27 23:45:14 +08:00
Thomas 7d9448571c Disable file upload (#737)
Go CI / Lint (push) Has been cancelled
Go CI / Check (push) Has been cancelled
Go CI / Test (mysql, 1.26, mysql:8, ubuntu-latest, 3306:3306) (push) Has been cancelled
Go CI / Test (postgres, 1.26, postgres:16, ubuntu-latest, 5432:5432) (push) Has been cancelled
Go CI / Test (sqlite, 1.26, macOS-latest) (push) Has been cancelled
Go CI / Test (sqlite, 1.26, ubuntu-latest) (push) Has been cancelled
Go CI / Build (1.26, macOS-latest) (push) Has been cancelled
Go CI / Build (1.26, ubuntu-latest) (push) Has been cancelled
Go CI / Build (1.26, windows-latest) (push) Has been cancelled
2026-06-27 05:19:45 +08:00
Thomas 50f2d9f67b Sanitize DOM for iypnb (#736) 2026-06-27 05:01:06 +08:00
Thomas 453bd09173 Better handler for committed http responses (#734) 2026-06-27 02:41:30 +08:00
Thomas ea6e7b7eb4 Add OpenSSH support (#735)
Signed-off-by: Thomas Miceli <tho.miceli@gmail.com>
2026-06-27 02:39:02 +08:00
Thomas 2a5a054167 Add rel="canonical" link tag (#732)
Go CI / Lint (push) Has been cancelled
Go CI / Check (push) Has been cancelled
Go CI / Test (mysql, 1.26, mysql:8, ubuntu-latest, 3306:3306) (push) Has been cancelled
Go CI / Test (postgres, 1.26, postgres:16, ubuntu-latest, 5432:5432) (push) Has been cancelled
Go CI / Test (sqlite, 1.26, macOS-latest) (push) Has been cancelled
Go CI / Test (sqlite, 1.26, ubuntu-latest) (push) Has been cancelled
Go CI / Build (1.26, macOS-latest) (push) Has been cancelled
Go CI / Build (1.26, ubuntu-latest) (push) Has been cancelled
Go CI / Build (1.26, windows-latest) (push) Has been cancelled
2026-06-26 03:59:41 +08:00
Thomas 28736d6b66 Gist expiration + scheduled actions (#726)
Signed-off-by: Thomas Miceli <tho.miceli@gmail.com>
2026-06-20 01:28:48 +08:00
Thomas 34e5a16a26 Require login + api (#711)
Signed-off-by: Thomas Miceli <tho.miceli@gmail.com>
2026-06-08 03:28:49 +08:00
Thomas 31bc25e569 Beautiful docs website (#710)
Signed-off-by: Thomas Miceli <tho.miceli@gmail.com>
2026-06-08 03:15:24 +08:00
Thomas 8e462397f4 API for gists and users (#707)
Go CI / Lint (push) Has been cancelled
Go CI / Check (push) Has been cancelled
Go CI / Test (mysql, 1.25, mysql:8, ubuntu-latest, 3306:3306) (push) Has been cancelled
Go CI / Test (postgres, 1.25, postgres:16, ubuntu-latest, 5432:5432) (push) Has been cancelled
Go CI / Test (sqlite, 1.25, macOS-latest) (push) Has been cancelled
Go CI / Test (sqlite, 1.25, ubuntu-latest) (push) Has been cancelled
Go CI / Build (1.25, macOS-latest) (push) Has been cancelled
Go CI / Build (1.25, ubuntu-latest) (push) Has been cancelled
Go CI / Build (1.25, windows-latest) (push) Has been cancelled
Signed-off-by: Thomas Miceli <tho.miceli@gmail.com>
2026-06-03 02:26:17 +08:00
awkj 690f151592 feat: add REST API v1 with admin toggle and OpenAPI spec (#702)
Go CI / Lint (push) Has been cancelled
Go CI / Check (push) Has been cancelled
Go CI / Test (mysql, 1.25, mysql:8, ubuntu-latest, 3306:3306) (push) Has been cancelled
Go CI / Test (postgres, 1.25, postgres:16, ubuntu-latest, 5432:5432) (push) Has been cancelled
Go CI / Test (sqlite, 1.25, macOS-latest) (push) Has been cancelled
Go CI / Test (sqlite, 1.25, ubuntu-latest) (push) Has been cancelled
Go CI / Build (1.25, macOS-latest) (push) Has been cancelled
Go CI / Build (1.25, ubuntu-latest) (push) Has been cancelled
Go CI / Build (1.25, windows-latest) (push) Has been cancelled
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
Thomas Miceli 6a61b720ab Improve test suite (#628)
Signed-off-by: Thomas Miceli <tho.miceli@gmail.com>
2026-03-02 15:43:24 +08:00
Thomas Miceli 829cd68879 CSRF skipper only for GET *.js request (#627)
Signed-off-by: Thomas Miceli <tho.miceli@gmail.com>
2026-03-02 15:05:45 +08:00
Thomas Miceli 7b1048ec30 Display a form to create an Opengist account coming from a OAuth provider (#623)
Go CI / Lint (push) Has been cancelled
Go CI / Check (push) Has been cancelled
Go CI / Test (mysql, 1.25, mysql:8, ubuntu-latest, 3306:3306) (push) Has been cancelled
Go CI / Test (postgres, 1.25, postgres:16, ubuntu-latest, 5432:5432) (push) Has been cancelled
Go CI / Test (sqlite, 1.25, macOS-latest) (push) Has been cancelled
Go CI / Test (sqlite, 1.25, ubuntu-latest) (push) Has been cancelled
Go CI / Test (sqlite, 1.25, windows-latest) (push) Has been cancelled
Go CI / Build (1.25, macOS-latest) (push) Has been cancelled
Go CI / Build (1.25, ubuntu-latest) (push) Has been cancelled
Go CI / Build (1.25, windows-latest) (push) Has been cancelled
2026-02-08 16:32:24 +08:00
Thomas Miceli b7dbdde66b Allow Access Tokens with Required Login (#611) 2026-02-02 19:31:07 +08:00
Thomas Miceli 5ddea2265d Add access tokens (#602) 2026-01-27 14:43:12 +08:00
Nova Cat 1128a81071 Ignore TCP errors (#601) 2026-01-27 13:49:37 +08:00
Thomas Miceli 145bf9d81a Move Prom metrics to a dedicated port + improve Helm chart (#599) 2026-01-26 17:28:51 +08:00
Thomas Miceli 594d876ba8 Add binary files support (#503) 2025-09-16 01:35:54 +02:00
Thomas Miceli dc43fccc04 Style preference tab for user (#467)
Go CI / Lint (push) Has been cancelled
Go CI / Check (push) Has been cancelled
Go CI / Test (mysql, 1.23, mysql:8, ubuntu-latest, 3306:3306) (push) Has been cancelled
Go CI / Test (postgres, 1.23, postgres:16, ubuntu-latest, 5432:5432) (push) Has been cancelled
Go CI / Test (sqlite, 1.23, macOS-latest) (push) Has been cancelled
Go CI / Test (sqlite, 1.23, ubuntu-latest) (push) Has been cancelled
Go CI / Test (sqlite, 1.23, windows-latest) (push) Has been cancelled
Go CI / Build (1.23, macOS-latest) (push) Has been cancelled
Go CI / Build (1.23, ubuntu-latest) (push) Has been cancelled
Go CI / Build (1.23, windows-latest) (push) Has been cancelled
2025-05-05 01:31:42 +02:00
Philipp Eckel 1ec026e191 feat: add Prometheus metrics (#439)
* feat: add Prometheus metrics

* setup metrics using Prometheus client under /metrics endpoint
* add configuration value for metrics
* configure Prometheus middleware for generic metrics
* provide metrics for totals of users, gists and SSH keys
* modify test request to optionally return the response
* provide integration test for Prometheus metrics
* update documentation

* chore: make fmt
2025-03-17 14:30:38 +01:00
Thomas Miceli 62d56cd1c7 Save content form on gist create error (#420)
Go CI / Lint (push) Waiting to run
Go CI / Check (push) Waiting to run
Go CI / Build (1.23, ubuntu-latest) (push) Waiting to run
Go CI / Build (1.23, windows-latest) (push) Waiting to run
Go CI / Test (mysql, 1.23, mysql:8, ubuntu-latest, 3306:3306) (push) Waiting to run
Go CI / Test (postgres, 1.23, postgres:16, ubuntu-latest, 5432:5432) (push) Waiting to run
Go CI / Test (sqlite, 1.23, macOS-latest) (push) Waiting to run
Go CI / Test (sqlite, 1.23, ubuntu-latest) (push) Waiting to run
Go CI / Test (sqlite, 1.23, windows-latest) (push) Waiting to run
Go CI / Build (1.23, macOS-latest) (push) Waiting to run
2025-01-29 16:00:58 +01:00
Thomas Miceli f5b8881d35 Add topics for Gists (#413)
Go CI / Lint (push) Has been cancelled
Go CI / Check (push) Has been cancelled
Go CI / Test (mysql, 1.23, mysql:8, ubuntu-latest, 3306:3306) (push) Has been cancelled
Go CI / Test (postgres, 1.23, postgres:16, ubuntu-latest, 5432:5432) (push) Has been cancelled
Go CI / Test (sqlite, 1.23, macOS-latest) (push) Has been cancelled
Go CI / Test (sqlite, 1.23, ubuntu-latest) (push) Has been cancelled
Go CI / Test (sqlite, 1.23, windows-latest) (push) Has been cancelled
Go CI / Build (1.23, macOS-latest) (push) Has been cancelled
Go CI / Build (1.23, ubuntu-latest) (push) Has been cancelled
Go CI / Build (1.23, windows-latest) (push) Has been cancelled
2025-01-24 14:39:42 +01:00
Thomas Miceli 662f553d37 Remove CSRF check for Git HTTP packs (#408) 2025-01-20 03:18:28 +01:00
Andreas Jaggi a752e0561d Skip CSRF for embeds (#402)
* Skip CSRF for embeds

The CSRF middleware sets a _csrf cookie also for loading the embed
javascript on third-party sites. With this change no _csrf cookie is set
when loading the embed javascript (regardless if third-party site or
first-party).
2025-01-20 02:18:45 +01:00
Thomas Miceli f935ee1a7e Refactor server code (#407) 2025-01-20 01:57:39 +01:00