Skip to content

Commit bc104b7

Browse files
authored
feat(web): add cross region user information authorize confirm (#2155)
* feat(web): add cross region user information authorize confirm * feat: modify CN service domain * feat: add agreement about collect privacy has changed
1 parent a7f8525 commit bc104b7

File tree

16 files changed

+263
-20
lines changed

16 files changed

+263
-20
lines changed

.github/workflows/deploy-web-dev-cn.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ jobs:
2929
cache: "pnpm"
3030

3131
- name: Install dependencies
32+
env:
33+
FLAT_AGREEMENT_URL: ${{ vars.FLAT_AGREEMENT_URL }}
3234
run: |
35+
echo "FLAT_AGREEMENT_URL=$FLAT_AGREEMENT_URL" >> config/CN/.env.development
3336
node ./scripts/ci/remove-workspace-packages.js web
3437
node ./scripts/ci/remove-package-scripts-hooks.js
3538
# failure automatically retries 3 times

.github/workflows/deploy-web-prod-cn.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ jobs:
2323
version: latest
2424

2525
- name: Install dependencies
26+
env:
27+
FLAT_AGREEMENT_URL: ${{ vars.FLAT_AGREEMENT_URL }}
2628
run: |
29+
echo "FLAT_AGREEMENT_URL=$FLAT_AGREEMENT_URL" >> config/CN/.env.production
2730
node ./scripts/ci/remove-workspace-packages.js web
2831
node ./scripts/ci/remove-package-scripts-hooks.js
2932
# failure automatically retries 3 times

config/CN/.env.development

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FLAT_SERVER_DOMAIN=flat-api-dev.whiteboard.agora.io
22
UPDATE_DOMAIN=https://flat-storage.oss-cn-hangzhou.aliyuncs.com/versions
33
FLAT_WEB_DOMAIN=flat-web-dev.whiteboard.agora.io
44

5-
FLAT_DOWNLOAD_URL=https://www.flat.shengwang.cn/#download
5+
FLAT_DOWNLOAD_URL=https://www.flat.apprtc.cn/#download
66
FEEDBACK_URL=https://www.yuque.com/leooel/ec1kmm/vmsolg
77

88
CLOUD_RECORDING_DEFAULT_AVATAR=https://flat-storage.oss-cn-hangzhou.aliyuncs.com/flat-resources/cloud-recording/default-avatar.jpg

config/CN/.env.production

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
FLAT_SERVER_DOMAIN=api.flat.shengwang.cn
1+
FLAT_SERVER_DOMAIN=api.flat.apprtc.cn
22
UPDATE_DOMAIN=https://flat-storage.oss-cn-hangzhou.aliyuncs.com/versions
3-
FLAT_WEB_DOMAIN=web.flat.shengwang.cn
3+
FLAT_WEB_DOMAIN=web.flat.apprtc.cn
44

5-
FLAT_DOWNLOAD_URL=https://www.flat.shengwang.cn/#download
5+
FLAT_DOWNLOAD_URL=https://www.flat.apprtc.cn/#download
66
FEEDBACK_URL=https://www.yuque.com/leooel/ec1kmm/vmsolg
77

88
CLOUD_RECORDING_DEFAULT_AVATAR=https://flat-storage.oss-cn-hangzhou.aliyuncs.com/flat-resources/cloud-recording/default-avatar.jpg

desktop/renderer-app/src/constants/process.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ export const FLAT_WEB_DOMAIN = process.env.FLAT_WEB_DOMAIN;
55

66
export const FLAT_WEB_BASE_URL = `https://${FLAT_WEB_DOMAIN}`;
77

8-
export const PRIVACY_URL_CN = "https://www.flat.shengwang.cn/privacy.html";
8+
export const PRIVACY_URL_CN = "https://www.flat.apprtc.cn/privacy.html";
99
export const PRIVACY_URL_EN = "https://flat.whiteboard.agora.io/en/privacy.html";
1010

11-
export const SERVICE_URL_CN = "https://www.flat.shengwang.cn/service.html";
11+
export const SERVICE_URL_CN = "https://www.flat.apprtc.cn/service.html";
1212
export const SERVICE_URL_EN = "https://flat.whiteboard.agora.io/en/service.html";

packages/flat-components/src/components/LoginPage/LoginWithCode/index.tsx

Lines changed: 66 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { LoginAccount, PasswordLoginType, defaultCountryCode } from "../LoginAcc
1414
import { LoginSendCode } from "../LoginSendCode";
1515
import { phoneValidator } from "../LoginWithPassword/validators";
1616
import { codeValidator } from "./validators";
17+
import { FLAT_AGREEMENT_URL } from "@netless/flat-server-api/src/constants";
1718
export * from "../LoginButtons";
1819
export * from "./validators";
1920

@@ -197,7 +198,15 @@ export const LoginWithCode: React.FC<LoginWithCodeProps> = ({
197198
checked={agreed}
198199
privacyURL={privacyURL}
199200
serviceURL={serviceURL}
200-
onChange={setAgreed}
201+
onChange={checked => {
202+
if (checked) {
203+
requestAgreement({ t, privacyURL, serviceURL }).then(agreed => {
204+
setAgreed(agreed);
205+
});
206+
} else {
207+
setAgreed(false);
208+
}
209+
}}
201210
/>
202211
<Button
203212
className="login-big-button"
@@ -223,12 +232,65 @@ export interface RequestAgreementParams {
223232
serviceURL?: string;
224233
t: FlatI18nTFunction;
225234
}
226-
227-
export function requestAgreement({
235+
export interface PrivacyAgreementData {
236+
title: string;
237+
content: string;
238+
}
239+
export async function getPrivacy(props: {
240+
privacyURL: string;
241+
serviceURL: string;
242+
}): Promise<PrivacyAgreementData | undefined> {
243+
const { privacyURL, serviceURL } = props;
244+
if (FLAT_AGREEMENT_URL) {
245+
const data = await fetch(FLAT_AGREEMENT_URL).then(response => {
246+
return response.json();
247+
});
248+
if (data.content) {
249+
data.content = data.content
250+
.replace(/{{serviceURL}}/g, serviceURL)
251+
.replace(/{{privacyURL}}/g, privacyURL);
252+
}
253+
return data;
254+
}
255+
return undefined;
256+
}
257+
export async function requestAgreement({
228258
t,
229259
privacyURL,
230260
serviceURL,
231261
}: RequestAgreementParams): Promise<boolean> {
262+
if (privacyURL && serviceURL) {
263+
const data = await getPrivacy({ privacyURL, serviceURL });
264+
if (data) {
265+
return await new Promise<boolean>(resolve => {
266+
Modal.confirm({
267+
title: (
268+
<div
269+
style={{
270+
borderBottom: "1px solid #EEEEEE",
271+
textAlign: "center",
272+
lineHeight: "30px",
273+
}}
274+
>
275+
{data.title}
276+
</div>
277+
),
278+
icon: null,
279+
content: (
280+
<div
281+
dangerouslySetInnerHTML={{
282+
__html: data.content,
283+
}}
284+
></div>
285+
),
286+
okText: t("cross-region-auth.agree"),
287+
cancelText: t("cross-region-auth.disagree"),
288+
onOk: () => resolve(true),
289+
onCancel: () => resolve(false),
290+
});
291+
});
292+
}
293+
}
232294
return new Promise<boolean>(resolve =>
233295
Modal.confirm({
234296
content: (
@@ -243,6 +305,7 @@ export function requestAgreement({
243305
</a>
244306
</div>
245307
),
308+
icon: null,
246309
onOk: () => resolve(true),
247310
onCancel: () => resolve(false),
248311
}),

packages/flat-components/src/components/LoginPage/LoginWithPassword/index.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,15 @@ export const LoginWithPassword: React.FC<LoginWithPasswordProps> = ({
268268
checked={agreed}
269269
privacyURL={privacyURL}
270270
serviceURL={serviceURL}
271-
onChange={setAgreed}
271+
onChange={checked => {
272+
if (checked) {
273+
requestAgreement({ t, privacyURL, serviceURL }).then(agreed => {
274+
setAgreed(agreed);
275+
});
276+
} else {
277+
setAgreed(false);
278+
}
279+
}}
272280
/>
273281

274282
<Button

packages/flat-components/src/components/RegisterModal/index.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,15 @@ export const RegisterModal: React.FC<RegisterProps> = ({
194194
checked={agreed}
195195
privacyURL={privacyURL}
196196
serviceURL={serviceURL}
197-
onChange={setAgreed}
197+
onChange={checked => {
198+
if (checked) {
199+
requestAgreement({ t, privacyURL, serviceURL }).then(agreed => {
200+
setAgreed(agreed);
201+
});
202+
} else {
203+
setAgreed(false);
204+
}
205+
}}
198206
/>
199207

200208
<Button

packages/flat-components/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ export * from "./components/Pmi";
3535
export * from "./containers/CloudStorageContainer";
3636
export * from "./theme/antd.mod";
3737

38-
export { message } from "antd";
38+
export { message, Modal } from "antd";

packages/flat-i18n/locales/en.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,5 +766,16 @@
766766
"drop-to-board": "Drop file to whiteboard",
767767
"mirror": "Mirror",
768768
"mirror-mode": "Mirror Mode",
769-
"edit-success": "Updated successfully"
769+
"edit-success": "Updated successfully",
770+
"cross-region-auth": {
771+
"title":"Cross-border data exit authorization",
772+
"desc":"Please note that you are joining a room created by Agora Flat Overseas users. We will strictly comply with applicable laws and regulations to conduct data exit security assessment, and adopt reasonable physical isolation and security protection measures to ensure that your data is only used under your authorization. See the {{serviceAgreement}} and {{privacyPolicy}} for details",
773+
"serviceAgreement": "service agreement",
774+
"privacyPolicy": "Privacy Policy",
775+
"agree": "agree",
776+
"disagree": "disagree"
777+
},
778+
"collect-media-options": "Audio and video data acquisition",
779+
"collect-media-turn-on": "Turn on",
780+
"collect-media-turn-off": "Turn off"
770781
}

0 commit comments

Comments
 (0)