import { ClientHtml } from '../../lib/client-html'
import { auditLoggerFactory, CustomConfigAuditView, getAuditIdFromRes } from '../../helpers/audit-logger'
import { remove, writeJSON } from 'fs-extra'
-import { getVersion } from '../../helpers/utils'
+import { getServerCommit } from '../../helpers/utils'
+import { Emailer } from '../../lib/emailer'
const packageJSON = require('../../../../package.json')
const configRouter = express.Router()
)
let serverCommit: string
-async function getConfig (req: express.Request, res: express.Response, next: express.NextFunction) {
+async function getConfig (req: express.Request, res: express.Response) {
const allowed = await isSignupAllowed()
const allowedForCurrentIP = isSignupAllowedForCurrentIP(req.ip)
- serverCommit = (serverCommit) ? serverCommit : getVersion()
- if (serverCommit === packageJSON.version) serverCommit = ''
+
+ if (serverCommit === undefined) serverCommit = await getServerCommit()
const enabledResolutions = Object.keys(CONFIG.TRANSCODING.RESOLUTIONS)
.filter(key => CONFIG.TRANSCODING.ENABLED === CONFIG.TRANSCODING.RESOLUTIONS[key] === true)
css: CONFIG.INSTANCE.CUSTOMIZATIONS.CSS
}
},
+ email: {
+ enabled: Emailer.Instance.isEnabled()
+ },
serverVersion: packageJSON.version,
serverCommit,
signup: {
'instance.defaultClientRoute',
'instance.shortDescription',
'cache.videoCaptions',
- 'signup.requiresEmailVerification'
+ 'signup.requiresEmailVerification',
+ 'transcoding.allowAdditionalExtensions'
)
toUpdateJSON.user['video_quota'] = toUpdate.user.videoQuota
toUpdateJSON.user['video_quota_daily'] = toUpdate.user.videoQuotaDaily
toUpdateJSON.instance['short_description'] = toUpdate.instance.shortDescription
toUpdateJSON.instance['default_nsfw_policy'] = toUpdate.instance.defaultNSFWPolicy
toUpdateJSON.signup['requires_email_verification'] = toUpdate.signup.requiresEmailVerification
+ toUpdateJSON.transcoding['allow_additional_extensions'] = toUpdate.transcoding.allowAdditionalExtensions
await writeJSON(CONFIG.CUSTOM_FILE, toUpdateJSON, { spaces: 2 })
},
transcoding: {
enabled: CONFIG.TRANSCODING.ENABLED,
+ allowAdditionalExtensions: CONFIG.TRANSCODING.ALLOW_ADDITIONAL_EXTENSIONS,
threads: CONFIG.TRANSCODING.THREADS,
resolutions: {
'240p': CONFIG.TRANSCODING.RESOLUTIONS[ '240p' ],