Add support for sandbox applications #2178
No reviewers
Labels
No labels
accessibility
app-parity
area: creator
area: daemon
area: design
area: devops
area: discovery
area: docs
area: installer
area: internal
area: livestream
area: performance
area: proposal
area: reposts
area: rewards
area: search
area: security
area: subscriptions
area: sync
area: ux
area: viewer
area: wallet
BEAMER
channel
comments
community PR
consider soon
core team
css
dependencies
electron
Epic
feature request
first-timers-only
good first issue
hacktoberfest
help wanted
hub-dependent
icebox
Invalid
level: 0
level: 1
level: 2
level: 3
level: 4
merge when green
needs: exploration
needs: grooming
needs: priority
needs: repro
needs: tech design
notifications
odysee
on hold
playlists
priority: blocker
priority: high
priority: low
priority: medium
protocol dependent
recsys
redesign
regression
resilience
sdk dependent
Tom's Wishlist
trending
type: bug
type: discussion
type: improvement
type: new feature
type: refactor
type: task
type: testing
unplanned
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: LBRYCommunity/lbry-desktop#2178
Loading…
Reference in a new issue
No description provided.
Delete branch "lbry-format-sandbox"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Can test with
lbry://FriendsOrFood#40b303c6714775a9863c8c1bda97bf396359c0c6
This should be close to final working functionality for this app (minimum functionality, wallet APIs have not been started).
I have investigated WebView and BrowserView, concluding that BrowserView lacks in functionality and may introduce additional security concerns. With the current implementation of WebView, there is no IPC access (I consider this a good thing, since module exploits should be rendered null), as a result I am working on an acceptable IPC channel. I am currently consider WebSocket support for IPC communication as this will be the most platform agnostic communication that also offers adequate API security.
This current implementation has no finalized API channel for packages to request funds from the user. This implementation for the in-app container is final (100% of a static view area is usable for all packages, just like an iframe would provide on other platforms).
Seeing this when I try and run the game
A couple changes/comments.
@ -57,6 +59,7 @@
"mime": "^2.3.1",
"mixpanel-browser": "^2.17.1",
"moment": "^2.22.0",
"node-fetch": "^2.3.0",
We aleady bring in
axios
for fetching in the build process. I'm in favor of usingnode-fetch
for the main process, it might help to dump axios while were adding this.https://github.com/lbryio/lbry-desktop/blob/master/build/downloadDaemon.js#L46
@ -0,0 +6,4 @@
global.window = global;
// eslint-disable-next-line import/no-commonjs,global-require
const { Lbry } = require('lbry-redux');
Does this need to be here? Or could we use
import
and move it to the top, then remove the eslint disable line.@ -0,0 +8,4 @@
// eslint-disable-next-line import/no-commonjs,global-require
const { Lbry } = require('lbry-redux');
delete global.window;
Why delete this?
@ -0,0 +20,4 @@
sandbox.use(`/sandbox/${outpoint}/`, express.static(resolvedPath));
res.send(`/sandbox/${outpoint}/`);
Is this needed?
I'm not able to enter full screen. Is this added?
This endpoint should be a constant
Can this just be replaced with the
this.supportedType()
function?Nevermind, I see it's used down here. It just seems kinda weird having very similar functionality. Maybe
isLbryPackage
can be moved to its own function?@ -0,0 +8,4 @@
// eslint-disable-next-line import/no-commonjs,global-require
const { Lbry } = require('lbry-redux');
delete global.window;
Should never try to emulate window inside Node, can cause side effects with other applications.
This is a patch to force this to work with
lbry-redux
, which I don't need, butLbry
is bundled with it, which I do need so I can make a daemon call for the file list.See line 7. This was grouped (spacing) with line 7. The linter forced my grouping to break.
@ -0,0 +6,4 @@
global.window = global;
// eslint-disable-next-line import/no-commonjs,global-require
const { Lbry } = require('lbry-redux');
Try it with
import
, doesn't work. See my other comment.Not yet, a lot of work needs to be done to make it work with Electron sandboxing.
The request from the sandbox goes through, but there are issues with dynamically sizing content that has already request a WebGL context.
See next comment
If you have logic written out for this, I'm all ears.
See the original line 263, I'm doing this to avoid breaking existing logic.
@ -0,0 +20,4 @@
sandbox.use(`/sandbox/${outpoint}/`, express.static(resolvedPath));
res.send(`/sandbox/${outpoint}/`);
Yes, see
src/renderer/component/fileViewer/internal/player.jsx
, it uses the response to know where to go when the sandbox is ready.@ -57,6 +59,7 @@
"mime": "^2.3.1",
"mixpanel-browser": "^2.17.1",
"moment": "^2.22.0",
"node-fetch": "^2.3.0",
I am in favor of this, do we want to do this now? (upcoming release, at the edge of release)
That entire function could use a rewrite to
async
/await
.This is added so if fullscreen happens, the user can always escape. Nothing is stopping existing apps from requesting it. *It can't be cancelled but it can be exited, Electron team hardcoded the events.
@ -57,6 +59,7 @@
"mime": "^2.3.1",
"mixpanel-browser": "^2.17.1",
"moment": "^2.22.0",
"node-fetch": "^2.3.0",
I think we might as well do it now. the
async/await
stuff might add a lot of work though. It should be super simple to swap axios for fetch indownloadDaemon.js
This looks good (pending removal of axios). Lets wait until the release to merge this.
@ -11,7 +11,10 @@ import LoadingScreen from 'component/common/loading-screen';
class MediaPlayer extends React.PureComponent {
static MP3_CONTENT_TYPES = ['audio/mpeg3', 'audio/mpeg'];
static SANDBOX_TYPES = ['application/x-lbry', 'application/x-ext-lbry'];
This is the most/only objectionable part for me. I would still strongly like to seek a way of triggering this behavior that does not require switching on a custom media type. This is not me saying a custom media type is wrong; it is me saying that only being able to trigger to the sandbox behavior via media type is wrong.
Please at least file/determine what metadata and sdk changes need to happen to facilitate this behavior without requiring this. @eukreign @lyoshenka
@ -11,7 +11,10 @@ import LoadingScreen from 'component/common/loading-screen';
class MediaPlayer extends React.PureComponent {
static MP3_CONTENT_TYPES = ['audio/mpeg3', 'audio/mpeg'];
static SANDBOX_TYPES = ['application/x-lbry', 'application/x-ext-lbry'];
There is a W3C proposal for something that seems very similar to
.lbry
, could we use that proposal instead of having our own?Proposal: https://github.com/WICG/webpackage
The extension suggested in that proposal is
.wpk
:https://github.com/WICG/webpackage/blob/master/draft-yasskin-dispatch-web-packaging.md#internet-media-type-registration
@ -11,7 +11,10 @@ import LoadingScreen from 'component/common/loading-screen';
class MediaPlayer extends React.PureComponent {
static MP3_CONTENT_TYPES = ['audio/mpeg3', 'audio/mpeg'];
static SANDBOX_TYPES = ['application/x-lbry', 'application/x-ext-lbry'];
A lot that makes sense, but it's a proposal 19 years in the making with zero adoption and no working tools.
I will reach out to the current maintainer.