temporary_link feature

This commit is contained in:
Mateusz Gruszczyński
2026-05-21 22:05:08 +02:00
parent cb48735178
commit b772c97d50
10 changed files with 844 additions and 41 deletions

View File

@@ -2111,6 +2111,28 @@
"type": "object"
}
]
},
"TemporaryLinkResponse": {
"type": "object",
"properties": {
"ok": {
"type": "boolean",
"example": true
},
"url": {
"type": "string",
"example": "/download/r4nd0mTemporaryToken"
},
"expires_in": {
"type": "integer",
"example": 600
}
},
"required": [
"ok",
"url",
"expires_in"
]
}
},
"securitySchemes": {
@@ -7101,6 +7123,362 @@
},
"summary": "Traffic history"
}
},
"/preview/pdf/{token}": {
"get": {
"summary": "Open temporary PDF preview",
"description": "Streams a PDF through an in-app temporary preview URL created by the API. The browser-visible URL does not expose the stable /api download route.",
"parameters": [
{
"in": "path",
"name": "token",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "PDF stream",
"content": {
"application/pdf": {
"schema": {
"type": "string",
"format": "binary"
}
}
}
},
"403": {
"description": "Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
},
"404": {
"description": "Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
}
}
}
},
"/download/{token}": {
"get": {
"summary": "Open temporary download link",
"description": "Resolves a short-lived in-app download token created by an API endpoint and streams the requested file or ZIP.",
"parameters": [
{
"in": "path",
"name": "token",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "File stream",
"content": {
"application/octet-stream": {
"schema": {
"type": "string",
"format": "binary"
}
},
"application/zip": {
"schema": {
"type": "string",
"format": "binary"
}
},
"application/x-bittorrent": {
"schema": {
"type": "string",
"format": "binary"
}
}
}
},
"403": {
"description": "Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
},
"404": {
"description": "Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
}
}
}
},
"/api/torrents/{torrent_hash}/files/{file_index}/download-link": {
"post": {
"summary": "Create temporary torrent file download link",
"description": "Validates the selected torrent file through the API and returns a short-lived /download URL for the UI.",
"parameters": [
{
"in": "path",
"name": "torrent_hash",
"required": true,
"schema": {
"type": "string"
}
},
{
"in": "path",
"name": "file_index",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TemporaryLinkResponse"
}
}
}
},
"400": {
"description": "Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
}
}
}
},
"/api/torrents/{torrent_hash}/files/download-link": {
"post": {
"summary": "Create temporary torrent file download link from body",
"description": "Body-based alias that validates a selected torrent file and returns a short-lived /download URL.",
"parameters": [
{
"in": "path",
"name": "torrent_hash",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"file_index": {
"type": "integer"
}
},
"required": [
"file_index"
]
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TemporaryLinkResponse"
}
}
}
},
"400": {
"description": "Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
}
}
}
},
"/api/torrents/{torrent_hash}/files/download.zip/link": {
"post": {
"summary": "Create temporary torrent files ZIP download link",
"description": "Validates selected torrent files and returns a short-lived /download URL for a ZIP archive. If indexes is omitted or null, all files are included.",
"parameters": [
{
"in": "path",
"name": "torrent_hash",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": false,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"indexes": {
"type": "array",
"items": {
"type": "integer"
},
"nullable": true
}
}
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TemporaryLinkResponse"
}
}
}
},
"400": {
"description": "Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
}
}
}
},
"/api/torrents/{torrent_hash}/torrent-file/link": {
"get": {
"summary": "Create temporary .torrent export download link",
"description": "Validates .torrent export availability and returns a short-lived /download URL for the UI.",
"parameters": [
{
"in": "path",
"name": "torrent_hash",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TemporaryLinkResponse"
}
}
}
},
"400": {
"description": "Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
}
}
}
},
"/api/torrents/torrent-files.zip/link": {
"post": {
"summary": "Create temporary .torrent files ZIP download link",
"description": "Validates selected torrents and returns a short-lived /download URL for a ZIP of exported .torrent files.",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"hashes": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"hashes"
]
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TemporaryLinkResponse"
}
}
}
},
"400": {
"description": "Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
}
}
}
}
}
}