Reorganize source code
This commit is contained in:
parent
cfcab5e007
commit
42be533614
|
@ -4,6 +4,7 @@
|
|||
.sync-config.cson
|
||||
.electron-gyp
|
||||
.npmrc
|
||||
.idea
|
||||
|
||||
.DS_Store
|
||||
|
||||
|
@ -14,4 +15,4 @@ npm-debug.log
|
|||
|
||||
Jitsi Meet*
|
||||
|
||||
build/
|
||||
build/
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
import React, { Component } from 'react';
|
||||
|
||||
import { Conference } from '../../conference';
|
||||
import config from '../../config';
|
||||
|
||||
/**
|
||||
* Main component encapsulating the entire application.
|
||||
*/
|
||||
export default class App extends Component {
|
||||
/**
|
||||
* Initializes a new {@code App} instance.
|
||||
*
|
||||
* @inheritdoc
|
||||
*/
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
document.title = config.appName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements React's {@link Component#render()}.
|
||||
*
|
||||
* @inheritdoc
|
||||
* @returns {ReactElement}
|
||||
*/
|
||||
render() {
|
||||
return (
|
||||
<Conference />
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
export { default as App } from './App';
|
|
@ -0,0 +1 @@
|
|||
export * from './components';
|
|
@ -1,5 +1,4 @@
|
|||
import React from 'react';
|
||||
import { render } from 'react-dom';
|
||||
import { Component } from 'react';
|
||||
|
||||
import {
|
||||
RemoteControl,
|
||||
|
@ -8,43 +7,43 @@ import {
|
|||
setupWiFiStats
|
||||
} from 'jitsi-meet-electron-utils';
|
||||
|
||||
import { jitsiMeetDomain } from '../../../config.js';
|
||||
import config from '../../config';
|
||||
|
||||
/**
|
||||
* Jitsi Meet Window Component
|
||||
*/
|
||||
class JitsiMeetWindow extends React.Component {
|
||||
|
||||
/**
|
||||
* Render function of component
|
||||
* @return {ScriptElement}
|
||||
*/
|
||||
render() {
|
||||
return null;
|
||||
}
|
||||
|
||||
export default class Conference extends Component {
|
||||
/**
|
||||
* Attach the script
|
||||
*/
|
||||
componentDidMount() {
|
||||
|
||||
const script = document.createElement('script');
|
||||
|
||||
script.async = true;
|
||||
script.onload = this._onScriptLoad;
|
||||
script.onerror = console.error;
|
||||
script.src = `https://${jitsiMeetDomain}/external_api.js`;
|
||||
script.src = `https://${config.defaultDomain}/external_api.js`;
|
||||
|
||||
document.head.appendChild(script);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render function of component.
|
||||
*
|
||||
* @return {ReactElement}
|
||||
*/
|
||||
render() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* When the script is loaded attach utils from jitsi-meet-electron-utils
|
||||
*/
|
||||
_onScriptLoad() {
|
||||
const JitsiMeetExternalAPI = window.JitsiMeetExternalAPI;
|
||||
|
||||
const api = new JitsiMeetExternalAPI(jitsiMeetDomain);
|
||||
const api = new JitsiMeetExternalAPI(config.defaultDomain);
|
||||
const iframe = api.getIFrame();
|
||||
|
||||
setupScreenSharingForWindow(iframe);
|
||||
|
@ -53,5 +52,3 @@ class JitsiMeetWindow extends React.Component {
|
|||
setupWiFiStats(iframe);
|
||||
}
|
||||
}
|
||||
|
||||
render(<JitsiMeetWindow />, document.getElementById('app'));
|
|
@ -0,0 +1 @@
|
|||
export { default as Conference } from './Conference';
|
|
@ -0,0 +1 @@
|
|||
export * from './components';
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
export default {
|
||||
/**
|
||||
* Application name.
|
||||
*/
|
||||
appName: 'Jitsi Meet',
|
||||
|
||||
/**
|
||||
* The domain of the Jitsi Meet deployment that will be used.
|
||||
*/
|
||||
defaultDomain: 'meet.jit.si'
|
||||
};
|
|
@ -1,7 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
<style>
|
||||
body, html {
|
||||
margin: 0;
|
|
@ -0,0 +1,9 @@
|
|||
import React from 'react';
|
||||
import { render } from 'react-dom';
|
||||
|
||||
import { App } from './features/app';
|
||||
|
||||
/**
|
||||
* Render the main / root application.
|
||||
*/
|
||||
render(<App />, document.getElementById('app'));
|
|
@ -1,6 +0,0 @@
|
|||
module.exports = {
|
||||
/**
|
||||
* The domain of the Jitsi Meet deployment that will be used.
|
||||
*/
|
||||
jitsiMeetDomain: 'meet.jit.si'
|
||||
};
|
|
@ -15,6 +15,15 @@ const commonConfig = {
|
|||
{
|
||||
exclude: /(node_modules)/,
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: [
|
||||
[
|
||||
require.resolve('babel-preset-env'),
|
||||
{ modules: false }
|
||||
],
|
||||
require.resolve('babel-preset-react')
|
||||
]
|
||||
},
|
||||
test: /\.js$/
|
||||
},
|
||||
{
|
||||
|
@ -41,11 +50,10 @@ module.exports = [
|
|||
commonConfig),
|
||||
Object.assign({
|
||||
target: 'electron-renderer',
|
||||
entry: { renderer: './windows/jitsi-meet/src/index.js' },
|
||||
entry: { renderer: './app/index.js' },
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
title: 'Jitsi Meet',
|
||||
template: path.resolve('./templates/index.html')
|
||||
template: './app/index.html'
|
||||
})
|
||||
]
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue