diff --git a/.dockerignore b/.dockerignore
index 5a30085..97f3901 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,7 +1,6 @@
Dockerfile
*.yaml
build
-.github
.gitignore
soundcloak.example.json
diff --git a/.gitignore b/.gitignore
index 9f8fd92..3ef17db 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,4 +16,6 @@ package-lock.json
regexp2_codegen.go
# built binary
-main
\ No newline at end of file
+main
+
+!.gitkeep
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index 53c6bff..4d99fa2 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -15,22 +15,19 @@ RUN go generate ./lib/*
RUN go install git.maid.zone/stuff/soundcloakctl@master
RUN soundcloakctl config codegen
+RUN soundcloakctl js download
RUN CGO_ENABLED=0 GOARCH=${TARGETARCH} GOOS=${TARGETOS} go build -ldflags "-s -w -extldflags '-static' -X main.commit=`git rev-parse HEAD | head -c 7` -X main.repo=`git remote get-url origin`" -o ./app
RUN echo "soundcloak:x:5000:5000:Soundcloak user:/:/sbin/nologin" > /etc/minimal-passwd && \
echo "soundcloak:x:5000:" > /etc/minimal-group
-FROM node:${NODE_VERSION} AS node
-WORKDIR /hls.js
-COPY --from=build /build/package.json ./
-RUN npm i
-
FROM scratch
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=build /build/assets /assets
+COPY --from=build /build/instance /instance
+COPY --from=build /build/external /external
COPY --from=build /build/app /app
-COPY --from=node /hls.js/node_modules/hls.js/dist/hls.light.min.js /node_modules/hls.js/dist/hls.light.min.js
COPY --from=build /etc/minimal-passwd /etc/passwd
COPY --from=build /etc/minimal-group /etc/group
diff --git a/docs/DEV_GUIDE.md b/docs/DEV_GUIDE.md
index ce44cfe..3545e38 100644
--- a/docs/DEV_GUIDE.md
+++ b/docs/DEV_GUIDE.md
@@ -1,8 +1,7 @@
# Setup
## Prerequisites
-1. [node.js + npm](https://nodejs.org) (any recent enough version should do, it's just used for getting hls.js builds)
-2. [golang](https://go.dev) (I recommend version 1.22.10. Technically, you need 1.21.4 or higher)
-3. [git](https://git-scm.com)
+1. [golang](https://go.dev) (I recommend version 1.22.10. Technically, you need 1.21.4 or higher)
+2. [git](https://git-scm.com)
## The setup
1. Clone this repository:
@@ -29,6 +28,12 @@ npm i
go install github.com/a-h/templ/cmd/templ@latest
```
+*You might need to add go binaries to your PATH (add this line to your .bashrc / .zshrc / whatever)*
+
+```sh
+export PATH=${PATH}:`go env GOPATH`/bin
+```
+
5. Download regexp2cg:
Not really required, but helps speed up some parts of the code that use regular expressions by generating code for them instead of compiling in runtime.
@@ -37,12 +42,21 @@ Not really required, but helps speed up some parts of the code that use regular
go install github.com/dlclark/regexp2cg@main
```
-*You might need to add go binaries to your PATH (add this line to your .bashrc / .zshrc / whatever)*
+6. Download soundcloakctl:
+
+Soundcloakctl is helper for soundcloak.
```sh
-export PATH=${PATH}:`go env GOPATH`/bin
+go install git.maid.zone/stuff/soundcloakctl@master
```
-6. Build binary:
+
+7. Download requried JS modules:
+
+```sh
+soundcloakctl js download
+```
+
+8. Build binary:
This uses the `build` script, which generates code from templates, generates code for regular expiressions, and then builds the binary.
@@ -61,13 +75,15 @@ git pull
2. Update dependencies/tools:
```sh
-npm i # for hls.js
-
-go get # for other go packages
+go get # for go packages
go install github.com/a-h/templ/cmd/templ@latest # templ cli
go install github.com/dlclark/regexp2cg@main # regexp2 codegen cli. not required unless you've installed it
+
+go install git.maid.zone/stuff/soundcloakctl@master # soundcloakctl
+
+soundcloakctl js download # re-download JS modules
```
3. Clean precompressed static files
diff --git a/instance/.gitkeep b/instance/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/main.go b/main.go
index 2d98b28..6c428b0 100644
--- a/main.go
+++ b/main.go
@@ -41,9 +41,9 @@ func main() {
}
app.Use(compress.New(compress.Config{Level: compress.LevelBestSpeed}))
- app.Static("/", "instance", fiber.Static{Compress: true, MaxAge: 7200}) // 2 hours
- app.Static("/", "assets", fiber.Static{Compress: true, MaxAge: 14400}) // 4 hours
- app.Static("/js/hls.js/", "node_modules/hls.js/dist", fiber.Static{Compress: true, MaxAge: 28800}) // 8 hours
+ app.Static("/", "instance", fiber.Static{Compress: true, MaxAge: 7200}) // 2 hours
+ app.Static("/", "assets", fiber.Static{Compress: true, MaxAge: 14400}) // 4 hours
+ app.Static("/js/", "external", fiber.Static{Compress: true, MaxAge: 28800}) // 8 hours
// Just for easy inspection of cache in development. Since debug is constant, the compiler will just remove the code below if it's set to false, so this has no runtime overhead.
if cfg.Debug {
diff --git a/templates/track.templ b/templates/track.templ
index f00e971..eda3067 100644
--- a/templates/track.templ
+++ b/templates/track.templ
@@ -48,7 +48,7 @@ templ TrackHeader(prefs cfg.Preferences, t sc.Track, needPlayer bool) {
if needPlayer && *prefs.Player == cfg.HLSPlayer {
-
+
}
}