Merge pull request #8 from WaveringAna/gifv

gifV support
This commit is contained in:
Wavering Ana 2022-11-19 02:24:44 -05:00 committed by GitHub
commit 337ef14cf4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 596 additions and 12 deletions

1
app.js
View file

@ -13,6 +13,7 @@ let indexRouter = require('./routes/index');
let authRouter = require('./routes/auth'); let authRouter = require('./routes/auth');
let app = express(); let app = express();
app.enable('trust proxy');
// view engine setup // view engine setup
app.set('views', path.join(__dirname, 'views')); app.set('views', path.join(__dirname, 'views'));

411
package-lock.json generated
View file

@ -9,12 +9,15 @@
"version": "0.0.0", "version": "0.0.0",
"license": "Unlicense", "license": "Unlicense",
"dependencies": { "dependencies": {
"@ffmpeg-installer/ffmpeg": "^1.1.0",
"@ffprobe-installer/ffprobe": "^1.4.1",
"connect-sqlite3": "^0.9.13", "connect-sqlite3": "^0.9.13",
"cookie-parser": "~1.4.4", "cookie-parser": "~1.4.4",
"dotenv": "^8.6.0", "dotenv": "^8.6.0",
"ejs": "^3.1.8", "ejs": "^3.1.8",
"express": "~4.16.1", "express": "~4.16.1",
"express-session": "^1.17.3", "express-session": "^1.17.3",
"fluent-ffmpeg": "^2.1.2",
"http-errors": "~1.6.3", "http-errors": "~1.6.3",
"mkdirp": "^1.0.4", "mkdirp": "^1.0.4",
"multer": "^1.4.5-lts.1", "multer": "^1.4.5-lts.1",
@ -23,6 +26,240 @@
"sqlite3": "^5.0.2" "sqlite3": "^5.0.2"
} }
}, },
"node_modules/@ffmpeg-installer/darwin-arm64": {
"version": "4.1.5",
"resolved": "https://registry.npmjs.org/@ffmpeg-installer/darwin-arm64/-/darwin-arm64-4.1.5.tgz",
"integrity": "sha512-hYqTiP63mXz7wSQfuqfFwfLOfwwFChUedeCVKkBtl/cliaTM7/ePI9bVzfZ2c+dWu3TqCwLDRWNSJ5pqZl8otA==",
"cpu": [
"arm64"
],
"hasInstallScript": true,
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@ffmpeg-installer/darwin-x64": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@ffmpeg-installer/darwin-x64/-/darwin-x64-4.1.0.tgz",
"integrity": "sha512-Z4EyG3cIFjdhlY8wI9aLUXuH8nVt7E9SlMVZtWvSPnm2sm37/yC2CwjUzyCQbJbySnef1tQwGG2Sx+uWhd9IAw==",
"cpu": [
"x64"
],
"hasInstallScript": true,
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@ffmpeg-installer/ffmpeg": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@ffmpeg-installer/ffmpeg/-/ffmpeg-1.1.0.tgz",
"integrity": "sha512-Uq4rmwkdGxIa9A6Bd/VqqYbT7zqh1GrT5/rFwCwKM70b42W5gIjWeVETq6SdcL0zXqDtY081Ws/iJWhr1+xvQg==",
"optionalDependencies": {
"@ffmpeg-installer/darwin-arm64": "4.1.5",
"@ffmpeg-installer/darwin-x64": "4.1.0",
"@ffmpeg-installer/linux-arm": "4.1.3",
"@ffmpeg-installer/linux-arm64": "4.1.4",
"@ffmpeg-installer/linux-ia32": "4.1.0",
"@ffmpeg-installer/linux-x64": "4.1.0",
"@ffmpeg-installer/win32-ia32": "4.1.0",
"@ffmpeg-installer/win32-x64": "4.1.0"
}
},
"node_modules/@ffmpeg-installer/linux-arm": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/@ffmpeg-installer/linux-arm/-/linux-arm-4.1.3.tgz",
"integrity": "sha512-NDf5V6l8AfzZ8WzUGZ5mV8O/xMzRag2ETR6+TlGIsMHp81agx51cqpPItXPib/nAZYmo55Bl2L6/WOMI3A5YRg==",
"cpu": [
"arm"
],
"hasInstallScript": true,
"optional": true,
"os": [
"linux"
]
},
"node_modules/@ffmpeg-installer/linux-arm64": {
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/@ffmpeg-installer/linux-arm64/-/linux-arm64-4.1.4.tgz",
"integrity": "sha512-dljEqAOD0oIM6O6DxBW9US/FkvqvQwgJ2lGHOwHDDwu/pX8+V0YsDL1xqHbj1DMX/+nP9rxw7G7gcUvGspSoKg==",
"cpu": [
"arm64"
],
"hasInstallScript": true,
"optional": true,
"os": [
"linux"
]
},
"node_modules/@ffmpeg-installer/linux-ia32": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@ffmpeg-installer/linux-ia32/-/linux-ia32-4.1.0.tgz",
"integrity": "sha512-0LWyFQnPf+Ij9GQGD034hS6A90URNu9HCtQ5cTqo5MxOEc7Rd8gLXrJvn++UmxhU0J5RyRE9KRYstdCVUjkNOQ==",
"cpu": [
"ia32"
],
"hasInstallScript": true,
"optional": true,
"os": [
"linux"
]
},
"node_modules/@ffmpeg-installer/linux-x64": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@ffmpeg-installer/linux-x64/-/linux-x64-4.1.0.tgz",
"integrity": "sha512-Y5BWhGLU/WpQjOArNIgXD3z5mxxdV8c41C+U15nsE5yF8tVcdCGet5zPs5Zy3Ta6bU7haGpIzryutqCGQA/W8A==",
"cpu": [
"x64"
],
"hasInstallScript": true,
"optional": true,
"os": [
"linux"
]
},
"node_modules/@ffmpeg-installer/win32-ia32": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@ffmpeg-installer/win32-ia32/-/win32-ia32-4.1.0.tgz",
"integrity": "sha512-FV2D7RlaZv/lrtdhaQ4oETwoFUsUjlUiasiZLDxhEUPdNDWcH1OU9K1xTvqz+OXLdsmYelUDuBS/zkMOTtlUAw==",
"cpu": [
"ia32"
],
"optional": true,
"os": [
"win32"
]
},
"node_modules/@ffmpeg-installer/win32-x64": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@ffmpeg-installer/win32-x64/-/win32-x64-4.1.0.tgz",
"integrity": "sha512-Drt5u2vzDnIONf4ZEkKtFlbvwj6rI3kxw1Ck9fpudmtgaZIHD4ucsWB2lCZBXRxJgXR+2IMSti+4rtM4C4rXgg==",
"cpu": [
"x64"
],
"optional": true,
"os": [
"win32"
]
},
"node_modules/@ffprobe-installer/darwin-arm64": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/@ffprobe-installer/darwin-arm64/-/darwin-arm64-5.0.1.tgz",
"integrity": "sha512-vwNCNjokH8hfkbl6m95zICHwkSzhEvDC3GVBcUp5HX8+4wsX10SP3B+bGur7XUzTIZ4cQpgJmEIAx6TUwRepMg==",
"cpu": [
"arm64"
],
"hasInstallScript": true,
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@ffprobe-installer/darwin-x64": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@ffprobe-installer/darwin-x64/-/darwin-x64-5.0.0.tgz",
"integrity": "sha512-Zl0UkZ+wW/eyMKBPLTUCcNQch2VDnZz/cBn1DXv3YtCBVbYd9aYzGj4MImdxgWcoE0+GpbfbO6mKGwMq5HCm6A==",
"cpu": [
"x64"
],
"hasInstallScript": true,
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@ffprobe-installer/ffprobe": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/@ffprobe-installer/ffprobe/-/ffprobe-1.4.1.tgz",
"integrity": "sha512-3WJvxU0f4d7IOZdzoVCAj9fYtiQNC6E0521FJFe9iP5Ej8auTXU7TsrUzIAG1CydeQI+BnM3vGog92SCcF9KtA==",
"optionalDependencies": {
"@ffprobe-installer/darwin-arm64": "5.0.1",
"@ffprobe-installer/darwin-x64": "5.0.0",
"@ffprobe-installer/linux-arm": "5.0.0",
"@ffprobe-installer/linux-arm64": "5.0.0",
"@ffprobe-installer/linux-ia32": "5.0.0",
"@ffprobe-installer/linux-x64": "5.0.0",
"@ffprobe-installer/win32-ia32": "5.0.0",
"@ffprobe-installer/win32-x64": "5.0.0"
}
},
"node_modules/@ffprobe-installer/linux-arm": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@ffprobe-installer/linux-arm/-/linux-arm-5.0.0.tgz",
"integrity": "sha512-mM1PPxP2UX5SUvhy0urcj5U8UolwbYgmnXA/eBWbW78k6N2Wk1COvcHYzOPs6c5yXXL6oshS2rZHU1kowigw7g==",
"cpu": [
"arm"
],
"hasInstallScript": true,
"optional": true,
"os": [
"linux"
]
},
"node_modules/@ffprobe-installer/linux-arm64": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@ffprobe-installer/linux-arm64/-/linux-arm64-5.0.0.tgz",
"integrity": "sha512-IwFbzhe1UydR849YXLPP0RMpHgHXSuPO1kznaCHcU5FscFBV5gOZLkdD8e/xrcC8g/nhKqy0xMjn5kv6KkFQlQ==",
"cpu": [
"arm64"
],
"hasInstallScript": true,
"optional": true,
"os": [
"linux"
]
},
"node_modules/@ffprobe-installer/linux-ia32": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@ffprobe-installer/linux-ia32/-/linux-ia32-5.0.0.tgz",
"integrity": "sha512-c3bWlWEDMST59SAZycVh0oyc2eNS/CxxeRjoNryGRgqcZX3EJWJJQL1rAXbpQOMLMi8to1RqnmMuwPJgLLjjUA==",
"cpu": [
"ia32"
],
"hasInstallScript": true,
"optional": true,
"os": [
"linux"
]
},
"node_modules/@ffprobe-installer/linux-x64": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@ffprobe-installer/linux-x64/-/linux-x64-5.0.0.tgz",
"integrity": "sha512-zgLnWJFvMGCaw1txGtz84sMEQt6mQUzdw86ih9S/kZOWnp06Gj/ams/EXxEkAxgAACCVM6/O0mkDe/6biY5tgA==",
"cpu": [
"x64"
],
"hasInstallScript": true,
"optional": true,
"os": [
"linux"
]
},
"node_modules/@ffprobe-installer/win32-ia32": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@ffprobe-installer/win32-ia32/-/win32-ia32-5.0.0.tgz",
"integrity": "sha512-NnDdAZD6ShFXzJeCkAFl2ZjAv7GcJWYudLA+0T/vjZwvskBop+sq1PGfdmVltfFDcdQiomoThRhn9Xiy9ZC71g==",
"cpu": [
"ia32"
],
"optional": true,
"os": [
"win32"
]
},
"node_modules/@ffprobe-installer/win32-x64": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@ffprobe-installer/win32-x64/-/win32-x64-5.0.0.tgz",
"integrity": "sha512-P4ZMRFxVMnfMsOyTfBM/+nkTodLeOUfXNPo+X1bKEWBiZxRErqX/IHS5sLA0yAH8XmtKZcL7Cu6M26ztGcQYxw==",
"cpu": [
"x64"
],
"optional": true,
"os": [
"win32"
]
},
"node_modules/@gar/promisify": { "node_modules/@gar/promisify": {
"version": "1.1.3", "version": "1.1.3",
"resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz", "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz",
@ -773,6 +1010,29 @@
"node": ">= 0.8" "node": ">= 0.8"
} }
}, },
"node_modules/fluent-ffmpeg": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/fluent-ffmpeg/-/fluent-ffmpeg-2.1.2.tgz",
"integrity": "sha512-IZTB4kq5GK0DPp7sGQ0q/BWurGHffRtQQwVkiqDgeO6wYJLLV5ZhgNOQ65loZxxuPMKZKZcICCUnaGtlxBiR0Q==",
"dependencies": {
"async": ">=0.2.9",
"which": "^1.1.1"
},
"engines": {
"node": ">=0.8.0"
}
},
"node_modules/fluent-ffmpeg/node_modules/which": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
"integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
"dependencies": {
"isexe": "^2.0.0"
},
"bin": {
"which": "bin/which"
}
},
"node_modules/forwarded": { "node_modules/forwarded": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
@ -1035,8 +1295,7 @@
"node_modules/isexe": { "node_modules/isexe": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="
"optional": true
}, },
"node_modules/jake": { "node_modules/jake": {
"version": "10.8.5", "version": "10.8.5",
@ -2052,6 +2311,132 @@
} }
}, },
"dependencies": { "dependencies": {
"@ffmpeg-installer/darwin-arm64": {
"version": "4.1.5",
"resolved": "https://registry.npmjs.org/@ffmpeg-installer/darwin-arm64/-/darwin-arm64-4.1.5.tgz",
"integrity": "sha512-hYqTiP63mXz7wSQfuqfFwfLOfwwFChUedeCVKkBtl/cliaTM7/ePI9bVzfZ2c+dWu3TqCwLDRWNSJ5pqZl8otA==",
"optional": true
},
"@ffmpeg-installer/darwin-x64": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@ffmpeg-installer/darwin-x64/-/darwin-x64-4.1.0.tgz",
"integrity": "sha512-Z4EyG3cIFjdhlY8wI9aLUXuH8nVt7E9SlMVZtWvSPnm2sm37/yC2CwjUzyCQbJbySnef1tQwGG2Sx+uWhd9IAw==",
"optional": true
},
"@ffmpeg-installer/ffmpeg": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@ffmpeg-installer/ffmpeg/-/ffmpeg-1.1.0.tgz",
"integrity": "sha512-Uq4rmwkdGxIa9A6Bd/VqqYbT7zqh1GrT5/rFwCwKM70b42W5gIjWeVETq6SdcL0zXqDtY081Ws/iJWhr1+xvQg==",
"requires": {
"@ffmpeg-installer/darwin-arm64": "4.1.5",
"@ffmpeg-installer/darwin-x64": "4.1.0",
"@ffmpeg-installer/linux-arm": "4.1.3",
"@ffmpeg-installer/linux-arm64": "4.1.4",
"@ffmpeg-installer/linux-ia32": "4.1.0",
"@ffmpeg-installer/linux-x64": "4.1.0",
"@ffmpeg-installer/win32-ia32": "4.1.0",
"@ffmpeg-installer/win32-x64": "4.1.0"
}
},
"@ffmpeg-installer/linux-arm": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/@ffmpeg-installer/linux-arm/-/linux-arm-4.1.3.tgz",
"integrity": "sha512-NDf5V6l8AfzZ8WzUGZ5mV8O/xMzRag2ETR6+TlGIsMHp81agx51cqpPItXPib/nAZYmo55Bl2L6/WOMI3A5YRg==",
"optional": true
},
"@ffmpeg-installer/linux-arm64": {
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/@ffmpeg-installer/linux-arm64/-/linux-arm64-4.1.4.tgz",
"integrity": "sha512-dljEqAOD0oIM6O6DxBW9US/FkvqvQwgJ2lGHOwHDDwu/pX8+V0YsDL1xqHbj1DMX/+nP9rxw7G7gcUvGspSoKg==",
"optional": true
},
"@ffmpeg-installer/linux-ia32": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@ffmpeg-installer/linux-ia32/-/linux-ia32-4.1.0.tgz",
"integrity": "sha512-0LWyFQnPf+Ij9GQGD034hS6A90URNu9HCtQ5cTqo5MxOEc7Rd8gLXrJvn++UmxhU0J5RyRE9KRYstdCVUjkNOQ==",
"optional": true
},
"@ffmpeg-installer/linux-x64": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@ffmpeg-installer/linux-x64/-/linux-x64-4.1.0.tgz",
"integrity": "sha512-Y5BWhGLU/WpQjOArNIgXD3z5mxxdV8c41C+U15nsE5yF8tVcdCGet5zPs5Zy3Ta6bU7haGpIzryutqCGQA/W8A==",
"optional": true
},
"@ffmpeg-installer/win32-ia32": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@ffmpeg-installer/win32-ia32/-/win32-ia32-4.1.0.tgz",
"integrity": "sha512-FV2D7RlaZv/lrtdhaQ4oETwoFUsUjlUiasiZLDxhEUPdNDWcH1OU9K1xTvqz+OXLdsmYelUDuBS/zkMOTtlUAw==",
"optional": true
},
"@ffmpeg-installer/win32-x64": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@ffmpeg-installer/win32-x64/-/win32-x64-4.1.0.tgz",
"integrity": "sha512-Drt5u2vzDnIONf4ZEkKtFlbvwj6rI3kxw1Ck9fpudmtgaZIHD4ucsWB2lCZBXRxJgXR+2IMSti+4rtM4C4rXgg==",
"optional": true
},
"@ffprobe-installer/darwin-arm64": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/@ffprobe-installer/darwin-arm64/-/darwin-arm64-5.0.1.tgz",
"integrity": "sha512-vwNCNjokH8hfkbl6m95zICHwkSzhEvDC3GVBcUp5HX8+4wsX10SP3B+bGur7XUzTIZ4cQpgJmEIAx6TUwRepMg==",
"optional": true
},
"@ffprobe-installer/darwin-x64": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@ffprobe-installer/darwin-x64/-/darwin-x64-5.0.0.tgz",
"integrity": "sha512-Zl0UkZ+wW/eyMKBPLTUCcNQch2VDnZz/cBn1DXv3YtCBVbYd9aYzGj4MImdxgWcoE0+GpbfbO6mKGwMq5HCm6A==",
"optional": true
},
"@ffprobe-installer/ffprobe": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/@ffprobe-installer/ffprobe/-/ffprobe-1.4.1.tgz",
"integrity": "sha512-3WJvxU0f4d7IOZdzoVCAj9fYtiQNC6E0521FJFe9iP5Ej8auTXU7TsrUzIAG1CydeQI+BnM3vGog92SCcF9KtA==",
"requires": {
"@ffprobe-installer/darwin-arm64": "5.0.1",
"@ffprobe-installer/darwin-x64": "5.0.0",
"@ffprobe-installer/linux-arm": "5.0.0",
"@ffprobe-installer/linux-arm64": "5.0.0",
"@ffprobe-installer/linux-ia32": "5.0.0",
"@ffprobe-installer/linux-x64": "5.0.0",
"@ffprobe-installer/win32-ia32": "5.0.0",
"@ffprobe-installer/win32-x64": "5.0.0"
}
},
"@ffprobe-installer/linux-arm": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@ffprobe-installer/linux-arm/-/linux-arm-5.0.0.tgz",
"integrity": "sha512-mM1PPxP2UX5SUvhy0urcj5U8UolwbYgmnXA/eBWbW78k6N2Wk1COvcHYzOPs6c5yXXL6oshS2rZHU1kowigw7g==",
"optional": true
},
"@ffprobe-installer/linux-arm64": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@ffprobe-installer/linux-arm64/-/linux-arm64-5.0.0.tgz",
"integrity": "sha512-IwFbzhe1UydR849YXLPP0RMpHgHXSuPO1kznaCHcU5FscFBV5gOZLkdD8e/xrcC8g/nhKqy0xMjn5kv6KkFQlQ==",
"optional": true
},
"@ffprobe-installer/linux-ia32": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@ffprobe-installer/linux-ia32/-/linux-ia32-5.0.0.tgz",
"integrity": "sha512-c3bWlWEDMST59SAZycVh0oyc2eNS/CxxeRjoNryGRgqcZX3EJWJJQL1rAXbpQOMLMi8to1RqnmMuwPJgLLjjUA==",
"optional": true
},
"@ffprobe-installer/linux-x64": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@ffprobe-installer/linux-x64/-/linux-x64-5.0.0.tgz",
"integrity": "sha512-zgLnWJFvMGCaw1txGtz84sMEQt6mQUzdw86ih9S/kZOWnp06Gj/ams/EXxEkAxgAACCVM6/O0mkDe/6biY5tgA==",
"optional": true
},
"@ffprobe-installer/win32-ia32": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@ffprobe-installer/win32-ia32/-/win32-ia32-5.0.0.tgz",
"integrity": "sha512-NnDdAZD6ShFXzJeCkAFl2ZjAv7GcJWYudLA+0T/vjZwvskBop+sq1PGfdmVltfFDcdQiomoThRhn9Xiy9ZC71g==",
"optional": true
},
"@ffprobe-installer/win32-x64": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@ffprobe-installer/win32-x64/-/win32-x64-5.0.0.tgz",
"integrity": "sha512-P4ZMRFxVMnfMsOyTfBM/+nkTodLeOUfXNPo+X1bKEWBiZxRErqX/IHS5sLA0yAH8XmtKZcL7Cu6M26ztGcQYxw==",
"optional": true
},
"@gar/promisify": { "@gar/promisify": {
"version": "1.1.3", "version": "1.1.3",
"resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz", "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz",
@ -2650,6 +3035,25 @@
"unpipe": "~1.0.0" "unpipe": "~1.0.0"
} }
}, },
"fluent-ffmpeg": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/fluent-ffmpeg/-/fluent-ffmpeg-2.1.2.tgz",
"integrity": "sha512-IZTB4kq5GK0DPp7sGQ0q/BWurGHffRtQQwVkiqDgeO6wYJLLV5ZhgNOQ65loZxxuPMKZKZcICCUnaGtlxBiR0Q==",
"requires": {
"async": ">=0.2.9",
"which": "^1.1.1"
},
"dependencies": {
"which": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
"integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
"requires": {
"isexe": "^2.0.0"
}
}
}
},
"forwarded": { "forwarded": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
@ -2858,8 +3262,7 @@
"isexe": { "isexe": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="
"optional": true
}, },
"jake": { "jake": {
"version": "10.8.5", "version": "10.8.5",

View file

@ -24,12 +24,15 @@
"start": "node ./bin/www" "start": "node ./bin/www"
}, },
"dependencies": { "dependencies": {
"@ffmpeg-installer/ffmpeg": "^1.1.0",
"@ffprobe-installer/ffprobe": "^1.4.1",
"connect-sqlite3": "^0.9.13", "connect-sqlite3": "^0.9.13",
"cookie-parser": "~1.4.4", "cookie-parser": "~1.4.4",
"dotenv": "^8.6.0", "dotenv": "^8.6.0",
"ejs": "^3.1.8", "ejs": "^3.1.8",
"express": "~4.16.1", "express": "~4.16.1",
"express-session": "^1.17.3", "express-session": "^1.17.3",
"fluent-ffmpeg": "^2.1.2",
"http-errors": "~1.6.3", "http-errors": "~1.6.3",
"mkdirp": "^1.0.4", "mkdirp": "^1.0.4",
"multer": "^1.4.5-lts.1", "multer": "^1.4.5-lts.1",

View file

@ -90,3 +90,27 @@ div.nonmedia p {
label { label {
text-align: center; text-align: center;
} }
.video {
position: relative;
}
.video .overlay {
position: absolute;
top: 0%;
left: 70%;
transform: translateY(0%) translateX(70%);
z-index: 1;
border-radius: 25px;
border: 2px solid #73AD21;
padding: 5px;
background-color: #eee;
}
.video .overlay a {
color: #73AD21;
font-size: 12px;
font-weight: 400;
line-height: 20px;
text-align: center;
}

View file

@ -9,6 +9,15 @@ function copyURI(evt) {
}); });
} }
function copyA(evt) {
evt.preventDefault();
navigator.clipboard.writeText(absolutePath(evt.target.getAttribute('href'))).then(() => {
console.log("copied");
}, () => {
console.log("failed");
});
}
function copyPath(evt) { function copyPath(evt) {
navigator.clipboard.writeText(absolutePath(evt)).then(() => { navigator.clipboard.writeText(absolutePath(evt)).then(() => {
console.log("copied"); console.log("copied");

View file

@ -1,5 +1,10 @@
let express = require('express'); let express = require('express');
let multer = require('multer'); let multer = require('multer');
let ffmpegpath = require('@ffmpeg-installer/ffmpeg').path;
let ffprobepath = require('@ffprobe-installer/ffprobe').path;
let ffmpeg = require('fluent-ffmpeg');
ffmpeg.setFfmpegPath(ffmpegpath);
ffmpeg.setFfprobePath(ffprobepath);
let db = require('../db'); let db = require('../db');
let fs = require('fs'); let fs = require('fs');
@ -73,6 +78,9 @@ function fetchMedia(req, res, next) {
}); });
} }
//middleware
//Checks ShareX key
function checkAuth(req, res, next) { function checkAuth(req, res, next) {
let auth = process.env.EBAPI_KEY || process.env.EBPASS || 'pleaseSetAPI_KEY'; let auth = process.env.EBAPI_KEY || process.env.EBPASS || 'pleaseSetAPI_KEY';
let key = null; let key = null;
@ -93,6 +101,63 @@ function checkAuth(req, res, next) {
next(); next();
} }
//Converts mp4 to gif and vice versa with ffmpeg
function convert(req, res, next) {
for (file in req.files) {
let nameAndExtension = extension(req.files[file].originalname);
let oembed = {
type: "video",
version: "1.0",
provider_name: "embedder",
provider_url: "https://github.com/WaveringAna/embedder",
cache_age: 86400,
html: "<iframe src='" + req.protocol + "://" + req.get('host') + "/gifv/" + nameAndExtension[0] + "'></iframe>",
width: 640,
height: 360
};
fs.writeFile('uploads/oembed-' + nameAndExtension[0] + '.json', JSON.stringify(oembed), function (err) {
if (err) return next(err);
console.log('oembed file created ' + nameAndExtension[0] + '.json');
});
if (nameAndExtension[1] == '.mp4') {
console.log('Converting ' + nameAndExtension[0] + nameAndExtension[1] + ' to gif');
console.log(nameAndExtension[0] + nameAndExtension[1]);
ffmpeg()
.input('uploads/' + req.files[file].originalname)
.inputFormat('mp4')
.outputFormat('gif')
.output('uploads/' + nameAndExtension[0] + '.gif')
.on('end', function() {
console.log('Conversion complete');
console.log('Uploaded to uploads/' + nameAndExtension[0] + '.gif');
})
.on('error', (e) => console.log(e))
.run();
} else if (nameAndExtension[1] == '.gif') {
console.log('Converting ' + nameAndExtension[0] + nameAndExtension[1] + ' to mp4');
ffmpeg('uploads/' + req.files[file].originalname)
.inputFormat('gif')
.outputFormat('mp4')
.outputOptions([
'-pix_fmt yuv420p',
'-c:v libx264',
'-movflags +faststart'
])
.noAudio()
.output('uploads/' + nameAndExtension[0] + '.mp4')
.on('end', function() {
console.log('Conversion complete');
console.log('Uploaded to uploads/' + nameAndExtension[0] + '.mp4');
})
.run();
}
}
next();
};
let router = express.Router(); let router = express.Router();
router.get('/', function (req, res, next) { router.get('/', function (req, res, next) {
@ -103,7 +168,37 @@ router.get('/', function (req, res, next) {
res.render('index', { user: req.user }); res.render('index', { user: req.user });
}); });
router.post('/', upload.array('fileupload'), function(req, res, next) { router.get('/gifv/:file', function (req, res, next) {
let url = req.protocol + '://' + req.get('host') + '/uploads/' + req.params.file;
let width; let height;
nameAndExtension = extension('uploads/' + req.params.file);
if (nameAndExtension[1] == '.mp4') {
ffmpeg()
.input('uploads/' + req.params.file)
.inputFormat('mp4')
.ffprobe(function(err, data) {
if (err) return next(err);
width = data.streams[0].width;
height = data.streams[0].height;
console.log(width + 'x' + height);
return res.render('gifv', { url: url, host: req.protocol + '://' + req.get('host'), width: width, height: height });
});
} else if (nameAndExtension[1] == '.gif') {
ffmpeg()
.input('uploads/' + req.params.file)
.inputFormat('gif')
.ffprobe(function(err, data) {
if (err) return next(err);
width = data.streams[0].width;
height = data.streams[0].height;
console.log(width + 'x' + height);
return res.render('gifv', { url: url, host: req.protocol + '://' + req.get('host'), width: width, height: height });
});
}
});
router.post('/', [upload.array('fileupload'), convert], function(req, res, next) {
if (!req.files || Object.keys(req.files).length === 0) { if (!req.files || Object.keys(req.files).length === 0) {
console.log(req) console.log(req)
return res.status(400).send('No files were uploaded.'); return res.status(400).send('No files were uploaded.');
@ -138,7 +233,6 @@ router.post('/sharex', [checkAuth, upload.array('fileupload')], function(req, re
} }
}); });
router.post('/:id(\\d+)/delete', function(req, res, next) { router.post('/:id(\\d+)/delete', function(req, res, next) {
db.all('SELECT path FROM media WHERE id = ?', [ req.params.id ], function(err, path) { db.all('SELECT path FROM media WHERE id = ?', [ req.params.id ], function(err, path) {
if (err) { return next(err); } if (err) { return next(err); }

36
views/gifv.ejs Normal file
View file

@ -0,0 +1,36 @@
<%
function extension(str){
let file = str.split('/').pop();
return [file.substr(0,file.lastIndexOf('.')),file.substr(file.lastIndexOf('.'),file.length).toLowerCase()]
}
%>
<!DOCTYPE html>
<html>
<head>
<meta name="twitter:image" content="<%= host %>/uploads/<%= extension(url)[0] %>.gif">
<meta name="twitter:card" content="player"></meta>
<meta name="twitter:player" content="<%= host %>/uploads/<%= extension(url)[0] %>.mp4">
<meta name="twitter:player:width" content="<%= width %>"></meta>
<meta name="twitter:player:height" content="<%= height %>"></meta>
<meta name="twitter:player:stream" content="<%= host %>/uploads/<%= extension(url)[0] %>.mp4">
<meta name="twitter:player:stream:content_type" content="text/mp4"></meta>
<link rel="alternate" type="application/json+oembed" href="<%= host %>/uploads/oembed-<%= extension(url)[0] %>.json"></link>
<meta property="og:title" content="<%= extension(url)[0] %>.gif"></meta>
<meta property="og:url" content="<%= host %>/uploads/<%= extension(url)[0] %>.gif"></meta>
<meta property="og:description" content="Click to view the GIF"></meta>
<meta property="og:type" content="video.other"></meta>
<meta property="og:image" content="<%= host %>/uploads/<%= extension(url)[0] %>.gif"></meta>
<meta property="og:image:type" content="image/gif"></meta>
<meta property="og:image:width" content="<%= width %>"></meta>
<meta property="og:image:height" content="<%= height %>"></meta>
<meta property="og:video" content="<%= host %>/uploads/<%= extension(url)[0] %>.mp4"></meta>
<meta property="og:video:secure_url" content="<%= host %>/uploads/<%= extension(url)[0] %>.mp4"></meta>
<meta property="og:video:type" content="text/mp4"></meta>
<meta property="og:video:width" content="<%= width %>"></meta>
<meta property="og:video:height" content="<%= height %>"></meta>
</head>
<body>
<video autoplay loop muted playsinline class="image" width="100%"><source src="/uploads/<%= extension(url)[0] %>.mp4"></video>
</body>
</html>

View file

@ -49,7 +49,21 @@ return string.slice((string.lastIndexOf(".") - 2 >>> 0) + 2);
<form action="<%= file.url %>" method="post"> <form action="<%= file.url %>" method="post">
<div class="view"> <div class="view">
<% if (extension(file.path) == ".mp4" || extension(file.path) == ".mov" || extension(file.path) == "webp") { %> <% if (extension(file.path) == ".mp4" || extension(file.path) == ".mov" || extension(file.path) == "webp") { %>
<video autoplay loop muted playsinline class="image" src="/uploads/<%=file.path %>" width="100%" onclick="copyURI(event)"></video> <div class="video">
<video class="image" autoplay loop muted playsinline>
<source src="/uploads/<%= file.path %>">
</video>
<div class="overlay">
<a href="/gifv/<%=file.path %>" onclick="copyA(event)">Copy as GIFv</a>
</div>
</div>
<% } else if (extension(file.path) == ".gif") { %>
<div class="video">
<img class="image" src="/uploads/<%=file.path %>" width="100%" onclick="copyURI(event)">
<div class="overlay">
<a href="/gifv/<%=file.path %>" onclick="copyA(event)">Copy as GIFv</a>
</div>
</div>
<% } else if (extension(file.path) == ".jpg" || extension(file.path) == ".jpeg" || extension(file.path) == ".png" || extension(file.path) == ".gif" || extension(file.path) == ".webp" ) { %> <% } else if (extension(file.path) == ".jpg" || extension(file.path) == ".jpeg" || extension(file.path) == ".png" || extension(file.path) == ".gif" || extension(file.path) == ".webp" ) { %>
<img class="image" src="/uploads/<%=file.path %>" width="100%" onclick="copyURI(event)"> <img class="image" src="/uploads/<%=file.path %>" width="100%" onclick="copyURI(event)">
<% } else {%> <!-- non-media file --> <% } else {%> <!-- non-media file -->