Files
soundcloak/docs/DEV_GUIDE.md
2024-12-25 08:34:16 +02:00

2.7 KiB

Setup

Prerequisites

  1. node.js + npm (any recent enough version should do, it's just used for getting hls.js builds)
  2. golang (I recommend version 1.22.10. Technically, you need 1.21.4 or higher)
  3. git

The setup

  1. Clone this repository:
git clone https://github.com/maid-zone/soundcloak
  1. Go into the cloned repository:
cd soundcloak
  1. Download hls.js:
npm i
  1. Download templ:
go install github.com/a-h/templ/cmd/templ@latest
  1. 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.

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)

export PATH=${PATH}:`go env GOPATH`/bin
  1. Build binary:

This uses the build script, which generates code from templates, generates code for regular expiressions, and then builds the binary.

./build

Now, you can run soundcloak with the ./main binary. By default, it is listening on 127.0.0.1:4664. For a configuration guide, refer to here

Updating your local setup

  1. Retrieve the latest code:
git fetch origin
git pull
  1. Update dependencies/tools:
npm i # for hls.js

go get # for other 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
  1. Clean precompressed static files Those are created by the webserver in order to more efficiently serve static files. They have the .fiber.gz extension. You can easily remove them from all directories like this:
find . -name \*.fiber.gz -type f -delete
  1. Run codegen and build the binary:
./build

Now, you can run soundcloak with the ./main binary.

Contributing

Contributions are appreciated!

We develop soundcloak on our forgejo instance, but feel free to contribute on our Codeberg and Github as well!

If you want to add a new feature that's not in the todo list, please create an issue or discussion first.

If you have updated go dependencies or added new ones, please run go mod tidy before commiting.

Any security vulnerabilities should first be disclosed privately to the maintainer (different ways to contact me are listed here)