Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ RUN chmod 777 /config; \

WORKDIR /api
COPY --from=builder /api/app .
COPY client ./client
COPY webassets ./webassets

EXPOSE 8080

ENTRYPOINT ["./app"]
ENTRYPOINT ["./app"]
4 changes: 1 addition & 3 deletions docs/ubuntu-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This guide has been written with Ubuntu in mind. If you are using any other flav

## Install Go

Podgrab is built using Go which would be needed to compile and build the source code. Podgrab is written with Go 1.15 so any version equal to or above this should be good to Go.
Podgrab is built using Go which would be needed to compile and build the source code. Podgrab is written with Go 1.16 so any version equal to or above this should be good to Go.

If you already have Go installed on your machine, you can skip to the next step.

Expand All @@ -31,8 +31,6 @@ git clone --depth 1 https://github.com/akhilrex/podgrab
``` bash
cd podgrab
mkdir -p ./dist
cp -r client ./dist
cp -r webassets ./dist
cp .env ./dist
go build -o ./dist/podgrab ./main.go
```
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/akhilrex/podgrab

go 1.15
go 1.16

require (
github.com/TheHippo/podcastindex v1.0.0
Expand Down
19 changes: 17 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package main

import (
"embed"
"fmt"
"html/template"
"io/fs"
"log"
"net/http"
"os"
"path"
"strconv"
Expand All @@ -18,6 +21,13 @@ import (
_ "github.com/joho/godotenv/autoload"
)

var (
//go:embed client
clientEmbed embed.FS
//go:embed webassets
webAssetsEmbed embed.FS
)

func main() {
var err error
db.DB, err = db.Init()
Expand Down Expand Up @@ -127,7 +137,7 @@ func main() {
return fmt.Sprintf("%02d:%02d", mins, secs)
},
}
tmpl := template.Must(template.New("main").Funcs(funcMap).ParseGlob("client/*"))
tmpl := template.Must(template.New("main").Funcs(funcMap).ParseFS(clientEmbed, "client/*"))

//r.LoadHTMLGlob("client/*")
r.SetHTMLTemplate(tmpl)
Expand All @@ -145,7 +155,12 @@ func main() {
dataPath := os.Getenv("DATA")
backupPath := path.Join(os.Getenv("CONFIG"), "backups")

router.Static("/webassets", "./webassets")
webAssets, err := fs.Sub(webAssetsEmbed, "webassets")
if err != nil {
log.Fatal(err)
}

router.StaticFS("/webassets", http.FS(webAssets))
router.Static("/assets", dataPath)
router.Static(backupPath, backupPath)
router.POST("/podcasts", controllers.AddPodcast)
Expand Down