diff --git a/BeatOn/MainActivity.cs b/BeatOn/MainActivity.cs index c3c22b8..95d0ddd 100644 --- a/BeatOn/MainActivity.cs +++ b/BeatOn/MainActivity.cs @@ -144,7 +144,9 @@ protected override void OnCreate(Bundle savedInstanceState) _browserView= FindViewById(Resource.Id.webView2); _toastInjector = new ToastInjectorWebViewClient(_browserView); _browserView.SetWebViewClient(_toastInjector); - _browserView.Settings.UserAgentString += " BeatOn_Quest/" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); + // _browserView.Settings.UserAgentString += " BeatOn_Quest/" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); + _browserView.Settings.UserAgentString = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36" + + " BeatOn_Quest /" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); _browserView.SetWebChromeClient(new WebChromeClient()); _browserView.Settings.JavaScriptEnabled = true; _browserView.Settings.AllowContentAccess = true; diff --git a/BeatOn/ToastInjectorWebViewClient.cs b/BeatOn/ToastInjectorWebViewClient.cs index 4fadfc4..043d21e 100644 --- a/BeatOn/ToastInjectorWebViewClient.cs +++ b/BeatOn/ToastInjectorWebViewClient.cs @@ -11,6 +11,7 @@ using Android.Webkit; using Android.Widget; using BeatOn.ClientModels; +using Newtonsoft.Json.Linq; namespace BeatOn { @@ -61,6 +62,25 @@ public override bool ShouldOverrideUrlLoading(WebView view, IWebResourceRequest return true; } + else if (lowerUrl.StartsWith("sidequest://bsaber-multi/#")) + { + string dlurls = url.Substring(26) + .Replace("%22,%22", "\",\"") + .Replace("[%22", "[\"") + .Replace("%22]", "\"]"); + + JArray urls = JArray.Parse(dlurls); + + if(urls.Count > 0) + { + for (int i = 0; i < urls.Count; i++) + { + Download?.Invoke(this, (string) urls[i]); + } + return true; + } + + } else if (lowerUrl.StartsWith("beatsaver://")) { string dlurl = url.Substring(12); @@ -74,4 +94,4 @@ public override WebResourceResponse ShouldInterceptRequest(WebView view, IWebRes return base.ShouldInterceptRequest(view, request); } } -} \ No newline at end of file +} diff --git a/frontend/src/app/browser-nav/browser-nav.component.ts b/frontend/src/app/browser-nav/browser-nav.component.ts index cf1db07..cdcbec3 100644 --- a/frontend/src/app/browser-nav/browser-nav.component.ts +++ b/frontend/src/app/browser-nav/browser-nav.component.ts @@ -12,8 +12,9 @@ export class BrowserNavComponent implements OnInit { browserLinks: any[] = [ { title: 'Beast Saber', url: 'https://bsaber.com' }, { title: 'Beat Saver', url: 'https://beatsaver.com' }, + { title: 'SideQuest', url: 'https://sidequestvr.com/#/apps/4' }, { title: 'Google', url: 'https://google.com' }, - { title: 'Mods', url: 'https://github.com/RedBrumbler/BeatOnCustomSabers' }, + // { title: 'Mods', url: 'https://github.com/RedBrumbler/BeatOnCustomSabers' }, ]; @Output() linkSelected = new EventEmitter();