Merge branch 'master' into 230-torrents-category

This commit is contained in:
cocool97
2024-03-24 14:28:31 +01:00
committed by GitHub
64 changed files with 1437 additions and 508 deletions

View File

@@ -19,17 +19,16 @@ import (
//
// @Tags API
//
// @Param hash query string true "Torrent hash"
// @Param id query string true "File index in torrent"
// @Param not_auth query bool false "Not authenticated"
// @Param hash path string true "Torrent hash"
// @Param id path string true "File index in torrent"
//
// @Produce application/octet-stream
// @Success 200 "Torrent data"
// @Router /play [get]
// @Router /play/{hash}/{id} [get]
func play(c *gin.Context) {
hash := c.Param("hash")
indexStr := c.Param("id")
notAuth := c.GetBool("not_auth")
notAuth := c.GetBool("auth_required") && c.GetString(gin.AuthUserKey) == ""
if hash == "" || indexStr == "" {
c.AbortWithError(http.StatusNotFound, errors.New("link should not be empty"))