Browse Source

remove hls.js from the repository and restore plain MIT license (#3008)

pull/3011/head
Alessandro Ros 1 year ago committed by GitHub
parent
commit
9eb97ad3a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      .dockerignore
  2. 5
      .github/workflows/bump_hls_js.yml
  3. 1
      .gitignore
  4. 5
      LICENSE
  5. 12
      README.md
  6. 2
      internal/servers/hls/hls.min.js
  7. 1
      internal/servers/hls/hlsjsdownloader/VERSION
  8. 51
      internal/servers/hls/hlsjsdownloader/main.go
  9. 3
      internal/servers/hls/http_server.go
  10. 1
      scripts/binaries.mk
  11. 1
      scripts/test-highlevel.mk
  12. 6
      scripts/test.mk

1
.dockerignore

@ -3,3 +3,4 @@
/binaries /binaries
/coverage*.txt /coverage*.txt
/apidocs/*.html /apidocs/*.html
**/hls.min.js

5
.github/workflows/bump_hls_js.yml

@ -20,8 +20,9 @@ jobs:
&& ((git checkout deps/hlsjs && git rebase ${GITHUB_REF_NAME}) || git checkout -b deps/hlsjs) && ((git checkout deps/hlsjs && git rebase ${GITHUB_REF_NAME}) || git checkout -b deps/hlsjs)
- run: > - run: >
curl -o internal/servers/hls/hls.min.js https://cdn.jsdelivr.net/npm/hls.js@latest/dist/hls.min.js VERSION=$(curl -s https://api.github.com/repos/video-dev/hls.js/releases?per_page=1 | grep tag_name | sed 's/\s\+"tag_name": "\(.\+\)",/\1/')
&& echo VERSION=$(cat internal/servers/hls/hls.min.js | grep -o '"version",get:function(){return".*"}' | sed 's/"version",get:function(){return"\(.*\)"}/\1/') >> $GITHUB_ENV && echo $VERSION > internal/servers/hls/hlsjsdownloader/VERSION
&& echo VERSION=$VERSION >> $GITHUB_ENV
- id: check_repo - id: check_repo
run: > run: >

1
.gitignore vendored

@ -2,3 +2,4 @@
/binaries /binaries
/coverage*.txt /coverage*.txt
/apidocs/*.html /apidocs/*.html
**/hls.min.js

5
LICENSE

@ -19,8 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
internal/core/hls.min.js is Copyright (c) Dailymotion and is protected by
its own license (Apache License, Version 2.0) available at
https://github.com/video-dev/hls.js/blob/master/LICENSE

12
README.md

@ -144,6 +144,7 @@ _rtsp-simple-server_ has been rebranded as _MediaMTX_. The reason is pretty obvi
* [OpenWrt](#openwrt-1) * [OpenWrt](#openwrt-1)
* [Cross compile](#cross-compile) * [Cross compile](#cross-compile)
* [Compile for all supported platforms](#compile-for-all-supported-platforms) * [Compile for all supported platforms](#compile-for-all-supported-platforms)
* [License](#license)
* [Specifications](#specifications) * [Specifications](#specifications)
* [Related projects](#related-projects) * [Related projects](#related-projects)
@ -1805,6 +1806,7 @@ Install git and Go ≥ 1.21. Clone the repository, enter into the folder and st
```sh ```sh
git clone https://github.com/bluenviron/mediamtx git clone https://github.com/bluenviron/mediamtx
cd mediamtx cd mediamtx
go generate ./...
CGO_ENABLED=0 go build . CGO_ENABLED=0 go build .
``` ```
@ -1825,6 +1827,7 @@ Download the repository, open a terminal in it and run:
cd internal/protocols/rpicamera/exe cd internal/protocols/rpicamera/exe
make make
cd ../../../../ cd ../../../../
go generate ./...
go build -tags rpicamera . go build -tags rpicamera .
``` ```
@ -1844,6 +1847,7 @@ Clone the repository, enter into the folder and start the building process:
```sh ```sh
git clone https://github.com/bluenviron/mediamtx git clone https://github.com/bluenviron/mediamtx
cd mediamtx cd mediamtx
go generate ./...
CGO_ENABLED=0 go build . CGO_ENABLED=0 go build .
``` ```
@ -1860,6 +1864,7 @@ On the machine you want to use to compile, install git and Go ≥ 1.21. Clone t
```sh ```sh
git clone https://github.com/bluenviron/mediamtx git clone https://github.com/bluenviron/mediamtx
cd mediamtx cd mediamtx
go generate ./...
CGO_ENABLED=0 GOOS=my_os GOARCH=my_arch go build . CGO_ENABLED=0 GOOS=my_os GOARCH=my_arch go build .
``` ```
@ -1899,6 +1904,13 @@ make binaries
The command will produce tarballs in folder `binaries/`. The command will produce tarballs in folder `binaries/`.
## License
All the code in this repository is released under the [MIT License](LICENSE). Compiled binaries make use of some third-party dependencies:
* hls.js, released under the [Apache License 2.0](https://github.com/video-dev/hls.js/blob/master/LICENSE)
* all the dependencies listed into the [go.mod file](go.mod), which are all released under either the MIT license, BSD-3-Clause license or Apache License 2.0
## Specifications ## Specifications
|name|area| |name|area|

2
internal/servers/hls/hls.min.js vendored

File diff suppressed because one or more lines are too long

1
internal/servers/hls/hlsjsdownloader/VERSION

@ -0,0 +1 @@
v1.5.4

51
internal/servers/hls/hlsjsdownloader/main.go

@ -0,0 +1,51 @@
// Package main contains an utility to download hls.js
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
)
func do() error {
log.Println("downloading hls.js...")
buf, err := os.ReadFile("./hlsjsdownloader/VERSION")
if err != nil {
return err
}
version := string(buf[:len(buf)-1])
res, err := http.Get("https://cdn.jsdelivr.net/npm/hls.js@" + version + "/dist/hls.min.js")
if err != nil {
return err
}
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
return fmt.Errorf("bad status code: %v", res.StatusCode)
}
buf, err = io.ReadAll(res.Body)
if err != nil {
return err
}
err = os.WriteFile("hls.min.js", buf, 0o644)
if err != nil {
return err
}
log.Println("ok")
return nil
}
func main() {
err := do()
if err != nil {
log.Printf("ERR: %v", err)
os.Exit(1)
}
}

3
internal/servers/hls/http_server.go

@ -23,9 +23,12 @@ const (
pauseAfterAuthError = 2 * time.Second pauseAfterAuthError = 2 * time.Second
) )
//go:generate go run ./hlsjsdownloader
//go:embed index.html //go:embed index.html
var hlsIndex []byte var hlsIndex []byte
//nolint:typecheck
//go:embed hls.min.js //go:embed hls.min.js
var hlsMinJS []byte var hlsMinJS []byte

1
scripts/binaries.mk

@ -26,6 +26,7 @@ ENV CGO_ENABLED 0
RUN rm -rf tmp binaries RUN rm -rf tmp binaries
RUN mkdir tmp binaries RUN mkdir tmp binaries
RUN cp mediamtx.yml LICENSE tmp/ RUN cp mediamtx.yml LICENSE tmp/
RUN go generate ./...
FROM build-base AS build-windows-amd64 FROM build-base AS build-windows-amd64
RUN GOOS=windows GOARCH=amd64 go build -ldflags "-X github.com/bluenviron/mediamtx/internal/core.version=$$VERSION" -o tmp/$(BINARY_NAME).exe RUN GOOS=windows GOARCH=amd64 go build -ldflags "-X github.com/bluenviron/mediamtx/internal/core.version=$$VERSION" -o tmp/$(BINARY_NAME).exe

1
scripts/test-highlevel.mk

@ -1,4 +1,5 @@
test-highlevel-nodocker: test-highlevel-nodocker:
go generate ./...
go test -v -race -tags enable_highlevel_tests ./internal/highleveltests go test -v -race -tags enable_highlevel_tests ./internal/highleveltests
define DOCKERFILE_HIGHLEVEL_TEST define DOCKERFILE_HIGHLEVEL_TEST

6
scripts/test.mk

@ -1,9 +1,9 @@
LBITS := $(shell getconf LONG_BIT) ifeq ($(shell getconf LONG_BIT),64)
ifeq ($(LBITS),64) RACE=-race
RACE=-race
endif endif
test-internal: test-internal:
go generate ./...
go test -v $(RACE) -coverprofile=coverage-internal.txt \ go test -v $(RACE) -coverprofile=coverage-internal.txt \
$$(go list ./internal/... | grep -v /core) $$(go list ./internal/... | grep -v /core)

Loading…
Cancel
Save