Merge pull request #6109 from fr500/master

remove dropbox
This commit is contained in:
Twinaphex 2018-01-15 04:32:35 +01:00 committed by GitHub
commit de1079497c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 117 deletions

View File

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<base target="_parent" />
<title>RetroArch Web Player</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap core CSS -->
@ -62,6 +62,7 @@
<a class="dropdown-item" href="." data-core="picodrive">PicoDrive</a>
<a class="dropdown-item" href="." data-core="prboom">PrBoom</a>
<a class="dropdown-item" href="." data-core="quicknes">QuickNES</a>
<a class="dropdown-item" href="." data-core="reicast">Reicast</a>
<a class="dropdown-item" href="." data-core="snes9x2002">Snes9x 2002</a>
<a class="dropdown-item" href="." data-core="snes9x2005">Snes9x 2005</a>
<a class="dropdown-item" href="." data-core="snes9x2010">Snes9x 2010</a>

View File

@ -48,7 +48,7 @@ var showError = function(error) {
function cleanupStorage()
{
localStorage.clear();
if (BrowserFS.FileSystem.IndexedDB.isAvailable())
if (BrowserFS.FileSystem.IndexedDB.isAvailable())
{
var req = indexedDB.deleteDatabase("RetroArch");
req.onsuccess = function () {

View File

@ -108,22 +108,6 @@
</div>
</div>
<div class="container">
<div class="row">
<div class="col-sm-12 form-group btn-group text-xs-left p-t-2">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary tooltip-enable" id="lblLocal" onclick="switchStorage('browser')" title="Store content in your browser's cache. May take up space on disk.">
<input type="radio" name="options" id="btnLocal" autocomplete="off" checked >
<span class="fa fa-globe" id="icnLocal"></span> Browser
</input>
</label>
<label class="btn btn-primary tooltip-enable" id="lblDrop" onclick="switchStorage('dropbox')" title="Stores content in a folder under Dropbox storage. Requires a Dropbox account.">
<input type="radio" name="options" id="btnDrop" autocomplete="off">
<span class="fa fa-dropbox" id="icnDrop"></span> Dropbox
</input>
</label>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 form-group btn-group text-xs-center p-t-2">
<div class="card">
@ -134,23 +118,18 @@
</div>
</div>
</div>
<div align="center">
<p>For now, we recommend you use <a href="https://www.google.com/chrome/">Google Chrome</a> for the best possible performance.</p>
<a href="http://www.libretro.com"><img align="center" src="media/libretro-logo.png" /></a>
</div>
<script src="//code.jquery.com/jquery-3.1.0.min.js"></script>
<script src="//rawgit.com/jeresig/jquery.hotkeys/master/jquery.hotkeys.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/tether/1.3.4/js/tether.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.3/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/dropbox.js/0.10.2/dropbox.min.js"></script>
<script src="analytics.js"></script>
<!--script src="//wzrd.in/standalone/browserfs@0.6.1"></script-->
<script src="//web.libretro.com/browserfs.min.js"></script>
<script src="libretro.js"></script>
<div align="center">
<a href="https://www.patreon.com/libretro">
<img src="http://patreon_public_assets.s3.amazonaws.com/sized/becomeAPatronBanner.png" width="350" height"116"></a>
<img src="https://patreon_public_assets.s3.amazonaws.com/sized/becomeAPatronBanner.png" width="350" height="116"></a>
</div>
</body>
</html>

View File

@ -3,48 +3,9 @@
*
* This provides the basic JavaScript for the RetroArch web player.
*/
var client = new Dropbox.Client({ key: "il6e10mfd7pgf8r" });
var BrowserFS = BrowserFS;
var afs;
var showError = function(error) {
switch (error.status) {
case Dropbox.ApiError.INVALID_TOKEN:
// If you're using dropbox.js, the only cause behind this error is that
// the user token expired.
// Get the user through the authentication flow again.
break;
case Dropbox.ApiError.NOT_FOUND:
// The file or folder you tried to access is not in the user's Dropbox.
// Handling this error is specific to your application.
break;
case Dropbox.ApiError.OVER_QUOTA:
// The user is over their Dropbox quota.
// Tell them their Dropbox is full. Refreshing the page won't help.
break;
case Dropbox.ApiError.RATE_LIMITED:
// Too many API requests. Tell the user to try again later.
// Long-term, optimize your code to use fewer API calls.
break;
case Dropbox.ApiError.NETWORK_ERROR:
// An error occurred at the XMLHttpRequest layer.
// Most likely, the user's network connection is down.
// API calls will not succeed until the user gets back online.
break;
case Dropbox.ApiError.INVALID_PARAM:
case Dropbox.ApiError.OAUTH_ERROR:
case Dropbox.ApiError.INVALID_METHOD:
default:
// Caused by a bug in dropbox.js, in your application, or in Dropbox.
// Tell the user an error occurred, ask them to refresh the page.
}
};
function cleanupStorage()
{
localStorage.clear();
@ -65,52 +26,8 @@ function cleanupStorage()
document.getElementById("btnClean").disabled = true;
}
function dropboxInit()
{
document.getElementById("btnDrop").disabled = true;
$('#icnDrop').removeClass('fa-dropbox');
$('#icnDrop').addClass('fa-spinner fa-spin');
client.authDriver(new Dropbox.AuthDriver.Redirect());
client.authenticate({ rememberUser: true }, function(error, client)
{
if (error)
{
return showError(error);
}
dropboxSync(client, dropboxSyncComplete);
});
}
function dropboxSync(dropboxClient, cb)
{
var dbfs = new BrowserFS.FileSystem.Dropbox(dropboxClient);
// Wrap in afsFS.
afs = new BrowserFS.FileSystem.AsyncMirror(
new BrowserFS.FileSystem.InMemory(), dbfs);
afs.initialize(function(err)
{
// Initialize it as the root file system.
//BrowserFS.initialize(afs);
cb();
});
}
function dropboxSyncComplete()
{
$('#icnDrop').removeClass('fa-spinner').removeClass('fa-spin');
$('#icnDrop').addClass('fa-check');
console.log("WEBPLAYER: Dropbox sync successful");
setupFileSystem("dropbox");
preLoadingComplete();
}
function idbfsInit()
{
document.getElementById("btnLocal").disabled = true;
$('#icnLocal').removeClass('fa-globe');
$('#icnLocal').addClass('fa-spinner fa-spin');
var imfs = new BrowserFS.FileSystem.InMemory();
@ -209,7 +126,6 @@ function startRetroArch()
{
$('.webplayer').show();
$('.webplayer-preview').hide();
document.getElementById("btnDrop").disabled = true;
document.getElementById("btnRun").disabled = true;
$('#btnFullscreen').removeClass('disabled');
@ -371,18 +287,11 @@ $(function() {
$('#icnRun').removeClass('fa-spinner').removeClass('fa-spin');
$('#icnRun').addClass('fa-play');
if (localStorage.getItem("backend") == "dropbox")
{
$('#lblDrop').addClass('active');
$('#lblLocal').removeClass('active');
dropboxInit();
}
else
{
$('#lblDrop').removeClass('active');
$('#lblLocal').addClass('active');
idbfsInit();
}
});
});