mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-08 08:39:59 +00:00
TSLint compliance
This commit is contained in:
@@ -56,7 +56,7 @@ export default new class StatusManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public * getReceivers() {
|
public *getReceivers () {
|
||||||
for (const [, receiver ] of this.receivers) {
|
for (const [, receiver ] of this.receivers) {
|
||||||
if (receiver.status && receiver.status.application
|
if (receiver.status && receiver.status.application
|
||||||
&& receiver.status.volume) {
|
&& receiver.status.volume) {
|
||||||
|
|||||||
@@ -45,23 +45,9 @@ browser.runtime.onInstalled.addListener(async details => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function initBrowserAction () {
|
async function initBrowserAction () {
|
||||||
logger.info("init (browser action)");
|
logger.info("init (browser action)");
|
||||||
|
|
||||||
/*browser.browserAction.disable();
|
|
||||||
|
|
||||||
function onServiceChange () {
|
|
||||||
if (StatusManager.getReceivers().length) {
|
|
||||||
browser.browserAction.enable();
|
|
||||||
} else {
|
|
||||||
browser.browserAction.disable();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
StatusManager.addEventListener("serviceUp", onServiceChange);
|
|
||||||
StatusManager.addEventListener("serviceDown", onServiceChange);*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When the browser action is clicked, open a receiver
|
* When the browser action is clicked, open a receiver
|
||||||
* selector and load a sender for the response. The
|
* selector and load a sender for the response. The
|
||||||
@@ -463,7 +449,7 @@ async function initRequestListener () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function initWhitelist () {
|
async function initWhitelist () {
|
||||||
logger.info("init (whitelist)");
|
logger.info("init (whitelist)");
|
||||||
|
|
||||||
type OnBeforeSendHeadersDetails = Parameters<Parameters<
|
type OnBeforeSendHeadersDetails = Parameters<Parameters<
|
||||||
@@ -476,9 +462,6 @@ function initWhitelist () {
|
|||||||
* to reflect this on whitelisted sites.
|
* to reflect this on whitelisted sites.
|
||||||
*/
|
*/
|
||||||
async function onBeforeSendHeaders (details: OnBeforeSendHeadersDetails) {
|
async function onBeforeSendHeaders (details: OnBeforeSendHeadersDetails) {
|
||||||
const { os } = await browser.runtime.getPlatformInfo();
|
|
||||||
const chromeUserAgent = getChromeUserAgent(os);
|
|
||||||
|
|
||||||
if (!details.requestHeaders) {
|
if (!details.requestHeaders) {
|
||||||
throw logger.error("OnBeforeSendHeaders handler details missing requestHeaders.");
|
throw logger.error("OnBeforeSendHeaders handler details missing requestHeaders.");
|
||||||
}
|
}
|
||||||
@@ -487,6 +470,8 @@ function initWhitelist () {
|
|||||||
header => header.name === "Host");
|
header => header.name === "Host");
|
||||||
|
|
||||||
for (const header of details.requestHeaders) {
|
for (const header of details.requestHeaders) {
|
||||||
|
const { os } = await browser.runtime.getPlatformInfo();
|
||||||
|
|
||||||
if (header.name.toLowerCase() === "user-agent") {
|
if (header.name.toLowerCase() === "user-agent") {
|
||||||
/**
|
/**
|
||||||
* New YouTube breaks without the default user agent string,
|
* New YouTube breaks without the default user agent string,
|
||||||
@@ -497,7 +482,7 @@ function initWhitelist () {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
header.value = chromeUserAgent;
|
header.value = getChromeUserAgent(os);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -526,7 +511,7 @@ function initWhitelist () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Register on first run
|
// Register on first run
|
||||||
registerUserAgentWhitelist();
|
await registerUserAgentWhitelist();
|
||||||
|
|
||||||
// Re-register when options change
|
// Re-register when options change
|
||||||
options.addEventListener("changed", ev => {
|
options.addEventListener("changed", ev => {
|
||||||
@@ -559,7 +544,7 @@ async function initMediaOverlay () {
|
|||||||
, runAt: "document_start"
|
, runAt: "document_start"
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error("Failed to register media overlay")
|
logger.error("Failed to register media overlay");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -577,7 +562,7 @@ async function initMediaOverlay () {
|
|||||||
await unregisterMediaOverlayContentScript();
|
await unregisterMediaOverlayContentScript();
|
||||||
await registerMediaOverlayContentScript();
|
await registerMediaOverlayContentScript();
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -601,16 +586,13 @@ async function init () {
|
|||||||
|
|
||||||
isInitialized = true;
|
isInitialized = true;
|
||||||
|
|
||||||
|
await StatusManager.init();
|
||||||
|
await ShimManager.init();
|
||||||
|
|
||||||
await initMenus();
|
await initMenus();
|
||||||
await initRequestListener();
|
await initRequestListener();
|
||||||
await initWhitelist();
|
await initWhitelist();
|
||||||
await initMediaOverlay();
|
await initMediaOverlay();
|
||||||
|
|
||||||
await StatusManager.init();
|
|
||||||
await ShimManager.init();
|
|
||||||
|
|
||||||
|
|
||||||
await initBrowserAction();
|
await initBrowserAction();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -104,8 +104,8 @@ export default class NativeReceiverSelector
|
|||||||
, i18n_extensionName: _("extensionName")
|
, i18n_extensionName: _("extensionName")
|
||||||
, i18n_castButtonTitle: _("popupCastButtonTitle")
|
, i18n_castButtonTitle: _("popupCastButtonTitle")
|
||||||
, i18n_stopButtonTitle: _("popupStopButtonTitle")
|
, i18n_stopButtonTitle: _("popupStopButtonTitle")
|
||||||
, i18n_mediaTypeApp:
|
, i18n_mediaTypeApp: knownApps[requestedAppId]?.name
|
||||||
knownApps[requestedAppId]?.name ?? _("popupMediaTypeApp")
|
?? _("popupMediaTypeApp")
|
||||||
, i18n_mediaTypeTab: _("popupMediaTypeTab")
|
, i18n_mediaTypeTab: _("popupMediaTypeTab")
|
||||||
, i18n_mediaTypeScreen: _("popupMediaTypeScreen")
|
, i18n_mediaTypeScreen: _("popupMediaTypeScreen")
|
||||||
, i18n_mediaTypeFile: _("popupMediaTypeFile")
|
, i18n_mediaTypeFile: _("popupMediaTypeFile")
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export default async function loadSender (opts: LoadSenderOptions) {
|
|||||||
const shim = ShimManager.getShim(opts.tabId, opts.frameId);
|
const shim = ShimManager.getShim(opts.tabId, opts.frameId);
|
||||||
if (!shim) {
|
if (!shim) {
|
||||||
throw logger.error(`Shim not found at tabId ${
|
throw logger.error(`Shim not found at tabId ${
|
||||||
opts.tabId} / frameId ${opts.frameId}`)
|
opts.tabId} / frameId ${opts.frameId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
shim.contentPort.postMessage({
|
shim.contentPort.postMessage({
|
||||||
|
|||||||
@@ -3,15 +3,17 @@
|
|||||||
export class Logger {
|
export class Logger {
|
||||||
constructor (private prefix: string) {}
|
constructor (private prefix: string) {}
|
||||||
|
|
||||||
log (message: string, data?: any) {
|
public log (message: string, data?: any) {
|
||||||
const formattedMessage = `${this.prefix} (Log): ${message}`;
|
const formattedMessage = `${this.prefix} (Log): ${message}`;
|
||||||
if (data) {
|
if (data) {
|
||||||
|
// tslint:disable-next-line:no-console
|
||||||
console.log(formattedMessage, data);
|
console.log(formattedMessage, data);
|
||||||
} else {
|
} else {
|
||||||
|
// tslint:disable-next-line:no-console
|
||||||
console.log(formattedMessage);
|
console.log(formattedMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
info (message: string, data?: any) {
|
public info (message: string, data?: any) {
|
||||||
const formattedMessage = `${this.prefix} (Info): ${message}`;
|
const formattedMessage = `${this.prefix} (Info): ${message}`;
|
||||||
if (data) {
|
if (data) {
|
||||||
console.info(formattedMessage, data);
|
console.info(formattedMessage, data);
|
||||||
@@ -19,7 +21,7 @@ export class Logger {
|
|||||||
console.info(formattedMessage);
|
console.info(formattedMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
error (message: string, data?: any) {
|
public error (message: string, data?: any) {
|
||||||
const formattedMessage = `${this.prefix} (Error): ${message}`;
|
const formattedMessage = `${this.prefix} (Error): ${message}`;
|
||||||
if (data) {
|
if (data) {
|
||||||
console.error(formattedMessage, data);
|
console.error(formattedMessage, data);
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ export default new class extends TypedEventTarget<EventMap> {
|
|||||||
* Returns storage promise.
|
* Returns storage promise.
|
||||||
*/
|
*/
|
||||||
public async setAll (options: Options): Promise<void> {
|
public async setAll (options: Options): Promise<void> {
|
||||||
return storageArea.set({ options })
|
return storageArea.set({ options });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export class TypedStorageArea<Schema extends { [key: string]: any }> {
|
|||||||
/**
|
/**
|
||||||
* Retrieves one or more items from the storage area.
|
* Retrieves one or more items from the storage area.
|
||||||
*
|
*
|
||||||
* @param keys -
|
* @param keys -
|
||||||
* A string, array of strings or partial schema object
|
* A string, array of strings or partial schema object
|
||||||
* (with default values) indicating which keys to retrieve
|
* (with default values) indicating which keys to retrieve
|
||||||
* from storage.
|
* from storage.
|
||||||
@@ -24,7 +24,7 @@ export class TypedStorageArea<Schema extends { [key: string]: any }> {
|
|||||||
public async get<SchemaKey extends keyof Schema
|
public async get<SchemaKey extends keyof Schema
|
||||||
, SchemaPartial extends Partial<Schema>> (
|
, SchemaPartial extends Partial<Schema>> (
|
||||||
keys?: SchemaKey
|
keys?: SchemaKey
|
||||||
| Array<SchemaKey>
|
| SchemaKey[]
|
||||||
| SchemaPartial
|
| SchemaPartial
|
||||||
| null | undefined)
|
| null | undefined)
|
||||||
: Promise<Pick<Schema, Extract<
|
: Promise<Pick<Schema, Extract<
|
||||||
@@ -37,12 +37,12 @@ export class TypedStorageArea<Schema extends { [key: string]: any }> {
|
|||||||
* Gets the amount of storage space — in bytes — used by one
|
* Gets the amount of storage space — in bytes — used by one
|
||||||
* or more items in the storage area.
|
* or more items in the storage area.
|
||||||
*
|
*
|
||||||
* @param keys -
|
* @param keys -
|
||||||
* A string or array of strings indicating the keys of
|
* A string or array of strings indicating the keys of
|
||||||
* which to get the storage space.
|
* which to get the storage space.
|
||||||
*/
|
*/
|
||||||
public async getBytesInUse<SchemaKey extends keyof Schema> (
|
public async getBytesInUse<SchemaKey extends keyof Schema> (
|
||||||
keys?: Schema | Array<SchemaKey>): Promise<number> {
|
keys?: Schema | SchemaKey[]): Promise<number> {
|
||||||
|
|
||||||
return await this.storageArea.getBytesInUse(keys);
|
return await this.storageArea.getBytesInUse(keys);
|
||||||
}
|
}
|
||||||
@@ -61,12 +61,12 @@ export class TypedStorageArea<Schema extends { [key: string]: any }> {
|
|||||||
/**
|
/**
|
||||||
* Removes one or more items from the storage area.
|
* Removes one or more items from the storage area.
|
||||||
*
|
*
|
||||||
* @param keys -
|
* @param keys -
|
||||||
* A string or array of strings indicating which keys to
|
* A string or array of strings indicating which keys to
|
||||||
* remove from storage.
|
* remove from storage.
|
||||||
*/
|
*/
|
||||||
public async remove<SchemaKey extends keyof Schema> (
|
public async remove<SchemaKey extends keyof Schema> (
|
||||||
keys: SchemaKey | Array<SchemaKey>): Promise<void> {
|
keys: SchemaKey | SchemaKey[]): Promise<void> {
|
||||||
|
|
||||||
await this.storageArea.remove(keys);
|
await this.storageArea.remove(keys);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ const PLATFORM_WIN = "Windows NT 10.0; Win64; x64";
|
|||||||
const PLATFORM_LINUX = "X11; Linux x86_64";
|
const PLATFORM_LINUX = "X11; Linux x86_64";
|
||||||
|
|
||||||
const UA_CHROME = "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36";
|
const UA_CHROME = "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36";
|
||||||
const UA_HYBRID = "Chrome/80.0.3987.87 Gecko/20100101 Firefox/72.0"
|
const UA_HYBRID = "Chrome/80.0.3987.87 Gecko/20100101 Firefox/72.0";
|
||||||
|
|
||||||
export function getChromeUserAgent(platform: string, hybrid = false) {
|
export function getChromeUserAgent (platform: string, hybrid = false) {
|
||||||
let platformComponent: string;
|
let platformComponent: string;
|
||||||
if (platform === "mac") {
|
if (platform === "mac") {
|
||||||
platformComponent = hybrid
|
platformComponent = hybrid
|
||||||
|
|||||||
@@ -91,8 +91,9 @@ function getSession (opts: InitOptions): Promise<cast.Session> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Handle this
|
function sessionListener () {
|
||||||
function sessionListener () {}
|
// TODO: Handle this
|
||||||
|
}
|
||||||
|
|
||||||
function onRequestSessionSuccess (session: cast.Session) {
|
function onRequestSessionSuccess (session: cast.Session) {
|
||||||
resolve(session);
|
resolve(session);
|
||||||
@@ -136,7 +137,7 @@ function getMedia (opts: InitOptions): Promise<cast.media.Media> {
|
|||||||
= await startMediaServer(mediaTitle, port);
|
= await startMediaServer(mediaTitle, port);
|
||||||
|
|
||||||
const baseUrl = new URL(`http://${host}:${port}/`);
|
const baseUrl = new URL(`http://${host}:${port}/`);
|
||||||
mediaUrl = new URL(mediaPath, baseUrl)
|
mediaUrl = new URL(mediaPath, baseUrl);
|
||||||
subtitleUrls = subtitlePaths.map(
|
subtitleUrls = subtitlePaths.map(
|
||||||
path => new URL(path, baseUrl));
|
path => new URL(path, baseUrl));
|
||||||
|
|
||||||
@@ -395,6 +396,7 @@ export async function init (opts: InitOptions) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (await options.get("mediaStopOnUnload")) {
|
if (await options.get("mediaStopOnUnload")) {
|
||||||
|
// tslint:disable-next-line: no-empty
|
||||||
currentSession.stop(() => {}, () => {});
|
currentSession.stop(() => {}, () => {});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export function bindPropertyDescriptor (
|
|||||||
* element and collect them into a property descriptor map.
|
* element and collect them into a property descriptor map.
|
||||||
*/
|
*/
|
||||||
export function clonePropsDescriptor<T> (
|
export function clonePropsDescriptor<T> (
|
||||||
target: T, props: Array<any/*keyof typeof T*/>)
|
target: T, props: any[])
|
||||||
: PropertyDescriptorMap {
|
: PropertyDescriptorMap {
|
||||||
|
|
||||||
return props.reduce<PropertyDescriptorMap>((descriptorMap, prop) => {
|
return props.reduce<PropertyDescriptorMap>((descriptorMap, prop) => {
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ function deepQuerySelector (selector: string): Element | null {
|
|||||||
, XPathResult.ORDERED_NODE_ITERATOR_TYPE);
|
, XPathResult.ORDERED_NODE_ITERATOR_TYPE);
|
||||||
|
|
||||||
let node: Node | null;
|
let node: Node | null;
|
||||||
|
// tslint:disable-next-line: no-conditional-assignment
|
||||||
while (node = result.iterateNext()) {
|
while (node = result.iterateNext()) {
|
||||||
const shadowRoot = getShadowRootFromNode(node);
|
const shadowRoot = getShadowRootFromNode(node);
|
||||||
if (!shadowRoot) {
|
if (!shadowRoot) {
|
||||||
@@ -78,6 +79,7 @@ function deepQuerySelectorAll (selector: string): Node[] {
|
|||||||
const nodes: Node[] = [];
|
const nodes: Node[] = [];
|
||||||
|
|
||||||
let node: Node | null;
|
let node: Node | null;
|
||||||
|
// tslint:disable-next-line: no-conditional-assignment
|
||||||
while (node = result.iterateNext()) {
|
while (node = result.iterateNext()) {
|
||||||
const shadowRoot = getShadowRootFromNode(node);
|
const shadowRoot = getShadowRootFromNode(node);
|
||||||
if (shadowRoot) {
|
if (shadowRoot) {
|
||||||
@@ -361,7 +363,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
const mediaElements = document.querySelectorAll(mediaSelector);
|
const mediaElements = document.querySelectorAll(mediaSelector);
|
||||||
const deepMediaElements = deepQuerySelectorAll(mediaSelector);
|
const deepMediaElements = deepQuerySelectorAll(mediaSelector);
|
||||||
|
|
||||||
for (const mediaElement of [...Array.from(mediaElements), ...deepMediaElements]) {
|
for (const mediaElement of [...mediaElements, ...deepMediaElements]) {
|
||||||
wrapMediaElement(mediaElement as HTMLMediaElement);
|
wrapMediaElement(mediaElement as HTMLMediaElement);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ function sendAppMessage (subject: string, data: any) {
|
|||||||
session.sendMessage(FX_CAST_RECEIVER_APP_NAMESPACE, {
|
session.sendMessage(FX_CAST_RECEIVER_APP_NAMESPACE, {
|
||||||
subject
|
subject
|
||||||
, data
|
, data
|
||||||
}, () => {}, () => {});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -45,7 +45,6 @@ window.addEventListener("beforeunload", () => {
|
|||||||
|
|
||||||
|
|
||||||
async function onRequestSessionSuccess (newSession: cast.Session) {
|
async function onRequestSessionSuccess (newSession: cast.Session) {
|
||||||
|
|
||||||
cast.logMessage("onRequestSessionSuccess");
|
cast.logMessage("onRequestSessionSuccess");
|
||||||
|
|
||||||
session = newSession;
|
session = newSession;
|
||||||
|
|||||||
@@ -295,8 +295,8 @@ export default class Session {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public leave (
|
public leave (
|
||||||
successCallback: SuccessCallback
|
successCallback?: SuccessCallback
|
||||||
, errorCallback: ErrorCallback): void {
|
, errorCallback?: ErrorCallback): void {
|
||||||
|
|
||||||
const id = uuid();
|
const id = uuid();
|
||||||
|
|
||||||
@@ -314,8 +314,8 @@ export default class Session {
|
|||||||
|
|
||||||
public loadMedia (
|
public loadMedia (
|
||||||
loadRequest: LoadRequest
|
loadRequest: LoadRequest
|
||||||
, successCallback: LoadSuccessCallback
|
, successCallback?: LoadSuccessCallback
|
||||||
, errorCallback: ErrorCallback): void {
|
, errorCallback?: ErrorCallback): void {
|
||||||
|
|
||||||
this._sendMediaMessage({
|
this._sendMediaMessage({
|
||||||
type: "LOAD"
|
type: "LOAD"
|
||||||
@@ -372,8 +372,8 @@ export default class Session {
|
|||||||
|
|
||||||
public queueLoad (
|
public queueLoad (
|
||||||
_queueLoadRequest: QueueLoadRequest
|
_queueLoadRequest: QueueLoadRequest
|
||||||
, _successCallback: LoadSuccessCallback
|
, _successCallback?: LoadSuccessCallback
|
||||||
, _errorCallback: ErrorCallback): void {
|
, _errorCallback?: ErrorCallback): void {
|
||||||
|
|
||||||
logger.info("STUB :: Session#queueLoad");
|
logger.info("STUB :: Session#queueLoad");
|
||||||
}
|
}
|
||||||
@@ -399,8 +399,8 @@ export default class Session {
|
|||||||
public sendMessage (
|
public sendMessage (
|
||||||
namespace: string
|
namespace: string
|
||||||
, message: {} | string
|
, message: {} | string
|
||||||
, successCallback: SuccessCallback
|
, successCallback?: SuccessCallback
|
||||||
, errorCallback: ErrorCallback): void {
|
, errorCallback?: ErrorCallback): void {
|
||||||
|
|
||||||
const messageId = uuid();
|
const messageId = uuid();
|
||||||
|
|
||||||
@@ -422,8 +422,8 @@ export default class Session {
|
|||||||
|
|
||||||
public setReceiverMuted (
|
public setReceiverMuted (
|
||||||
muted: boolean
|
muted: boolean
|
||||||
, successCallback: SuccessCallback
|
, successCallback?: SuccessCallback
|
||||||
, errorCallback: ErrorCallback) {
|
, errorCallback?: ErrorCallback) {
|
||||||
|
|
||||||
const volumeId = uuid();
|
const volumeId = uuid();
|
||||||
|
|
||||||
@@ -441,8 +441,8 @@ export default class Session {
|
|||||||
|
|
||||||
public setReceiverVolumeLevel (
|
public setReceiverVolumeLevel (
|
||||||
newLevel: number
|
newLevel: number
|
||||||
, successCallback: SuccessCallback
|
, successCallback?: SuccessCallback
|
||||||
, errorCallback: ErrorCallback): void {
|
, errorCallback?: ErrorCallback): void {
|
||||||
|
|
||||||
const volumeId = uuid();
|
const volumeId = uuid();
|
||||||
|
|
||||||
@@ -459,8 +459,8 @@ export default class Session {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public stop (
|
public stop (
|
||||||
successCallback: SuccessCallback
|
successCallback?: SuccessCallback
|
||||||
, errorCallback: ErrorCallback): void {
|
, errorCallback?: ErrorCallback): void {
|
||||||
|
|
||||||
const stopId = uuid();
|
const stopId = uuid();
|
||||||
|
|
||||||
@@ -478,9 +478,6 @@ export default class Session {
|
|||||||
|
|
||||||
|
|
||||||
private _sendMediaMessage (message: string | {}) {
|
private _sendMediaMessage (message: string | {}) {
|
||||||
this.sendMessage(
|
this.sendMessage("urn:x-cast:com.google.cast.media", message);
|
||||||
"urn:x-cast:com.google.cast.media"
|
|
||||||
, message
|
|
||||||
, () => {}, () => {});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,8 +178,8 @@ export function requestSession (
|
|||||||
|
|
||||||
export function _requestSession (
|
export function _requestSession (
|
||||||
_receiver: Receiver
|
_receiver: Receiver
|
||||||
, successCallback: RequestSessionSuccessCallback
|
, successCallback?: RequestSessionSuccessCallback
|
||||||
, errorCallback: ErrorCallback): void {
|
, errorCallback?: ErrorCallback): void {
|
||||||
|
|
||||||
logger.info("cast._requestSession");
|
logger.info("cast._requestSession");
|
||||||
|
|
||||||
@@ -243,7 +243,7 @@ export function _requestSession (
|
|||||||
const lastSession = sessionList[sessionList.length - 1];
|
const lastSession = sessionList[sessionList.length - 1];
|
||||||
|
|
||||||
if (lastSession.status !== SessionStatus.STOPPED) {
|
if (lastSession.status !== SessionStatus.STOPPED) {
|
||||||
lastSession.stop(createSession, () => {});
|
lastSession.stop(createSession);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
createSession();
|
createSession();
|
||||||
@@ -368,7 +368,7 @@ onMessage(async message => {
|
|||||||
const lastSession = sessionList[sessionList.length - 1];
|
const lastSession = sessionList[sessionList.length - 1];
|
||||||
|
|
||||||
if (lastSession.status !== SessionStatus.STOPPED) {
|
if (lastSession.status !== SessionStatus.STOPPED) {
|
||||||
lastSession.stop(createSession, () => {});
|
lastSession.stop(createSession);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
createSession();
|
createSession();
|
||||||
@@ -417,8 +417,7 @@ onMessage(async message => {
|
|||||||
_requestSession(receiver
|
_requestSession(receiver
|
||||||
, session => {
|
, session => {
|
||||||
apiConfig.sessionListener(session);
|
apiConfig.sessionListener(session);
|
||||||
}
|
});
|
||||||
, () => {});
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -390,7 +390,7 @@ class OptionsApp extends Component<{}, OptionsAppState> {
|
|||||||
{ _("optionsUserAgentWhitelistContent") }
|
{ _("optionsUserAgentWhitelistContent") }
|
||||||
</div>
|
</div>
|
||||||
<div className="option__control">
|
<div className="option__control">
|
||||||
{ this.state.options?.userAgentWhitelist &&
|
{ this.state.options?.userAgentWhitelist &&
|
||||||
<EditableList data={ this.state.options.userAgentWhitelist }
|
<EditableList data={ this.state.options.userAgentWhitelist }
|
||||||
onChange={ this.handleWhitelistChange }
|
onChange={ this.handleWhitelistChange }
|
||||||
itemPattern={ REMOTE_MATCH_PATTERN_REGEX }
|
itemPattern={ REMOTE_MATCH_PATTERN_REGEX }
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ class ReceiverEntry extends Component<ReceiverEntryProps, ReceiverEntryState> {
|
|||||||
showAlternateAction: ev.type === "keydown"
|
showAlternateAction: ev.type === "keydown"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
window.addEventListener("keydown", handleActionKeyEvents);
|
window.addEventListener("keydown", handleActionKeyEvents);
|
||||||
window.addEventListener("keyup", handleActionKeyEvents);
|
window.addEventListener("keyup", handleActionKeyEvents);
|
||||||
|
|||||||
157
package-lock.json
generated
157
package-lock.json
generated
@@ -2,6 +2,26 @@
|
|||||||
"requires": true,
|
"requires": true,
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@babel/code-frame": {
|
||||||
|
"version": "7.8.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz",
|
||||||
|
"integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@babel/highlight": "^7.8.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@babel/highlight": {
|
||||||
|
"version": "7.8.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.8.3.tgz",
|
||||||
|
"integrity": "sha512-PX4y5xQUvy0fnEVHrYOarRPXVWafSjTW9T0Hab8gVIawpl2Sj0ORyrygANq+KjcNlSSTw0YCLSNA8OyZ1I4yEg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"chalk": "^2.0.0",
|
||||||
|
"esutils": "^2.0.2",
|
||||||
|
"js-tokens": "^4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@types/minimist": {
|
"@types/minimist": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.0.tgz",
|
||||||
@@ -53,6 +73,15 @@
|
|||||||
"color-convert": "^1.9.0"
|
"color-convert": "^1.9.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"argparse": {
|
||||||
|
"version": "1.0.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
|
||||||
|
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"sprintf-js": "~1.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"balanced-match": {
|
"balanced-match": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||||
@@ -69,6 +98,12 @@
|
|||||||
"concat-map": "0.0.1"
|
"concat-map": "0.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"builtin-modules": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
|
||||||
|
"integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"chalk": {
|
"chalk": {
|
||||||
"version": "2.4.2",
|
"version": "2.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
||||||
@@ -122,6 +157,12 @@
|
|||||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
|
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"commander": {
|
||||||
|
"version": "2.20.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
||||||
|
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"concat-map": {
|
"concat-map": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||||
@@ -143,12 +184,30 @@
|
|||||||
"clone": "^1.0.2"
|
"clone": "^1.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"diff": {
|
||||||
|
"version": "4.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
|
||||||
|
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"escape-string-regexp": {
|
"escape-string-regexp": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
||||||
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
|
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"esprima": {
|
||||||
|
"version": "4.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
|
||||||
|
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"esutils": {
|
||||||
|
"version": "2.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
|
||||||
|
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"fs-extra": {
|
"fs-extra": {
|
||||||
"version": "8.1.0",
|
"version": "8.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
|
||||||
@@ -234,6 +293,22 @@
|
|||||||
"perfy": "^1.1.5"
|
"perfy": "^1.1.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"js-tokens": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"js-yaml": {
|
||||||
|
"version": "3.13.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz",
|
||||||
|
"integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"argparse": "^1.0.7",
|
||||||
|
"esprima": "^4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"jsonfile": {
|
"jsonfile": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
|
||||||
@@ -300,6 +375,23 @@
|
|||||||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
|
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"mkdirp": {
|
||||||
|
"version": "0.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
|
||||||
|
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"minimist": "0.0.8"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"minimist": {
|
||||||
|
"version": "0.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
||||||
|
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node-emoji": {
|
"node-emoji": {
|
||||||
"version": "1.10.0",
|
"version": "1.10.0",
|
||||||
"resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.10.0.tgz",
|
"resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.10.0.tgz",
|
||||||
@@ -359,6 +451,12 @@
|
|||||||
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
|
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"path-parse": {
|
||||||
|
"version": "1.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
|
||||||
|
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"perfy": {
|
"perfy": {
|
||||||
"version": "1.1.5",
|
"version": "1.1.5",
|
||||||
"resolved": "https://registry.npmjs.org/perfy/-/perfy-1.1.5.tgz",
|
"resolved": "https://registry.npmjs.org/perfy/-/perfy-1.1.5.tgz",
|
||||||
@@ -386,6 +484,15 @@
|
|||||||
"util-deprecate": "~1.0.1"
|
"util-deprecate": "~1.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"resolve": {
|
||||||
|
"version": "1.15.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.1.tgz",
|
||||||
|
"integrity": "sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"path-parse": "^1.0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"restore-cursor": {
|
"restore-cursor": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz",
|
||||||
@@ -447,6 +554,12 @@
|
|||||||
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
|
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"sprintf-js": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
||||||
|
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"string_decoder": {
|
"string_decoder": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
||||||
@@ -483,6 +596,50 @@
|
|||||||
"os-tmpdir": "~1.0.1"
|
"os-tmpdir": "~1.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"tslib": {
|
||||||
|
"version": "1.10.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
|
||||||
|
"integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"tslint": {
|
||||||
|
"version": "6.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/tslint/-/tslint-6.0.0.tgz",
|
||||||
|
"integrity": "sha512-9nLya8GBtlFmmFMW7oXXwoXS1NkrccqTqAtwXzdPV9e2mqSEvCki6iHL/Fbzi5oqbugshzgGPk7KBb2qNP1DSA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@babel/code-frame": "^7.0.0",
|
||||||
|
"builtin-modules": "^1.1.1",
|
||||||
|
"chalk": "^2.3.0",
|
||||||
|
"commander": "^2.12.1",
|
||||||
|
"diff": "^4.0.1",
|
||||||
|
"glob": "^7.1.1",
|
||||||
|
"js-yaml": "^3.13.1",
|
||||||
|
"minimatch": "^3.0.4",
|
||||||
|
"mkdirp": "^0.5.1",
|
||||||
|
"resolve": "^1.3.2",
|
||||||
|
"semver": "^5.3.0",
|
||||||
|
"tslib": "^1.10.0",
|
||||||
|
"tsutils": "^2.29.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"semver": {
|
||||||
|
"version": "5.7.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
|
||||||
|
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tsutils": {
|
||||||
|
"version": "2.29.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz",
|
||||||
|
"integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"tslib": "^1.8.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"typescript": {
|
"typescript": {
|
||||||
"version": "3.7.4",
|
"version": "3.7.4",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.4.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.4.tgz",
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
"minimist": "^1.2.0",
|
"minimist": "^1.2.0",
|
||||||
"selenium-webdriver": "^4.0.0-alpha.5",
|
"selenium-webdriver": "^4.0.0-alpha.5",
|
||||||
"semver": "^6.3.0",
|
"semver": "^6.3.0",
|
||||||
|
"tslint": "^6.0.0",
|
||||||
"typescript": "^3.7.4",
|
"typescript": "^3.7.4",
|
||||||
"uuid": "^3.3.3",
|
"uuid": "^3.3.3",
|
||||||
"ws": "^7.2.1"
|
"ws": "^7.2.1"
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
]
|
]
|
||||||
, "jsRules": false
|
, "jsRules": false
|
||||||
, "rules": {
|
, "rules": {
|
||||||
|
"array-type": [ true, "array-simple" ],
|
||||||
"arrow-parens": false
|
"arrow-parens": false
|
||||||
, "import-spacing": false
|
, "import-spacing": false
|
||||||
, "interface-name": false
|
, "interface-name": false
|
||||||
|
|||||||
Reference in New Issue
Block a user