mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
Merge branch 'master' of https://github.com/YouROK/TorrServer
This commit is contained in:
@@ -218,11 +218,13 @@ cd server; swag init -g web/server.go
|
|||||||
swag fmt
|
swag fmt
|
||||||
```
|
```
|
||||||
|
|
||||||
### MSX Install
|
### Smart TV (using Media Station X)
|
||||||
|
|
||||||
Open msx and goto: Settings -> Start Parameter -> Setup
|
1. Install **Media Station X** on your Smart TV (see [platform support](https://msx.benzac.de/info/?tab=PlatformSupport))
|
||||||
|
|
||||||
Enter current ip address and port of server _e.g. 127.0.0.1:8090_
|
2. Open it and go to: **Settings -> Start Parameter -> Setup**
|
||||||
|
|
||||||
|
3. Enter current ip and port of the TorrServe(r), e.g. `127.0.0.1:8090`
|
||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ func SetupRoute(r gin.IRouter) {
|
|||||||
rsp(c, r, e)
|
rsp(c, r, e)
|
||||||
})
|
})
|
||||||
authorized.GET("/msx/start.json", func(c *gin.Context) {
|
authorized.GET("/msx/start.json", func(c *gin.Context) {
|
||||||
c.JSON(200, map[string]any{
|
c.JSON(http.StatusOK, map[string]any{
|
||||||
"name": "TorrServer",
|
"name": "TorrServer",
|
||||||
"version": version.Version,
|
"version": version.Version,
|
||||||
"parameter": param,
|
"parameter": param,
|
||||||
@@ -80,7 +80,7 @@ func SetupRoute(r gin.IRouter) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
c.JSON(200, r)
|
c.JSON(http.StatusOK, r)
|
||||||
})
|
})
|
||||||
authorized.POST("/msx/trn", func(c *gin.Context) {
|
authorized.POST("/msx/trn", func(c *gin.Context) {
|
||||||
var r struct {
|
var r struct {
|
||||||
@@ -114,7 +114,7 @@ func SetupRoute(r gin.IRouter) {
|
|||||||
r.R.S, r.R.D = http.StatusOK, map[string]any{"action": j.Data, "data": r.R.D}
|
r.R.S, r.R.D = http.StatusOK, map[string]any{"action": j.Data, "data": r.R.D}
|
||||||
}
|
}
|
||||||
r.R.T = http.StatusText(r.R.S)
|
r.R.T = http.StatusText(r.R.S)
|
||||||
c.JSON(200, &r)
|
c.JSON(http.StatusOK, &r)
|
||||||
})
|
})
|
||||||
authorized.Any("/msx/proxy", func(c *gin.Context) {
|
authorized.Any("/msx/proxy", func(c *gin.Context) {
|
||||||
if u := c.Query("url"); u == "" {
|
if u := c.Query("url"); u == "" {
|
||||||
@@ -132,36 +132,32 @@ func SetupRoute(r gin.IRouter) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
authorized.GET("/msx/imdb/:id", func(c *gin.Context) {
|
authorized.GET("/msx/imdb/:id", func(c *gin.Context) {
|
||||||
i, l, j := strings.TrimPrefix(c.Param("id"), "/"), "", false
|
i, j := strings.TrimPrefix(c.Param("id"), "/"), false
|
||||||
if j = strings.HasSuffix(i, ".json"); !j {
|
if j = strings.HasSuffix(i, ".json"); !j {
|
||||||
i += ".json"
|
i += ".json"
|
||||||
}
|
}
|
||||||
if r, e := http.Get("https://v2.sg.media-imdb.com/suggestion/h/" + i); e == nil {
|
if r, e := http.Get("https://v2.sg.media-imdb.com/suggestion/h/" + i); e != nil || r.StatusCode != http.StatusOK || j {
|
||||||
if r.StatusCode == http.StatusOK {
|
rsp(c, r, e)
|
||||||
var j struct {
|
|
||||||
D []struct{ I struct{ ImageUrl string } }
|
|
||||||
}
|
|
||||||
if e = json.NewDecoder(r.Body).Decode(&j); e == nil && len(j.D) > 0 {
|
|
||||||
l = j.D[0].I.ImageUrl
|
|
||||||
}
|
|
||||||
}
|
|
||||||
r.Body.Close()
|
|
||||||
}
|
|
||||||
if j {
|
|
||||||
c.JSON(200, l)
|
|
||||||
} else if l == "" {
|
|
||||||
c.Status(http.StatusNotFound)
|
|
||||||
} else {
|
} else {
|
||||||
c.Redirect(http.StatusMovedPermanently, l)
|
var j struct {
|
||||||
|
D []struct{ I struct{ ImageUrl string } }
|
||||||
|
}
|
||||||
|
if e = json.NewDecoder(r.Body).Decode(&j); e != nil {
|
||||||
|
c.AbortWithError(http.StatusInternalServerError, e)
|
||||||
|
} else if len(j.D) == 0 || j.D[0].I.ImageUrl == "" {
|
||||||
|
c.Status(http.StatusNotFound)
|
||||||
|
} else {
|
||||||
|
c.Redirect(http.StatusMovedPermanently, j.D[0].I.ImageUrl)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// Files:
|
// Files:
|
||||||
authorized.StaticFS("/files/", gin.Dir(filepath.Join(settings.Path, files), true))
|
authorized.StaticFS("/files/", gin.Dir(filepath.Join(settings.Path, files), true))
|
||||||
authorized.GET("/files", func(c *gin.Context) {
|
authorized.GET("/files", func(c *gin.Context) {
|
||||||
if l, e := os.Readlink(filepath.Join(settings.Path, files)); e == nil || os.IsNotExist(e) {
|
if l, e := os.Readlink(filepath.Join(settings.Path, files)); e == nil || os.IsNotExist(e) {
|
||||||
c.JSON(200, l)
|
c.JSON(http.StatusOK, l)
|
||||||
} else {
|
} else {
|
||||||
c.AbortWithError(http.StatusInternalServerError, e)
|
c.JSON(http.StatusInternalServerError, e.Error)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
authorized.POST("/files", func(c *gin.Context) {
|
authorized.POST("/files", func(c *gin.Context) {
|
||||||
|
|||||||
Reference in New Issue
Block a user