GithubHelp home page GithubHelp logo

netless-io / flat Goto Github PK

View Code? Open in Web Editor NEW
5.4K 73.0 786.0 71.23 MB

Project flat is the Web, Windows and macOS client of Agora Flat open source classroom.

Home Page: https://flat.whiteboard.agora.io

License: MIT License

JavaScript 2.98% TypeScript 86.67% HTML 0.20% Shell 0.01% Less 9.93% AppleScript 0.06% SCSS 0.03% Batchfile 0.01% Dockerfile 0.01% Smarty 0.08% CSS 0.03%
whiteboard flat agora electron online-classroom agora-flat cloud-recording e-class e-learning virtual-classroom

flat's Introduction

Agora Flat

Project flat is the Web, Windows and macOS client of Agora Flat open source classroom.

中文

Features

  • Real-time interaction
    • Multifunctional interactive whiteboard
    • Real-time video/audio chat (RTC)
    • Real-time messaging (RTM)
  • Login via
    • GitHub
    • WeChat
  • Classroom management
    • Join, create and schedule classrooms
    • Support periodic rooms
  • Classroom recording and replaying
    • Whiteboard replaying
    • Cloud recording for video and audio
    • Messaging replaying
  • Cloud Storage for multi-media courseware
  • Screen sharing

Quickstart

You can build and run the Flat client without a server. This repository includes the following projects:

Installation

If you don't have pnpm installed:

npm i -g pnpm

Clone or fork this project, at project root run:

pnpm i

Build and run Flat Electron client

Run the following commands at the root of the repository to build and run Flat Electron client.

pnpm start

You can use one of the following methods to package your executable:

  • Run pnpm ship at project root to package based on current system.
  • Alternatively, run pnpm ship:mac or pnpm ship:win at project root to package for a specified system.

Build and run Flat Web client

Run the following command at the root of the repository to build and run Flat web client.

pnpm start:web

Alternatively, run the following command:

cd ./web/flat-web/ && pnpm start

UI and business logic are separated in Flat. You can view and develop Flat components UI via Storybook. You can either visit the (Online address) or run pnpm storybook at the root of the repository to run Storybook locally.

References

Related Projects

Contributing

Writing code is great, but there are many other ways to make meaningful contributions to the project:

For more info about how to contribute, see CONTRIBUTING.md

Code Contributors

Thank you to all the people who already contributed to Flat!

Disclaimer

You may use Flat for commercial purposes but please note that we do not accept customizational commercial requirements and deployment supports. Nor do we offer customer supports for commercial usage. Please head to Flexible Classroom for such requirements.

License

Copyright © Agora Corporation. All rights reserved.

Licensed under the MIT license.

When using the Flat or other GitHub logos, be sure to follow the GitHub logo guidelines.

flat's People

Contributors

alwaysmavs avatar blackhole1 avatar cheerego7 avatar crimx avatar cyberhan123 avatar dependabot[bot] avatar ganofins avatar gavin0x0 avatar guqianfeng avatar guyith avatar gxhao avatar haoran965 avatar hyrious avatar jayeclark avatar kongkang avatar l1shen avatar leooeloel avatar litomore avatar matrixbirds avatar ooeyuna avatar rbrishabh avatar shunyue1320 avatar syt-honey avatar vince-hz avatar yamasite avatar ylduang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flat's Issues

[bug]: blocking browser fallback in flat-web

when accessing https://flat-web.whiteboard.agora.io/ from another page in the browser, the browser will not be able to make the action that will rewind to the previous page.

[bug]: resolve load source-map error

Reproduce Step

  1. open flat
  2. open devtools at renderer
  3. switch console
  4. (option) click WeChat Login button:
    图片

Note

launch Flat when development environment:
图片

if click weChat Login button:
图片


if open the release Flat:
图片

if click weChat Login button:
图片

[improve]: show errortips only once

After opening https://flat-web.whiteboard.agora.io, switch to another tab page.

At this time, if you are in a situation where you have no internet, or very poor internet. Wait a few minutes and switch back to the flat page.

You can then see a very large number of repeated error messages.

But really we only need it once.

图片

CleanShot.2021-12-06.at.14.55.34.mp4

[refactor]: adjustment of file name specification

Since we don't do any strong checks on the file names, we have the following file name forms:

  1. camelcase
  2. snake_case
  3. kebab-case
  4. Pascalcase

I think we should have a set of specifications to restrict file names.

all I can think of at the moment is:

  • Components: Pascalcase
  • script: kebab-case
  • other: camelcase

yarn install error

Environment: Mac Big Sur
Node: v16.0.0
NPM: v7.10.0
Yarn: v1.22.10

and

Environment: Windows 10
Node: v14.15.4
NPM: v6.14.10
Yarn: v1.22.10

yiwen@YIWENtekiMacBook-Pro flat % yarn install --frozen-lockfile
yarn install v1.22.10
$ node ./scripts/preinstall
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
error Couldn't find match for "fb67b54fe18bdf556fb3e3d00db5fbaf0dbb294d" in "refs/heads/dependabot/npm_and_yarn/electron-9.4.0,refs/heads/dependabot/npm_and_yarn/ini-1.3.8,refs/heads/dependabot/npm_and_yarn/lodash-4.17.19,refs/heads/dependabot/npm_and_yarn/npm-6.14.6,refs/heads/dependabot/npm_and_yarn/npm-registry-fetch-4.0.5,refs/heads/dependabot/npm_and_yarn/npm-user-validate-1.0.1,refs/heads/fix-electron-warning,refs/heads/master,refs/tags/v1.0.0,refs/tags/v1.0.1,refs/tags/v1.0.2,refs/tags/v1.0.3,refs/tags/v1.0.4,refs/tags/v1.0.5,refs/tags/v1.1.0,refs/tags/v1.1.1,refs/tags/v1.1.2,refs/tags/v1.1.3,refs/tags/v1.1.4,refs/tags/v1.1.5,refs/tags/v2.0.0,refs/tags/v2.0.1,refs/tags/v2.1.0,refs/tags/v2.2.0,refs/tags/v2.2.1,refs/tags/v2.2.2,refs/tags/v2.2.3,refs/tags/v2.2.4,refs/tags/v3.0.0,refs/tags/v3.1.0,refs/tags/v3.1.1" for "git://github.com/BlackHole1/electron-devtools-installer".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Dart is more suitable alternative

Dart is an object-oriented C language,Dart is a statically typed language that eliminates common sources of errors in JavaScript code. Dart supports type inference, so there is no need to include type boilerplate every time a variable or function is declared.Perhaps the most exciting feature of Dart is its availability outside the network.Perhaps the most exciting feature of Dart is its availability outside the network. Google's Flutter UI toolkit is a portable front-end framework that can be used on desktops, mobile devices and the Web to build native applications. @bestony

[bug]: autoResize not scaling

Im finding that autoresize scaling is not adjusted when adjusting the whiteboard div. Sometimes it works but most of the time it doesn't.

I believe the issue is due to the ApplianceManager.GetViewState() returning 0 for width and 0 for height. When the adaptRectangle is created it forces a scale of 1.

when refreshSize is called this.adaptRectangle is null which forces the resize property to take this.camera property.

is this a race condition as the DIV container is not yet created so the Width and Height is 0?

below is excerpts of white-sdk

creation of adaptRectangle below

  key: "adaptRectangle",
          value: function adaptRectangle(e) {
              if (e.width === 0 || e.height === 0) this.transformCamera({
                  animationMode: e.animationMode,
                  centerX: e.originX + e.width / 2,
                  centerY: e.originY + e.height / 2,
                  scale: 1
              });
              else {
                  var t = He(D({}, this.cameraWithAdaptRectangle(e, e.adapterMode)), {
                      animationMode: e.animationMode
                  });
                  this.setCameraTransfrom(t, !1), this.adaptedRectangle = Object.freeze({
                      originX: e.originX,
                      originY: e.originY,
                      width: e.width,
                      height: e.height,
                      adapterMode: e.adapterMode
                  })
              }
          }
        },

this.adaptedRectangle is null and therefore this.camera properties are taken.

key: "refreshSize",
        value: function refreshSize(e, t) {
            if (this._width !== e || this._height !== t) {
                this._width = e, this._height = t;
                var r;
                this.adaptedRectangle ? r = this.cameraWithAdaptRectangle(this.adaptedRectangle, this.adaptedRectangle.adapterMode) : r = this.camera, this.setCameraTransfrom(He(D({}, r), {
                    animationMode: G.Immediately
                }), !1), this.dispatchUpdatedEvent(r, !1), this.sizeUpdatedDispatcher.dispatch({
                    width: e,
                    height: t
                })
            }
        }

[refactor]: activate terminal after start command

exec yarn run start in project root path, will open system terminal or iTerm2.
but they(terminal / iTerm2) will not to the front (like z-index).

1.mp4

related documents: https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_cmds.html#//apple_ref/doc/uid/TP40000983-CH216-SW60

related code:

  • tell application "iTerm"
    set W to create window with default profile
    tell W's current session
    split vertically with default profile
    end tell
    set T to W's current tab
    set ProjectRoot to "$(dirname $(dirname $(dirname $(dirname " & (POSIX path of (path to me)) & "))))"
    write T's session 1 text "yarn --cwd \"" & ProjectRoot & "/desktop/renderer-app\" start"
    write T's session 2 text "yarn --cwd \"" & ProjectRoot & "/desktop/main-app\" start"
    end tell

  • tell application "Terminal"
    set ProjectRoot to "$(dirname $(dirname $(dirname $(dirname " & (POSIX path of (path to me)) & "))))"
    do script "yarn --cwd \"" & ProjectRoot & "/desktop/renderer-app\" start"
    do script "yarn --cwd \"" & ProjectRoot & "/desktop/main-app\" start"
    end tell

[pref]: refactor date-fns import/use

In the project, I found that we were mixing up the data-fns approach, which would result in less maintainable code and no Tree shaking, eg:

import { format } from "data-fns/fp";
import { add } from "data-fns";
import max from "data-fns/max"

After testing, I found that I should change the data-fns to:

import format from "date-fns/fp/format";
import addBusinessDays from "date-fns/fp/addBusinessDays";

we should use fp, unless the method does not exist in fp

This is for code maintainability reasons


I tested several different writing methods to analyze their final pack size

mix use deconstruction

import { format } from "date-fns";
import { addBusinessDays } from "date-fns/fp";

Stat Size: 625.18 KB

图片

use deconstruction

import { format } from "date-fns/fp";
import { addBusinessDays } from "date-fns/fp";

Stat Size: 582.38 KB

图片

mix use no deconstruction

import format from "date-fns/format";
import addBusinessDays from "date-fns/fp/addBusinessDays";

Stat Size: 91.98 KB

图片

use no deconstruction

import format from "date-fns/fp/format";
import addBusinessDays from "date-fns/fp/addBusinessDays";

Stat Size: 92.21 KB

图片


From the above, we can see that there is not much difference between mix use no deconstruction and use no deconstruction. The reason why use no deconstruction is a bit larger than mix use no deconstruction is that there is more code for fp implementation.

As I mentioned above, we should only use one for code maintainability (usually fp's methods are sufficient for our needs)

Another reason to choose fp is that we can take advantage of Currying for further abstraction.

control scale api

Did you solve the problem of controlling scaling API mentioned before

[discussion]: Questions about the open-source of this project

感谢你们的开源,想咨询一下这是基于声网传输服务的收费开源项目吗?

Update (i18n)

Thank you for the open source, I would like to inquire about this is based on the sound network transmission service fee open source project?

[refactor]: remove Chinese comment

remove all Chinese comment in project, replace with English.

Because this project is open to all developers worldwide, we should use English as the primary language for ease of communication and maintenance

match Regex: (//|\* ).*[\u4e00-\u9fa5]
file type: *.ts,*.tsx,*.json,*.js.

e.g:
图片

[refactor]: remove useless code / file / dependencies

for historical reasons there are code that we will never use again and we should delete them instead of keeping them in the project.

e.g:

  1. /desktop/renderer-app/src/taskUuids.ts
  2. /desktop/renderer-app/src/custom.d.ts
  3. /desktop/renderer-app/src/react-app-env.d.ts
  4. /desktop/renderer-app/package.json -> scripts -> react-app-rewired and eject
  5. /desktop/renderer-app/package.json -> devDependencies -> edit-json-file
  6. ...

[bug]: Virtual webcam not showing on desktop

Unable to choose virtual webcam on Mac OS. The only camera in the list is the default built-in webcam. The web version of flat has the virtual camera available in the dropdown menu.

[chore]: replace rollup with webpack

flat-web use rollup, but rollup has high memory requirements.

The disadvantages of rollup outweigh its advantages.

If the memory problem is solved by a later rollup, we will consider migrating it all.

But for now we need to use webpack.

Remove component code from store

Use a property to switch Preview Modal:

Modal.info({
content: <ResourcePreview fileInfo={fileInfo} />,
className: "resource-preview-container",
width: "100%",
centered: true,
closable: true,
maskClosable: true,
closeIcon: <img src={closeSVG} />,
});

Style files should be alongside with the component:

[bug]: electron → web RECV_VIDEO_DECODE_FAILED

When use mode: 'live' (or broadcast in electron), you can't see the video stream sent by electron on the web page, other directions are ok.

I will investigate it soon.

Update: did not reproduce on windows x64 with agora-electron-sdk@latest

[chore]: replace esbuild with swc in flat-web

Our mobx class is starting to look more and more complex. Using reflect-metadata can be a good solution to this problem.

currently flat-web uses vite, and uses vite's built-in esbuild build tool.

But currently esbuild does not support reflect-metadata, which is the main reason why we want to migrate to swc.

Since the implementation logic of esbuild and swc is completely inconsistent, it will be difficult to support esbuild in the future, see: evanw/esbuild#257 (comment)

Related Links: vitejs/vite#788

[bug]: run dekstop failed on windows system

Environment

Windows 10

Steps to reproduce

After executing yarn run start.

The following error occurs:

C:\Users\WL\Documents\GitHub\flat\node_modules\electron\dist\electron.exe exited with signal SIGINT

(node:1656) ExtensionLoadWarning: Warnings loading extension at C:\Users\WL\AppData\Roaming\Electron\extensions\fmkadmapgofadopljbjfkapdkoienihi: Unrecognized manifest key 'browser_action'. Unrecognized manifest key 'minimum_chrome_version'. Unrecognized manifest key 'update_url'. Cannot load extension with file or directory name _metadata. Filenames starting with "_" are reserved for use by the system.

Checking for update
Update for version 11.3.0 is not available (latest version: 1.1.0-beta.1, downgrade is disallowed).

Checking for update
Update for version 11.3.0 is not available (latest version: 1.1.0, downgrade is disallowed).

The app launches successfully with errors and I can neither create nor join a room:

image

[chore]: use `unicorn/filename-case` eslint rule

Previously, we discussed the specification of file names (see: #714)

But this is all built on an ego-driven basis and we need to have a rule to help us check this.

Thanks to @LitoMore recommendation, we were made aware of the existence of unicorn/filename-case.

Rule Link: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/filename-case.md

The following rules, which I have just come up with, may not be perfect.

"unicorn/filename-case": [
	"error",
	{
		"cases": {
			"kebabCase": true,
			"ignore": [
				"^[A-Z].+\\.tsx$",
				"^README.*\\.md$",
				".*\\.yaml",
				".*\\.yml"
			],
		}
	}
]

[chore]: unified build tool to vite

The current flat sub-project uses a different build tool:

we always knew it was confusing, but the good news is that we will remain unified in the future and will all switch to vite.

before switching to vite, we need to wait for the storybook to support vite builds

The storybook is still being optimized and there are still some issues with storybook-builder-vite(see:
storybookjs/builder-vite#2).

When they are finished, they will be ready for migration

other sub-projects can be migrated in one step first

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.