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

This commit is contained in:
Alessandro Ros 2024-02-12 00:31:13 +01:00 committed by GitHub
parent fcf649cdaf
commit 9eb97ad3a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 77 additions and 12 deletions

View File

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

View File

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

1
.gitignore vendored
View File

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

View File

@ -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,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
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

View File

@ -144,6 +144,7 @@ _rtsp-simple-server_ has been rebranded as _MediaMTX_. The reason is pretty obvi
* [OpenWrt](#openwrt-1)
* [Cross compile](#cross-compile)
* [Compile for all supported platforms](#compile-for-all-supported-platforms)
* [License](#license)
* [Specifications](#specifications)
* [Related projects](#related-projects)
@ -1805,6 +1806,7 @@ Install git and Go ≥ 1.21. Clone the repository, enter into the folder and st
```sh
git clone https://github.com/bluenviron/mediamtx
cd mediamtx
go generate ./...
CGO_ENABLED=0 go build .
```
@ -1825,6 +1827,7 @@ Download the repository, open a terminal in it and run:
cd internal/protocols/rpicamera/exe
make
cd ../../../../
go generate ./...
go build -tags rpicamera .
```
@ -1844,6 +1847,7 @@ Clone the repository, enter into the folder and start the building process:
```sh
git clone https://github.com/bluenviron/mediamtx
cd mediamtx
go generate ./...
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
git clone https://github.com/bluenviron/mediamtx
cd mediamtx
go generate ./...
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/`.
## 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
|name|area|

File diff suppressed because one or more lines are too long

View File

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

View File

@ -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)
}
}

View File

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

View File

@ -26,6 +26,7 @@ ENV CGO_ENABLED 0
RUN rm -rf tmp binaries
RUN mkdir tmp binaries
RUN cp mediamtx.yml LICENSE tmp/
RUN go generate ./...
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

View File

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

View File

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