aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorSeth Falco <seth@falco.fun>2023-08-02 23:22:36 +0100
committerChocobozzz <chocobozzz@cpy.re>2023-08-18 10:17:16 +0200
commit2055962c844e557d628d9d0aae9303590c39eab8 (patch)
treee1ead9fc49f6b70e51e3728485d5c6b6c2d7fba9 /server
parent8e4fba97b26090e0c77ee9591058cd34ef9d2f55 (diff)
downloadPeerTube-2055962c844e557d628d9d0aae9303590c39eab8.tar.gz
PeerTube-2055962c844e557d628d9d0aae9303590c39eab8.tar.zst
PeerTube-2055962c844e557d628d9d0aae9303590c39eab8.zip
fix: handle git installation of ffmpeg
Diffstat (limited to 'server')
-rw-r--r--server/server/helpers/core-utils.ts14
-rw-r--r--server/server/initializers/checker-after-init.ts9
2 files changed, 20 insertions, 3 deletions
diff --git a/server/server/helpers/core-utils.ts b/server/server/helpers/core-utils.ts
index 6dc09d317..9b40ca5be 100644
--- a/server/server/helpers/core-utils.ts
+++ b/server/server/helpers/core-utils.ts
@@ -183,13 +183,23 @@ function pageToStartAndCount (page: number, itemsPerPage: number) {
183// --------------------------------------------------------------------------- 183// ---------------------------------------------------------------------------
184 184
185type SemVersion = { major: number, minor: number, patch: number } 185type SemVersion = { major: number, minor: number, patch: number }
186
187/**
188 * Parses a semantic version string into its separate components.
189 * Fairly lax, and allows for missing or additional segments in the string.
190 *
191 * @param s String to parse semantic version from.
192 * @returns Major, minor, and patch version, or null if string does not follow semantic version conventions.
193 */
186function parseSemVersion (s: string) { 194function parseSemVersion (s: string) {
187 const parsed = s.match(/^v?(\d+)\.(\d+)\.(\d+)$/i) 195 const parsed = s.match(/v?(\d+)\.(\d+)(?:\.(\d+))?/i)
196
197 if (!parsed) return null
188 198
189 return { 199 return {
190 major: parseInt(parsed[1]), 200 major: parseInt(parsed[1]),
191 minor: parseInt(parsed[2]), 201 minor: parseInt(parsed[2]),
192 patch: parseInt(parsed[3]) 202 patch: parsed[3] ? parseInt(parsed[3]) : 0
193 } as SemVersion 203 } as SemVersion
194} 204}
195 205
diff --git a/server/server/initializers/checker-after-init.ts b/server/server/initializers/checker-after-init.ts
index afcf6176b..5e7e513f1 100644
--- a/server/server/initializers/checker-after-init.ts
+++ b/server/server/initializers/checker-after-init.ts
@@ -78,7 +78,14 @@ async function applicationExist () {
78 78
79async function checkFFmpegVersion () { 79async function checkFFmpegVersion () {
80 const version = await getFFmpegVersion() 80 const version = await getFFmpegVersion()
81 const { major, minor, patch } = parseSemVersion(version) 81 const semvar = parseSemVersion(version)
82
83 if (!semvar) {
84 logger.warn('Your ffmpeg version (%s) does not use semvar. Unable to determine version compatibility.', version)
85 return
86 }
87
88 const { major, minor, patch } = semvar
82 89
83 if (major < 4 || (major === 4 && minor < 1)) { 90 if (major < 4 || (major === 4 && minor < 1)) {
84 logger.warn('Your ffmpeg version (%s) is outdated. PeerTube supports ffmpeg >= 4.1. Please upgrade ffmpeg.', version) 91 logger.warn('Your ffmpeg version (%s) is outdated. PeerTube supports ffmpeg >= 4.1. Please upgrade ffmpeg.', version)