mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 17:15:48 +00:00
Merge branch 'development' into pr/1130
This commit is contained in:
commit
14765d8c22
7 changed files with 29 additions and 28 deletions
|
|
@ -23,8 +23,8 @@
|
||||||
// HTML sizes
|
// HTML sizes
|
||||||
@html-width: ~"calc(max(var(--small-viewport-width), var(--dynamic-viewport-width)))";
|
@html-width: ~"calc(max(var(--small-viewport-width), var(--dynamic-viewport-width)))";
|
||||||
@html-height: ~"calc(max(var(--small-viewport-height), var(--dynamic-viewport-height)))";
|
@html-height: ~"calc(max(var(--small-viewport-height), var(--dynamic-viewport-height)))";
|
||||||
@html-standalone-width: ~"calc(max(100%, var(--small-viewport-width)))";
|
@html-standalone-width: ~"calc(max(100%, var(--large-viewport-width)))";
|
||||||
@html-standalone-height: ~"calc(max(100%, var(--small-viewport-height)))";
|
@html-standalone-height: ~"calc(max(100%, var(--large-viewport-height)))";
|
||||||
|
|
||||||
// Safe area insets
|
// Safe area insets
|
||||||
@safe-area-inset-top: env(safe-area-inset-top, 0rem);
|
@safe-area-inset-top: env(safe-area-inset-top, 0rem);
|
||||||
|
|
@ -156,6 +156,7 @@ html {
|
||||||
overscroll-behavior: none;
|
overscroll-behavior: none;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
touch-action: manipulation;
|
touch-action: manipulation;
|
||||||
|
background-color: var(--primary-background-color);
|
||||||
-webkit-tap-highlight-color: transparent;
|
-webkit-tap-highlight-color: transparent;
|
||||||
|
|
||||||
@media (display-mode: standalone) {
|
@media (display-mode: standalone) {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,9 @@ const PlatformProvider = ({ children }: Props) => {
|
||||||
const openExternal = (url: string) => {
|
const openExternal = (url: string) => {
|
||||||
try {
|
try {
|
||||||
const { hostname } = new URL(url);
|
const { hostname } = new URL(url);
|
||||||
const isWhitelisted = WHITELISTED_HOSTS.some((host: string) => hostname.endsWith(host));
|
const isWhitelisted = WHITELISTED_HOSTS.some((host: string) =>
|
||||||
|
hostname === host || hostname.endsWith('.' + host)
|
||||||
|
);
|
||||||
const finalUrl = !isWhitelisted ? `https://www.stremio.com/warning#${encodeURIComponent(url)}` : url;
|
const finalUrl = !isWhitelisted ? `https://www.stremio.com/warning#${encodeURIComponent(url)}` : url;
|
||||||
|
|
||||||
window.open(finalUrl, '_blank');
|
window.open(finalUrl, '_blank');
|
||||||
|
|
|
||||||
|
|
@ -5,24 +5,11 @@ const PropTypes = require('prop-types');
|
||||||
const { useServices } = require('stremio/services');
|
const { useServices } = require('stremio/services');
|
||||||
const LibItem = require('stremio/components/LibItem');
|
const LibItem = require('stremio/components/LibItem');
|
||||||
|
|
||||||
const ContinueWatchingItem = ({ _id, notifications, deepLinks, ...props }) => {
|
const ContinueWatchingItem = ({ _id, notifications, ...props }) => {
|
||||||
const { core } = useServices();
|
const { core } = useServices();
|
||||||
|
|
||||||
const onClick = React.useCallback(() => {
|
|
||||||
if (deepLinks?.metaDetailsVideos ?? deepLinks?.metaDetailsStreams) {
|
|
||||||
window.location = deepLinks?.metaDetailsVideos ?? deepLinks?.metaDetailsStreams;
|
|
||||||
}
|
|
||||||
}, [deepLinks]);
|
|
||||||
|
|
||||||
const onPlayClick = React.useCallback((event) => {
|
|
||||||
event.stopPropagation();
|
|
||||||
if (deepLinks?.player ?? deepLinks?.metaDetailsStreams ?? deepLinks?.metaDetailsVideos) {
|
|
||||||
window.location = deepLinks?.player ?? deepLinks?.metaDetailsStreams ?? deepLinks?.metaDetailsVideos;
|
|
||||||
}
|
|
||||||
}, [deepLinks]);
|
|
||||||
|
|
||||||
const onDismissClick = React.useCallback((event) => {
|
const onDismissClick = React.useCallback((event) => {
|
||||||
event.stopPropagation();
|
event.preventDefault();
|
||||||
if (typeof _id === 'string') {
|
if (typeof _id === 'string') {
|
||||||
core.transport.dispatch({
|
core.transport.dispatch({
|
||||||
action: 'Ctx',
|
action: 'Ctx',
|
||||||
|
|
@ -47,8 +34,6 @@ const ContinueWatchingItem = ({ _id, notifications, deepLinks, ...props }) => {
|
||||||
_id={_id}
|
_id={_id}
|
||||||
posterChangeCursor={true}
|
posterChangeCursor={true}
|
||||||
notifications={notifications}
|
notifications={notifications}
|
||||||
onClick={onClick}
|
|
||||||
onPlayClick={onPlayClick}
|
|
||||||
onDismissClick={onDismissClick}
|
onDismissClick={onDismissClick}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ const LibItem = ({ _id, removable, notifications, watched, ...props }) => {
|
||||||
case 'details':
|
case 'details':
|
||||||
return props.deepLinks && (typeof props.deepLinks.metaDetailsVideos === 'string' || typeof props.deepLinks.metaDetailsStreams === 'string');
|
return props.deepLinks && (typeof props.deepLinks.metaDetailsVideos === 'string' || typeof props.deepLinks.metaDetailsStreams === 'string');
|
||||||
case 'watched':
|
case 'watched':
|
||||||
return props.deepLinks && (typeof props.deepLinks.metaDetailsVideos === 'string' || typeof props.deepLinks.metaDetailsStreams === 'string');
|
return typeof watched !== 'undefined' && props.deepLinks && (typeof props.deepLinks.metaDetailsVideos === 'string' || typeof props.deepLinks.metaDetailsStreams === 'string');
|
||||||
case 'dismiss':
|
case 'dismiss':
|
||||||
return typeof _id === 'string' && props.progress !== null && !isNaN(props.progress) && props.progress > 0;
|
return typeof _id === 'string' && props.progress !== null && !isNaN(props.progress) && props.progress > 0;
|
||||||
case 'remove':
|
case 'remove':
|
||||||
|
|
@ -119,6 +119,16 @@ const LibItem = ({ _id, removable, notifications, watched, ...props }) => {
|
||||||
}
|
}
|
||||||
}, [_id, props.deepLinks, props.optionOnSelect]);
|
}, [_id, props.deepLinks, props.optionOnSelect]);
|
||||||
|
|
||||||
|
const onPlayClick = React.useMemo(() => {
|
||||||
|
if (props.deepLinks && typeof props.deepLinks.player === 'string') {
|
||||||
|
return (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
window.location = props.deepLinks.player;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}, [props.deepLinks]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MetaItem
|
<MetaItem
|
||||||
{...props}
|
{...props}
|
||||||
|
|
@ -126,6 +136,7 @@ const LibItem = ({ _id, removable, notifications, watched, ...props }) => {
|
||||||
newVideos={newVideos}
|
newVideos={newVideos}
|
||||||
options={options}
|
options={options}
|
||||||
optionOnSelect={optionOnSelect}
|
optionOnSelect={optionOnSelect}
|
||||||
|
onPlayClick={onPlayClick}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -18,15 +18,15 @@ const MetaItem = React.memo(({ className, type, name, poster, posterShape, poste
|
||||||
const [menuOpen, onMenuOpen, onMenuClose] = useBinaryState(false);
|
const [menuOpen, onMenuOpen, onMenuClose] = useBinaryState(false);
|
||||||
const href = React.useMemo(() => {
|
const href = React.useMemo(() => {
|
||||||
return deepLinks ?
|
return deepLinks ?
|
||||||
typeof deepLinks.player === 'string' ?
|
|
||||||
deepLinks.player
|
|
||||||
:
|
|
||||||
typeof deepLinks.metaDetailsStreams === 'string' ?
|
typeof deepLinks.metaDetailsStreams === 'string' ?
|
||||||
deepLinks.metaDetailsStreams
|
deepLinks.metaDetailsStreams
|
||||||
:
|
:
|
||||||
typeof deepLinks.metaDetailsVideos === 'string' ?
|
typeof deepLinks.metaDetailsVideos === 'string' ?
|
||||||
deepLinks.metaDetailsVideos
|
deepLinks.metaDetailsVideos
|
||||||
:
|
:
|
||||||
|
typeof deepLinks.player === 'string' ?
|
||||||
|
deepLinks.player
|
||||||
|
:
|
||||||
null
|
null
|
||||||
:
|
:
|
||||||
null;
|
null;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0, user-scalable=no, viewport-fit=cover">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0, user-scalable=no, viewport-fit=cover">
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||||
<meta name="apple-mobile-web-app-title" content="Stremio">
|
<meta name="apple-mobile-web-app-title" content="Stremio">
|
||||||
<link rel="icon" type="image/x-icon" href="<%= htmlWebpackPlugin.options.faviconsPath %>/favicon.ico">
|
<link rel="icon" type="image/x-icon" href="<%= htmlWebpackPlugin.options.faviconsPath %>/favicon.ico">
|
||||||
<link rel="manifest" href="manifest.json" />
|
<link rel="manifest" href="manifest.json" />
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: @padding;
|
padding: @padding;
|
||||||
|
padding-top: calc(@padding + var(--safe-area-inset-top));
|
||||||
height: 100dvh;
|
height: 100dvh;
|
||||||
max-width: 35rem;
|
max-width: 35rem;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
|
@ -28,7 +29,7 @@
|
||||||
.close-button {
|
.close-button {
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 1.3rem;
|
top: calc(1.3rem + var(--safe-area-inset-top));
|
||||||
right: 1.3rem;
|
right: 1.3rem;
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue