[PR #497] [MERGED] APIv1: Start working on new REST API. Refactor logic in domains. #619

Closed
opened 2026-02-25 23:34:55 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-shiori/shiori/pull/497
Author: @fmartingr
Created: 10/9/2022
Status: Merged
Merged: 7/17/2023
Merged by: @fmartingr

Base: masterHead: feat/api-next


📝 Commits (10+)

  • c002f06 added 404 template
  • 92c24a2 added auth domain
  • 5ce8603 added embed file for frontend
  • 13ecc16 added base config and dependencies
  • 09d9a48 added basic new http server
  • bf10fa7 added separated server command
  • c97d620 updated go modules
  • f9bf322 removed modd file
  • 29d0de4 Added shortcut to send internal server error response
  • 0fab419 Added JWT support to Auth Domain

📊 Changes

117 files changed (+28180 additions, -75 deletions)

View changed files

📝 .github/workflows/_test.yml (+9 -2)
.golangci.yml (+31 -0)
📝 .goreleaser.yaml (+1 -0)
Makefile (+66 -0)
coverage.txt (+827 -0)
📝 docs/API.md (+2 -0)
docs/APIv1.md (+18 -0)
📝 docs/Contribute.md (+47 -2)
📝 docs/Usage.md (+2 -0)
docs/docs.go (+221 -0)
📝 docs/index.md (+5 -1)
docs/swagger.json (+191 -0)
docs/swagger.yaml (+121 -0)
📝 go.mod (+46 -8)
📝 go.sum (+168 -14)
📝 internal/assets.go (+1 -1)
📝 internal/cmd/root.go (+8 -3)
internal/cmd/server.go (+85 -0)
internal/cmd/version.go (+23 -0)
internal/config/config.go (+98 -0)

...and 80 more files

📄 Description

Meta: #640

Added a proof of concept (extending the idea from #467) with a new API server built on gin.

  • Added a separate server command to launch the new HTTP server
  • Database interface remains the same, though it should change a little bit, but it works for the PoC.
  • Added logic Domains which will encapsulate logic related to Shiori domains, to avoid having duplicated code between the client, the api and the extension API (which will merge)
  • Added the Auth Domain, which now checks for an user account based on the credentials (login check) and creates an auth token for an specific account to use as authentication in the API.
  • Adds a Makefile with a bunch of QoL commands for contributing, along with some contributing documentation.

Status

UI Routes

Category Method Endpoint Ready Tested
System GET /system/liveness
Bookmarks GET /bookmarks/:id/content
Bookmarks GET /bookmarks/:id/archive
Bookmarks GET /bookmarks/:id/thumb
UI GET /*files*

API routes

Category Method Endpoint Ready Swagger Tested
Tags GET /api/v1/tags
Tags POST /api/v1/tags
Tags PUT/PATCH /api/v1/tags/:id
Tags DELETE /api/v1/tags/:id
Accounts GET /api/v1/accounts
Accounts POST /api/v1/accounts
Accounts PUT/PATCH /api/v1/accounts/:id
Accounts DELETE /api/v1/accounts/:id
Accounts GET /api/v1/account/me
Accounts POST /api/v1/account/login
Accounts POST /api/v1/account/refresh
Bookmarks GET /api/v1/bookmarks
Bookmarks POST /api/v1/bookmarks
Bookmarks PUT/PATCH /api/v1/bookmarks/:id
Bookmarks PUT /api/v1/bookmarks/:id/cache

Database

Category SQLite MySQL PSQL
CreateTags

Discussion here: https://github.com/go-shiori/shiori/discussions/462

Fixes: #571 #184 #463


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-shiori/shiori/pull/497 **Author:** [@fmartingr](https://github.com/fmartingr) **Created:** 10/9/2022 **Status:** ✅ Merged **Merged:** 7/17/2023 **Merged by:** [@fmartingr](https://github.com/fmartingr) **Base:** `master` ← **Head:** `feat/api-next` --- ### 📝 Commits (10+) - [`c002f06`](https://github.com/go-shiori/shiori/commit/c002f062ef2f1584a5d4ba0105156fc667943e72) added 404 template - [`92c24a2`](https://github.com/go-shiori/shiori/commit/92c24a2453face4225d2d24034c4ff2701eb386e) added auth domain - [`5ce8603`](https://github.com/go-shiori/shiori/commit/5ce860311a228bf707992507d700b4d23a76664b) added embed file for frontend - [`13ecc16`](https://github.com/go-shiori/shiori/commit/13ecc1698402206bb3630225d17cb7c91a4e4c43) added base config and dependencies - [`09d9a48`](https://github.com/go-shiori/shiori/commit/09d9a48364afba6db3b0d5af9458cb488846f0dc) added basic new http server - [`bf10fa7`](https://github.com/go-shiori/shiori/commit/bf10fa72399e4dba44bad2416237bc209d0bdbc9) added separated server command - [`c97d620`](https://github.com/go-shiori/shiori/commit/c97d620c21ae38abf920c4aa9e92c7f756340995) updated go modules - [`f9bf322`](https://github.com/go-shiori/shiori/commit/f9bf322ab53a6d30c9549e38a0cfaedf32968ece) removed modd file - [`29d0de4`](https://github.com/go-shiori/shiori/commit/29d0de4a55ad91a7bf3e1a3219af3d7c877b7235) Added shortcut to send internal server error response - [`0fab419`](https://github.com/go-shiori/shiori/commit/0fab419b059b640b8ed642c070b22bdf15746d13) Added JWT support to Auth Domain ### 📊 Changes **117 files changed** (+28180 additions, -75 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/_test.yml` (+9 -2) ➕ `.golangci.yml` (+31 -0) 📝 `.goreleaser.yaml` (+1 -0) ➕ `Makefile` (+66 -0) ➕ `coverage.txt` (+827 -0) 📝 `docs/API.md` (+2 -0) ➕ `docs/APIv1.md` (+18 -0) 📝 `docs/Contribute.md` (+47 -2) 📝 `docs/Usage.md` (+2 -0) ➕ `docs/docs.go` (+221 -0) 📝 `docs/index.md` (+5 -1) ➕ `docs/swagger.json` (+191 -0) ➕ `docs/swagger.yaml` (+121 -0) 📝 `go.mod` (+46 -8) 📝 `go.sum` (+168 -14) 📝 `internal/assets.go` (+1 -1) 📝 `internal/cmd/root.go` (+8 -3) ➕ `internal/cmd/server.go` (+85 -0) ➕ `internal/cmd/version.go` (+23 -0) ➕ `internal/config/config.go` (+98 -0) _...and 80 more files_ </details> ### 📄 Description Meta: #640 Added a proof of concept (extending the idea from #467) with a new API server built on [gin](https://gin-gonic.com). - Added a separate `server` command to launch the new HTTP server - Database interface remains the same, though it should change a little bit, but it works for the PoC. - Added logic Domains which will encapsulate logic related to Shiori domains, to avoid having duplicated code between the client, the api and the extension API (which will merge) - Added the Auth Domain, which now checks for an user account based on the credentials (login check) and creates an auth token for an specific account to use as authentication in the API. - Adds a `Makefile` with a bunch of QoL commands for contributing, along with some contributing documentation. ## Status ### UI Routes | Category | Method | Endpoint | Ready | Tested | | --------- | ------ | ---------------------- | ----- | ------ | | System | `GET` | /system/liveness | ✅ | ✅ | | Bookmarks | `GET` | /bookmarks/:id/content | | | | Bookmarks | `GET` | /bookmarks/:id/archive | | | | Bookmarks | `GET` | /bookmarks/:id/thumb | | | | UI | `GET` | `/*files*` | ✅ | | ### API routes | Category | Method | Endpoint | Ready | Swagger | Tested | | --------- | ----------- | --------------------------- | ----- | ------- | ------ | | Tags | `GET` | /api/v1/tags | ✅ | ✅ | ✅ | | Tags | `POST` | /api/v1/tags | ✅ | ✅ | | | Tags | `PUT/PATCH` | /api/v1/tags/:id | | | | | Tags | `DELETE` | /api/v1/tags/:id | | | | | Accounts | `GET` | /api/v1/accounts | | | | | Accounts | `POST` | /api/v1/accounts | | | | | Accounts | `PUT/PATCH` | /api/v1/accounts/:id | | | | | Accounts | `DELETE` | /api/v1/accounts/:id | | | | | Accounts | `GET` | /api/v1/account/me | ✅ | ✅ | ✅ | | Accounts | `POST` | /api/v1/account/login | ✅ | ✅ | ✅ | | Accounts | `POST` | /api/v1/account/refresh | ✅ | ✅ | ✅ | | Bookmarks | `GET` | /api/v1/bookmarks | | | | | Bookmarks | `POST` | /api/v1/bookmarks | | | | | Bookmarks | `PUT/PATCH` | /api/v1/bookmarks/:id | | | | | Bookmarks | `PUT` | /api/v1/bookmarks/:id/cache | | | | ### Database | Category | SQLite | MySQL | PSQL | | -------- | ------ | ----- | ------ | | `CreateTags` | ✅ | ✅ | ✅ | **Discussion here:** https://github.com/go-shiori/shiori/discussions/462 Fixes: #571 #184 #463 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-25 23:34:55 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shiori#619
No description provided.