@@ -0,0 +1,3 @@
|
||||
export const isCompanionApp = (userAgent: string): boolean => {
|
||||
return !!userAgent.match(/Home ?Assistant/);
|
||||
};
|
||||
@@ -3,6 +3,7 @@ import { localize } from '../localize/localize';
|
||||
import { ExtendedHomeAssistant, FrigateCardError } from '../types';
|
||||
import { ViewMedia } from '../view/media';
|
||||
import { errorToConsole } from './basic';
|
||||
import { isCompanionApp } from './companion';
|
||||
import { homeAssistantSignPath } from './ha';
|
||||
|
||||
export const downloadURL = (url: string, filename = 'download'): void => {
|
||||
@@ -11,11 +12,7 @@ export const downloadURL = (url: string, filename = 'download'): void => {
|
||||
const isSameOrigin = new URL(url).origin === window.location.origin;
|
||||
const dataURL = url.startsWith('data:');
|
||||
|
||||
if (
|
||||
navigator.userAgent.startsWith('Home Assistant/') ||
|
||||
navigator.userAgent.startsWith('HomeAssistant/') ||
|
||||
(!isSameOrigin && !dataURL)
|
||||
) {
|
||||
if (isCompanionApp(navigator.userAgent) || (!isSameOrigin && !dataURL)) {
|
||||
// Home Assistant companion apps cannot download files without opening a
|
||||
// new browser window.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user