Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 820ef493 authored by Simon Chan's avatar Simon Chan
Browse files

fix(credential): support web workers

parent b066ca01
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ export default class AdbWebCredentialStore implements AdbCredentialStore {
        for (const key of await getAllKeys()) {
            yield {
                buffer: key,
                name: `${this.#appName}@${window.location.hostname}`,
                name: `${this.#appName}@${globalThis.location.hostname}`,
            };
        }
    }
+21 −0
Original line number Diff line number Diff line
MIT License

Copyright (c) 2020-2023 Simon Chan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+16 −14
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ export interface LogcatFormatModifiers {
}

export interface LogcatOptions {
    dump?: boolean;
    pid?: number;
    ids?: LogId[];
}
@@ -479,22 +480,23 @@ export class Logcat extends AdbCommandBase {

    binary(options?: LogcatOptions): ReadableStream<AndroidLogEntry> {
        return new WrapReadableStream(async () => {
            const args = ["logcat", "-B"];
            if (options?.dump) {
                args.push("-d");
            }
            if (options?.pid) {
                args.push("--pid", options.pid.toString());
            }
            if (options?.ids) {
                args.push("-b", Logcat.joinLogId(options.ids));
            }

            // TODO: make `spawn` return synchronously with streams pending
            // so it's easier to chain them.
            const { stdout } = await this.adb.subprocess.spawn(
                [
                    "logcat",
                    "-B",
                    ...(options?.pid ? ["--pid", options.pid.toString()] : []),
                    ...(options?.ids
                        ? ["-b", Logcat.joinLogId(options.ids)]
                        : []),
                ],
                {
            const { stdout } = await this.adb.subprocess.spawn(args, {
                // PERF: None protocol is 150% faster then Shell protocol
                protocols: [AdbSubprocessNoneProtocol],
                },
            );
            });
            return stdout;
        }).pipeThrough(
            new BufferedTransformStream((stream) => {