Add Jitsi SDK as a static resource and set up CI to update it on change
This commit is contained in:
parent
802571176e
commit
b08f83b415
5 changed files with 39 additions and 34 deletions
31
.github/workflows/update-jitsi.yml
vendored
Normal file
31
.github/workflows/update-jitsi.yml
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
# Re-fetches the Jitsi SDK and opens a PR to update it if it's different from what's in the repository
|
||||
name: Update Jitsi
|
||||
on:
|
||||
workflow_dispatch: {}
|
||||
schedule:
|
||||
- cron: "0 3 * * 0" # 3am every Sunday
|
||||
jobs:
|
||||
update:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
cache: "yarn"
|
||||
|
||||
- name: Install Deps
|
||||
run: "yarn install --frozen-lockfile"
|
||||
|
||||
- name: Fetch Jitsi
|
||||
run: "yarn update:jitsi"
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5
|
||||
with:
|
||||
token: ${{ secrets.ELEMENT_BOT_TOKEN }}
|
||||
branch: actions/jitsi-update
|
||||
delete-branch: true
|
||||
title: Jitsi Update
|
||||
labels: |
|
||||
T-Task
|
|
@ -37,15 +37,14 @@
|
|||
"clean": "rimraf lib webapp",
|
||||
"build": "yarn clean && yarn build:genfiles && yarn build:bundle",
|
||||
"build-stats": "yarn clean && yarn build:genfiles && yarn build:bundle-stats",
|
||||
"build:jitsi": "ts-node scripts/build-jitsi.ts",
|
||||
"build:res": "ts-node scripts/copy-res.ts",
|
||||
"build:genfiles": "yarn build:res && yarn build:jitsi && yarn build:module_system",
|
||||
"build:genfiles": "yarn build:res && yarn build:module_system",
|
||||
"build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js",
|
||||
"build:bundle": "webpack --progress --mode production",
|
||||
"build:bundle-stats": "webpack --progress --mode production --json > webpack-stats.json",
|
||||
"build:module_system": "ts-node --project ./tsconfig.module_system.json module_system/scripts/install.ts",
|
||||
"dist": "scripts/package.sh",
|
||||
"start": "concurrently --kill-others-on-fail --prefix \"{time} [{name}]\" -n modules,res,jitsi \"yarn build:module_system\" \"yarn build:res\" \"yarn build:jitsi\" && concurrently --kill-others-on-fail --prefix \"{time} [{name}]\" -n res,element-js \"yarn start:res\" \"yarn start:js\"",
|
||||
"start": "concurrently --kill-others-on-fail --prefix \"{time} [{name}]\" -n modules,res \"yarn build:module_system\" \"yarn build:res\" && concurrently --kill-others-on-fail --prefix \"{time} [{name}]\" -n res,element-js \"yarn start:res\" \"yarn start:js\"",
|
||||
"start:https": "concurrently --kill-others-on-fail --prefix \"{time} [{name}]\" -n res,element-js \"yarn start:res\" \"yarn start:js --https\"",
|
||||
"start:res": "ts-node scripts/copy-res.ts -w",
|
||||
"start:js": "webpack serve --output-path webapp --output-filename=bundles/_dev_/[name].js --output-chunk-filename=bundles/_dev_/[name].js --mode development",
|
||||
|
@ -63,7 +62,8 @@
|
|||
"test": "jest",
|
||||
"coverage": "yarn test --coverage",
|
||||
"analyse:unused-exports": "ts-node ./scripts/analyse_unused_exports.ts",
|
||||
"analyse:webpack-bundles": "webpack-bundle-analyzer webpack-stats.json webapp"
|
||||
"analyse:webpack-bundles": "webpack-bundle-analyzer webpack-stats.json webapp",
|
||||
"update:jitsi": "curl -s https://meet.element.io/libs/external_api.min.js > ./res/jitsi_external_api.min.js"
|
||||
},
|
||||
"resolutions": {
|
||||
"@types/react-dom": "17.0.21",
|
||||
|
|
3
res/jitsi_external_api.min.js
vendored
Normal file
3
res/jitsi_external_api.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,30 +0,0 @@
|
|||
// This is a JS script so that the directory is created in-process on Windows.
|
||||
// If the script isn't run in-process, there's a risk of it racing or never running
|
||||
// due to file associations in Windows.
|
||||
// Sorry.
|
||||
|
||||
import * as fs from "node:fs";
|
||||
import * as path from "node:path";
|
||||
import { mkdirpSync } from "mkdirp";
|
||||
import fetch from "node-fetch";
|
||||
import { ProxyAgent } from "proxy-agent";
|
||||
|
||||
console.log("Making webapp directory");
|
||||
mkdirpSync("webapp");
|
||||
|
||||
// curl -s https://meet.element.io/libs/external_api.min.js > ./webapp/jitsi_external_api.min.js
|
||||
console.log("Downloading Jitsi script");
|
||||
const fname = path.join("webapp", "jitsi_external_api.min.js");
|
||||
|
||||
fetch("https://meet.element.io/libs/external_api.min.js", {
|
||||
agent: new ProxyAgent(),
|
||||
})
|
||||
.then((res) => {
|
||||
const stream = fs.createWriteStream(fname);
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
res.body.pipe(stream);
|
||||
res.body.on("error", (err) => reject(err));
|
||||
res.body.on("finish", () => resolve());
|
||||
});
|
||||
})
|
||||
.then(() => console.log("Done with Jitsi download"));
|
|
@ -714,6 +714,7 @@ module.exports = (env, argv) => {
|
|||
new CopyWebpackPlugin({
|
||||
patterns: [
|
||||
"res/apple-app-site-association",
|
||||
"res/jitsi_external_api.min.js",
|
||||
"res/manifest.json",
|
||||
"res/sw.js",
|
||||
"res/welcome.html",
|
||||
|
|
Loading…
Reference in a new issue