frontend icon indicating copy to clipboard operation
frontend copied to clipboard

bug: Web client should get configuration from API

Open Docteh opened this issue 8 months ago • 0 comments

What happened?

Bug/Feature, not sure. But if the web client grabs the configuration from the API, then only the API url needs to be specified. Something like this, but like properly done with error checking or something.

diff --git a/packages/client/components/client/Controller.ts b/packages/client/components/client/Controller.ts
index 683be61..7eef216 100644
--- a/packages/client/components/client/Controller.ts
+++ b/packages/client/components/client/Controller.ts
@@ -110,6 +110,10 @@ class Lifecycle {
       debug: import.meta.env.DEV,
     });

+(async () => {
+    this.client.configuration = await this.client.api.get("/");
+})();
+/*
     this.client.configuration = {
       revolt: String(),
       app: String(),
@@ -131,6 +135,7 @@ class Lifecycle {
       vapid: String(),
       ws: CONFIGURATION.DEFAULT_WS_URL,
     };
+    */

     this.client.events.on("state", this.onState);
     this.client.on("ready", this.onReady);

Mostly useful for testing/self-hosted

Also I guess this URL is outdated https://github.com/revoltchat/frontend/blob/39018e732ee7241072f0fed9dba5a1b98007de0e/packages/client/components/common/lib/env.ts#L36

The api indicates it should be https://cdn.revoltusercontent.com

Docteh avatar May 04 '25 05:05 Docteh