Change go-rimgu to rimgo
This commit is contained in:
parent
34f09c36fb
commit
33e6c58ba3
22
api/album.go
22
api/album.go
|
@ -6,7 +6,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"codeberg.org/video-prize-ranch/go-rimgu/types"
|
||||
"codeberg.org/video-prize-ranch/rimgo/types"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/tidwall/gjson"
|
||||
)
|
||||
|
@ -33,11 +33,11 @@ func FetchAlbum(albumID string) (types.Album, error) {
|
|||
url = strings.ReplaceAll(url, "https://i.imgur.com", "/media")
|
||||
|
||||
media = append(media, types.Media{
|
||||
Id: value.Get("id").String(),
|
||||
Name: value.Get("name").String(),
|
||||
Title: value.Get("metadata.title").String(),
|
||||
Id: value.Get("id").String(),
|
||||
Name: value.Get("name").String(),
|
||||
Title: value.Get("metadata.title").String(),
|
||||
Description: value.Get("metadata.description").String(),
|
||||
Url: url,
|
||||
Url: url,
|
||||
})
|
||||
|
||||
return true
|
||||
|
@ -50,10 +50,10 @@ func FetchAlbum(albumID string) (types.Album, error) {
|
|||
}
|
||||
|
||||
return types.Album{
|
||||
Id: data.Get("id").String(),
|
||||
Title: data.Get("title").String(),
|
||||
Views: data.Get("view_count").Int(),
|
||||
CreatedAt: createdAt.Format("January 2, 2006 3:04 PM"),
|
||||
Media: media,
|
||||
Id: data.Get("id").String(),
|
||||
Title: data.Get("title").String(),
|
||||
Views: data.Get("view_count").Int(),
|
||||
CreatedAt: createdAt.Format("January 2, 2006 3:04 PM"),
|
||||
Media: media,
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
|
|
2
go.mod
2
go.mod
|
@ -1,4 +1,4 @@
|
|||
module codeberg.org/video-prize-ranch/go-rimgu
|
||||
module codeberg.org/video-prize-ranch/rimgo
|
||||
|
||||
go 1.17
|
||||
|
||||
|
|
16
main.go
16
main.go
|
@ -4,9 +4,9 @@ import (
|
|||
"log"
|
||||
"net/http"
|
||||
|
||||
"codeberg.org/video-prize-ranch/go-rimgu/pages"
|
||||
"codeberg.org/video-prize-ranch/go-rimgu/static"
|
||||
"codeberg.org/video-prize-ranch/go-rimgu/views"
|
||||
"codeberg.org/video-prize-ranch/rimgo/pages"
|
||||
"codeberg.org/video-prize-ranch/rimgo/static"
|
||||
"codeberg.org/video-prize-ranch/rimgo/views"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/gofiber/fiber/v2/middleware/filesystem"
|
||||
"github.com/gofiber/template/handlebars"
|
||||
|
@ -30,12 +30,12 @@ func main() {
|
|||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
|
||||
engine := handlebars.NewFileSystem(http.FS(views.GetFiles()), ".hbs")
|
||||
app := fiber.New(fiber.Config{
|
||||
Views: engine,
|
||||
Prefork: viper.GetBool("FIBER_PREFORK"),
|
||||
UnescapePath: true,
|
||||
Views: engine,
|
||||
Prefork: viper.GetBool("FIBER_PREFORK"),
|
||||
UnescapePath: true,
|
||||
StreamRequestBody: true,
|
||||
})
|
||||
|
||||
|
@ -51,4 +51,4 @@ func main() {
|
|||
app.Get("/gallery/:galleryID", pages.HandleGallery)*/
|
||||
|
||||
app.Listen(":" + viper.GetString("RIMGU_PORT"))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
package pages
|
||||
|
||||
import (
|
||||
"codeberg.org/video-prize-ranch/go-rimgu/api"
|
||||
"codeberg.org/video-prize-ranch/rimgo/api"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
|
||||
)
|
||||
|
||||
func HandleAlbum(c *fiber.Ctx) error {
|
||||
|
|
Loading…
Reference in New Issue