Skip to content

Node.js based forum software built for the modern web

feat: add isACP to config, closes #12623

Barış Soner Uşaklıc51b772fae76
diff --git a/public/openapi/read/config.yaml b/public/openapi/read/config.yaml
index ceb99c0d58..69520e29a3 100644
--- a/public/openapi/read/config.yaml
+++ b/public/openapi/read/config.yaml
@@ -94,6 +94,9 @@ get:
uid:
type: number
description: A user identifier
+ isACP:
+ type: boolean
+ description: true if admin page is being loaded, false otherwise
cache-buster:
type: string
topicPostSort:
diff --git a/src/controllers/api.js b/src/controllers/api.js
index 22574a9ce6..7c575b6070 100644
--- a/src/controllers/api.js
+++ b/src/controllers/api.js
@@ -67,6 +67,7 @@ apiController.loadConfig = async function (req) {
userLang: req.query.lang ? validator.escape(String(req.query.lang)) : (meta.config.defaultLang || 'en-GB'),
loggedIn: !!req.user,
uid: req.uid,
+ isACP: !!(req.res && req.res.locals && req.res.locals.renderAdminHeader),
'cache-buster': meta.config['cache-buster'] || '',
topicPostSort: meta.config.topicPostSort || 'oldest_to_newest',
categoryTopicSort: meta.config.categoryTopicSort || 'recently_replied',