Skip to content

Commit

Permalink
feat(project): add sg support (#1991)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
syt-honey and hyrious authored Aug 10, 2023
1 parent 59c5fb7 commit 7aea5e7
Show file tree
Hide file tree
Showing 39 changed files with 138 additions and 570 deletions.
6 changes: 0 additions & 6 deletions config/CN/.env.development
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ WECHAT_APP_ID=wx1133c2153a45e9b8
AGORA_OAUTH_CLIENT_ID=flat-dev
GOOGLE_OAUTH_CLIENT_ID=273996094508-p97og69ojac5ja0khn1rvmi3tb7vgfgm.apps.googleusercontent.com

CLOUD_STORAGE_OSS_ALIBABA_ACCESS_KEY=LTAI5tD4WSVBxAyfwVoaKTWr
CLOUD_STORAGE_OSS_ALIBABA_BUCKET=flat-storage
CLOUD_STORAGE_OSS_ALIBABA_REGION=oss-cn-hangzhou

CLOUD_STORAGE_DOMAIN=https://flat-storage-[region].whiteboard.agora.io

FLAT_SERVER_DOMAIN=flat-api-dev.whiteboard.agora.io
UPDATE_DOMAIN=https://flat-storage.oss-cn-hangzhou.aliyuncs.com/versions
FLAT_WEB_DOMAIN=flat-web-dev.whiteboard.agora.io
Expand Down
6 changes: 0 additions & 6 deletions config/CN/.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ WECHAT_APP_ID=wx96d522d69d384cce
AGORA_OAUTH_CLIENT_ID=flat
GOOGLE_OAUTH_CLIENT_ID=273996094508-2rpraucen77a1o5dul5ftrua5k3og157.apps.googleusercontent.com

CLOUD_STORAGE_OSS_ALIBABA_ACCESS_KEY=LTAI5tMwHQ1xyroeneA9XLh4
CLOUD_STORAGE_OSS_ALIBABA_BUCKET=flat-storage
CLOUD_STORAGE_OSS_ALIBABA_REGION=oss-cn-hangzhou

CLOUD_STORAGE_DOMAIN=https://flat-storage-[region].whiteboard.agora.io

FLAT_SERVER_DOMAIN=flat-api.whiteboard.agora.io
UPDATE_DOMAIN=https://flat-storage.oss-cn-hangzhou.aliyuncs.com/versions
FLAT_WEB_DOMAIN=flat-web.whiteboard.agora.io
Expand Down
6 changes: 0 additions & 6 deletions config/US/.env.development
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ WECHAT_APP_ID=wx1133c2153a45e9b8
AGORA_OAUTH_CLIENT_ID=flat-dev
GOOGLE_OAUTH_CLIENT_ID=273996094508-p97og69ojac5ja0khn1rvmi3tb7vgfgm.apps.googleusercontent.com

CLOUD_STORAGE_OSS_ALIBABA_ACCESS_KEY=LTAI5tD4WSVBxAyfwVoaKTWr
CLOUD_STORAGE_OSS_ALIBABA_BUCKET=flat-storage
CLOUD_STORAGE_OSS_ALIBABA_REGION=oss-cn-hangzhou

CLOUD_STORAGE_DOMAIN=https://flat-storage-[region].whiteboard.agora.io

FLAT_SERVER_DOMAIN=api-dev.flat.agora.io
UPDATE_DOMAIN=https://flat-storage-us-sv.oss-us-west-1.aliyuncs.com/versions
FLAT_WEB_DOMAIN=web-dev.flat.agora.io
Expand Down
6 changes: 0 additions & 6 deletions config/US/.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ WECHAT_APP_ID=wx96d522d69d384cce
AGORA_OAUTH_CLIENT_ID=flat
GOOGLE_OAUTH_CLIENT_ID=273996094508-2rpraucen77a1o5dul5ftrua5k3og157.apps.googleusercontent.com

CLOUD_STORAGE_OSS_ALIBABA_ACCESS_KEY=LTAI5tMwHQ1xyroeneA9XLh4
CLOUD_STORAGE_OSS_ALIBABA_BUCKET=flat-storage
CLOUD_STORAGE_OSS_ALIBABA_REGION=oss-cn-hangzhou

CLOUD_STORAGE_DOMAIN=https://flat-storage-[region].whiteboard.agora.io

FLAT_SERVER_DOMAIN=api.flat.agora.io
UPDATE_DOMAIN=https://flat-storage-us-sv.oss-us-west-1.aliyuncs.com/versions
FLAT_WEB_DOMAIN=web.flat.agora.io
Expand Down
2 changes: 2 additions & 0 deletions cspell.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ module.exports = {
"quickstart",
"signup",
"dataurl",
"CNSVG",
"ENSVG",

// appstore
"flatmacrelease",
Expand Down
8 changes: 0 additions & 8 deletions desktop/renderer-app/src/constants/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@ export const NETLESS = Object.freeze({
APP_IDENTIFIER: process.env.NETLESS_APP_IDENTIFIER,
});

export const CLOUD_STORAGE_OSS_ALIBABA_CONFIG = Object.freeze({
accessKey: process.env.CLOUD_STORAGE_OSS_ALIBABA_ACCESS_KEY,
bucket: process.env.CLOUD_STORAGE_OSS_ALIBABA_BUCKET,
region: process.env.CLOUD_STORAGE_OSS_ALIBABA_REGION,
});

export const CLOUD_STORAGE_DOMAIN = process.env.CLOUD_STORAGE_DOMAIN;

export const AGORA = Object.freeze({
APP_ID: process.env.AGORA_APP_ID,
});
Expand Down
10 changes: 9 additions & 1 deletion desktop/renderer-app/src/tasks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ import { initWhiteSDK } from "./init-white-sdk";
import { initUI } from "./init-ui";
import { initURLProtocol } from "./init-url-protocol";
import { initFlatServices } from "./init-flat-services";
import { initRegionConfigs } from "./init-region-configs";

const tasks = [initEnv, initURLProtocol, initFlatServices, initWhiteSDK, initUI];
const tasks: Array<() => void | Promise<void>> = [
initEnv,
initURLProtocol,
initRegionConfigs,
initFlatServices,
initWhiteSDK,
initUI,
];

export default tasks;
17 changes: 17 additions & 0 deletions desktop/renderer-app/src/tasks/init-region-configs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { getServerRegionConfigs } from "@netless/flat-server-api";
import { globalStore } from "@netless/flat-stores";
import { errorTips } from "flat-components";

export const initRegionConfigs = async (): Promise<void> => {
try {
const regionConfigs = await getServerRegionConfigs();
if (regionConfigs.hash !== globalStore.configHash) {
globalStore.updateServerRegionConfig(regionConfigs);
}
} catch (error) {
globalStore.updateServerRegionConfig(null);
console.error(error);
errorTips(error as Error);
throw error; // Break the whole page
}
};
6 changes: 0 additions & 6 deletions desktop/renderer-app/typings/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ declare namespace NodeJS {
NODE_ENV: "development" | "production";
NETLESS_APP_IDENTIFIER: string;

CLOUD_STORAGE_OSS_ALIBABA_ACCESS_KEY: string;
CLOUD_STORAGE_OSS_ALIBABA_BUCKET: string;
CLOUD_STORAGE_OSS_ALIBABA_REGION: string;

CLOUD_STORAGE_DOMAIN: string;

AGORA_APP_ID: string;

GITHUB_CLIENT_ID: string;
Expand Down
3 changes: 0 additions & 3 deletions docs/env/README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
| ------------------------------------ | -------------------------------------------------- | ---------------------------------------------------------------- |
| NETLESS_APP_IDENTIFIER | 互动白板 Access Key | 见: [在 app 服务端生成 Token][netless-auth] |
| AGORA_APP_ID | Agora 声网 App ID | 用于 RTC 与 RTM。见: [校验用户权限][agora-app-id-auth] |
| CLOUD_STORAGE_OSS_ALIBABA_ACCESS_KEY | Agora 云端录制 OSS 配置 | 用于云端录制存储用户音视频。见: [云存储设置][cloud-recording] |
| CLOUD_STORAGE_OSS_ALIBABA_BUCKET | Agora 云端录制 OSS 配置 | 同上 |
| CLOUD_STORAGE_OSS_ALIBABA_REGION | Agora 云端录制 OSS 配置 | 同上 |
| CLOUD_RECORDING_DEFAULT_AVATAR | Agora 云端录制用户默认背景图 URL | 见:[设置背景色或背景图][cloud-recording-background] |
| WECHAT_APP_ID | [微信开放平台][open-wechat] App ID |`网站应用``AppID` |
| FLAT_SERVER_DOMAIN | Flat Server 部署的域名地址 | 如: `flat-api.whiteboard.agora.io` |
Expand Down
3 changes: 0 additions & 3 deletions docs/env/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
| ------------------------------------ | -------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| NETLESS_APP_IDENTIFIER | Whiteboard Access Key | See [Projects and permissions][netless-auth] |
| AGORA_APP_ID | Agora App ID | For RTC and RTM. See [Use an App ID for authentication][agora-app-id-auth] |
| CLOUD_STORAGE_OSS_ALIBABA_ACCESS_KEY | Agora Cloud Recording OSS | For storing RTC Cloud Recording media files. See [Cloud Recording][cloud-recording] |
| CLOUD_STORAGE_OSS_ALIBABA_BUCKET | Agora Cloud Recording OSS | As above |
| CLOUD_STORAGE_OSS_ALIBABA_REGION | Agora Cloud Recording OSS | As above |
| CLOUD_RECORDING_DEFAULT_AVATAR | Agora Cloud Recording default user avatar URL | See: [Set the background color or background image][cloud-recording-background] |
| WECHAT_APP_ID | [Wechat Open Platform][open-wechat] App ID | |
| FLAT_SERVER_DOMAIN | Flat Server deployed address | e.g. `flat-api.whiteboard.agora.io` |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import gbSVG from "./icons/gb.svg";
import usSVG from "./icons/us.svg";
import sgSVG from "./icons/sg.svg";

import { Button, Checkbox, Dropdown, Form, Input, Menu, Modal } from "antd";
import { Button, Checkbox, Form, Input, Modal } from "antd";
import { CheckboxChangeEvent } from "antd/lib/checkbox";
import { addWeeks, endOfDay, getDay } from "date-fns";
import React, { useMemo, useRef, useState } from "react";
Expand All @@ -16,7 +16,6 @@ import { renderBeginTimePicker } from "./renderBeginTimePicker";
import { renderEndTimePicker } from "./renderEndTimePicker";
import { renderPeriodicForm } from "./renderPeriodicForm";
import { ClassPicker } from "../../HomePage/ClassPicker";
import { Fragment } from "react";

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

const [isFormVetted, setIsFormVetted] = useState(true);
const [isShowEditSubmitConfirm, showEditSubmitConfirm] = useState(false);
const [region, setRegion] = useState<Region>(initialValues.region);

// @TODO: need to remove
const [region] = useState<Region>(initialValues.region);

const t = useTranslate();
const language = useLanguage();

Expand All @@ -103,25 +105,6 @@ export const EditRoomBody: React.FC<EditRoomBodyProps> = ({
...initialValues,
};
}, [initialValues]);

const regionMenu = (
<Menu
className="edit-room-body-menu-item"
items={regions.map(region => ({
key: region,
label: (
<Fragment>
<img alt={region} src={RegionSVG[region]} style={{ width: 22 }} />
<span style={{ paddingLeft: 8 }}>{t(`region-${region}`)}</span>
</Fragment>
),
}))}
prefix="hello"
style={{ width: "auto" }}
onClick={e => setRegion(e.key as Region)}
/>
);

return (
<>
<div className="edit-room-body fancy-scrollbar">
Expand Down Expand Up @@ -163,19 +146,6 @@ export const EditRoomBody: React.FC<EditRoomBodyProps> = ({
}}
disabled={type === "periodicSub"}
placeholder={t("enter-room-theme")}
suffix={
<Dropdown
overlay={regionMenu}
placement="bottomRight"
trigger={["click"]}
>
<img
alt={region}
src={RegionSVG[region]}
style={{ cursor: "pointer", width: 22, marginRight: 0 }}
/>
</Dropdown>
}
/>
</Form.Item>
<Form.Item label={t("type")} name="type">
Expand Down
Loading

0 comments on commit 7aea5e7

Please sign in to comment.