Upgrade Echo framework from v4 to v5
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/labstack/echo/v5"
|
||||
"log"
|
||||
"music-server/internal/backend"
|
||||
"net/http"
|
||||
@@ -22,7 +22,7 @@ func NewDownloadHandler() *DownloadHandler {
|
||||
// @Produce json
|
||||
// @Success 200 {string} string
|
||||
// @Router /download [get]
|
||||
func (d *DownloadHandler) checkLatest(ctx echo.Context) error {
|
||||
func (d *DownloadHandler) checkLatest(ctx *echo.Context) error {
|
||||
log.Println("Checking latest version")
|
||||
latest := backend.CheckLatest()
|
||||
return ctx.JSON(http.StatusOK, latest)
|
||||
@@ -36,7 +36,7 @@ func (d *DownloadHandler) checkLatest(ctx echo.Context) error {
|
||||
// @Produce json
|
||||
// @Success 200 {array} string
|
||||
// @Router /download/list [get]
|
||||
func (d *DownloadHandler) listAssetsOfLatest(ctx echo.Context) error {
|
||||
func (d *DownloadHandler) listAssetsOfLatest(ctx *echo.Context) error {
|
||||
log.Println("Listing assets")
|
||||
assets := backend.ListAssetsOfLatest()
|
||||
return ctx.JSON(http.StatusOK, assets)
|
||||
@@ -49,7 +49,7 @@ func (d *DownloadHandler) listAssetsOfLatest(ctx echo.Context) error {
|
||||
// @Produce octet-stream
|
||||
// @Success 302 {string} string
|
||||
// @Router /download/windows [get]
|
||||
func (d *DownloadHandler) downloadLatestWindows(ctx echo.Context) error {
|
||||
func (d *DownloadHandler) downloadLatestWindows(ctx *echo.Context) error {
|
||||
log.Println("Downloading latest windows")
|
||||
asset := backend.DownloadLatestWindows()
|
||||
ctx.Response().Header().Set("Content-Type", "application/octet-stream")
|
||||
@@ -63,7 +63,7 @@ func (d *DownloadHandler) downloadLatestWindows(ctx echo.Context) error {
|
||||
// @Produce octet-stream
|
||||
// @Success 302 {string} string
|
||||
// @Router /download/linux [get]
|
||||
func (d *DownloadHandler) downloadLatestLinux(ctx echo.Context) error {
|
||||
func (d *DownloadHandler) downloadLatestLinux(ctx *echo.Context) error {
|
||||
log.Println("Downloading latest linux")
|
||||
asset := backend.DownloadLatestLinux()
|
||||
ctx.Response().Header().Set("Content-Type", "application/octet-stream")
|
||||
|
||||
Reference in New Issue
Block a user