diff --git a/dist.zip b/dist.zip index cbbfdedeb..adb031ad1 100644 Binary files a/dist.zip and b/dist.zip differ diff --git a/dist/index.html b/dist/index.html index 9dfc19fd1..4bfac2bd2 100644 --- a/dist/index.html +++ b/dist/index.html @@ -26,6 +26,10 @@ + + + + diff --git a/js/.DS_Store b/js/.DS_Store new file mode 100644 index 000000000..7b0ba57c7 Binary files /dev/null and b/js/.DS_Store differ diff --git a/js/app.js b/js/app.js index 309846633..ac6d67509 100644 --- a/js/app.js +++ b/js/app.js @@ -5,16 +5,42 @@ var appStyles = { }; var App = React.createClass({ getInitialState: function() { - return { - viewingPage: window.location.search === '?settings' ? 'settings' : 'home' + // For now, routes are in format ?page or ?page=args + var match, param, val; + [match, param, val] = window.location.search.match(/\??([^=]*)(?:=(.*))?/); + + if (['settings', 'help', 'start', 'watch', 'report'].indexOf(param) != -1) { + var viewingPage = param; + } else { + var viewingPage = 'home'; } + + return { + viewingPage: viewingPage, + pageArgs: val, + }; }, componentWillMount: function() { lbry.checkNewVersionAvailable(function(isAvailable) { if (isAvailable) { - alert("The version of LBRY you're using is not up to date.\n\n" + - "You'll now be taken to lbry.io, where you can download the latest version."); - window.location = "http://www.lbry.io/" + (navigator.userAgent.indexOf('Mac OS X') != -1 ? 'osx' : 'linux'); + var message = "The version of LBRY you're using is not up to date.\n\n" + + "You'll now be taken to lbry.io, where you can download the latest version."; + + lbry.getVersionInfo(function(versionInfo) { + var maj, min, patch; + [maj, min, patch] = versionInfo.lbrynet_version.split('.'); + + if (versionInfo.os_system == 'Darwin' && maj == 0 && min <= 2 && patch <= 2) { + // On OS X with version <= 0.2.2, we need to notify user to close manually close LBRY + message += "\n\nBefore installing the new version, make sure to exit LBRY, if you started the app " + + "click that LBRY icon in your status bar and choose \"Quit.\""; + } else { + lbry.stop(); + } + + alert(message); + window.location = "http://www.lbry.io/" + (versionInfo.os_system == 'Darwin' ? 'osx' : 'linux'); + }); } }); }, @@ -30,6 +56,14 @@ var App = React.createClass({ var content = ; } else if (this.state.viewingPage == 'settings') { var content = ; + } else if (this.state.viewingPage == 'help') { + var content = ; + } else if (this.state.viewingPage == 'watch') { + var content = ; + } else if (this.state.viewingPage == 'report') { + var content = ; + } else if (this.state.viewingPage == 'start') { + var content = ; } return (
diff --git a/js/component/common.js b/js/component/common.js index 43433638b..c1dd5610e 100644 --- a/js/component/common.js +++ b/js/component/common.js @@ -15,7 +15,8 @@ var Link = React.createClass({ console.log(this.props); var href = this.props.href ? this.props.href : 'javascript:;', icon = this.props.icon ? : '', - className = (this.props.button ? 'button-block button-' + this.props.button : 'button-text'); + className = (this.props.button ? 'button-block button-' + this.props.button : 'button-text') + + (this.props.hidden ? ' hidden' : '') + (this.props.disabled ? ' disabled' : ''); return ( {this.props.icon ? icon : '' } diff --git a/js/lbry.js b/js/lbry.js index 4b216f703..3c8d7a0a8 100644 --- a/js/lbry.js +++ b/js/lbry.js @@ -95,6 +95,18 @@ lbry.search = function(query, callback) lbry.call("search_nametrie", { "search": query }, callback); } +lbry.getStream = function(name, callback) { + lbry.call('get', { 'name': name }, callback); +}; + +lbry.getFileStatus = function(name, callback) { + lbry.call('get_lbry_file', { 'name': name }, callback); +} + +lbry.getVersionInfo = function(callback) { + lbry.call('version', {}, callback); +}; + lbry.checkNewVersionAvailable = function(callback) { lbry.call('version', {}, function() { // If the "version" method is available, we have a daemon new enough to do version checking @@ -107,6 +119,15 @@ lbry.checkNewVersionAvailable = function(callback) { }); } +lbry.reportBug = function(message, callback) { + lbry.call('upload_log', { + name_prefix: 'report', + exclude_previous: false, + force: true, + message: message + }, callback); +} + //utilities lbry.formatCredits = function(amount, precision) { @@ -132,3 +153,7 @@ lbry.imagePath = function(file) { return lbry.rootPath + '/img/' + file; } + +lbry.stop = function(callback) { + lbry.call('stop', {}, callback); +}; diff --git a/js/page/help.js b/js/page/help.js new file mode 100644 index 000000000..c6268a7f7 --- /dev/null +++ b/js/page/help.js @@ -0,0 +1,33 @@ +//@TODO: Customize advice based on OS + +var HelpPage = React.createClass({ + render: function() { + return ( +
+

Troubleshooting

+

Here are the most commonly encountered problems and what to try doing about them

+ +

Nothing seems to start downloading

+

Not all content that you find in the search window is necessarily hosted; LBRY is still young. However, 'wonderfullife' should assuredly be accessible. If you can't download it, and you're not experiencing the below problem, try forwarding ports 4444 and 3333 on your firewall or router.

+ +

Videos have trouble playing

+

This is caused by your video player trying to start the file while it's still empty. Try reloading the page after a few seconds, it should work. You should also see the file appear in the downloads folder configured in your LBRY settings, which is the gear icon at the top of the main menu.

+ +

A real fix for this is underway!

+ +

How do I turn LBRY off?

+

If you're on OS X you can find the app running in the notification area at the top right of your screen; simply click the LBRY icon and choose "Quit."

+ +

On Linux, you'll find a Close button in the menu at the top right of LBRY.

+ +

If you're running LBRY from the command line, you may also close the app with the command "stop-lbrynet-daemon."

+ +

None of this applies to me, or it didn't work

+

Please . Thanks!

+
+ +
+
+ ); + } +}); \ No newline at end of file diff --git a/js/page/home.js b/js/page/home.js index 313e9ee8e..914c24248 100644 --- a/js/page/home.js +++ b/js/page/home.js @@ -87,12 +87,27 @@ var searchRowImgStyle = { var SearchResultRow = React.createClass({ + getInitialState: function() { + return { + downloading: false + } + }, + startDownload: function() { + if (!this.state.downloading) { + this.setState({ + downloading: true + }); + lbry.getStream(this.props.name, (streamInfo) => { + alert('Downloading ' + this.props.title + ' to ' + streamInfo.path); + }); + } + }, render: function() { var displayURI = 'lbry://' + this.props.name; // No support for lbry:// URLs in Windows or on Chrome yet if (/windows|win32/i.test(navigator.userAgent) || (window.chrome && window.navigator.vendor == "Google Inc.")) { - var linkURI = window.location.host + "/view?name=" + this.props.name; + var linkURI = "/?watch=" + this.props.name; } else { var linkURI = displayURI; } @@ -100,7 +115,7 @@ var SearchResultRow = React.createClass({ return (
- Photo for {this.props.title} + {'Photo
@@ -111,7 +126,8 @@ var SearchResultRow = React.createClass({

{this.props.description}

- +
@@ -202,7 +218,7 @@ var Header = React.createClass({ render: function() { return (
- +
@@ -216,12 +232,19 @@ var topBarStyle = { }, balanceStyle = { 'marginRight': '5px' +}, +closeIconStyle = { + 'color': '#ff5155' }; var TopBar = React.createClass({ + onClose: function() { + window.location.href = "?start"; + }, getInitialState: function() { return { - balance: 0 + balance: 0, + showClose: /linux/i.test(navigator.userAgent) // @TODO: find a way to use getVersionInfo() here without messy state management }; }, componentDidMount: function() { @@ -238,7 +261,11 @@ var TopBar = React.createClass({ - + + { ' ' } + + { ' ' } + ); } @@ -253,4 +280,4 @@ var HomePage = React.createClass({
); } -}); \ No newline at end of file +}); diff --git a/js/page/report.js b/js/page/report.js new file mode 100644 index 000000000..ddfb999c4 --- /dev/null +++ b/js/page/report.js @@ -0,0 +1,39 @@ +var ReportPage = React.createClass({ + submitMessage: function() { + if (this._messageArea.value) { + this.setState({ + submitting: true + }); + lbry.reportBug(this._messageArea.value, () => { + this.setState({ + submitting: false + }); + alert("Your bug report has been submitted! Thank you for your feedback."); + }); + this._messageArea.value = ''; + } + }, + getInitialState: function() { + return { + submitting: false, + } + }, + render: function() { + return ( +
+

Report a bug

+
+

Please describe the problem you experienced and any information you think might be useful to us. Links to screenshots are great!

+