mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 09:09:36 +02:00
Add Template Gallery support
This commit is contained in:
@@ -66,6 +66,11 @@ if (settings.filestore.stores.template_files) {
|
||||
keyBuilder.templateFileKeyMiddleware,
|
||||
fileController.insertFile
|
||||
)
|
||||
app.delete(
|
||||
'/template/:template_id/v/:version/:format',
|
||||
keyBuilder.templateFileKeyMiddleware,
|
||||
fileController.deleteFile
|
||||
)
|
||||
}
|
||||
|
||||
app.get(
|
||||
|
||||
@@ -6,7 +6,7 @@ import Errors from './Errors.js'
|
||||
|
||||
const { ConversionError } = Errors
|
||||
|
||||
const APPROVED_FORMATS = ['png']
|
||||
const APPROVED_FORMATS = ['png', 'jpg']
|
||||
const FOURTY_SECONDS = 40 * 1000
|
||||
const KILL_SIGNAL = 'SIGTERM'
|
||||
|
||||
|
||||
@@ -111,7 +111,9 @@ async function _getConvertedFileAndCache(bucket, key, convertedKey, opts) {
|
||||
let convertedFsPath
|
||||
try {
|
||||
convertedFsPath = await _convertFile(bucket, key, opts)
|
||||
await ImageOptimiser.promises.compressPng(convertedFsPath)
|
||||
if (convertedFsPath.toLowerCase().endsWith(".png")) {
|
||||
await ImageOptimiser.promises.compressPng(convertedFsPath)
|
||||
}
|
||||
await PersistorManager.sendFile(bucket, convertedKey, convertedFsPath)
|
||||
} catch (err) {
|
||||
LocalFileWriter.deleteFile(convertedFsPath, () => {})
|
||||
|
||||
Reference in New Issue
Block a user