Skip to content

Commit 7aea5e7

Browse files
syt-honeyhyrious
andauthored
feat(project): add sg support (#1991)
* refactor(project): add sg support * fix(flat-stores): fix config update error * fix(project): fix vite build error * fix: handle favicon in build mode * add region configs task on init * refactor(assets): update cover svg --------- Co-authored-by: hyrious <hyrious@outlook.com>
1 parent 59c5fb7 commit 7aea5e7

File tree

39 files changed

+138
-570
lines changed

39 files changed

+138
-570
lines changed

config/CN/.env.development

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ WECHAT_APP_ID=wx1133c2153a45e9b8
55
AGORA_OAUTH_CLIENT_ID=flat-dev
66
GOOGLE_OAUTH_CLIENT_ID=273996094508-p97og69ojac5ja0khn1rvmi3tb7vgfgm.apps.googleusercontent.com
77

8-
CLOUD_STORAGE_OSS_ALIBABA_ACCESS_KEY=LTAI5tD4WSVBxAyfwVoaKTWr
9-
CLOUD_STORAGE_OSS_ALIBABA_BUCKET=flat-storage
10-
CLOUD_STORAGE_OSS_ALIBABA_REGION=oss-cn-hangzhou
11-
12-
CLOUD_STORAGE_DOMAIN=https://flat-storage-[region].whiteboard.agora.io
13-
148
FLAT_SERVER_DOMAIN=flat-api-dev.whiteboard.agora.io
159
UPDATE_DOMAIN=https://flat-storage.oss-cn-hangzhou.aliyuncs.com/versions
1610
FLAT_WEB_DOMAIN=flat-web-dev.whiteboard.agora.io

config/CN/.env.production

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ WECHAT_APP_ID=wx96d522d69d384cce
55
AGORA_OAUTH_CLIENT_ID=flat
66
GOOGLE_OAUTH_CLIENT_ID=273996094508-2rpraucen77a1o5dul5ftrua5k3og157.apps.googleusercontent.com
77

8-
CLOUD_STORAGE_OSS_ALIBABA_ACCESS_KEY=LTAI5tMwHQ1xyroeneA9XLh4
9-
CLOUD_STORAGE_OSS_ALIBABA_BUCKET=flat-storage
10-
CLOUD_STORAGE_OSS_ALIBABA_REGION=oss-cn-hangzhou
11-
12-
CLOUD_STORAGE_DOMAIN=https://flat-storage-[region].whiteboard.agora.io
13-
148
FLAT_SERVER_DOMAIN=flat-api.whiteboard.agora.io
159
UPDATE_DOMAIN=https://flat-storage.oss-cn-hangzhou.aliyuncs.com/versions
1610
FLAT_WEB_DOMAIN=flat-web.whiteboard.agora.io

config/US/.env.development

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ WECHAT_APP_ID=wx1133c2153a45e9b8
55
AGORA_OAUTH_CLIENT_ID=flat-dev
66
GOOGLE_OAUTH_CLIENT_ID=273996094508-p97og69ojac5ja0khn1rvmi3tb7vgfgm.apps.googleusercontent.com
77

8-
CLOUD_STORAGE_OSS_ALIBABA_ACCESS_KEY=LTAI5tD4WSVBxAyfwVoaKTWr
9-
CLOUD_STORAGE_OSS_ALIBABA_BUCKET=flat-storage
10-
CLOUD_STORAGE_OSS_ALIBABA_REGION=oss-cn-hangzhou
11-
12-
CLOUD_STORAGE_DOMAIN=https://flat-storage-[region].whiteboard.agora.io
13-
148
FLAT_SERVER_DOMAIN=api-dev.flat.agora.io
159
UPDATE_DOMAIN=https://flat-storage-us-sv.oss-us-west-1.aliyuncs.com/versions
1610
FLAT_WEB_DOMAIN=web-dev.flat.agora.io

config/US/.env.production

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ WECHAT_APP_ID=wx96d522d69d384cce
55
AGORA_OAUTH_CLIENT_ID=flat
66
GOOGLE_OAUTH_CLIENT_ID=273996094508-2rpraucen77a1o5dul5ftrua5k3og157.apps.googleusercontent.com
77

8-
CLOUD_STORAGE_OSS_ALIBABA_ACCESS_KEY=LTAI5tMwHQ1xyroeneA9XLh4
9-
CLOUD_STORAGE_OSS_ALIBABA_BUCKET=flat-storage
10-
CLOUD_STORAGE_OSS_ALIBABA_REGION=oss-cn-hangzhou
11-
12-
CLOUD_STORAGE_DOMAIN=https://flat-storage-[region].whiteboard.agora.io
13-
148
FLAT_SERVER_DOMAIN=api.flat.agora.io
159
UPDATE_DOMAIN=https://flat-storage-us-sv.oss-us-west-1.aliyuncs.com/versions
1610
FLAT_WEB_DOMAIN=web.flat.agora.io

cspell.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ module.exports = {
1919
"quickstart",
2020
"signup",
2121
"dataurl",
22+
"CNSVG",
23+
"ENSVG",
2224

2325
// appstore
2426
"flatmacrelease",

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@ export const NETLESS = Object.freeze({
44
APP_IDENTIFIER: process.env.NETLESS_APP_IDENTIFIER,
55
});
66

7-
export const CLOUD_STORAGE_OSS_ALIBABA_CONFIG = Object.freeze({
8-
accessKey: process.env.CLOUD_STORAGE_OSS_ALIBABA_ACCESS_KEY,
9-
bucket: process.env.CLOUD_STORAGE_OSS_ALIBABA_BUCKET,
10-
region: process.env.CLOUD_STORAGE_OSS_ALIBABA_REGION,
11-
});
12-
13-
export const CLOUD_STORAGE_DOMAIN = process.env.CLOUD_STORAGE_DOMAIN;
14-
157
export const AGORA = Object.freeze({
168
APP_ID: process.env.AGORA_APP_ID,
179
});

desktop/renderer-app/src/tasks/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@ import { initWhiteSDK } from "./init-white-sdk";
33
import { initUI } from "./init-ui";
44
import { initURLProtocol } from "./init-url-protocol";
55
import { initFlatServices } from "./init-flat-services";
6+
import { initRegionConfigs } from "./init-region-configs";
67

7-
const tasks = [initEnv, initURLProtocol, initFlatServices, initWhiteSDK, initUI];
8+
const tasks: Array<() => void | Promise<void>> = [
9+
initEnv,
10+
initURLProtocol,
11+
initRegionConfigs,
12+
initFlatServices,
13+
initWhiteSDK,
14+
initUI,
15+
];
816

917
export default tasks;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { getServerRegionConfigs } from "@netless/flat-server-api";
2+
import { globalStore } from "@netless/flat-stores";
3+
import { errorTips } from "flat-components";
4+
5+
export const initRegionConfigs = async (): Promise<void> => {
6+
try {
7+
const regionConfigs = await getServerRegionConfigs();
8+
if (regionConfigs.hash !== globalStore.configHash) {
9+
globalStore.updateServerRegionConfig(regionConfigs);
10+
}
11+
} catch (error) {
12+
globalStore.updateServerRegionConfig(null);
13+
console.error(error);
14+
errorTips(error as Error);
15+
throw error; // Break the whole page
16+
}
17+
};

desktop/renderer-app/typings/global.d.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ declare namespace NodeJS {
1616
NODE_ENV: "development" | "production";
1717
NETLESS_APP_IDENTIFIER: string;
1818

19-
CLOUD_STORAGE_OSS_ALIBABA_ACCESS_KEY: string;
20-
CLOUD_STORAGE_OSS_ALIBABA_BUCKET: string;
21-
CLOUD_STORAGE_OSS_ALIBABA_REGION: string;
22-
23-
CLOUD_STORAGE_DOMAIN: string;
24-
2519
AGORA_APP_ID: string;
2620

2721
GITHUB_CLIENT_ID: string;

docs/env/README-zh.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
| ------------------------------------ | -------------------------------------------------- | ---------------------------------------------------------------- |
55
| NETLESS_APP_IDENTIFIER | 互动白板 Access Key | 见: [在 app 服务端生成 Token][netless-auth] |
66
| AGORA_APP_ID | Agora 声网 App ID | 用于 RTC 与 RTM。见: [校验用户权限][agora-app-id-auth] |
7-
| CLOUD_STORAGE_OSS_ALIBABA_ACCESS_KEY | Agora 云端录制 OSS 配置 | 用于云端录制存储用户音视频。见: [云存储设置][cloud-recording] |
8-
| CLOUD_STORAGE_OSS_ALIBABA_BUCKET | Agora 云端录制 OSS 配置 | 同上 |
9-
| CLOUD_STORAGE_OSS_ALIBABA_REGION | Agora 云端录制 OSS 配置 | 同上 |
107
| CLOUD_RECORDING_DEFAULT_AVATAR | Agora 云端录制用户默认背景图 URL | 见:[设置背景色或背景图][cloud-recording-background] |
118
| WECHAT_APP_ID | [微信开放平台][open-wechat] App ID |`网站应用``AppID` |
129
| FLAT_SERVER_DOMAIN | Flat Server 部署的域名地址 | 如: `flat-api.whiteboard.agora.io` |

docs/env/README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
| ------------------------------------ | -------------------------------------------------------- | ----------------------------------------------------------------------------------- |
55
| NETLESS_APP_IDENTIFIER | Whiteboard Access Key | See [Projects and permissions][netless-auth] |
66
| AGORA_APP_ID | Agora App ID | For RTC and RTM. See [Use an App ID for authentication][agora-app-id-auth] |
7-
| CLOUD_STORAGE_OSS_ALIBABA_ACCESS_KEY | Agora Cloud Recording OSS | For storing RTC Cloud Recording media files. See [Cloud Recording][cloud-recording] |
8-
| CLOUD_STORAGE_OSS_ALIBABA_BUCKET | Agora Cloud Recording OSS | As above |
9-
| CLOUD_STORAGE_OSS_ALIBABA_REGION | Agora Cloud Recording OSS | As above |
107
| CLOUD_RECORDING_DEFAULT_AVATAR | Agora Cloud Recording default user avatar URL | See: [Set the background color or background image][cloud-recording-background] |
118
| WECHAT_APP_ID | [Wechat Open Platform][open-wechat] App ID | |
129
| FLAT_SERVER_DOMAIN | Flat Server deployed address | e.g. `flat-api.whiteboard.agora.io` |

packages/flat-components/src/components/EditRoomPage/EditRoomBody/index.tsx

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import gbSVG from "./icons/gb.svg";
55
import usSVG from "./icons/us.svg";
66
import sgSVG from "./icons/sg.svg";
77

8-
import { Button, Checkbox, Dropdown, Form, Input, Menu, Modal } from "antd";
8+
import { Button, Checkbox, Form, Input, Modal } from "antd";
99
import { CheckboxChangeEvent } from "antd/lib/checkbox";
1010
import { addWeeks, endOfDay, getDay } from "date-fns";
1111
import React, { useMemo, useRef, useState } from "react";
@@ -16,7 +16,6 @@ import { renderBeginTimePicker } from "./renderBeginTimePicker";
1616
import { renderEndTimePicker } from "./renderEndTimePicker";
1717
import { renderPeriodicForm } from "./renderPeriodicForm";
1818
import { ClassPicker } from "../../HomePage/ClassPicker";
19-
import { Fragment } from "react";
2019

2120
export enum Region {
2221
CN_HZ = "cn-hz",
@@ -84,7 +83,10 @@ export const EditRoomBody: React.FC<EditRoomBodyProps> = ({
8483

8584
const [isFormVetted, setIsFormVetted] = useState(true);
8685
const [isShowEditSubmitConfirm, showEditSubmitConfirm] = useState(false);
87-
const [region, setRegion] = useState<Region>(initialValues.region);
86+
87+
// @TODO: need to remove
88+
const [region] = useState<Region>(initialValues.region);
89+
8890
const t = useTranslate();
8991
const language = useLanguage();
9092

@@ -103,25 +105,6 @@ export const EditRoomBody: React.FC<EditRoomBodyProps> = ({
103105
...initialValues,
104106
};
105107
}, [initialValues]);
106-
107-
const regionMenu = (
108-
<Menu
109-
className="edit-room-body-menu-item"
110-
items={regions.map(region => ({
111-
key: region,
112-
label: (
113-
<Fragment>
114-
<img alt={region} src={RegionSVG[region]} style={{ width: 22 }} />
115-
<span style={{ paddingLeft: 8 }}>{t(`region-${region}`)}</span>
116-
</Fragment>
117-
),
118-
}))}
119-
prefix="hello"
120-
style={{ width: "auto" }}
121-
onClick={e => setRegion(e.key as Region)}
122-
/>
123-
);
124-
125108
return (
126109
<>
127110
<div className="edit-room-body fancy-scrollbar">
@@ -163,19 +146,6 @@ export const EditRoomBody: React.FC<EditRoomBodyProps> = ({
163146
}}
164147
disabled={type === "periodicSub"}
165148
placeholder={t("enter-room-theme")}
166-
suffix={
167-
<Dropdown
168-
overlay={regionMenu}
169-
placement="bottomRight"
170-
trigger={["click"]}
171-
>
172-
<img
173-
alt={region}
174-
src={RegionSVG[region]}
175-
style={{ cursor: "pointer", width: 22, marginRight: 0 }}
176-
/>
177-
</Dropdown>
178-
}
179149
/>
180150
</Form.Item>
181151
<Form.Item label={t("type")} name="type">

0 commit comments

Comments
 (0)