Add constants for app features

This commit is contained in:
Bill Thornton
2025-04-30 17:41:36 -04:00
parent bb810a183a
commit fdcf1b06c3
34 changed files with 211 additions and 129 deletions
+20 -39
View File
@@ -5,6 +5,7 @@ import * as htmlMediaHelper from '../components/htmlMediaHelper';
import * as webSettings from '../scripts/settings/webSettings';
import globalize from '../lib/globalize';
import profileBuilder from '../scripts/browserDeviceProfile';
import { AppFeature } from 'constants/appFeature';
const appName = 'Jellyfin Web';
@@ -169,14 +170,6 @@ function getDeviceName() {
return deviceName;
}
function supportsVoiceInput() {
if (!browser.tv) {
return window.SpeechRecognition || window.webkitSpeechRecognition || window.mozSpeechRecognition || window.oSpeechRecognition || window.msSpeechRecognition;
}
return false;
}
function supportsFullscreen() {
if (browser.tv) {
return false;
@@ -235,77 +228,65 @@ const supportedFeatures = function () {
const features = [];
if (navigator.share) {
features.push('sharing');
features.push(AppFeature.Sharing);
}
if (!browser.edgeUwp && !browser.tv && !browser.xboxOne && !browser.ps4) {
features.push('filedownload');
features.push(AppFeature.FileDownload);
}
if (browser.operaTv || browser.tizen || browser.orsay || browser.web0s) {
features.push('exit');
} else {
features.push('plugins');
features.push(AppFeature.Exit);
}
if (!browser.operaTv && !browser.tizen && !browser.orsay && !browser.web0s && !browser.ps4) {
features.push('externallinks');
features.push('externalpremium');
}
if (!browser.operaTv) {
features.push('externallinkdisplay');
}
if (supportsVoiceInput()) {
features.push('voiceinput');
features.push(AppFeature.ExternalLinks);
}
if (supportsHtmlMediaAutoplay()) {
features.push('htmlaudioautoplay');
features.push('htmlvideoautoplay');
features.push(AppFeature.HtmlAudioAutoplay);
features.push(AppFeature.HtmlVideoAutoplay);
}
if (supportsFullscreen()) {
features.push('fullscreenchange');
features.push(AppFeature.Fullscreen);
}
if (browser.tv || browser.xboxOne || browser.ps4 || browser.mobile || browser.ipad) {
features.push('physicalvolumecontrol');
features.push(AppFeature.PhysicalVolumeControl);
}
if (!browser.tv && !browser.xboxOne && !browser.ps4) {
features.push('remotecontrol');
features.push(AppFeature.RemoteControl);
}
if (!browser.operaTv && !browser.tizen && !browser.orsay && !browser.web0s && !browser.edgeUwp) {
features.push('remotevideo');
features.push(AppFeature.RemoteVideo);
}
features.push('displaylanguage');
features.push('otherapppromotions');
features.push('displaymode');
features.push('targetblank');
features.push('screensaver');
features.push(AppFeature.DisplayLanguage);
features.push(AppFeature.DisplayMode);
features.push(AppFeature.TargetBlank);
features.push(AppFeature.Screensaver);
webSettings.getMultiServer().then(enabled => {
if (enabled) features.push('multiserver');
if (enabled) features.push(AppFeature.MultiServer);
});
if (!browser.orsay && (browser.firefox || browser.ps4 || browser.edge || supportsCue())) {
features.push('subtitleappearancesettings');
features.push(AppFeature.SubtitleAppearance);
}
if (!browser.orsay) {
features.push('subtitleburnsettings');
features.push(AppFeature.SubtitleBurnIn);
}
if (!browser.tv && !browser.ps4 && !browser.xboxOne) {
features.push('fileinput');
features.push(AppFeature.FileInput);
}
if (browser.chrome || browser.edgeChromium) {
features.push('chromecast');
features.push(AppFeature.Chromecast);
}
return features;