@@ -23,14 +23,15 @@ const auth = require('../middleware/auth.js');
23
23
const config = require ( '../config' ) ;
24
24
const { app_name_exists, refresh_apps_cache, chkperm, convert_path_to_fsentry, get_app } = require ( '../helpers' ) ;
25
25
const { DB_WRITE , DB_READ } = require ( '../services/database/consts.js' ) ;
26
+ const subdomain = require ( '../middleware/subdomain.js' ) ;
26
27
27
28
// -----------------------------------------------------------------------//
28
29
// GET /apps
29
30
// -----------------------------------------------------------------------//
30
- router . get ( '/apps' , auth , express . json ( { limit : '50mb' } ) , async ( req , res , next ) => {
31
- // check subdomain
32
- if ( require ( '../helpers' ) . subdomain ( req ) !== 'api' )
33
- next ( ) ;
31
+ router . get ( '/apps' ,
32
+ subdomain ( 'api' ) ,
33
+ auth , express . json ( { limit : '50mb' } ) , async ( req , res , next ) => {
34
+ // /!\ open brace on end of previous line
34
35
35
36
// check if user is verified
36
37
if ( ( config . strict_email_verification_required || req . user . requires_email_confirmation ) && ! req . user . email_confirmed )
@@ -88,7 +89,11 @@ router.get('/apps', auth, express.json({limit: '50mb'}), async (req, res, next)=
88
89
// -----------------------------------------------------------------------//
89
90
// GET /apps/:name(s)
90
91
// -----------------------------------------------------------------------//
91
- router . get ( '/apps/:name' , auth , express . json ( { limit : '50mb' } ) , async ( req , res , next ) => {
92
+ router . get ( '/apps/:name' ,
93
+ subdomain ( 'api' ) ,
94
+ auth , express . json ( { limit : '50mb' } ) , async ( req , res , next ) => {
95
+ // /!\ open brace on end of previous line
96
+
92
97
// check subdomain
93
98
if ( require ( '../helpers' ) . subdomain ( req ) !== 'api' )
94
99
next ( ) ;
0 commit comments