diff options
author | Chocobozzz <me@florianbigard.com> | 2019-02-20 15:36:43 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-02-20 15:36:43 +0100 |
commit | f8802489bbc2c0363b5668e47de7c35f573342e1 (patch) | |
tree | 526054fad5a7f944b008ac1a6e400dfbe66a1639 /server/controllers/api | |
parent | 1aabcae7e36bb113c2887bd7180dad2916ecaaf2 (diff) | |
download | PeerTube-f8802489bbc2c0363b5668e47de7c35f573342e1.tar.gz PeerTube-f8802489bbc2c0363b5668e47de7c35f573342e1.tar.zst PeerTube-f8802489bbc2c0363b5668e47de7c35f573342e1.zip |
Add isNSFW instance configuration key
Diffstat (limited to 'server/controllers/api')
-rw-r--r-- | server/controllers/api/config.ts | 10 |
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 | ||
137 | function getAbout (req: express.Request, res: express.Response, next: express.NextFunction) { | 138 | function 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 | ||
150 | async function getCustomConfig (req: express.Request, res: express.Response, next: express.NextFunction) { | 151 | async 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 | ||
156 | async function deleteCustomConfig (req: express.Request, res: express.Response, next: express.NextFunction) { | 157 | async 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 | ||
169 | async function updateCustomConfig (req: express.Request, res: express.Response, next: express.NextFunction) { | 170 | async 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: { |