diff --git a/.vscode/settings.json b/.vscode/settings.json index 8608917..232cb76 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -19,6 +19,7 @@ "mpfd", "necsfield", "Presign", + "Recaptcha", "Robohash", "Taymiyyah", "templater", diff --git a/db/ano-user-activities.sql b/db/ano-user-activities.sql index 3378c40..e373e6f 100644 --- a/db/ano-user-activities.sql +++ b/db/ano-user-activities.sql @@ -13,6 +13,7 @@ WITH activity.type = 'activity' AND activity.src = "web" AND activity.kind != "comment" + AND activity.kind != 'follow' ORDER BY activity.timestamp DESC OFFSET diff --git a/db/count-ano-user-activities.sql b/db/count-ano-user-activities.sql index 35462fb..5618f7e 100644 --- a/db/count-ano-user-activities.sql +++ b/db/count-ano-user-activities.sql @@ -1,8 +1,8 @@ SELECT RAW COUNT(*) FROM - `bucket_name` s + `bucket_name` activity WHERE - s.type = "activity" + activity.type = "activity" AND activity.src = "web" AND activity.kind != "comment" diff --git a/db/user-activities.sql b/db/user-activities.sql index 488d4e0..e76544b 100644 --- a/db/user-activities.sql +++ b/db/user-activities.sql @@ -20,6 +20,7 @@ WITH activity.`type` = 'activity' AND activity.src = 'web' AND activity.kind != 'comment' + AND activity.kind != 'follow' ) SELECT { diff --git a/docs/docs.go b/docs/docs.go index fc78406..906be9b 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -450,6 +450,74 @@ const docTemplate = `{ } }, "/comments/": { + "get": { + "description": "List comments", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Comment" + ], + "summary": "Retrieves a paginated list of comments", + "parameters": [ + { + "type": "integer", + "description": "Number of comments per page", + "name": "per_page", + "in": "query" + }, + { + "type": "integer", + "description": "Specify the page number", + "name": "page", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/pagination.Pages" + }, + { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/entity.Comment" + } + } + } + } + ] + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/errors.ErrorResponse" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/errors.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/errors.ErrorResponse" + } + } + } + }, "post": { "security": [ { @@ -676,6 +744,73 @@ const docTemplate = `{ } } }, + "/contact/": { + "post": { + "description": "Handles form-data sent via landing page.", + "tags": [ + "Support" + ], + "summary": "Contact Us", + "parameters": [ + { + "description": "The user's email", + "name": "email", + "in": "body", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The subject of the email", + "name": "subject", + "in": "body", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The content of the email", + "name": "message", + "in": "body", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "Google Recaptcha v3 response", + "name": "g-recaptcha-response", + "in": "body", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/errors.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/errors.ErrorResponse" + } + } + } + } + }, "/files/": { "get": { "security": [ @@ -810,6 +945,66 @@ const docTemplate = `{ } } }, + "/files/search": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "Search files", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "File" + ], + "summary": "Searches files based on files' metadata", + "parameters": [ + { + "type": "integer", + "description": "Number of files per page", + "name": "per_page", + "in": "query" + }, + { + "type": "integer", + "description": "Specify the page number", + "name": "page", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/pagination.Pages" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/errors.ErrorResponse" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/errors.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/errors.ErrorResponse" + } + } + } + } + }, "/files/{sha256}": { "get": { "description": "Retrieves the content of a file report.", @@ -1179,6 +1374,12 @@ const docTemplate = `{ } ], "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object" + } + }, "403": { "description": "Forbidden", "schema": { @@ -1252,6 +1453,59 @@ const docTemplate = `{ } } }, + "/files/{sha256}/meta-ui/": { + "get": { + "security": [ + { + "Bearer": [], + - {}: [] + } + ], + "description": "Frontend metadata fields such as navbar menus.", + "produces": [ + "application/json" + ], + "tags": [ + "File" + ], + "summary": "Frontend Metadata", + "parameters": [ + { + "type": "string", + "description": "File SHA256", + "name": "sha256", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/errors.ErrorResponse" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/errors.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/errors.ErrorResponse" + } + } + } + } + }, "/files/{sha256}/rescan/": { "post": { "security": [ @@ -1277,6 +1531,12 @@ const docTemplate = `{ } ], "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object" + } + }, "403": { "description": "Forbidden", "schema": { @@ -1330,6 +1590,12 @@ const docTemplate = `{ "description": "Specify the page number", "name": "page", "in": "query" + }, + { + "type": "string", + "description": "Specify the string to search for", + "name": "q", + "in": "query" } ], "responses": { @@ -1438,6 +1704,12 @@ const docTemplate = `{ } ], "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object" + } + }, "403": { "description": "Forbidden", "schema": { @@ -2580,6 +2852,9 @@ const docTemplate = `{ "api_trace": {}, "artifacts": {}, "capabilities": {}, + "doc": { + "$ref": "#/definitions/entity.DocMetadata" + }, "env": {}, "proc_tree": {}, "sandbox_log": {}, @@ -2591,7 +2866,7 @@ const docTemplate = `{ "type": "string" }, "status": { - "type": "integer" + "$ref": "#/definitions/entity.FileScanProgressType" }, "sys_events": {}, "timestamp": { @@ -2609,6 +2884,14 @@ const docTemplate = `{ "description": "Body represents the content of the comment.", "type": "string" }, + "doc": { + "description": "Meta represents document metadata.", + "allOf": [ + { + "$ref": "#/definitions/entity.DocMetadata" + } + ] + }, "id": { "description": "ID represents the activity identifier.", "type": "string" @@ -2631,6 +2914,20 @@ const docTemplate = `{ } } }, + "entity.DocMetadata": { + "type": "object", + "properties": { + "created_at": { + "type": "integer" + }, + "last_updated": { + "type": "integer" + }, + "version": { + "type": "integer" + } + } + }, "entity.File": { "type": "object", "properties": { @@ -2641,13 +2938,13 @@ const docTemplate = `{ "type": "integer" } }, - "comments_count": { - "type": "integer" - }, "crc32": { "type": "string" }, "default_behavior_report": {}, + "doc": { + "$ref": "#/definitions/entity.DocMetadata" + }, "exif": { "type": "object", "additionalProperties": { @@ -2709,7 +3006,7 @@ const docTemplate = `{ "type": "string" }, "status": { - "type": "integer" + "$ref": "#/definitions/entity.FileScanProgressType" }, "strings": {}, "submissions": { @@ -2722,6 +3019,9 @@ const docTemplate = `{ "type": "object", "additionalProperties": true }, + "tlsh": { + "type": "string" + }, "trid": { "type": "array", "items": { @@ -2733,6 +3033,19 @@ const docTemplate = `{ } } }, + "entity.FileScanProgressType": { + "type": "integer", + "enum": [ + 1, + 2, + 3 + ], + "x-enum-varnames": [ + "FileScanProgressQueued", + "FileScanProgressProcessing", + "FileScanProgressFinished" + ] + }, "entity.Submission": { "type": "object", "properties": { @@ -2765,42 +3078,33 @@ const docTemplate = `{ "confirmed": { "type": "boolean" }, + "doc": { + "$ref": "#/definitions/entity.DocMetadata" + }, "email": { "type": "string" }, "followers": { "type": "array", "items": { - "type": "string" + "$ref": "#/definitions/entity.UserFollows" } }, - "followers_count": { - "type": "integer" - }, "following": { "type": "array", "items": { - "type": "string" + "$ref": "#/definitions/entity.UserFollows" } }, - "following_count": { - "type": "integer" - }, - "has_avatar": { - "type": "boolean" - }, "last_seen": { "type": "integer" }, "likes": { "type": "array", "items": { - "type": "string" + "$ref": "#/definitions/entity.UserLike" } }, - "likes_count": { - "type": "integer" - }, "location": { "type": "string" }, @@ -2813,8 +3117,11 @@ const docTemplate = `{ "password": { "type": "string" }, - "submissions_count": { - "type": "integer" + "submissions": { + "type": "array", + "items": { + "$ref": "#/definitions/entity.UserSubmission" + } }, "type": { "type": "string" @@ -2827,6 +3134,39 @@ const docTemplate = `{ } } }, + "entity.UserFollows": { + "type": "object", + "properties": { + "ts": { + "type": "integer" + }, + "username": { + "type": "string" + } + } + }, + "entity.UserLike": { + "type": "object", + "properties": { + "sha256": { + "type": "string" + }, + "ts": { + "type": "integer" + } + } + }, + "entity.UserSubmission": { + "type": "object", + "properties": { + "sha256": { + "type": "string" + }, + "ts": { + "type": "integer" + } + } + }, "errors.ErrorResponse": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index 24c99a4..1caafd5 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -447,6 +447,74 @@ } }, "/comments/": { + "get": { + "description": "List comments", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Comment" + ], + "summary": "Retrieves a paginated list of comments", + "parameters": [ + { + "type": "integer", + "description": "Number of comments per page", + "name": "per_page", + "in": "query" + }, + { + "type": "integer", + "description": "Specify the page number", + "name": "page", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/pagination.Pages" + }, + { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/entity.Comment" + } + } + } + } + ] + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/errors.ErrorResponse" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/errors.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/errors.ErrorResponse" + } + } + } + }, "post": { "security": [ { @@ -673,6 +741,73 @@ } } }, + "/contact/": { + "post": { + "description": "Handles form-data sent via landing page.", + "tags": [ + "Support" + ], + "summary": "Contact Us", + "parameters": [ + { + "description": "The user's email", + "name": "email", + "in": "body", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The subject of the email", + "name": "subject", + "in": "body", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The content of the email", + "name": "message", + "in": "body", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "Google Recaptcha v3 response", + "name": "g-recaptcha-response", + "in": "body", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/errors.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/errors.ErrorResponse" + } + } + } + } + }, "/files/": { "get": { "security": [ @@ -807,6 +942,66 @@ } } }, + "/files/search": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "Search files", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "File" + ], + "summary": "Searches files based on files' metadata", + "parameters": [ + { + "type": "integer", + "description": "Number of files per page", + "name": "per_page", + "in": "query" + }, + { + "type": "integer", + "description": "Specify the page number", + "name": "page", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/pagination.Pages" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/errors.ErrorResponse" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/errors.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/errors.ErrorResponse" + } + } + } + } + }, "/files/{sha256}": { "get": { "description": "Retrieves the content of a file report.", @@ -1176,6 +1371,12 @@ } ], "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object" + } + }, "403": { "description": "Forbidden", "schema": { @@ -1249,6 +1450,59 @@ } } }, + "/files/{sha256}/meta-ui/": { + "get": { + "security": [ + { + "Bearer": [] + }, + {} + ], + "description": "Frontend metadata fields such as navbar menus.", + "produces": [ + "application/json" + ], + "tags": [ + "File" + ], + "summary": "Frontend Metadata", + "parameters": [ + { + "type": "string", + "description": "File SHA256", + "name": "sha256", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/errors.ErrorResponse" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/errors.ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/errors.ErrorResponse" + } + } + } + } + }, "/files/{sha256}/rescan/": { "post": { "security": [ @@ -1274,6 +1528,12 @@ } ], "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object" + } + }, "403": { "description": "Forbidden", "schema": { @@ -1327,6 +1587,12 @@ "description": "Specify the page number", "name": "page", "in": "query" + }, + { + "type": "string", + "description": "Specify the string to search for", + "name": "q", + "in": "query" } ], "responses": { @@ -1435,6 +1701,12 @@ } ], "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object" + } + }, "403": { "description": "Forbidden", "schema": { @@ -2577,6 +2849,9 @@ "api_trace": {}, "artifacts": {}, "capabilities": {}, + "doc": { + "$ref": "#/definitions/entity.DocMetadata" + }, "env": {}, "proc_tree": {}, "sandbox_log": {}, @@ -2588,7 +2863,7 @@ "type": "string" }, "status": { - "type": "integer" + "$ref": "#/definitions/entity.FileScanProgressType" }, "sys_events": {}, "timestamp": { @@ -2606,6 +2881,14 @@ "description": "Body represents the content of the comment.", "type": "string" }, + "doc": { + "description": "Meta represents document metadata.", + "allOf": [ + { + "$ref": "#/definitions/entity.DocMetadata" + } + ] + }, "id": { "description": "ID represents the activity identifier.", "type": "string" @@ -2628,6 +2911,20 @@ } } }, + "entity.DocMetadata": { + "type": "object", + "properties": { + "created_at": { + "type": "integer" + }, + "last_updated": { + "type": "integer" + }, + "version": { + "type": "integer" + } + } + }, "entity.File": { "type": "object", "properties": { @@ -2638,13 +2935,13 @@ "type": "integer" } }, - "comments_count": { - "type": "integer" - }, "crc32": { "type": "string" }, "default_behavior_report": {}, + "doc": { + "$ref": "#/definitions/entity.DocMetadata" + }, "exif": { "type": "object", "additionalProperties": { @@ -2706,7 +3003,7 @@ "type": "string" }, "status": { - "type": "integer" + "$ref": "#/definitions/entity.FileScanProgressType" }, "strings": {}, "submissions": { @@ -2719,6 +3016,9 @@ "type": "object", "additionalProperties": true }, + "tlsh": { + "type": "string" + }, "trid": { "type": "array", "items": { @@ -2730,6 +3030,19 @@ } } }, + "entity.FileScanProgressType": { + "type": "integer", + "enum": [ + 1, + 2, + 3 + ], + "x-enum-varnames": [ + "FileScanProgressQueued", + "FileScanProgressProcessing", + "FileScanProgressFinished" + ] + }, "entity.Submission": { "type": "object", "properties": { @@ -2762,42 +3075,33 @@ "confirmed": { "type": "boolean" }, + "doc": { + "$ref": "#/definitions/entity.DocMetadata" + }, "email": { "type": "string" }, "followers": { "type": "array", "items": { - "type": "string" + "$ref": "#/definitions/entity.UserFollows" } }, - "followers_count": { - "type": "integer" - }, "following": { "type": "array", "items": { - "type": "string" + "$ref": "#/definitions/entity.UserFollows" } }, - "following_count": { - "type": "integer" - }, - "has_avatar": { - "type": "boolean" - }, "last_seen": { "type": "integer" }, "likes": { "type": "array", "items": { - "type": "string" + "$ref": "#/definitions/entity.UserLike" } }, - "likes_count": { - "type": "integer" - }, "location": { "type": "string" }, @@ -2810,8 +3114,11 @@ "password": { "type": "string" }, - "submissions_count": { - "type": "integer" + "submissions": { + "type": "array", + "items": { + "$ref": "#/definitions/entity.UserSubmission" + } }, "type": { "type": "string" @@ -2824,6 +3131,39 @@ } } }, + "entity.UserFollows": { + "type": "object", + "properties": { + "ts": { + "type": "integer" + }, + "username": { + "type": "string" + } + } + }, + "entity.UserLike": { + "type": "object", + "properties": { + "sha256": { + "type": "string" + }, + "ts": { + "type": "integer" + } + } + }, + "entity.UserSubmission": { + "type": "object", + "properties": { + "sha256": { + "type": "string" + }, + "ts": { + "type": "integer" + } + } + }, "errors.ErrorResponse": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index acc976c..466ddcb 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -73,6 +73,8 @@ definitions: api_trace: {} artifacts: {} capabilities: {} + doc: + $ref: '#/definitions/entity.DocMetadata' env: {} proc_tree: {} sandbox_log: {} @@ -82,7 +84,7 @@ definitions: sha256: type: string status: - type: integer + $ref: '#/definitions/entity.FileScanProgressType' sys_events: {} timestamp: type: integer @@ -94,6 +96,10 @@ definitions: body: description: Body represents the content of the comment. type: string + doc: + allOf: + - $ref: '#/definitions/entity.DocMetadata' + description: Meta represents document metadata. id: description: ID represents the activity identifier. type: string @@ -112,6 +118,15 @@ definitions: description: Username represents the author of the comment. type: string type: object + entity.DocMetadata: + properties: + created_at: + type: integer + last_updated: + type: integer + version: + type: integer + type: object entity.File: properties: behavior_scans: {} @@ -119,11 +134,11 @@ definitions: items: type: integer type: array - comments_count: - type: integer crc32: type: string default_behavior_report: {} + doc: + $ref: '#/definitions/entity.DocMetadata' exif: additionalProperties: type: string @@ -166,7 +181,7 @@ definitions: ssdeep: type: string status: - type: integer + $ref: '#/definitions/entity.FileScanProgressType' strings: {} submissions: items: @@ -175,6 +190,8 @@ definitions: tags: additionalProperties: true type: object + tlsh: + type: string trid: items: type: string @@ -182,6 +199,16 @@ definitions: type: type: string type: object + entity.FileScanProgressType: + enum: + - 1 + - 2 + - 3 + type: integer + x-enum-varnames: + - FileScanProgressQueued + - FileScanProgressProcessing + - FileScanProgressFinished entity.Submission: properties: country: @@ -203,30 +230,24 @@ definitions: type: integer confirmed: type: boolean + doc: + $ref: '#/definitions/entity.DocMetadata' email: type: string followers: items: - type: string + $ref: '#/definitions/entity.UserFollows' type: array - followers_count: - type: integer following: items: - type: string + $ref: '#/definitions/entity.UserFollows' type: array - following_count: - type: integer - has_avatar: - type: boolean last_seen: type: integer likes: items: - type: string + $ref: '#/definitions/entity.UserLike' type: array - likes_count: - type: integer location: type: string member_since: @@ -235,8 +256,10 @@ definitions: type: string password: type: string - submissions_count: - type: integer + submissions: + items: + $ref: '#/definitions/entity.UserSubmission' + type: array type: type: string url: @@ -244,6 +267,27 @@ definitions: username: type: string type: object + entity.UserFollows: + properties: + ts: + type: integer + username: + type: string + type: object + entity.UserLike: + properties: + sha256: + type: string + ts: + type: integer + type: object + entity.UserSubmission: + properties: + sha256: + type: string + ts: + type: integer + type: object errors.ErrorResponse: properties: details: {} @@ -615,6 +659,48 @@ paths: tags: - Behavior /comments/: + get: + consumes: + - application/json + description: List comments + parameters: + - description: Number of comments per page + in: query + name: per_page + type: integer + - description: Specify the page number + in: query + name: page + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/pagination.Pages' + - properties: + items: + items: + $ref: '#/definitions/entity.Comment' + type: array + type: object + "403": + description: Forbidden + schema: + $ref: '#/definitions/errors.ErrorResponse' + "404": + description: Not Found + schema: + $ref: '#/definitions/errors.ErrorResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/errors.ErrorResponse' + summary: Retrieves a paginated list of comments + tags: + - Comment post: consumes: - application/json @@ -760,6 +846,50 @@ paths: summary: Update a comment object (full update) tags: - Comment + /contact/: + post: + description: Handles form-data sent via landing page. + parameters: + - description: The user's email + in: body + name: email + required: true + schema: + type: string + - description: The subject of the email + in: body + name: subject + required: true + schema: + type: string + - description: The content of the email + in: body + name: message + required: true + schema: + type: string + - description: Google Recaptcha v3 response + in: body + name: g-recaptcha-response + required: true + schema: + type: string + responses: + "200": + description: OK + schema: + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/errors.ErrorResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/errors.ErrorResponse' + summary: Contact Us + tags: + - Support /files/: get: consumes: @@ -1077,6 +1207,10 @@ paths: produces: - application/json responses: + "200": + description: OK + schema: + type: object "403": description: Forbidden schema: @@ -1127,6 +1261,40 @@ paths: summary: Like a file tags: - File + /files/{sha256}/meta-ui/: + get: + description: Frontend metadata fields such as navbar menus. + parameters: + - description: File SHA256 + in: path + name: sha256 + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + type: object + "403": + description: Forbidden + schema: + $ref: '#/definitions/errors.ErrorResponse' + "404": + description: Not Found + schema: + $ref: '#/definitions/errors.ErrorResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/errors.ErrorResponse' + security: + - {} + - Bearer: [] + summary: Frontend Metadata + tags: + - File /files/{sha256}/rescan/: post: description: Rescan an existing file. @@ -1139,6 +1307,10 @@ paths: produces: - application/json responses: + "200": + description: OK + schema: + type: object "403": description: Forbidden schema: @@ -1175,6 +1347,10 @@ paths: in: query name: page type: integer + - description: Specify the string to search for + in: query + name: q + type: string produces: - application/json responses: @@ -1243,6 +1419,10 @@ paths: produces: - application/json responses: + "200": + description: OK + schema: + type: object "403": description: Forbidden schema: @@ -1260,6 +1440,44 @@ paths: summary: Unlike a file tags: - File + /files/search: + post: + consumes: + - application/json + description: Search files + parameters: + - description: Number of files per page + in: query + name: per_page + type: integer + - description: Specify the page number + in: query + name: page + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/pagination.Pages' + "403": + description: Forbidden + schema: + $ref: '#/definitions/errors.ErrorResponse' + "404": + description: Not Found + schema: + $ref: '#/definitions/errors.ErrorResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/errors.ErrorResponse' + security: + - Bearer: [] + summary: Searches files based on files' metadata + tags: + - File /users/: get: consumes: diff --git a/internal/support/api.go b/internal/support/api.go index 8c1ca23..0475333 100644 --- a/internal/support/api.go +++ b/internal/support/api.go @@ -34,6 +34,18 @@ type resource struct { verifier recaptcha.VerifierV3 } + +// @Summary Contact Us +// @Description Handles form-data sent via landing page. +// @Tags Support +// @Param email body string true "The user's email" +// @Param subject body string true "The subject of the email" +// @Param message body string true "The content of the email" +// @Param g-recaptcha-response body string true "Google Recaptcha v3 response" +// @Success 200 {object} object{} +// @Failure 400 {object} errors.ErrorResponse +// @Failure 500 {object} errors.ErrorResponse +// @Router /contact/ [post] func (r resource) contact(c echo.Context) error { var input SupportEmailRequest ctx := c.Request().Context()