Skip to content

Commit 37ffe15

Browse files
authored
Merge pull request #84 from lbr38/devel
5.4.0
2 parents 9a7ca71 + 320b169 commit 37ffe15

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+960
-3177
lines changed

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ RUN ARCH=$(dpkg --print-architecture); \
110110
fi
111111
# Then link go2rtc binary to /usr/local/bin/ and set permissions
112112
RUN ln -s ${WWW_DIR}/bin/go2rtc/go2rtc_linux_$(dpkg --print-architecture) /usr/local/bin/go2rtc
113-
RUN chmod 755 /usr/local/bin/go2rtc
113+
RUN chmod 750 /usr/local/bin/go2rtc
114114
# Copy go2rtc template config file if not exists
115115
RUN if [ ! -f "${DATA_DIR}/go2rtc/go2rtc.yml" ]; then \
116116
mkdir -p ${DATA_DIR}/go2rtc; \

docker/config/nginx/motionui.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ server {
108108

109109
location ~ \.(?:css|js|woff2?|svg|gif|map)$ {
110110
try_files $uri $uri/ =404;
111-
add_header Cache-Control "public, max-age=15778463";
111+
add_header Cache-Control "public, max-age=3600";
112112
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;
113113
add_header Referrer-Policy "no-referrer" always;
114114
add_header X-Content-Type-Options "nosniff" always;

www/bin/go2rtc/README

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- When updating binaries, set 750 permissions on each of them

www/bin/go2rtc/go2rtc_linux_amd64

189 KB
Binary file not shown.

www/bin/go2rtc/go2rtc_linux_arm64

100644100755
167 KB
Binary file not shown.

www/bin/go2rtc/go2rtc_linux_armhf

100644100755
151 KB
Binary file not shown.

www/bin/go2rtc/go2rtc_linux_i386

100644100755
167 KB
Binary file not shown.

www/controllers/App/Config/Notification.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ public static function get()
2222
* If an update is available, generate a new notification
2323
*/
2424
if (UPDATE_AVAILABLE) {
25-
$message = '<p>A new release is available: <a href="' . PROJECT_GIT_REPO . '/releases/latest" target="_blank" rel="noopener noreferrer" title="See changelog"><code>' . GIT_VERSION . '</code> <img src="/assets/icons/external-link.svg" class="icon" /></a></p>';
26-
$message .= '<p>Please update your docker image by following the steps documented <b><a href="' . PROJECT_UPDATE_DOC_URL . '" target="_blank" rel="noopener noreferrer"><code>here</code></b> <img src="/assets/icons/external-link.svg" class="icon" /></a></p>';
25+
$message = '<p>A new release is available: <a href="' . PROJECT_GIT_REPO . '/releases/latest" target="_blank" rel="noopener noreferrer" title="See changelog"><code>' . GIT_VERSION . '</code> <img src="/assets/icons/external-link.svg" class="icon-small" /></a></p>';
26+
$message .= '<p>Please update your docker image by following the steps documented <b><a href="' . PROJECT_UPDATE_DOC_URL . '" target="_blank" rel="noopener noreferrer"><code>here</code></b> <img src="/assets/icons/external-link.svg" class="icon-small" /></a></p>';
2727

2828
$NOTIFICATION_MESSAGES[] = array('Title' => 'Update available', 'Message' => $message);
2929
$NOTIFICATION++;

www/controllers/Camera/Camera.php

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,20 @@ public function add(array $params)
113113
throw new Exception('Frame rate is required');
114114
}
115115

116+
/**
117+
* Check that URL starts with http(s)://, rtsp:// or /dev/video
118+
*/
119+
if (!preg_match('#(^https?://|^rtsp://|^/dev/video)#', $params['url'])) {
120+
throw new Exception('URL must start with <b>http(s)://</b>, <b>rtsp://</b> or <b>/dev/video</b>');
121+
}
122+
123+
/**
124+
* Check that URL does not contain invalid characters
125+
*/
126+
if (str_contains($params['url'], "'") || str_contains($params['url'], "\\") || str_contains($params['url'], '<') || str_contains($params['url'], '>')) {
127+
throw new Exception('Url contains invalid characters');
128+
}
129+
116130
/**
117131
* Retrieve params
118132
*/
@@ -138,13 +152,6 @@ public function add(array $params)
138152
$motionEnabled = 'true';
139153
}
140154

141-
/**
142-
* Check that URL starts with http(s)://, rtsp:// or /dev/video
143-
*/
144-
if (!preg_match('#(^https?://|^rtsp://|^/dev/video)#', $url)) {
145-
throw new Exception('URL must start with <b>http(s)://</b>, <b>rtsp://</b> or <b>/dev/video</b>');
146-
}
147-
148155
/**
149156
* Check that resolution is valid
150157
*/
@@ -328,6 +335,20 @@ public function editGlobalSettings(int $id, array $params)
328335
throw new Exception('Frame rate is required');
329336
}
330337

338+
/**
339+
* Check that URL starts with http(s)://, rtsp:// or /dev/video
340+
*/
341+
if (!preg_match('#(^https?://|^rtsp://|^/dev/video)#', $params['url'])) {
342+
throw new Exception('URL must start with <b>http(s)://</b>, <b>rtsp://</b> or <b>/dev/video</b>');
343+
}
344+
345+
/**
346+
* Check that URL does not contain invalid characters
347+
*/
348+
if (str_contains($params['url'], "'") || str_contains($params['url'], "\\") || str_contains($params['url'], '<') || str_contains($params['url'], '>')) {
349+
throw new Exception('Url contains invalid characters');
350+
}
351+
331352
/**
332353
* Retrieve params
333354
*/
@@ -406,13 +427,6 @@ public function editGlobalSettings(int $id, array $params)
406427
$timelapseEnabled = 'true';
407428
}
408429

409-
/**
410-
* Check that URL starts with http(s)://, rtsp:// or /dev/video
411-
*/
412-
if (!preg_match('#(^https?://|^rtsp://|^/dev/video)#', $url)) {
413-
throw new Exception('URL must start with <b>http(s)://</b>, <b>rtsp://</b> or <b>/dev/video</b>');
414-
}
415-
416430
/**
417431
* Check that resolution is valid
418432
*/

www/controllers/Go2rtc/Go2rtc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ private function getConfig() : array
4343
public function addStream(int $id, array $params)
4444
{
4545
$id = $params['id'];
46-
$urlOrDevice = $params['url'];
46+
$urlOrDevice = htmlspecialchars_decode($params['url']);
4747
$basicAuthUsername = $params['basicAuthUsername'];
4848
$basicAuthPassword = $params['basicAuthPassword'];
4949
$rotate = $params['rotate'];

0 commit comments

Comments
 (0)