toeverything / AFFiNE

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
https://affine.pro
Other
41.37k stars 2.69k forks source link

Hardcoded ​API_URL_MAPPING breaks OIDC on-premise install #8434

Closed amravyan closed 1 week ago

amravyan commented 2 weeks ago

What happened?

Hi! We are using an on-premise Affine setup with OIDC (local Keycloak instance) and noticed an issue: even after defining all the necessary environment variables, the "Continue with OIDC" button redirects to https://app.affine.pro/ (in stable version).

From what I can tell, this happens due to a hardcoded value in the API_URL_MAPPING:

https://github.com/toeverything/AFFiNE/blob/stable/packages/frontend/electron/src/main/config.ts#L26

const API_URL_MAPPING = {
  stable: `https://app.affine.pro`,
  beta: `https://insider.affine.pro`,
  canary: `https://affine.fail`,
  internal: `https://insider.affine.pro`,
};

Simplest workaround without patching source is to replace all the occurencies of affine.pro with our custom domain before staring the app

grep -rl app.affine.pro . | xargs sed -i "s/app.affine.pro/affine-stg.mydomain.com/g"

Could you please check it and replace hardcode to environment variables?

Distribution version

Linux

What browsers are you seeing the problem on if you're using web version?

Chrome

Are you self-hosting?

Relevant log output

No response

Anything else?

No response

affine-issue-bot[bot] commented 2 weeks ago

Issue Status: 🆕 *Untriaged

*🆕 Untriaged**

The team has not yet reviewed the issue. We usually do it within one business day. Docs: https://github.com/toeverything/AFFiNE/blob/canary/docs/issue-triaging.md

This is an automatic reply by the bot.

forehalo commented 1 week ago

what's the response of 'http://your.instance/info'

amravyan commented 1 week ago

@forehalo

{
  "compatibility": "0.17.2",
  "message": "AFFiNE 0.17.2 Server",
  "type": "selfhosted",
  "flavor": "allinone"
}
forehalo commented 1 week ago

fixed by #8448, please wait for the next release