fix: route IM clients through current origin
Deploy im-webapp production / deploy (push) Successful in 1m35s

This commit is contained in:
Your Name
2026-10-19 17:23:34 +08:00
parent b0d1199fb6
commit df173879fa
9 changed files with 116 additions and 18 deletions
+9 -4
View File
@@ -38,9 +38,12 @@ class DeployWorkflowContractTest(unittest.TestCase):
self.assertNotIn("KUBECONFIG", self.workflow)
self.assertNotIn("git.118im.com", self.workflow)
def test_uses_production_im_endpoint(self):
self.assertIn('TINODE_API_BASE="https://im-api.yuexuan.shop/v1/im"', self.workflow)
self.assertIn('TINODE_FILE_BASE="https://im-api.yuexuan.shop/v0/file"', self.workflow)
def test_uses_same_origin_im_endpoints(self):
self.assertNotIn("TINODE_API_BASE=", self.workflow)
self.assertNotIn("TINODE_FILE_BASE=", self.workflow)
self.assertNotIn("im-api.yuexuan.shop", self.workflow)
self.assertIn("ARG TINODE_FILE_BASE=", self.dockerfile)
self.assertNotIn("api.118im.com", self.dockerfile)
def test_build_exposes_configured_api_base_to_vite(self):
self.assertIn("ARG TINODE_API_BASE=", self.dockerfile)
@@ -50,9 +53,11 @@ class DeployWorkflowContractTest(unittest.TestCase):
self.assertIn('TINODE_API_KEY="${TINODE_API_KEY#\\\'}"', self.workflow)
self.assertIn('TINODE_API_KEY="${TINODE_API_KEY%\\\'}"', self.workflow)
def test_api_client_prefers_the_configured_production_origin(self):
def test_api_client_keeps_same_origin_defaults(self):
self.assertIn("import.meta.env.VITE_TINODE_API_BASE?.trim()", self.api_client)
self.assertIn("CONFIGURED_API_BASE || endpoints?.api || DEFAULT_API_BASE", self.api_client)
self.assertIn("const DEFAULT_API_BASE = '/v1/im'", self.api_client)
self.assertIn("const DEFAULT_FILE_BASE = '/v0/file'", self.api_client)
if __name__ == "__main__":
unittest.main()