]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/server-commands/server/config-command.ts
Fix client html cache on theme update
[github/Chocobozzz/PeerTube.git] / shared / server-commands / server / config-command.ts
index e47a0d34617ca0a5a2ea0d41f29d124c2d8ae090..1dd6e1ea4bda766180007841b5c0224305bb5d93 100644 (file)
@@ -123,6 +123,21 @@ export class ConfigCommand extends AbstractCommand {
     })
   }
 
+  async getIndexHTMLConfig (options: OverrideCommandOptions = {}) {
+    const text = await this.getRequestText({
+      ...options,
+
+      path: '/',
+      implicitToken: false,
+      defaultExpectedStatus: HttpStatusCode.OK_200
+    })
+
+    const match = text.match('<script type="application/javascript">window.PeerTubeServerConfig = (".+?")</script>')
+
+    // We parse the string twice, first to extract the string and then to extract the JSON
+    return JSON.parse(JSON.parse(match[1])) as ServerConfig
+  }
+
   getAbout (options: OverrideCommandOptions = {}) {
     const path = '/api/v1/config/about'