aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/config.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-02-20 15:36:43 +0100
committerChocobozzz <me@florianbigard.com>2019-02-20 15:36:43 +0100
commitf8802489bbc2c0363b5668e47de7c35f573342e1 (patch)
tree526054fad5a7f944b008ac1a6e400dfbe66a1639 /server/controllers/api/config.ts
parent1aabcae7e36bb113c2887bd7180dad2916ecaaf2 (diff)
downloadPeerTube-f8802489bbc2c0363b5668e47de7c35f573342e1.tar.gz
PeerTube-f8802489bbc2c0363b5668e47de7c35f573342e1.tar.zst
PeerTube-f8802489bbc2c0363b5668e47de7c35f573342e1.zip
Add isNSFW instance configuration key
Diffstat (limited to 'server/controllers/api/config.ts')
-rw-r--r--server/controllers/api/config.ts10
1 files changed, 6 insertions, 4 deletions
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts
index 1f3341bc0..6497cda3c 100644
--- a/server/controllers/api/config.ts
+++ b/server/controllers/api/config.ts
@@ -58,6 +58,7 @@ async function getConfig (req: express.Request, res: express.Response) {
58 name: CONFIG.INSTANCE.NAME, 58 name: CONFIG.INSTANCE.NAME,
59 shortDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION, 59 shortDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION,
60 defaultClientRoute: CONFIG.INSTANCE.DEFAULT_CLIENT_ROUTE, 60 defaultClientRoute: CONFIG.INSTANCE.DEFAULT_CLIENT_ROUTE,
61 isNSFW: CONFIG.INSTANCE.IS_NSFW,
61 defaultNSFWPolicy: CONFIG.INSTANCE.DEFAULT_NSFW_POLICY, 62 defaultNSFWPolicy: CONFIG.INSTANCE.DEFAULT_NSFW_POLICY,
62 customizations: { 63 customizations: {
63 javascript: CONFIG.INSTANCE.CUSTOMIZATIONS.JAVASCRIPT, 64 javascript: CONFIG.INSTANCE.CUSTOMIZATIONS.JAVASCRIPT,
@@ -134,7 +135,7 @@ async function getConfig (req: express.Request, res: express.Response) {
134 return res.json(json) 135 return res.json(json)
135} 136}
136 137
137function getAbout (req: express.Request, res: express.Response, next: express.NextFunction) { 138function getAbout (req: express.Request, res: express.Response) {
138 const about: About = { 139 const about: About = {
139 instance: { 140 instance: {
140 name: CONFIG.INSTANCE.NAME, 141 name: CONFIG.INSTANCE.NAME,
@@ -147,13 +148,13 @@ function getAbout (req: express.Request, res: express.Response, next: express.Ne
147 return res.json(about).end() 148 return res.json(about).end()
148} 149}
149 150
150async function getCustomConfig (req: express.Request, res: express.Response, next: express.NextFunction) { 151async function getCustomConfig (req: express.Request, res: express.Response) {
151 const data = customConfig() 152 const data = customConfig()
152 153
153 return res.json(data).end() 154 return res.json(data).end()
154} 155}
155 156
156async function deleteCustomConfig (req: express.Request, res: express.Response, next: express.NextFunction) { 157async function deleteCustomConfig (req: express.Request, res: express.Response) {
157 await remove(CONFIG.CUSTOM_FILE) 158 await remove(CONFIG.CUSTOM_FILE)
158 159
159 auditLogger.delete(getAuditIdFromRes(res), new CustomConfigAuditView(customConfig())) 160 auditLogger.delete(getAuditIdFromRes(res), new CustomConfigAuditView(customConfig()))
@@ -166,7 +167,7 @@ async function deleteCustomConfig (req: express.Request, res: express.Response,
166 return res.json(data).end() 167 return res.json(data).end()
167} 168}
168 169
169async function updateCustomConfig (req: express.Request, res: express.Response, next: express.NextFunction) { 170async function updateCustomConfig (req: express.Request, res: express.Response) {
170 const oldCustomConfigAuditKeys = new CustomConfigAuditView(customConfig()) 171 const oldCustomConfigAuditKeys = new CustomConfigAuditView(customConfig())
171 172
172 // camelCase to snake_case key + Force number conversion 173 // camelCase to snake_case key + Force number conversion
@@ -203,6 +204,7 @@ function customConfig (): CustomConfig {
203 shortDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION, 204 shortDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION,
204 description: CONFIG.INSTANCE.DESCRIPTION, 205 description: CONFIG.INSTANCE.DESCRIPTION,
205 terms: CONFIG.INSTANCE.TERMS, 206 terms: CONFIG.INSTANCE.TERMS,
207 isNSFW: CONFIG.INSTANCE.IS_NSFW,
206 defaultClientRoute: CONFIG.INSTANCE.DEFAULT_CLIENT_ROUTE, 208 defaultClientRoute: CONFIG.INSTANCE.DEFAULT_CLIENT_ROUTE,
207 defaultNSFWPolicy: CONFIG.INSTANCE.DEFAULT_NSFW_POLICY, 209 defaultNSFWPolicy: CONFIG.INSTANCE.DEFAULT_NSFW_POLICY,
208 customizations: { 210 customizations: {