From 7214330e5385fea5c2db03263423f2433a2304dc Mon Sep 17 00:00:00 2001
From: Dmitry Miasnenko
Date: Tue, 6 Aug 2024 04:02:44 +0300
Subject: [PATCH 1/3] readme-fix: remove warning about cli tool. Update version
in docker-compose.yml to match. (#25)
---
Cargo.toml | 2 +-
docker-compose.yml | 4 +---
openapi.json | 2 +-
readme.md | 31 ++++++++++++-------------------
4 files changed, 15 insertions(+), 24 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index 0c740b0..29a6dda 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "sero"
-version = "0.2.6"
+version = "0.2.7"
edition = "2021"
authors = ["clowzed "]
description = "Muiltidomain static site hosting"
diff --git a/docker-compose.yml b/docker-compose.yml
index 21cee03..8c1be93 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -39,15 +39,13 @@ services:
- server
server:
- image: clowzed/sero
+ image: clowzed/sero:v0.2.7
build: .
depends_on:
database:
condition: service_healthy
volumes:
- server-files:/app/sites-uploads
- ports:
- - 8080:8080
environment:
- DATABASE_URL=postgresql://postgres:1234@database/sero
- PORT=8080
diff --git a/openapi.json b/openapi.json
index 551cefd..8c00c2b 100644
--- a/openapi.json
+++ b/openapi.json
@@ -10,7 +10,7 @@
"license": {
"name": "MIT"
},
- "version": "0.2.6"
+ "version": "0.2.7"
},
"paths": {
"/api/auth/login": {
diff --git a/readme.md b/readme.md
index 9c4ed94..dacf155 100644
--- a/readme.md
+++ b/readme.md
@@ -21,31 +21,24 @@
-# Warning
-
-> [!CAUTION]
->
-> **_This project was in a huge rewrite and upload tool and docs are not updated!
-> THis will be fixed very soon._**
-
## 📖 Table Of Contents
-- [Warning!](#warning)
- - [📖 Table Of Contents](#-table-of-contents)
- - [Docs](#docs)
- - [🔧 Tools](#-tools)
- - [❓ About The Project](#-about-the-project)
- - [🚀 Features](#-features)
- - [🔌 Built With](#-built-with)
- - [📍 Roadmap](#-roadmap)
- - [🧑🤝🧑 Contributing](#-contributing)
+- [📖 Table Of Contents](#-table-of-contents)
+- [Docs](#docs)
+- [🔧 Tools](#-tools)
+- [❓ About The Project](#-about-the-project)
+- [🚀 Features](#-features)
+- [🔌 Built With](#-built-with)
+- [📍 Roadmap](#-roadmap)
+- [🧑🤝🧑 Contributing](#-contributing)
- [Creating A Pull Request](#creating-a-pull-request)
- - [License](#license)
- - [Authors](#authors)
+- [License](#license)
+- [Authors](#authors)
## Docs
-Read [docs here]("http://sero-docs.clowzed.ru") for fast installation.
+In progress...
+~~Read [docs here]("http://sero-docs.clowzed.ru") for fast installation.~~
## 🔧 Tools
From 782d8e4b0524361b84d7a417af9c520dc72b287d Mon Sep 17 00:00:00 2001
From: Dmitry Miasnenko
Date: Fri, 4 Oct 2024 15:59:59 +0300
Subject: [PATCH 2/3] Update readme. Remove openapi.json and adjust workflows.
(#26)
* readme-fix: remove warning about cli tool. Update version in docker-compose.yml to match.
* Updated readme.md. Fully remove openapi.json. Remove version cmp beteen Cargo.toml and openapi.json. Added openapi.josn to gitignore.
---
.github/workflows/dev.yml | 2 +-
.github/workflows/test.yml | 18 -
.gitignore | 1 +
Cargo.toml | 38 +-
openapi.json | 2434 ++++++++++++++++++------------------
readme.md | 4 +-
6 files changed, 1240 insertions(+), 1257 deletions(-)
diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index 7b64b15..af04248 100644
--- a/.github/workflows/dev.yml
+++ b/.github/workflows/dev.yml
@@ -3,7 +3,7 @@ name: "Test"
on:
push:
branches:
- - "dev" # matches every branch
+ - "dev"
jobs:
push-to-registry:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 894068a..2a2e902 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -46,24 +46,6 @@ jobs:
steps:
- uses: actions/checkout@v3
- - name: "Get version from Cargo.toml"
- id: "get-cargo-version"
- shell: "bash"
- run: |
- echo PKG_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' Cargo.toml) >> $GITHUB_OUTPUT
- - name: Get version from openapi.json
- id: get-openapi-version
- run: |
- echo OAPI_VERSION=$(jq -r '.info.version' openapi.json) >> $GITHUB_OUTPUT
-
- - name: Compare versions
- run: |
- if [ "${{ steps.get-cargo-version.outputs.PKG_VERSION }}" != "${{ steps.get-openapi-version.outputs.OAPI_VERSION }}" ]; then
- echo "Version mismatch between cargo.toml and generated OpenAPI JSON."
- exit 1
- else
- echo "Version matches between cargo.toml and generated OpenAPI JSON."
- fi
- name: Run tests (with database service)
run: cargo test --verbose -- --test-threads=1
diff --git a/.gitignore b/.gitignore
index 3337113..99dc2ec 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@ sites-uploads
logs
test_upload_files
.env
+openapi.json
diff --git a/Cargo.toml b/Cargo.toml
index 29a6dda..80b0906 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "sero"
-version = "0.2.7"
+version = "0.2.8"
edition = "2021"
authors = ["clowzed "]
description = "Muiltidomain static site hosting"
@@ -11,19 +11,19 @@ license = "MIT"
[dependencies]
envy = "0.4.2"
sea-orm = { version = "0.12.3", features = [
- "sqlx-postgres",
- "runtime-tokio-rustls",
- "macros",
+ "sqlx-postgres",
+ "runtime-tokio-rustls",
+ "macros",
] }
tokio = { version = "1.32.0", features = ["full"] }
tokio-postgres = "0.7.10"
tracing = { version = "0.1.37", features = ["async-await"] }
tracing-subscriber = { version = "0.3.17", features = [
- "env-filter",
- "fmt",
- "ansi",
- "std",
- "json",
+ "env-filter",
+ "fmt",
+ "ansi",
+ "std",
+ "json",
] }
entity = { path = "entity" }
migration = { path = "migration" }
@@ -41,9 +41,9 @@ mime = "0.3.17"
mime_guess = "2.0.4"
argon2 = { version = "0.5.3", features = ["std"] }
utoipa = { version = "4.2.0", features = [
- "axum_extras",
- "chrono",
- "preserve_order",
+ "axum_extras",
+ "chrono",
+ "preserve_order",
] }
dotenvy = "0.15.7"
toml = "0.8.8"
@@ -52,16 +52,16 @@ utoipa-rapidoc = { version = "4.0.0", features = ["axum"] }
utoipa-redoc = { version = "4.0.0", features = ["axum"] }
utoipa-swagger-ui = { version = "7.1.0", features = ["axum"] }
axum = { version = "0.7.4", features = [
- "macros",
- "tracing",
- "json",
- "multipart",
+ "macros",
+ "tracing",
+ "json",
+ "multipart",
] }
axum_typed_multipart = "0.11.0"
tower-http = { git = "https://github.com/tower-rs/tower-http.git", features = [
- "cors",
- "trace",
- "timeout",
+ "cors",
+ "trace",
+ "timeout",
] }
tower = { version = "0.4.13", features = ["util"] }
hyper = "0.14.28"
diff --git a/openapi.json b/openapi.json
index 8c00c2b..27f35d2 100644
--- a/openapi.json
+++ b/openapi.json
@@ -1,1219 +1,1219 @@
{
- "openapi": "3.0.3",
- "info": {
- "title": "sero",
- "description": "Muiltidomain static site hosting",
- "contact": {
- "name": "clowzed",
- "email": "clowzed.work@gmail.com"
- },
- "license": {
- "name": "MIT"
- },
- "version": "0.2.7"
- },
- "paths": {
- "/api/auth/login": {
- "post": {
- "tags": [
- "Account management"
- ],
- "summary": "Login user and receive JWT token.",
- "description": "This endpoint allows users to login to sero server. The TTL for token is set by\nthe owner of the server by `JWT_TTL` env.",
- "operationId": "Login",
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/LoginRequest"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "User was successfully authenticated.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/LoginResponse"
- }
- }
- }
- },
- "400": {
- "description": "Bad request or bad credentials. See details.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "404": {
- "description": "Login was not found.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "500": {
- "description": "Some error occurred on the server.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- }
- }
- }
- },
- "/api/auth/registration": {
- "post": {
- "tags": [
- "Account management"
- ],
- "summary": "Register new user for sero server.",
- "description": "This endpoint creates new user for sero server. The amount of users is checked\nby [RegistrationGuard]. The amount of allowed users is determined by `MAX_USERS` env.",
- "operationId": "Registration",
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/RegistrationRequest"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "User was successfully registered.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/RegistrationResponse"
- }
- }
- }
- },
- "400": {
- "description": "Bad request or bad credentials. See details.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "409": {
- "description": "Login has already been registered.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "500": {
- "description": "Some error occurred on the server.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- }
- }
- }
- },
- "/api/origin": {
- "get": {
- "tags": [
- "Origins Management and Dynamic Access Control"
- ],
- "summary": "List all origins for specified subdomain for dynamic CORS (Cross-Origin Resource Sharing) management.",
- "description": "This endpoint allows users to list all origins that are permitted to access resources\non their specified subdomains. The action is authenticated using a JWT, and the subdomain must\nbe owned by the user making the request. This will be checked by the server.",
- "operationId": "Get all origins",
- "parameters": [
- {
- "name": "x-subdomain",
- "in": "header",
- "description": "'x-subdomain' header represents the name of the subdomain on which the action is to be performed.",
- "required": true,
- "schema": {
- "type": "string"
- }
- }
- ],
- "responses": {
- "201": {
- "description": "Origins were successfully retrieved for subdomain.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ListOriginsResponse"
- }
- }
- }
- },
- "400": {
- "description": "The 'x-subdomain' header is missing or contains invalid characters.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized: The JWT in the header is invalid or expired.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "403": {
- "description": "Forbidden: The subdomain is owned by another user.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "404": {
- "description": "Not Found: The login or subdomain was not found. See details for more information.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "500": {
- "description": "Internal Server Error: An error occurred on the server.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- }
- },
- "security": [
- {
- "Bearer-JWT": []
- }
- ]
- },
- "post": {
- "tags": [
- "Origins Management and Dynamic Access Control"
- ],
- "summary": "Adds a new origin to a specified subdomain for dynamic CORS (Cross-Origin Resource Sharing) management.",
- "description": "This endpoint allows users to add origins that are permitted to access resources\non their specified subdomains. The action is authenticated using a JWT, and the subdomain must\nbe owned by the user making the request. This will be checked by the server.",
- "operationId": "Create origin",
- "parameters": [
- {
- "name": "x-subdomain",
- "in": "header",
- "description": "'x-subdomain' header represents the name of the subdomain on which the action is to be performed.",
- "required": true,
- "schema": {
- "type": "string"
- }
- }
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/AddOriginRequest"
- }
- }
- },
- "required": true
- },
- "responses": {
- "201": {
- "description": "The origin was successfully added.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/AddOriginResponse"
- }
- }
- }
- },
- "400": {
- "description": "The 'x-subdomain' header is missing or contains invalid characters.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized: The JWT in the header is invalid or expired.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "403": {
- "description": "Forbidden: The subdomain is owned by another user.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "404": {
- "description": "Not Found: The login or subdomain was not found. See details for more information.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "500": {
- "description": "Internal Server Error: An error occurred on the server.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- }
- },
- "security": [
- {
- "Bearer-JWT": []
- }
- ]
- },
- "delete": {
- "tags": [
- "Origins Management and Dynamic Access Control"
- ],
- "summary": "Delete all origins for specified subdomain for dynamic CORS (Cross-Origin Resource Sharing) management.",
- "description": "This endpoint allows users to delete all origins that are permitted to access resources\non their specified subdomains. The action is authenticated using a JWT, and the subdomain must\nbe owned by the user making the request. This will be checked by the server.",
- "operationId": "Delete all origins",
- "parameters": [
- {
- "name": "x-subdomain",
- "in": "header",
- "description": "'x-subdomain' header represents the name of the subdomain on which the action is to be performed.",
- "required": true,
- "schema": {
- "type": "string"
- }
- }
- ],
- "responses": {
- "204": {
- "description": "Origins were successfully deleted for subdomain."
- },
- "400": {
- "description": "The 'x-subdomain' header is missing or contains invalid characters.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized: The JWT in the header is invalid or expired.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "403": {
- "description": "Forbidden: The subdomain is owned by another user.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "404": {
- "description": "Not Found: The login or subdomain was not found. See details for more information.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "500": {
- "description": "Internal Server Error: An error occurred on the server.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- }
- },
- "security": [
- {
- "Bearer-JWT": []
- }
- ]
- }
- },
- "/api/origin/{id}": {
- "get": {
- "tags": [
- "Origins Management and Dynamic Access Control"
- ],
- "summary": "Get specified origin [by id] for specified subdomain for dynamic CORS (Cross-Origin Resource Sharing) management.",
- "description": "This endpoint allows users to get specified origin by id that is permitted to access resources\non specified subdomain. The action is authenticated using a JWT, and the subdomain must\nbe owned by the user making the request. This will be checked by the server.",
- "operationId": "Get origin by id",
- "parameters": [
- {
- "name": "x-subdomain",
- "in": "header",
- "description": "'x-subdomain' header represents the name of the subdomain on which the action is to be performed.",
- "required": true,
- "schema": {
- "type": "string"
- }
- },
- {
- "name": "id",
- "in": "path",
- "description": "Id of the origin to retrieve",
- "required": true,
- "schema": {
- "type": "integer",
- "format": "int64"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "Origin was successfully retrieved.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/GetOriginResponse"
- }
- }
- }
- },
- "400": {
- "description": "The 'x-subdomain' header is missing or contains invalid characters.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized: The JWT in the header is invalid or expired.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "403": {
- "description": "Forbidden: The subdomain is owned by another user.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "404": {
- "description": "Not Found: The login or subdomain or origin was not found. See details for more information.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "500": {
- "description": "Internal Server Error: An error occurred on the server.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- }
- },
- "security": [
- {
- "Bearer-JWT": []
- }
- ]
- },
- "delete": {
- "tags": [
- "Origins Management and Dynamic Access Control"
- ],
- "summary": "Delete origin by id for specified subdomain for dynamic CORS (Cross-Origin Resource Sharing) management.",
- "description": "This endpoint allows users to delete origin by id that is permitted to access resources\non their specified subdomains. The action is authenticated using a JWT, and the subdomain must\nbe owned by the user making the request. This will be checked by the server.",
- "operationId": "Delete origin by id",
- "parameters": [
- {
- "name": "x-subdomain",
- "in": "header",
- "description": "'x-subdomain' header represents the name of the subdomain on which the action is to be performed.",
- "required": true,
- "schema": {
- "type": "string"
- }
- },
- {
- "name": "id",
- "in": "path",
- "description": "Id of the origin to delete",
- "required": true,
- "schema": {
- "type": "integer",
- "format": "int64"
- }
- }
- ],
- "responses": {
- "204": {
- "description": "Origin was successfully deleted for subdomain."
- },
- "400": {
- "description": "The 'x-subdomain' header is missing or contains invalid characters.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized: The JWT in the header is invalid or expired.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "403": {
- "description": "Forbidden: The origin is owned by another user.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "404": {
- "description": "Not Found: The login or subdomain or origin was not found. See details for more information.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "500": {
- "description": "Internal Server Error: An error occurred on the server.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- }
- },
- "security": [
- {
- "Bearer-JWT": []
- }
- ]
- }
- },
- "/api/site": {
- "get": {
- "tags": [
- "Actions"
- ],
- "summary": "Download site of the specified subdomain.",
- "description": "Returns a zip file which was uploaded by user (last)",
- "operationId": "Download site",
- "parameters": [
- {
- "name": "x-subdomain",
- "in": "header",
- "description": "x-subdomain header represents name of subdomain to call action on",
- "required": true,
- "schema": {
- "type": "string"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "Site was successfully downloaded",
- "content": {
- "application/octet-stream": {
- "schema": {
- "type": "string"
- }
- }
- }
- },
- "400": {
- "description": "The 'x-subdomain' header is missing or contains invalid characters.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized: The JWT in the header is invalid or expired.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "403": {
- "description": "Forbidden: The subdomain is owned by another user.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "404": {
- "description": "Not Found: The login or subdomain was not found. See details for more information.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "500": {
- "description": "Internal Server Error: An error occurred on the server.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- }
- },
- "security": [
- {
- "Bearer-JWT": []
- }
- ]
- },
- "post": {
- "tags": [
- "Actions"
- ],
- "summary": "Uploads site for a specified subdomain.",
- "description": "Warning: Old files will be removed after successful upload.\nThe cleanup task is configured with `CLEAN_OBSOLETE_INTERVAL` env\nIf upload fails then old files will be preserved.\nIf upload fails on th stage of extracting zips then\nnew subdomain will be associated with user\n\nUpload guard checks amount of uploads available for user.\nThe guard is configured with `MAX_SITES_PER_USER` env.",
- "operationId": "Upload site",
- "parameters": [
- {
- "name": "x-subdomain",
- "in": "header",
- "description": "x-subdomain header represents name of subdomain to call action on",
- "required": true,
- "schema": {
- "type": "string"
- }
- }
- ],
- "requestBody": {
- "content": {
- "multipart/form-data": {
- "schema": {
- "$ref": "#/components/schemas/UploadData"
- }
- }
- },
- "required": true
- },
- "responses": {
- "204": {
- "description": "Site was successfully uploaded"
- },
- "400": {
- "description": "The 'x-subdomain' header is missing or contains invalid characters.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized: The JWT in the header is invalid or expired.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "403": {
- "description": "Forbidden: The subdomain is owned by another user.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "404": {
- "description": "Not Found: The login or subdomain was not found. See details for more information.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "500": {
- "description": "Internal Server Error: An error occurred on the server.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- }
- },
- "security": [
- {
- "Bearer-JWT": []
- }
- ]
- },
- "delete": {
- "tags": [
- "Actions"
- ],
- "summary": "Removes a specific site identified by the `x-subdomain` header.",
- "description": "This endpoint allows authenticated users to remove a site associated with the specified subdomain.\nThe subdomain to be removed is specified in the `x-subdomain` header.",
- "operationId": "Teardown site",
- "parameters": [
- {
- "name": "x-subdomain",
- "in": "header",
- "description": "x-subdomain header represents name of subdomain to call action on",
- "required": true,
- "schema": {
- "type": "string"
- }
- }
- ],
- "responses": {
- "204": {
- "description": "Site was successfully removed."
- },
- "400": {
- "description": "The 'x-subdomain' header is missing or contains invalid characters.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized: The JWT in the header is invalid or expired.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "403": {
- "description": "Forbidden: The subdomain is owned by another user.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "404": {
- "description": "Not Found: The login or subdomain was not found. See details for more information.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "500": {
- "description": "Internal Server Error: An error occurred on the server.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- }
- },
- "security": [
- {
- "Bearer-JWT": []
- }
- ]
- }
- },
- "/api/site/disable": {
- "patch": {
- "tags": [
- "Actions"
- ],
- "summary": "Disables a specific site identified by the `x-subdomain` header.",
- "description": "This endpoint allows authenticated users to disable a site associated with the specified subdomain.",
- "operationId": "Disable site",
- "parameters": [
- {
- "name": "x-subdomain",
- "in": "header",
- "description": "x-subdomain header represents name of subdomain to call action on",
- "required": true,
- "schema": {
- "type": "string"
- }
- }
- ],
- "responses": {
- "204": {
- "description": "Site was successfully disabled."
- },
- "400": {
- "description": "The 'x-subdomain' header is missing or contains invalid characters.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized: The JWT in the header is invalid or expired.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "403": {
- "description": "Forbidden: The subdomain is owned by another user.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "404": {
- "description": "Not Found: The login or subdomain was not found. See details for more information.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "500": {
- "description": "Internal Server Error: An error occurred on the server.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- }
- },
- "security": [
- {
- "Bearer-JWT": []
- }
- ]
- }
- },
- "/api/site/enable": {
- "patch": {
- "tags": [
- "Actions"
- ],
- "summary": "Enables a specific site identified by the `x-subdomain` header.",
- "description": "This endpoint allows authenticated users to enable a site associated with the specified subdomain.",
- "operationId": "Enable site",
- "parameters": [
- {
- "name": "x-subdomain",
- "in": "header",
- "description": "x-subdomain header represents name of subdomain to call action on",
- "required": true,
- "schema": {
- "type": "string"
- }
- }
- ],
- "responses": {
- "204": {
- "description": "Site was successfully enabled"
- },
- "400": {
- "description": "The 'x-subdomain' header is missing or contains invalid characters.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized: The JWT in the header is invalid or expired.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "403": {
- "description": "Forbidden: The subdomain is owned by another user.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "404": {
- "description": "Not Found: The login or subdomain was not found. See details for more information.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "500": {
- "description": "Internal Server Error: An error occurred on the server.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- }
- },
- "security": [
- {
- "Bearer-JWT": []
- }
- ]
- }
- }
- },
- "components": {
- "schemas": {
- "AddOriginRequest": {
- "type": "object",
- "required": [
- "origin"
- ],
- "properties": {
- "origin": {
- "type": "string",
- "description": "Origin to be added"
- }
- },
- "example": {
- "origin": "https://example.com/"
- }
- },
- "AddOriginResponse": {
- "type": "object",
- "required": [
- "id",
- "origin"
- ],
- "properties": {
- "id": {
- "type": "integer",
- "format": "int64",
- "description": "Automatically generated id for new origin\nThis can be used for further management"
- },
- "origin": {
- "type": "string",
- "description": "This duplicates origin from response payload\nto match REST specification"
- }
- },
- "example": {
- "id": "42",
- "origin": "https://example.com/"
- }
- },
- "Details": {
- "type": "object",
- "description": "This struct is a response of server in bad situation\nThat can be INTERNAL SERVER ERROR or BAD REQUEST\nYou can find all information in reason field",
- "required": [
- "reason"
- ],
- "properties": {
- "reason": {
- "type": "string",
- "description": "This field will contain error information"
- }
- }
- },
- "GetOriginResponse": {
- "type": "object",
- "required": [
- "origin"
- ],
- "properties": {
- "origin": {
- "$ref": "#/components/schemas/OriginModel"
- }
- },
- "example": {
- "origin": {
- "id": 42,
- "subdomain_id": 1,
- "value": "https://example.com"
- }
- }
- },
- "ListOriginsResponse": {
- "type": "object",
- "required": [
- "origins"
- ],
- "properties": {
- "origins": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/OriginModel"
- },
- "description": "List of retrieved origins"
- }
- },
- "example": {
- "origins": [
- {
- "id": 42,
- "subdomain_id": 1,
- "value": "https://example.com"
- }
- ]
- }
- },
- "LoginRequest": {
- "type": "object",
- "required": [
- "login",
- "password"
- ],
- "properties": {
- "login": {
- "type": "string",
- "description": "The username used for authentication.\nIt must adhere to the following criteria:\n- Minimum length of 5 characters.\n- Maximum length of 40 characters.",
- "maxLength": 40,
- "minLength": 5
- },
- "password": {
- "type": "string",
- "description": "The password used for authentication.\nIt must meet the following requirements:\n- Minimum length of 12 characters.\n- Maximum length of 40 characters.",
- "maxLength": 40,
- "minLength": 12
- }
- }
- },
- "LoginResponse": {
- "type": "object",
- "description": "The JWT token generated for authentication purposes.",
- "required": [
- "token"
- ],
- "properties": {
- "token": {
- "type": "string",
- "description": "Token in JWT format"
- }
- },
- "example": {
- "token": "ferwfwerfwer.fwerfwerfwerfwer.fwerfewfr"
- }
- },
- "OriginModel": {
- "type": "object",
- "required": [
- "id",
- "subdomain_id",
- "value"
- ],
- "properties": {
- "id": {
- "type": "integer",
- "format": "int64"
- },
- "subdomain_id": {
- "type": "integer",
- "format": "int64"
- },
- "value": {
- "type": "string"
- }
- }
- },
- "RegistrationRequest": {
- "type": "object",
- "required": [
- "login",
- "password"
- ],
- "properties": {
- "login": {
- "type": "string",
- "description": "The username used for authentication.\nIt must adhere to the following criteria:\n- Minimum length of 5 characters.\n- Maximum length of 40 characters.",
- "maxLength": 40,
- "minLength": 5
- },
- "password": {
- "type": "string",
- "description": "The password used for authentication.\nIt must meet the following requirements:\n- Minimum length of 12 characters.\n- Maximum length of 40 characters.",
- "maxLength": 40,
- "minLength": 12
- }
- }
- },
- "RegistrationResponse": {
- "type": "object",
- "required": [
- "id"
- ],
- "properties": {
- "id": {
- "type": "integer",
- "format": "int64",
- "description": "Auto generated id of a registered user"
- }
- },
- "example": {
- "id": 1293983717
- }
- },
- "UploadData": {
- "type": "object",
- "required": [
- "archive"
- ],
- "properties": {
- "archive": {
- "type": "string",
- "format": "binary"
- }
- }
- }
- },
- "securitySchemes": {
- "Bearer-JWT": {
- "type": "http",
- "scheme": "bearer",
- "bearerFormat": "JWT"
- }
- }
- }
+ "openapi": "3.0.3",
+ "info": {
+ "title": "sero",
+ "description": "Muiltidomain static site hosting",
+ "contact": {
+ "name": "clowzed",
+ "email": "clowzed.work@gmail.com"
+ },
+ "license": {
+ "name": "MIT"
+ },
+ "version": "0.2.7"
+ },
+ "paths": {
+ "/api/auth/login": {
+ "post": {
+ "tags": [
+ "Account management"
+ ],
+ "summary": "Login user and receive JWT token.",
+ "description": "This endpoint allows users to login to sero server. The TTL for token is set by\nthe owner of the server by `JWT_TTL` env.",
+ "operationId": "Login",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/LoginRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "User was successfully authenticated.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/LoginResponse"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Bad request or bad credentials. See details.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Login was not found.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Some error occurred on the server.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/api/auth/registration": {
+ "post": {
+ "tags": [
+ "Account management"
+ ],
+ "summary": "Register new user for sero server.",
+ "description": "This endpoint creates new user for sero server. The amount of users is checked\nby [RegistrationGuard]. The amount of allowed users is determined by `MAX_USERS` env.",
+ "operationId": "Registration",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/RegistrationRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "User was successfully registered.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/RegistrationResponse"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Bad request or bad credentials. See details.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "409": {
+ "description": "Login has already been registered.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Some error occurred on the server.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/api/origin": {
+ "get": {
+ "tags": [
+ "Origins Management and Dynamic Access Control"
+ ],
+ "summary": "List all origins for specified subdomain for dynamic CORS (Cross-Origin Resource Sharing) management.",
+ "description": "This endpoint allows users to list all origins that are permitted to access resources\non their specified subdomains. The action is authenticated using a JWT, and the subdomain must\nbe owned by the user making the request. This will be checked by the server.",
+ "operationId": "Get all origins",
+ "parameters": [
+ {
+ "name": "x-subdomain",
+ "in": "header",
+ "description": "'x-subdomain' header represents the name of the subdomain on which the action is to be performed.",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "description": "Origins were successfully retrieved for subdomain.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ListOriginsResponse"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "The 'x-subdomain' header is missing or contains invalid characters.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "Unauthorized: The JWT in the header is invalid or expired.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "403": {
+ "description": "Forbidden: The subdomain is owned by another user.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Not Found: The login or subdomain was not found. See details for more information.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal Server Error: An error occurred on the server.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "Bearer-JWT": []
+ }
+ ]
+ },
+ "post": {
+ "tags": [
+ "Origins Management and Dynamic Access Control"
+ ],
+ "summary": "Adds a new origin to a specified subdomain for dynamic CORS (Cross-Origin Resource Sharing) management.",
+ "description": "This endpoint allows users to add origins that are permitted to access resources\non their specified subdomains. The action is authenticated using a JWT, and the subdomain must\nbe owned by the user making the request. This will be checked by the server.",
+ "operationId": "Create origin",
+ "parameters": [
+ {
+ "name": "x-subdomain",
+ "in": "header",
+ "description": "'x-subdomain' header represents the name of the subdomain on which the action is to be performed.",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AddOriginRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "201": {
+ "description": "The origin was successfully added.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AddOriginResponse"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "The 'x-subdomain' header is missing or contains invalid characters.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "Unauthorized: The JWT in the header is invalid or expired.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "403": {
+ "description": "Forbidden: The subdomain is owned by another user.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Not Found: The login or subdomain was not found. See details for more information.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal Server Error: An error occurred on the server.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "Bearer-JWT": []
+ }
+ ]
+ },
+ "delete": {
+ "tags": [
+ "Origins Management and Dynamic Access Control"
+ ],
+ "summary": "Delete all origins for specified subdomain for dynamic CORS (Cross-Origin Resource Sharing) management.",
+ "description": "This endpoint allows users to delete all origins that are permitted to access resources\non their specified subdomains. The action is authenticated using a JWT, and the subdomain must\nbe owned by the user making the request. This will be checked by the server.",
+ "operationId": "Delete all origins",
+ "parameters": [
+ {
+ "name": "x-subdomain",
+ "in": "header",
+ "description": "'x-subdomain' header represents the name of the subdomain on which the action is to be performed.",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "Origins were successfully deleted for subdomain."
+ },
+ "400": {
+ "description": "The 'x-subdomain' header is missing or contains invalid characters.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "Unauthorized: The JWT in the header is invalid or expired.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "403": {
+ "description": "Forbidden: The subdomain is owned by another user.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Not Found: The login or subdomain was not found. See details for more information.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal Server Error: An error occurred on the server.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "Bearer-JWT": []
+ }
+ ]
+ }
+ },
+ "/api/origin/{id}": {
+ "get": {
+ "tags": [
+ "Origins Management and Dynamic Access Control"
+ ],
+ "summary": "Get specified origin [by id] for specified subdomain for dynamic CORS (Cross-Origin Resource Sharing) management.",
+ "description": "This endpoint allows users to get specified origin by id that is permitted to access resources\non specified subdomain. The action is authenticated using a JWT, and the subdomain must\nbe owned by the user making the request. This will be checked by the server.",
+ "operationId": "Get origin by id",
+ "parameters": [
+ {
+ "name": "x-subdomain",
+ "in": "header",
+ "description": "'x-subdomain' header represents the name of the subdomain on which the action is to be performed.",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "id",
+ "in": "path",
+ "description": "Id of the origin to retrieve",
+ "required": true,
+ "schema": {
+ "type": "integer",
+ "format": "int64"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Origin was successfully retrieved.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GetOriginResponse"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "The 'x-subdomain' header is missing or contains invalid characters.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "Unauthorized: The JWT in the header is invalid or expired.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "403": {
+ "description": "Forbidden: The subdomain is owned by another user.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Not Found: The login or subdomain or origin was not found. See details for more information.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal Server Error: An error occurred on the server.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "Bearer-JWT": []
+ }
+ ]
+ },
+ "delete": {
+ "tags": [
+ "Origins Management and Dynamic Access Control"
+ ],
+ "summary": "Delete origin by id for specified subdomain for dynamic CORS (Cross-Origin Resource Sharing) management.",
+ "description": "This endpoint allows users to delete origin by id that is permitted to access resources\non their specified subdomains. The action is authenticated using a JWT, and the subdomain must\nbe owned by the user making the request. This will be checked by the server.",
+ "operationId": "Delete origin by id",
+ "parameters": [
+ {
+ "name": "x-subdomain",
+ "in": "header",
+ "description": "'x-subdomain' header represents the name of the subdomain on which the action is to be performed.",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "id",
+ "in": "path",
+ "description": "Id of the origin to delete",
+ "required": true,
+ "schema": {
+ "type": "integer",
+ "format": "int64"
+ }
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "Origin was successfully deleted for subdomain."
+ },
+ "400": {
+ "description": "The 'x-subdomain' header is missing or contains invalid characters.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "Unauthorized: The JWT in the header is invalid or expired.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "403": {
+ "description": "Forbidden: The origin is owned by another user.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Not Found: The login or subdomain or origin was not found. See details for more information.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal Server Error: An error occurred on the server.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "Bearer-JWT": []
+ }
+ ]
+ }
+ },
+ "/api/site": {
+ "get": {
+ "tags": [
+ "Actions"
+ ],
+ "summary": "Download site of the specified subdomain.",
+ "description": "Returns a zip file which was uploaded by user (last)",
+ "operationId": "Download site",
+ "parameters": [
+ {
+ "name": "x-subdomain",
+ "in": "header",
+ "description": "x-subdomain header represents name of subdomain to call action on",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Site was successfully downloaded",
+ "content": {
+ "application/octet-stream": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "The 'x-subdomain' header is missing or contains invalid characters.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "Unauthorized: The JWT in the header is invalid or expired.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "403": {
+ "description": "Forbidden: The subdomain is owned by another user.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Not Found: The login or subdomain was not found. See details for more information.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal Server Error: An error occurred on the server.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "Bearer-JWT": []
+ }
+ ]
+ },
+ "post": {
+ "tags": [
+ "Actions"
+ ],
+ "summary": "Uploads site for a specified subdomain.",
+ "description": "Warning: Old files will be removed after successful upload.\nThe cleanup task is configured with `CLEAN_OBSOLETE_INTERVAL` env\nIf upload fails then old files will be preserved.\nIf upload fails on th stage of extracting zips then\nnew subdomain will be associated with user\n\nUpload guard checks amount of uploads available for user.\nThe guard is configured with `MAX_SITES_PER_USER` env.",
+ "operationId": "Upload site",
+ "parameters": [
+ {
+ "name": "x-subdomain",
+ "in": "header",
+ "description": "x-subdomain header represents name of subdomain to call action on",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "multipart/form-data": {
+ "schema": {
+ "$ref": "#/components/schemas/UploadData"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "204": {
+ "description": "Site was successfully uploaded"
+ },
+ "400": {
+ "description": "The 'x-subdomain' header is missing or contains invalid characters.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "Unauthorized: The JWT in the header is invalid or expired.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "403": {
+ "description": "Forbidden: The subdomain is owned by another user.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Not Found: The login or subdomain was not found. See details for more information.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal Server Error: An error occurred on the server.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "Bearer-JWT": []
+ }
+ ]
+ },
+ "delete": {
+ "tags": [
+ "Actions"
+ ],
+ "summary": "Removes a specific site identified by the `x-subdomain` header.",
+ "description": "This endpoint allows authenticated users to remove a site associated with the specified subdomain.\nThe subdomain to be removed is specified in the `x-subdomain` header.",
+ "operationId": "Teardown site",
+ "parameters": [
+ {
+ "name": "x-subdomain",
+ "in": "header",
+ "description": "x-subdomain header represents name of subdomain to call action on",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "Site was successfully removed."
+ },
+ "400": {
+ "description": "The 'x-subdomain' header is missing or contains invalid characters.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "Unauthorized: The JWT in the header is invalid or expired.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "403": {
+ "description": "Forbidden: The subdomain is owned by another user.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Not Found: The login or subdomain was not found. See details for more information.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal Server Error: An error occurred on the server.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "Bearer-JWT": []
+ }
+ ]
+ }
+ },
+ "/api/site/disable": {
+ "patch": {
+ "tags": [
+ "Actions"
+ ],
+ "summary": "Disables a specific site identified by the `x-subdomain` header.",
+ "description": "This endpoint allows authenticated users to disable a site associated with the specified subdomain.",
+ "operationId": "Disable site",
+ "parameters": [
+ {
+ "name": "x-subdomain",
+ "in": "header",
+ "description": "x-subdomain header represents name of subdomain to call action on",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "Site was successfully disabled."
+ },
+ "400": {
+ "description": "The 'x-subdomain' header is missing or contains invalid characters.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "Unauthorized: The JWT in the header is invalid or expired.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "403": {
+ "description": "Forbidden: The subdomain is owned by another user.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Not Found: The login or subdomain was not found. See details for more information.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal Server Error: An error occurred on the server.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "Bearer-JWT": []
+ }
+ ]
+ }
+ },
+ "/api/site/enable": {
+ "patch": {
+ "tags": [
+ "Actions"
+ ],
+ "summary": "Enables a specific site identified by the `x-subdomain` header.",
+ "description": "This endpoint allows authenticated users to enable a site associated with the specified subdomain.",
+ "operationId": "Enable site",
+ "parameters": [
+ {
+ "name": "x-subdomain",
+ "in": "header",
+ "description": "x-subdomain header represents name of subdomain to call action on",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "Site was successfully enabled"
+ },
+ "400": {
+ "description": "The 'x-subdomain' header is missing or contains invalid characters.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "Unauthorized: The JWT in the header is invalid or expired.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "403": {
+ "description": "Forbidden: The subdomain is owned by another user.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Not Found: The login or subdomain was not found. See details for more information.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal Server Error: An error occurred on the server.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Details"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "Bearer-JWT": []
+ }
+ ]
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "AddOriginRequest": {
+ "type": "object",
+ "required": [
+ "origin"
+ ],
+ "properties": {
+ "origin": {
+ "type": "string",
+ "description": "Origin to be added"
+ }
+ },
+ "example": {
+ "origin": "https://example.com/"
+ }
+ },
+ "AddOriginResponse": {
+ "type": "object",
+ "required": [
+ "id",
+ "origin"
+ ],
+ "properties": {
+ "id": {
+ "type": "integer",
+ "format": "int64",
+ "description": "Automatically generated id for new origin\nThis can be used for further management"
+ },
+ "origin": {
+ "type": "string",
+ "description": "This duplicates origin from response payload\nto match REST specification"
+ }
+ },
+ "example": {
+ "id": "42",
+ "origin": "https://example.com/"
+ }
+ },
+ "Details": {
+ "type": "object",
+ "description": "This struct is a response of server in bad situation\nThat can be INTERNAL SERVER ERROR or BAD REQUEST\nYou can find all information in reason field",
+ "required": [
+ "reason"
+ ],
+ "properties": {
+ "reason": {
+ "type": "string",
+ "description": "This field will contain error information"
+ }
+ }
+ },
+ "GetOriginResponse": {
+ "type": "object",
+ "required": [
+ "origin"
+ ],
+ "properties": {
+ "origin": {
+ "$ref": "#/components/schemas/OriginModel"
+ }
+ },
+ "example": {
+ "origin": {
+ "id": 42,
+ "subdomain_id": 1,
+ "value": "https://example.com"
+ }
+ }
+ },
+ "ListOriginsResponse": {
+ "type": "object",
+ "required": [
+ "origins"
+ ],
+ "properties": {
+ "origins": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/OriginModel"
+ },
+ "description": "List of retrieved origins"
+ }
+ },
+ "example": {
+ "origins": [
+ {
+ "id": 42,
+ "subdomain_id": 1,
+ "value": "https://example.com"
+ }
+ ]
+ }
+ },
+ "LoginRequest": {
+ "type": "object",
+ "required": [
+ "login",
+ "password"
+ ],
+ "properties": {
+ "login": {
+ "type": "string",
+ "description": "The username used for authentication.\nIt must adhere to the following criteria:\n- Minimum length of 5 characters.\n- Maximum length of 40 characters.",
+ "maxLength": 40,
+ "minLength": 5
+ },
+ "password": {
+ "type": "string",
+ "description": "The password used for authentication.\nIt must meet the following requirements:\n- Minimum length of 12 characters.\n- Maximum length of 40 characters.",
+ "maxLength": 40,
+ "minLength": 12
+ }
+ }
+ },
+ "LoginResponse": {
+ "type": "object",
+ "description": "The JWT token generated for authentication purposes.",
+ "required": [
+ "token"
+ ],
+ "properties": {
+ "token": {
+ "type": "string",
+ "description": "Token in JWT format"
+ }
+ },
+ "example": {
+ "token": "ferwfwerfwer.fwerfwerfwerfwer.fwerfewfr"
+ }
+ },
+ "OriginModel": {
+ "type": "object",
+ "required": [
+ "id",
+ "subdomain_id",
+ "value"
+ ],
+ "properties": {
+ "id": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "subdomain_id": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "value": {
+ "type": "string"
+ }
+ }
+ },
+ "RegistrationRequest": {
+ "type": "object",
+ "required": [
+ "login",
+ "password"
+ ],
+ "properties": {
+ "login": {
+ "type": "string",
+ "description": "The username used for authentication.\nIt must adhere to the following criteria:\n- Minimum length of 5 characters.\n- Maximum length of 40 characters.",
+ "maxLength": 40,
+ "minLength": 5
+ },
+ "password": {
+ "type": "string",
+ "description": "The password used for authentication.\nIt must meet the following requirements:\n- Minimum length of 12 characters.\n- Maximum length of 40 characters.",
+ "maxLength": 40,
+ "minLength": 12
+ }
+ }
+ },
+ "RegistrationResponse": {
+ "type": "object",
+ "required": [
+ "id"
+ ],
+ "properties": {
+ "id": {
+ "type": "integer",
+ "format": "int64",
+ "description": "Auto generated id of a registered user"
+ }
+ },
+ "example": {
+ "id": 1293983717
+ }
+ },
+ "UploadData": {
+ "type": "object",
+ "required": [
+ "archive"
+ ],
+ "properties": {
+ "archive": {
+ "type": "string",
+ "format": "binary"
+ }
+ }
+ }
+ },
+ "securitySchemes": {
+ "Bearer-JWT": {
+ "type": "http",
+ "scheme": "bearer",
+ "bearerFormat": "JWT"
+ }
+ }
+ }
}
diff --git a/readme.md b/readme.md
index dacf155..240f6b8 100644
--- a/readme.md
+++ b/readme.md
@@ -31,7 +31,7 @@
- [🔌 Built With](#-built-with)
- [📍 Roadmap](#-roadmap)
- [🧑🤝🧑 Contributing](#-contributing)
- - [Creating A Pull Request](#creating-a-pull-request)
+ - [Creating A Pull Request](#creating-a-pull-request)
- [License](#license)
- [Authors](#authors)
@@ -63,7 +63,7 @@ One key feature that it is self-hosted. This gives users more flexibility and co
- Custom 503.html `new` `(on disabled site)`
- Clean urls
- Dynamic CORS Management
-- `[WIP]` Server events with websocket
+- `[WIP]` SSE
## 🔌 Built With
From 466dd6b3f0f677c969f025f139d9e4e182b8e07d Mon Sep 17 00:00:00 2001
From: Dmitry Miasnenko
Date: Fri, 4 Oct 2024 16:24:02 +0300
Subject: [PATCH 3/3] Fix 1 commit behind (#27)
* readme-fix: remove warning about cli tool. Update version in docker-compose.yml to match.
* Updated readme.md. Fully remove openapi.json. Remove version cmp beteen Cargo.toml and openapi.json. Added openapi.josn to gitignore.
* Removed openapi.json
* Update readme.md
* Update readme.md
---
openapi.json | 1219 --------------------------------------------------
readme.md | 3 +-
2 files changed, 1 insertion(+), 1221 deletions(-)
delete mode 100644 openapi.json
diff --git a/openapi.json b/openapi.json
deleted file mode 100644
index 27f35d2..0000000
--- a/openapi.json
+++ /dev/null
@@ -1,1219 +0,0 @@
-{
- "openapi": "3.0.3",
- "info": {
- "title": "sero",
- "description": "Muiltidomain static site hosting",
- "contact": {
- "name": "clowzed",
- "email": "clowzed.work@gmail.com"
- },
- "license": {
- "name": "MIT"
- },
- "version": "0.2.7"
- },
- "paths": {
- "/api/auth/login": {
- "post": {
- "tags": [
- "Account management"
- ],
- "summary": "Login user and receive JWT token.",
- "description": "This endpoint allows users to login to sero server. The TTL for token is set by\nthe owner of the server by `JWT_TTL` env.",
- "operationId": "Login",
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/LoginRequest"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "User was successfully authenticated.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/LoginResponse"
- }
- }
- }
- },
- "400": {
- "description": "Bad request or bad credentials. See details.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "404": {
- "description": "Login was not found.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "500": {
- "description": "Some error occurred on the server.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- }
- }
- }
- },
- "/api/auth/registration": {
- "post": {
- "tags": [
- "Account management"
- ],
- "summary": "Register new user for sero server.",
- "description": "This endpoint creates new user for sero server. The amount of users is checked\nby [RegistrationGuard]. The amount of allowed users is determined by `MAX_USERS` env.",
- "operationId": "Registration",
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/RegistrationRequest"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "description": "User was successfully registered.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/RegistrationResponse"
- }
- }
- }
- },
- "400": {
- "description": "Bad request or bad credentials. See details.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "409": {
- "description": "Login has already been registered.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "500": {
- "description": "Some error occurred on the server.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- }
- }
- }
- },
- "/api/origin": {
- "get": {
- "tags": [
- "Origins Management and Dynamic Access Control"
- ],
- "summary": "List all origins for specified subdomain for dynamic CORS (Cross-Origin Resource Sharing) management.",
- "description": "This endpoint allows users to list all origins that are permitted to access resources\non their specified subdomains. The action is authenticated using a JWT, and the subdomain must\nbe owned by the user making the request. This will be checked by the server.",
- "operationId": "Get all origins",
- "parameters": [
- {
- "name": "x-subdomain",
- "in": "header",
- "description": "'x-subdomain' header represents the name of the subdomain on which the action is to be performed.",
- "required": true,
- "schema": {
- "type": "string"
- }
- }
- ],
- "responses": {
- "201": {
- "description": "Origins were successfully retrieved for subdomain.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ListOriginsResponse"
- }
- }
- }
- },
- "400": {
- "description": "The 'x-subdomain' header is missing or contains invalid characters.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized: The JWT in the header is invalid or expired.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "403": {
- "description": "Forbidden: The subdomain is owned by another user.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "404": {
- "description": "Not Found: The login or subdomain was not found. See details for more information.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "500": {
- "description": "Internal Server Error: An error occurred on the server.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- }
- },
- "security": [
- {
- "Bearer-JWT": []
- }
- ]
- },
- "post": {
- "tags": [
- "Origins Management and Dynamic Access Control"
- ],
- "summary": "Adds a new origin to a specified subdomain for dynamic CORS (Cross-Origin Resource Sharing) management.",
- "description": "This endpoint allows users to add origins that are permitted to access resources\non their specified subdomains. The action is authenticated using a JWT, and the subdomain must\nbe owned by the user making the request. This will be checked by the server.",
- "operationId": "Create origin",
- "parameters": [
- {
- "name": "x-subdomain",
- "in": "header",
- "description": "'x-subdomain' header represents the name of the subdomain on which the action is to be performed.",
- "required": true,
- "schema": {
- "type": "string"
- }
- }
- ],
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/AddOriginRequest"
- }
- }
- },
- "required": true
- },
- "responses": {
- "201": {
- "description": "The origin was successfully added.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/AddOriginResponse"
- }
- }
- }
- },
- "400": {
- "description": "The 'x-subdomain' header is missing or contains invalid characters.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized: The JWT in the header is invalid or expired.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "403": {
- "description": "Forbidden: The subdomain is owned by another user.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "404": {
- "description": "Not Found: The login or subdomain was not found. See details for more information.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "500": {
- "description": "Internal Server Error: An error occurred on the server.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- }
- },
- "security": [
- {
- "Bearer-JWT": []
- }
- ]
- },
- "delete": {
- "tags": [
- "Origins Management and Dynamic Access Control"
- ],
- "summary": "Delete all origins for specified subdomain for dynamic CORS (Cross-Origin Resource Sharing) management.",
- "description": "This endpoint allows users to delete all origins that are permitted to access resources\non their specified subdomains. The action is authenticated using a JWT, and the subdomain must\nbe owned by the user making the request. This will be checked by the server.",
- "operationId": "Delete all origins",
- "parameters": [
- {
- "name": "x-subdomain",
- "in": "header",
- "description": "'x-subdomain' header represents the name of the subdomain on which the action is to be performed.",
- "required": true,
- "schema": {
- "type": "string"
- }
- }
- ],
- "responses": {
- "204": {
- "description": "Origins were successfully deleted for subdomain."
- },
- "400": {
- "description": "The 'x-subdomain' header is missing or contains invalid characters.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized: The JWT in the header is invalid or expired.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "403": {
- "description": "Forbidden: The subdomain is owned by another user.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "404": {
- "description": "Not Found: The login or subdomain was not found. See details for more information.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "500": {
- "description": "Internal Server Error: An error occurred on the server.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- }
- },
- "security": [
- {
- "Bearer-JWT": []
- }
- ]
- }
- },
- "/api/origin/{id}": {
- "get": {
- "tags": [
- "Origins Management and Dynamic Access Control"
- ],
- "summary": "Get specified origin [by id] for specified subdomain for dynamic CORS (Cross-Origin Resource Sharing) management.",
- "description": "This endpoint allows users to get specified origin by id that is permitted to access resources\non specified subdomain. The action is authenticated using a JWT, and the subdomain must\nbe owned by the user making the request. This will be checked by the server.",
- "operationId": "Get origin by id",
- "parameters": [
- {
- "name": "x-subdomain",
- "in": "header",
- "description": "'x-subdomain' header represents the name of the subdomain on which the action is to be performed.",
- "required": true,
- "schema": {
- "type": "string"
- }
- },
- {
- "name": "id",
- "in": "path",
- "description": "Id of the origin to retrieve",
- "required": true,
- "schema": {
- "type": "integer",
- "format": "int64"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "Origin was successfully retrieved.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/GetOriginResponse"
- }
- }
- }
- },
- "400": {
- "description": "The 'x-subdomain' header is missing or contains invalid characters.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized: The JWT in the header is invalid or expired.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "403": {
- "description": "Forbidden: The subdomain is owned by another user.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "404": {
- "description": "Not Found: The login or subdomain or origin was not found. See details for more information.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "500": {
- "description": "Internal Server Error: An error occurred on the server.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- }
- },
- "security": [
- {
- "Bearer-JWT": []
- }
- ]
- },
- "delete": {
- "tags": [
- "Origins Management and Dynamic Access Control"
- ],
- "summary": "Delete origin by id for specified subdomain for dynamic CORS (Cross-Origin Resource Sharing) management.",
- "description": "This endpoint allows users to delete origin by id that is permitted to access resources\non their specified subdomains. The action is authenticated using a JWT, and the subdomain must\nbe owned by the user making the request. This will be checked by the server.",
- "operationId": "Delete origin by id",
- "parameters": [
- {
- "name": "x-subdomain",
- "in": "header",
- "description": "'x-subdomain' header represents the name of the subdomain on which the action is to be performed.",
- "required": true,
- "schema": {
- "type": "string"
- }
- },
- {
- "name": "id",
- "in": "path",
- "description": "Id of the origin to delete",
- "required": true,
- "schema": {
- "type": "integer",
- "format": "int64"
- }
- }
- ],
- "responses": {
- "204": {
- "description": "Origin was successfully deleted for subdomain."
- },
- "400": {
- "description": "The 'x-subdomain' header is missing or contains invalid characters.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized: The JWT in the header is invalid or expired.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "403": {
- "description": "Forbidden: The origin is owned by another user.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "404": {
- "description": "Not Found: The login or subdomain or origin was not found. See details for more information.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "500": {
- "description": "Internal Server Error: An error occurred on the server.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- }
- },
- "security": [
- {
- "Bearer-JWT": []
- }
- ]
- }
- },
- "/api/site": {
- "get": {
- "tags": [
- "Actions"
- ],
- "summary": "Download site of the specified subdomain.",
- "description": "Returns a zip file which was uploaded by user (last)",
- "operationId": "Download site",
- "parameters": [
- {
- "name": "x-subdomain",
- "in": "header",
- "description": "x-subdomain header represents name of subdomain to call action on",
- "required": true,
- "schema": {
- "type": "string"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "Site was successfully downloaded",
- "content": {
- "application/octet-stream": {
- "schema": {
- "type": "string"
- }
- }
- }
- },
- "400": {
- "description": "The 'x-subdomain' header is missing or contains invalid characters.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized: The JWT in the header is invalid or expired.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "403": {
- "description": "Forbidden: The subdomain is owned by another user.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "404": {
- "description": "Not Found: The login or subdomain was not found. See details for more information.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "500": {
- "description": "Internal Server Error: An error occurred on the server.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- }
- },
- "security": [
- {
- "Bearer-JWT": []
- }
- ]
- },
- "post": {
- "tags": [
- "Actions"
- ],
- "summary": "Uploads site for a specified subdomain.",
- "description": "Warning: Old files will be removed after successful upload.\nThe cleanup task is configured with `CLEAN_OBSOLETE_INTERVAL` env\nIf upload fails then old files will be preserved.\nIf upload fails on th stage of extracting zips then\nnew subdomain will be associated with user\n\nUpload guard checks amount of uploads available for user.\nThe guard is configured with `MAX_SITES_PER_USER` env.",
- "operationId": "Upload site",
- "parameters": [
- {
- "name": "x-subdomain",
- "in": "header",
- "description": "x-subdomain header represents name of subdomain to call action on",
- "required": true,
- "schema": {
- "type": "string"
- }
- }
- ],
- "requestBody": {
- "content": {
- "multipart/form-data": {
- "schema": {
- "$ref": "#/components/schemas/UploadData"
- }
- }
- },
- "required": true
- },
- "responses": {
- "204": {
- "description": "Site was successfully uploaded"
- },
- "400": {
- "description": "The 'x-subdomain' header is missing or contains invalid characters.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized: The JWT in the header is invalid or expired.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "403": {
- "description": "Forbidden: The subdomain is owned by another user.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "404": {
- "description": "Not Found: The login or subdomain was not found. See details for more information.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "500": {
- "description": "Internal Server Error: An error occurred on the server.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- }
- },
- "security": [
- {
- "Bearer-JWT": []
- }
- ]
- },
- "delete": {
- "tags": [
- "Actions"
- ],
- "summary": "Removes a specific site identified by the `x-subdomain` header.",
- "description": "This endpoint allows authenticated users to remove a site associated with the specified subdomain.\nThe subdomain to be removed is specified in the `x-subdomain` header.",
- "operationId": "Teardown site",
- "parameters": [
- {
- "name": "x-subdomain",
- "in": "header",
- "description": "x-subdomain header represents name of subdomain to call action on",
- "required": true,
- "schema": {
- "type": "string"
- }
- }
- ],
- "responses": {
- "204": {
- "description": "Site was successfully removed."
- },
- "400": {
- "description": "The 'x-subdomain' header is missing or contains invalid characters.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized: The JWT in the header is invalid or expired.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "403": {
- "description": "Forbidden: The subdomain is owned by another user.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "404": {
- "description": "Not Found: The login or subdomain was not found. See details for more information.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "500": {
- "description": "Internal Server Error: An error occurred on the server.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- }
- },
- "security": [
- {
- "Bearer-JWT": []
- }
- ]
- }
- },
- "/api/site/disable": {
- "patch": {
- "tags": [
- "Actions"
- ],
- "summary": "Disables a specific site identified by the `x-subdomain` header.",
- "description": "This endpoint allows authenticated users to disable a site associated with the specified subdomain.",
- "operationId": "Disable site",
- "parameters": [
- {
- "name": "x-subdomain",
- "in": "header",
- "description": "x-subdomain header represents name of subdomain to call action on",
- "required": true,
- "schema": {
- "type": "string"
- }
- }
- ],
- "responses": {
- "204": {
- "description": "Site was successfully disabled."
- },
- "400": {
- "description": "The 'x-subdomain' header is missing or contains invalid characters.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized: The JWT in the header is invalid or expired.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "403": {
- "description": "Forbidden: The subdomain is owned by another user.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "404": {
- "description": "Not Found: The login or subdomain was not found. See details for more information.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "500": {
- "description": "Internal Server Error: An error occurred on the server.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- }
- },
- "security": [
- {
- "Bearer-JWT": []
- }
- ]
- }
- },
- "/api/site/enable": {
- "patch": {
- "tags": [
- "Actions"
- ],
- "summary": "Enables a specific site identified by the `x-subdomain` header.",
- "description": "This endpoint allows authenticated users to enable a site associated with the specified subdomain.",
- "operationId": "Enable site",
- "parameters": [
- {
- "name": "x-subdomain",
- "in": "header",
- "description": "x-subdomain header represents name of subdomain to call action on",
- "required": true,
- "schema": {
- "type": "string"
- }
- }
- ],
- "responses": {
- "204": {
- "description": "Site was successfully enabled"
- },
- "400": {
- "description": "The 'x-subdomain' header is missing or contains invalid characters.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "401": {
- "description": "Unauthorized: The JWT in the header is invalid or expired.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "403": {
- "description": "Forbidden: The subdomain is owned by another user.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "404": {
- "description": "Not Found: The login or subdomain was not found. See details for more information.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- },
- "500": {
- "description": "Internal Server Error: An error occurred on the server.",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/Details"
- }
- }
- }
- }
- },
- "security": [
- {
- "Bearer-JWT": []
- }
- ]
- }
- }
- },
- "components": {
- "schemas": {
- "AddOriginRequest": {
- "type": "object",
- "required": [
- "origin"
- ],
- "properties": {
- "origin": {
- "type": "string",
- "description": "Origin to be added"
- }
- },
- "example": {
- "origin": "https://example.com/"
- }
- },
- "AddOriginResponse": {
- "type": "object",
- "required": [
- "id",
- "origin"
- ],
- "properties": {
- "id": {
- "type": "integer",
- "format": "int64",
- "description": "Automatically generated id for new origin\nThis can be used for further management"
- },
- "origin": {
- "type": "string",
- "description": "This duplicates origin from response payload\nto match REST specification"
- }
- },
- "example": {
- "id": "42",
- "origin": "https://example.com/"
- }
- },
- "Details": {
- "type": "object",
- "description": "This struct is a response of server in bad situation\nThat can be INTERNAL SERVER ERROR or BAD REQUEST\nYou can find all information in reason field",
- "required": [
- "reason"
- ],
- "properties": {
- "reason": {
- "type": "string",
- "description": "This field will contain error information"
- }
- }
- },
- "GetOriginResponse": {
- "type": "object",
- "required": [
- "origin"
- ],
- "properties": {
- "origin": {
- "$ref": "#/components/schemas/OriginModel"
- }
- },
- "example": {
- "origin": {
- "id": 42,
- "subdomain_id": 1,
- "value": "https://example.com"
- }
- }
- },
- "ListOriginsResponse": {
- "type": "object",
- "required": [
- "origins"
- ],
- "properties": {
- "origins": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/OriginModel"
- },
- "description": "List of retrieved origins"
- }
- },
- "example": {
- "origins": [
- {
- "id": 42,
- "subdomain_id": 1,
- "value": "https://example.com"
- }
- ]
- }
- },
- "LoginRequest": {
- "type": "object",
- "required": [
- "login",
- "password"
- ],
- "properties": {
- "login": {
- "type": "string",
- "description": "The username used for authentication.\nIt must adhere to the following criteria:\n- Minimum length of 5 characters.\n- Maximum length of 40 characters.",
- "maxLength": 40,
- "minLength": 5
- },
- "password": {
- "type": "string",
- "description": "The password used for authentication.\nIt must meet the following requirements:\n- Minimum length of 12 characters.\n- Maximum length of 40 characters.",
- "maxLength": 40,
- "minLength": 12
- }
- }
- },
- "LoginResponse": {
- "type": "object",
- "description": "The JWT token generated for authentication purposes.",
- "required": [
- "token"
- ],
- "properties": {
- "token": {
- "type": "string",
- "description": "Token in JWT format"
- }
- },
- "example": {
- "token": "ferwfwerfwer.fwerfwerfwerfwer.fwerfewfr"
- }
- },
- "OriginModel": {
- "type": "object",
- "required": [
- "id",
- "subdomain_id",
- "value"
- ],
- "properties": {
- "id": {
- "type": "integer",
- "format": "int64"
- },
- "subdomain_id": {
- "type": "integer",
- "format": "int64"
- },
- "value": {
- "type": "string"
- }
- }
- },
- "RegistrationRequest": {
- "type": "object",
- "required": [
- "login",
- "password"
- ],
- "properties": {
- "login": {
- "type": "string",
- "description": "The username used for authentication.\nIt must adhere to the following criteria:\n- Minimum length of 5 characters.\n- Maximum length of 40 characters.",
- "maxLength": 40,
- "minLength": 5
- },
- "password": {
- "type": "string",
- "description": "The password used for authentication.\nIt must meet the following requirements:\n- Minimum length of 12 characters.\n- Maximum length of 40 characters.",
- "maxLength": 40,
- "minLength": 12
- }
- }
- },
- "RegistrationResponse": {
- "type": "object",
- "required": [
- "id"
- ],
- "properties": {
- "id": {
- "type": "integer",
- "format": "int64",
- "description": "Auto generated id of a registered user"
- }
- },
- "example": {
- "id": 1293983717
- }
- },
- "UploadData": {
- "type": "object",
- "required": [
- "archive"
- ],
- "properties": {
- "archive": {
- "type": "string",
- "format": "binary"
- }
- }
- }
- },
- "securitySchemes": {
- "Bearer-JWT": {
- "type": "http",
- "scheme": "bearer",
- "bearerFormat": "JWT"
- }
- }
- }
-}
diff --git a/readme.md b/readme.md
index 240f6b8..744c7de 100644
--- a/readme.md
+++ b/readme.md
@@ -37,8 +37,7 @@
## Docs
-In progress...
-~~Read [docs here]("http://sero-docs.clowzed.ru") for fast installation.~~
+Read [docs here]("clowzed.github.io/sero-docs/") for fast installation.
## 🔧 Tools