Accept json body or formdata in app install route

This commit is contained in:
Johannes Zellner
2026-01-26 19:53:50 +01:00
parent 713774c03f
commit 280f628746
2 changed files with 7 additions and 6 deletions
+4 -3
View File
@@ -41,7 +41,8 @@ async function initializeExpressSync() {
const REQUEST_TIMEOUT = 60000; // timeout for all requests (see also setTimeout on the httpServer)
const json = middleware.json({ strict: true, limit: QUERY_LIMIT }); // forces json content-type
const json = middleware.json({ strict: true, limit: QUERY_LIMIT }, true); // forces json content-type
const jsonOptional = middleware.json({ strict: true, limit: QUERY_LIMIT }, false);
app.set('json spaces', 2); // pretty json
app.enable('trust proxy'); // trust the X-Forwarded-* headers
@@ -264,8 +265,8 @@ async function initializeExpressSync() {
router.get ('/api/v1/appstore/apps/:appstoreId/versions/:versionId', token, authorizeAdmin, routes.appstore.getAppVersion);
// app routes
router.post('/api/v1/apps/install', json, token, authorizeAdmin, routes.apps.install); // DEPRECATED from 8.1 on in favor of route below
router.post('/api/v1/apps', json, token, authorizeAdmin, routes.apps.install);
router.post('/api/v1/apps/install', jsonOptional, token, multipart,authorizeAdmin, routes.apps.install); // DEPRECATED from 8.1 on in favor of route below
router.post('/api/v1/apps', jsonOptional, token, multipart,authorizeAdmin, routes.apps.install);
router.get ('/api/v1/apps', token, authorizeUser, routes.apps.listByUser);
router.get ('/api/v1/apps/:id', token, routes.apps.load, authorizeOperator, routes.apps.getApp);
router.get ('/api/v1/apps/:id/icon', routes.apps.load, routes.apps.getAppIcon);