Merge branch 'develop' of github.com:vector-im/riot-web into t3chguy/feat/widgets
This commit is contained in:
commit
c75a4add42
7 changed files with 75 additions and 20 deletions
34
docs/customisations.md
Normal file
34
docs/customisations.md
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
# Customisations
|
||||||
|
|
||||||
|
Element Web and the React SDK support "customisation points" that can be used to
|
||||||
|
easily add custom logic specific to a particular deployment of Element Web.
|
||||||
|
|
||||||
|
An example of this is the [security customisations
|
||||||
|
module](https://github.com/matrix-org/matrix-react-sdk/blob/develop/src/customisations/Security.ts).
|
||||||
|
This module in the React SDK only defines some empty functions and their types:
|
||||||
|
it does not do anything by default.
|
||||||
|
|
||||||
|
To make use of these customisation points, you will first need to fork Element
|
||||||
|
Web so that you can add your own code. Even though the default module is part of
|
||||||
|
the React SDK, you can still override it from the Element Web layer:
|
||||||
|
|
||||||
|
1. Copy the default customisation module to
|
||||||
|
`element-web/src/customisations/YourNameSecurity.ts`
|
||||||
|
2. Edit customisations points and make sure export the ones you actually want to
|
||||||
|
activate
|
||||||
|
3. Tweak the Element build process to use the customised module instead of the
|
||||||
|
default by adding this to end of the `plugins` array in `webpack.config.js`:
|
||||||
|
|
||||||
|
```js
|
||||||
|
new webpack.NormalModuleReplacementPlugin(
|
||||||
|
/src\/customisations\/Security.ts/,
|
||||||
|
path.resolve(__dirname, 'src/customisations/YourNameSecurity.ts'),
|
||||||
|
),
|
||||||
|
```
|
||||||
|
|
||||||
|
If we add more customisation modules in the future, we'll likely improve these
|
||||||
|
steps to remove the need for build changes like the above.
|
||||||
|
|
||||||
|
By isolating customisations to their own module, this approach should remove the
|
||||||
|
chance of merge conflicts when updating your fork, and thus simplify ongoing
|
||||||
|
maintenance.
|
|
@ -62,7 +62,7 @@
|
||||||
"jsrsasign": "^9.1.5",
|
"jsrsasign": "^9.1.5",
|
||||||
"matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop",
|
"matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop",
|
||||||
"matrix-react-sdk": "github:matrix-org/matrix-react-sdk#develop",
|
"matrix-react-sdk": "github:matrix-org/matrix-react-sdk#develop",
|
||||||
"matrix-widget-api": "^0.1.0-beta.2",
|
"matrix-widget-api": "^0.1.0-beta.5",
|
||||||
"olm": "https://packages.matrix.org/npm/olm/olm-3.2.1.tgz",
|
"olm": "https://packages.matrix.org/npm/olm/olm-3.2.1.tgz",
|
||||||
"prop-types": "^15.7.2",
|
"prop-types": "^15.7.2",
|
||||||
"react": "^16.9.0",
|
"react": "^16.9.0",
|
||||||
|
@ -139,6 +139,7 @@
|
||||||
"postcss-strip-inline-comments": "^0.1.5",
|
"postcss-strip-inline-comments": "^0.1.5",
|
||||||
"rimraf": "^2.4.3",
|
"rimraf": "^2.4.3",
|
||||||
"shell-escape": "^0.2.0",
|
"shell-escape": "^0.2.0",
|
||||||
|
"simple-proxy-agent": "^1.1.0",
|
||||||
"stylelint": "^12.0.1",
|
"stylelint": "^12.0.1",
|
||||||
"terser-webpack-plugin": "^2.3.0",
|
"terser-webpack-plugin": "^2.3.0",
|
||||||
"typescript": "^3.7.3",
|
"typescript": "^3.7.3",
|
||||||
|
|
|
@ -7,6 +7,7 @@ const fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const mkdirp = require("mkdirp");
|
const mkdirp = require("mkdirp");
|
||||||
const fetch = require("node-fetch");
|
const fetch = require("node-fetch");
|
||||||
|
const ProxyAgent = require("simple-proxy-agent");
|
||||||
|
|
||||||
console.log("Making webapp directory");
|
console.log("Making webapp directory");
|
||||||
mkdirp.sync("webapp");
|
mkdirp.sync("webapp");
|
||||||
|
@ -14,7 +15,13 @@ mkdirp.sync("webapp");
|
||||||
// curl -s https://jitsi.riot.im/libs/external_api.min.js > ./webapp/jitsi_external_api.min.js
|
// curl -s https://jitsi.riot.im/libs/external_api.min.js > ./webapp/jitsi_external_api.min.js
|
||||||
console.log("Downloading Jitsi script");
|
console.log("Downloading Jitsi script");
|
||||||
const fname = path.join("webapp", "jitsi_external_api.min.js");
|
const fname = path.join("webapp", "jitsi_external_api.min.js");
|
||||||
fetch("https://jitsi.riot.im/libs/external_api.min.js").then(res => {
|
|
||||||
|
const options = {};
|
||||||
|
if (process.env.HTTPS_PROXY) {
|
||||||
|
options.agent = new ProxyAgent(process.env.HTTPS_PROXY, {tunnel: true});
|
||||||
|
}
|
||||||
|
|
||||||
|
fetch("https://jitsi.riot.im/libs/external_api.min.js", options).then(res => {
|
||||||
const stream = fs.createWriteStream(fname);
|
const stream = fs.createWriteStream(fname);
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
res.body.pipe(stream);
|
res.body.pipe(stream);
|
||||||
|
|
1
src/customisations/README.md
Symbolic link
1
src/customisations/README.md
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../docs/customisations.md
|
|
@ -81,7 +81,7 @@ let meetApi: any; // JitsiMeetExternalAPI
|
||||||
widgetApi.requestCapabilities(VideoConferenceCapabilities);
|
widgetApi.requestCapabilities(VideoConferenceCapabilities);
|
||||||
readyPromise = Promise.all([
|
readyPromise = Promise.all([
|
||||||
new Promise<void>(resolve => {
|
new Promise<void>(resolve => {
|
||||||
widgetApi.once<CustomEvent<IWidgetApiRequest>>(`action:${ElementWidgetActions.ClientReady}`, ev => {
|
widgetApi.once(`action:${ElementWidgetActions.ClientReady}`, ev => {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
widgetApi.transport.reply(ev.detail, {});
|
widgetApi.transport.reply(ev.detail, {});
|
||||||
resolve();
|
resolve();
|
||||||
|
@ -93,7 +93,7 @@ let meetApi: any; // JitsiMeetExternalAPI
|
||||||
]);
|
]);
|
||||||
widgetApi.start();
|
widgetApi.start();
|
||||||
} else {
|
} else {
|
||||||
throw new Error("No parent URL or no widget ID");
|
console.warn("No parent URL or no widget ID - assuming no widget API is available");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populate the Jitsi params now
|
// Populate the Jitsi params now
|
||||||
|
@ -118,7 +118,7 @@ let meetApi: any; // JitsiMeetExternalAPI
|
||||||
|
|
||||||
// TODO: register widgetApi listeners for PTT controls (https://github.com/vector-im/riot-web/issues/12795)
|
// TODO: register widgetApi listeners for PTT controls (https://github.com/vector-im/riot-web/issues/12795)
|
||||||
|
|
||||||
widgetApi.addEventListener(`action:${ElementWidgetActions.HangupCall}`,
|
widgetApi.on(`action:${ElementWidgetActions.HangupCall}`,
|
||||||
(ev: CustomEvent<IWidgetApiRequest>) => {
|
(ev: CustomEvent<IWidgetApiRequest>) => {
|
||||||
if (meetApi) meetApi.executeCommand('hangup');
|
if (meetApi) meetApi.executeCommand('hangup');
|
||||||
widgetApi.transport.reply(ev.detail, {}); // ack
|
widgetApi.transport.reply(ev.detail, {}); // ack
|
||||||
|
|
|
@ -140,8 +140,8 @@ class SeshatIndexManager extends BaseEventIndexManager {
|
||||||
return this._ipcCall('supportsEventIndexing');
|
return this._ipcCall('supportsEventIndexing');
|
||||||
}
|
}
|
||||||
|
|
||||||
async initEventIndex(): Promise<void> {
|
async initEventIndex(userId: string, deviceId: string): Promise<void> {
|
||||||
return this._ipcCall('initEventIndex');
|
return this._ipcCall('initEventIndex', userId, deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
async addEventToIndex(ev: MatrixEvent, profile: MatrixProfile): Promise<void> {
|
async addEventToIndex(ev: MatrixEvent, profile: MatrixProfile): Promise<void> {
|
||||||
|
|
38
yarn.lock
38
yarn.lock
|
@ -4778,10 +4778,10 @@ eventemitter3@^4.0.0:
|
||||||
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.4.tgz#b5463ace635a083d018bdc7c917b4c5f10a85384"
|
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.4.tgz#b5463ace635a083d018bdc7c917b4c5f10a85384"
|
||||||
integrity sha512-rlaVLnVxtxvoyLsQQFBx53YmXHDxRIzzTLbdfxqi4yocpSjAxXwkU0cScM5JgSKMqEhrZpnvQ2D9gjylR0AimQ==
|
integrity sha512-rlaVLnVxtxvoyLsQQFBx53YmXHDxRIzzTLbdfxqi4yocpSjAxXwkU0cScM5JgSKMqEhrZpnvQ2D9gjylR0AimQ==
|
||||||
|
|
||||||
events@^3.0.0:
|
events@^3.0.0, events@^3.2.0:
|
||||||
version "3.1.0"
|
version "3.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/events/-/events-3.1.0.tgz#84279af1b34cb75aa88bf5ff291f6d0bd9b31a59"
|
resolved "https://registry.yarnpkg.com/events/-/events-3.2.0.tgz#93b87c18f8efcd4202a461aec4dfc0556b639379"
|
||||||
integrity sha512-Rv+u8MLHNOdMjTAFeT3nCjHn2aGlx435FP/sDHNaRhDEMwyI/aB22Kj2qIN8R0cw3z28psEQLYwxVKLsKrMgWg==
|
integrity sha512-/46HWwbfCX2xTawVfkKLGxMifJYQBWMwY1mjywRtb4c9x8l5NP3KoJtnIOiL1hfdRkIuYhETxQlo62IF8tcnlg==
|
||||||
|
|
||||||
eventsource@^1.0.7:
|
eventsource@^1.0.7:
|
||||||
version "1.0.7"
|
version "1.0.7"
|
||||||
|
@ -7980,15 +7980,12 @@ matrix-react-test-utils@^0.2.2:
|
||||||
resolved "https://registry.yarnpkg.com/matrix-react-test-utils/-/matrix-react-test-utils-0.2.2.tgz#c87144d3b910c7edc544a6699d13c7c2bf02f853"
|
resolved "https://registry.yarnpkg.com/matrix-react-test-utils/-/matrix-react-test-utils-0.2.2.tgz#c87144d3b910c7edc544a6699d13c7c2bf02f853"
|
||||||
integrity sha512-49+7gfV6smvBIVbeloql+37IeWMTD+fiywalwCqk8Dnz53zAFjKSltB3rmWHso1uecLtQEcPtCijfhzcLXAxTQ==
|
integrity sha512-49+7gfV6smvBIVbeloql+37IeWMTD+fiywalwCqk8Dnz53zAFjKSltB3rmWHso1uecLtQEcPtCijfhzcLXAxTQ==
|
||||||
|
|
||||||
matrix-widget-api@^0.1.0-beta.2:
|
matrix-widget-api@^0.1.0-beta.3, matrix-widget-api@^0.1.0-beta.5:
|
||||||
version "0.1.0-beta.2"
|
version "0.1.0-beta.5"
|
||||||
resolved "https://registry.yarnpkg.com/matrix-widget-api/-/matrix-widget-api-0.1.0-beta.2.tgz#367da1ccd26b711f73fc5b6e02edf55ac2ea2692"
|
resolved "https://registry.yarnpkg.com/matrix-widget-api/-/matrix-widget-api-0.1.0-beta.5.tgz#dd7f24a177aa590d812bd4e92e2c3ac225c5557e"
|
||||||
integrity sha512-q5g5RZN+RRjM4HmcJ+LYoQAYrB1wzyERmoQ+LvKbTV/+9Ov36Kp0QEP8CleSXEd5WLp6bkRlt60axDaY6pWGmg==
|
integrity sha512-J3GBJtVMFuEM/EWFylc0IlkPjdgmWxrkGYPaZ0LSmxp+OlNJxYfnWPR6F6HveW+Z8C1i0vq+BTueofSqKv2zDg==
|
||||||
|
dependencies:
|
||||||
matrix-widget-api@^0.1.0-beta.3:
|
events "^3.2.0"
|
||||||
version "0.1.0-beta.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/matrix-widget-api/-/matrix-widget-api-0.1.0-beta.3.tgz#356965ca357172ee056e3fd86fd96879b059a114"
|
|
||||||
integrity sha512-j7nxdhLQfdU6snsdBA29KQR0DmT8/vl6otOvGqPCV0OCHpq1312cP79Eg4JzJKIFI3A76Qha3nYx6G9/aapwXg==
|
|
||||||
|
|
||||||
md5.js@^1.3.4:
|
md5.js@^1.3.4:
|
||||||
version "1.3.5"
|
version "1.3.5"
|
||||||
|
@ -11286,6 +11283,13 @@ simple-get@^3.0.3:
|
||||||
once "^1.3.1"
|
once "^1.3.1"
|
||||||
simple-concat "^1.0.0"
|
simple-concat "^1.0.0"
|
||||||
|
|
||||||
|
simple-proxy-agent@^1.1.0:
|
||||||
|
version "1.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/simple-proxy-agent/-/simple-proxy-agent-1.1.0.tgz#974cd1130dd32554775e2d4caeb70d701f7ca8b3"
|
||||||
|
integrity sha512-amJaLagzNELaNNB2UXdXiORVbbU/RC4yRwtGvF4cttJheTm4JvL2fZ1SfuLU952XC7TLamYdgzzJtWUbGM6Jcw==
|
||||||
|
dependencies:
|
||||||
|
socks "^2.3.2"
|
||||||
|
|
||||||
simple-swizzle@^0.2.2:
|
simple-swizzle@^0.2.2:
|
||||||
version "0.2.2"
|
version "0.2.2"
|
||||||
resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a"
|
resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a"
|
||||||
|
@ -11386,6 +11390,14 @@ socks-proxy-agent@^4.0.0:
|
||||||
agent-base "~4.2.1"
|
agent-base "~4.2.1"
|
||||||
socks "~2.3.2"
|
socks "~2.3.2"
|
||||||
|
|
||||||
|
socks@^2.3.2:
|
||||||
|
version "2.4.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/socks/-/socks-2.4.4.tgz#f1a3382e7814ae28c97bb82a38bc1ac24b21cca2"
|
||||||
|
integrity sha512-7LmHN4IHj1Vpd/k8D872VGCHJ6yIVyeFkfIBExRmGPYQ/kdUkpdg9eKh9oOzYYYKQhuxavayJHTnmBG+EzluUA==
|
||||||
|
dependencies:
|
||||||
|
ip "^1.1.5"
|
||||||
|
smart-buffer "^4.1.0"
|
||||||
|
|
||||||
socks@~2.3.2:
|
socks@~2.3.2:
|
||||||
version "2.3.3"
|
version "2.3.3"
|
||||||
resolved "https://registry.yarnpkg.com/socks/-/socks-2.3.3.tgz#01129f0a5d534d2b897712ed8aceab7ee65d78e3"
|
resolved "https://registry.yarnpkg.com/socks/-/socks-2.3.3.tgz#01129f0a5d534d2b897712ed8aceab7ee65d78e3"
|
||||||
|
|
Loading…
Add table
Reference in a new issue