mv element.io @types __mocks__/ debian docker module_system/ playwright res src test webapp Dockerfile .dockerignore .eslintignore .stylelintrc.cjs babel.config.cjs recorder-worklet-loader.cjs .modernizr.json components.json config.json config.sample.json package.json project.json tsconfig.json tsconfig.module_system.json jest.config.ts playwright.config.ts webpack.config.ts build_config.sample.yaml apps/web/
mkdir apps/web/scripts
mv scripts/{cleanup.sh,ci_package.sh,copy-res.ts,deploy.py,package.sh} apps/web/scripts
And a couple of gitignore tweaks
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { encode } from "blurhash";
|
||||
|
||||
import { type WorkerPayload } from "./worker";
|
||||
|
||||
const ctx: Worker = self as any;
|
||||
|
||||
export interface Request {
|
||||
imageData: ImageData;
|
||||
}
|
||||
|
||||
export interface Response {
|
||||
blurhash: string;
|
||||
}
|
||||
|
||||
ctx.addEventListener("message", (event: MessageEvent<Request & WorkerPayload>): void => {
|
||||
const { seq, imageData } = event.data;
|
||||
const blurhash = encode(
|
||||
imageData.data,
|
||||
imageData.width,
|
||||
imageData.height,
|
||||
// use 4 components on the longer dimension, if square then both
|
||||
imageData.width >= imageData.height ? 4 : 3,
|
||||
imageData.height >= imageData.width ? 4 : 3,
|
||||
);
|
||||
|
||||
ctx.postMessage({ seq, blurhash });
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2023 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
export default function factory(options?: WorkerOptions | undefined): Worker {
|
||||
return new Worker(
|
||||
/* webpackChunkName: "blurhash.worker" */ new URL("./blurhash.worker.ts", import.meta.url),
|
||||
options,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2017 Vector Creations Ltd
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { IndexedDBStoreWorker } from "matrix-js-sdk/src/indexeddb-worker";
|
||||
|
||||
const ctx: Worker = self as any;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
const remoteWorker = new IndexedDBStoreWorker(ctx.postMessage);
|
||||
|
||||
ctx.onmessage = remoteWorker.onMessage;
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2023 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
export default function factory(options?: WorkerOptions | undefined): Worker {
|
||||
return new Worker(
|
||||
/* webpackChunkName: "indexeddb.worker" */ new URL("./indexeddb.worker.ts", import.meta.url),
|
||||
options,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { type WorkerPayload } from "./worker";
|
||||
import { arrayRescale, arraySmoothingResample } from "../utils/arrays";
|
||||
import { PLAYBACK_WAVEFORM_SAMPLES } from "../audio/consts";
|
||||
|
||||
const ctx: Worker = self as any;
|
||||
|
||||
export interface Request {
|
||||
data: number[];
|
||||
}
|
||||
|
||||
export interface Response {
|
||||
waveform: number[];
|
||||
}
|
||||
|
||||
ctx.addEventListener("message", async (event: MessageEvent<Request & WorkerPayload>): Promise<void> => {
|
||||
const { seq, data } = event.data;
|
||||
|
||||
// First, convert negative amplitudes to positive so we don't detect zero as "noisy".
|
||||
const noiseWaveform = data.map((v) => Math.abs(v));
|
||||
|
||||
// Then, we'll resample the waveform using a smoothing approach so we can keep the same rough shape.
|
||||
// We also rescale the waveform to be 0-1 so we end up with a clamped waveform to rely upon.
|
||||
const waveform = arrayRescale(arraySmoothingResample(noiseWaveform, PLAYBACK_WAVEFORM_SAMPLES), 0, 1);
|
||||
|
||||
ctx.postMessage({ seq, waveform });
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2023 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
export default function factory(options?: WorkerOptions | undefined): Worker {
|
||||
return new Worker(
|
||||
/* webpackChunkName: "playback.worker" */ new URL("./playback.worker.ts", import.meta.url),
|
||||
options,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
export interface WorkerPayload {
|
||||
seq: number;
|
||||
}
|
||||
Reference in New Issue
Block a user