temporarily disable lbry-format apps
This commit is contained in:
parent
86414855b1
commit
3eae6f8fdf
1 changed files with 54 additions and 44 deletions
|
@ -1,6 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React, { useState, useEffect } from 'react';
|
import React from 'react';
|
||||||
import LoadingScreen from 'component/common/loading-screen';
|
import Yrbl from 'component/yrbl';
|
||||||
|
// import LoadingScreen from 'component/common/loading-screen';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
source: string,
|
source: string,
|
||||||
|
@ -8,57 +9,66 @@ type Props = {
|
||||||
contentType: string,
|
contentType: string,
|
||||||
};
|
};
|
||||||
|
|
||||||
const SANDBOX_TYPES = ['application/x-lbry', 'application/x-ext-lbry'];
|
// const SANDBOX_TYPES = ['application/x-lbry', 'application/x-ext-lbry'];
|
||||||
|
|
||||||
// This server exists in src/platforms/electron/startSandBox.js
|
// This server exists in src/platforms/electron/startSandBox.js
|
||||||
const SANDBOX_SET_BASE_URL = 'http://localhost:5278/set/';
|
// const SANDBOX_SET_BASE_URL = 'http://localhost:5278/set/';
|
||||||
const SANDBOX_CONTENT_BASE_URL = 'http://localhost:5278';
|
// const SANDBOX_CONTENT_BASE_URL = 'http://localhost:5278';
|
||||||
|
|
||||||
function AppViewer(props: Props) {
|
function AppViewer(props: Props) {
|
||||||
const { claim, contentType } = props;
|
// const { claim, contentType } = props;
|
||||||
const [loading, setLoading] = useState(true);
|
// const [loading, setLoading] = useState(true);
|
||||||
const [appUrl, setAppUrl] = useState(false);
|
// const [appUrl, setAppUrl] = useState(false);
|
||||||
|
|
||||||
const outpoint = `${claim.txid}:${claim.nout}`;
|
// const outpoint = `${claim.txid}:${claim.nout}`;
|
||||||
useEffect(() => {
|
// useEffect(() => {
|
||||||
if (SANDBOX_TYPES.indexOf(contentType) > -1) {
|
// if (SANDBOX_TYPES.indexOf(contentType) > -1) {
|
||||||
fetch(`${SANDBOX_SET_BASE_URL}${outpoint}`)
|
// fetch(`${SANDBOX_SET_BASE_URL}${outpoint}`)
|
||||||
.then(res => res.text())
|
// .then(res => res.text())
|
||||||
.then(url => {
|
// .then(url => {
|
||||||
const appUrl = `${SANDBOX_CONTENT_BASE_URL}${url}`;
|
// const appUrl = `${SANDBOX_CONTENT_BASE_URL}${url}`;
|
||||||
setAppUrl(appUrl);
|
// setAppUrl(appUrl);
|
||||||
setLoading(false);
|
// setLoading(false);
|
||||||
})
|
// })
|
||||||
.catch(err => {
|
// .catch(err => {
|
||||||
setLoading(false);
|
// setLoading(false);
|
||||||
});
|
// });
|
||||||
} else {
|
// } else {
|
||||||
setLoading(false);
|
// setLoading(false);
|
||||||
}
|
// }
|
||||||
}, [outpoint, contentType, setAppUrl, setLoading]);
|
// }, [outpoint, contentType, setAppUrl, setLoading]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="file-render__viewer">
|
<div className="content__cover--disabled">
|
||||||
{!appUrl && (
|
<Yrbl
|
||||||
<LoadingScreen
|
title={__('Sorry')}
|
||||||
status={loading ? __('Almost there') : __('Unable to view this file in the app')}
|
subtitle={__('Games and apps are currently disabled due to potential security concerns.')}
|
||||||
spinner={loading}
|
|
||||||
/>
|
/>
|
||||||
)}
|
|
||||||
{appUrl && (
|
|
||||||
<webview
|
|
||||||
title=""
|
|
||||||
sandbox="allow-scripts allow-forms allow-pointer-lock"
|
|
||||||
src={appUrl}
|
|
||||||
autosize="on"
|
|
||||||
style={{ border: 0, width: '100%', height: '100%' }}
|
|
||||||
useragent="Mozilla/5.0 AppleWebKit/537 Chrome/60 Safari/537"
|
|
||||||
enableremotemodule="false"
|
|
||||||
webpreferences="sandbox=true,contextIsolation=true,webviewTag=false,enableRemoteModule=false,devTools=false"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// return (
|
||||||
|
// <div className="file-render__viewer">
|
||||||
|
// {!appUrl && (
|
||||||
|
// <LoadingScreen
|
||||||
|
// status={loading ? __('Almost there') : __('Unable to view this file in the app')}
|
||||||
|
// spinner={loading}
|
||||||
|
// />
|
||||||
|
// )}
|
||||||
|
// {appUrl && (
|
||||||
|
// <webview
|
||||||
|
// title=""
|
||||||
|
// sandbox="allow-scripts allow-forms allow-pointer-lock"
|
||||||
|
// src={appUrl}
|
||||||
|
// autosize="on"
|
||||||
|
// style={{ border: 0, width: '100%', height: '100%' }}
|
||||||
|
// useragent="Mozilla/5.0 AppleWebKit/537 Chrome/60 Safari/537"
|
||||||
|
// enableremotemodule="false"
|
||||||
|
// webpreferences="sandbox=true,contextIsolation=true,webviewTag=false,enableRemoteModule=false,devTools=false"
|
||||||
|
// />
|
||||||
|
// )}
|
||||||
|
// </div>
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
export default AppViewer;
|
export default AppViewer;
|
||||||
|
|
Loading…
Add table
Reference in a new issue