Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into sec-fix-slowloris
Browse files Browse the repository at this point in the history
  • Loading branch information
skrashevich committed Apr 20, 2024
2 parents e1ebed4 + fcfef30 commit 905ef9b
Show file tree
Hide file tree
Showing 9 changed files with 194 additions and 88 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1352,6 +1352,7 @@ streams:
**Distributions**

- [Alpine Linux](https://pkgs.alpinelinux.org/packages?name=go2rtc)
- [Arch User Repository](https://linux-packages.com/aur/package/go2rtc)
- [Gentoo](https://github.com/inode64/inode64-overlay/tree/main/media-video/go2rtc)
- [NixOS](https://search.nixos.org/packages?query=go2rtc)
- [Proxmox Helper Scripts](https://tteck.github.io/Proxmox/)
Expand Down
3 changes: 2 additions & 1 deletion hardware.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked --mount=type=cache,t
python3 curl jq \
intel-media-va-driver-non-free \
mesa-va-drivers \
libasound2-plugins
libasound2-plugins && \
apt-get clean && rm -rf /var/lib/apt/lists/*

COPY --link --from=rootfs / /

Expand Down
3 changes: 2 additions & 1 deletion internal/exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"os"
"os/exec"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -108,7 +109,7 @@ func handleRTSP(url, path string, cmd *exec.Cmd) (core.Producer, error) {
waitersMu.Unlock()
}()

log.Debug().Str("url", url).Msg("[exec] run")
log.Debug().Str("url", url).Str("cmd", fmt.Sprintf("%s", strings.Join(cmd.Args, " "))).Msg("[exec] run")

ts := time.Now()

Expand Down
6 changes: 6 additions & 0 deletions pkg/ivideon/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ func (c *Client) Handle() error {
case "stream-init":
continue

case "metadata":
continue

case "fragment":
_, data, err = c.conn.ReadMessage()
if err != nil {
Expand Down Expand Up @@ -183,6 +186,9 @@ func (c *Client) getTracks() error {
}

switch msg.Type {
case "metadata":
continue

case "stream-init":
s := msg.CodecString
i := strings.IndexByte(s, '.')
Expand Down
27 changes: 0 additions & 27 deletions www/add.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1, maximum-scale=1">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<style>
body {
font-family: Arial, Helvetica, sans-serif;
background-color: white;
}

body {
margin: 0;
padding: 0;
Expand All @@ -27,33 +22,11 @@
padding: 10px;
}

table {
background-color: white;
text-align: left;
border-collapse: collapse;
}

table td, table th {
border: 1px solid black;
padding: 5px 5px;
}

table tbody td {
font-size: 13px;
}

table thead {
background: #CFCFCF;
background: linear-gradient(to bottom, #dbdbdb 0%, #d3d3d3 66%, #CFCFCF 100%);
border-bottom: 3px solid black;
}

table thead th {
font-size: 15px;
font-weight: bold;
color: black;
text-align: center;
}
</style>
</head>
<body>
Expand Down
68 changes: 34 additions & 34 deletions www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,18 @@
<title>go2rtc</title>

<style>
body {
font-family: Arial, Helvetica, sans-serif;
background-color: white;
}

table {
background-color: white;
text-align: left;
border-collapse: collapse;
}

table td, table th {
border: 1px solid black;
padding: 5px 5px;
body {
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
}

table tbody td {
font-size: 13px;
}

table thead {
background: #CFCFCF;
background: linear-gradient(to bottom, #dbdbdb 0%, #d3d3d3 66%, #CFCFCF 100%);
border-bottom: 3px solid black;
}

table thead th {
font-size: 15px;
font-weight: bold;
color: black;
text-align: center;
}

label {
display: flex;
align-items: center;
Expand Down Expand Up @@ -121,28 +100,49 @@

function reload() {
const url = new URL('api/streams', location.href);
const checkboxStates = {};
tbody.querySelectorAll('input[type="checkbox"][name]').forEach(checkbox => {
checkboxStates[checkbox.name] = checkbox.checked;
});
fetch(url, {cache: 'no-cache'}).then(r => r.json()).then(data => {
tbody.innerHTML = '';
const existingIds = Array.from(tbody.querySelectorAll('tr')).map(tr => tr.dataset['id']);
const fetchedIds = [];

for (const [key, value] of Object.entries(data)) {
const name = key.replace(/[<">]/g, ''); // sanitize
fetchedIds.push(name);

let tr = tbody.querySelector(`tr[data-id="${name}"]`);
const online = value && value.consumers ? value.consumers.length : 0;
const src = encodeURIComponent(name);
const links = templates.map(link => {
return link.replace('{name}', src);
}).join(' ');
const links = templates.map(link => link.replace('{name}', src)).join(' ');

const tr = document.createElement('tr');
tr.dataset['id'] = name;
if (!tr) {
tr = document.createElement('tr');
tr.dataset['id'] = name;
tbody.appendChild(tr);
}

const isChecked = checkboxStates[name] ? 'checked' : '';
tr.innerHTML =
`<td><label><input type="checkbox" name="${name}">${name}</label></td>` +
`<td><label><input type="checkbox" name="${name}" ${isChecked}>${name}</label></td>` +
`<td><a href="api/streams?src=${src}">${online} / info</a></td>` +
`<td>${links}</td>`;
tbody.appendChild(tr);
}

// Remove old rows
existingIds.forEach(id => {
if (!fetchedIds.includes(id)) {
const trToRemove = tbody.querySelector(`tr[data-id="${id}"]`);
tbody.removeChild(trToRemove);
}
});
});
}

// Auto-reload
setInterval(reload, 1000);

const url = new URL('api', location.href);
fetch(url, {cache: 'no-cache'}).then(r => r.json()).then(data => {
const info = document.querySelector('.info');
Expand Down
4 changes: 0 additions & 4 deletions www/links.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1, maximum-scale=1">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<style>
body {
font-family: Arial, Helvetica, sans-serif;
background-color: white;
}

body {
margin: 0;
Expand Down
23 changes: 3 additions & 20 deletions www/log.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,17 @@
height: 100%;
}

table {
background-color: white;
text-align: left;
border-collapse: collapse;
}


table td, table th {
border: 1px solid black;
padding: 5px 5px;
}


table tbody td {
font-size: 13px;
vertical-align: top;
}

table thead {
background: #CFCFCF;
background: linear-gradient(to bottom, #dbdbdb 0%, #d3d3d3 66%, #CFCFCF 100%);
border-bottom: 3px solid black;
}


table thead th {
font-size: 15px;
font-weight: bold;
color: black;
text-align: center;
}
</style>
</head>
<body>
Expand Down
Loading

0 comments on commit 905ef9b

Please sign in to comment.