diff --git a/Core/FormBrowser.cs b/Core/FormBrowser.cs index b00d783a..a4fa7e62 100644 --- a/Core/FormBrowser.cs +++ b/Core/FormBrowser.cs @@ -393,7 +393,7 @@ public void OpenSettings(Type startTab){ FormSettings form = new FormSettings(this, plugins, updates, analytics, startTab); form.FormClosed += (sender, args) => { - if (!prevEnableUpdateCheck && Config.EnableUpdateCheck){ + if (!prevEnableUpdateCheck && Config.EnableUpdateCheck && !UpdateHandler.TemporarilyForceUpdateChecking){ Config.DismissedUpdate = null; Config.Save(); diff --git a/Core/Handling/RequestHandlerBrowser.cs b/Core/Handling/RequestHandlerBrowser.cs index 3765af74..42f6c5ca 100644 --- a/Core/Handling/RequestHandlerBrowser.cs +++ b/Core/Handling/RequestHandlerBrowser.cs @@ -1,8 +1,11 @@ -using CefSharp; +using System.Text.RegularExpressions; +using CefSharp; using TweetDuck.Core.Utils; namespace TweetDuck.Core.Handling{ sealed class RequestHandlerBrowser : RequestHandlerBase{ + private static readonly Regex TmpResourceRedirect = new Regex(@"dist\/(.*?)\.(.*?)\.js$", RegexOptions.Compiled); + public string BlockNextUserNavUrl { get; set; } public RequestHandlerBrowser() : base(true){} @@ -31,6 +34,30 @@ public override bool OnResourceResponse(IWebBrowser browserControl, IBrowser bro request.Url = TwitterUtils.LoadingSpinner.Url; return true; } + else if (request.ResourceType == ResourceType.Script){ // TODO delaying the apocalypse + Match match = TmpResourceRedirect.Match(request.Url); + + if (match.Success){ + string scriptType = match.Groups[1].Value; + string scriptHash = match.Groups[2].Value; + + const string HashBundle = "1bd75b5854"; + const string HashVendor = "942c0a20e8"; + + if (scriptType == "bundle" && scriptHash != HashBundle){ + request.Url = TmpResourceRedirect.Replace(request.Url, "dist/$1."+HashBundle+".js"); + System.Diagnostics.Debug.WriteLine("rewriting "+scriptType+" to "+request.Url); + return true; + } + else if (scriptType == "vendor" && scriptHash != HashVendor){ + request.Url = TmpResourceRedirect.Replace(request.Url, "dist/$1."+HashVendor+".js"); + System.Diagnostics.Debug.WriteLine("rewriting "+scriptType+" to "+request.Url); + return true; + } + + System.Diagnostics.Debug.WriteLine("accepting "+scriptType+" as "+request.Url); + } + } return base.OnResourceResponse(browserControl, browser, frame, request, response); } diff --git a/Resources/Scripts/code.js b/Resources/Scripts/code.js index 53201397..4488d15f 100644 --- a/Resources/Scripts/code.js +++ b/Resources/Scripts/code.js @@ -398,6 +398,8 @@ let menu = $(".js-dropdown-content").children("ul").first(); return if menu.length === 0; + menu.find(".update-available-item").parent().remove(); // TODO temp + let button = $('<li class="is-selectable" data-tweetduck><a href="#" data-action>TweetDuck</a></li>'); button.insertBefore(menu.children(".drp-h-divider").last()); @@ -1520,10 +1522,17 @@ // // Block: Disable default TweetDeck update notification. // - onAppReady.push(function(){ + $(document).on("uiSuggestRefreshToggle", function(e){ + e.stopPropagation(); + e.stopImmediatePropagation(); + }); + + /*onAppReady.push(function(){ let events = $._data(document, "events"); delete events["uiSuggestRefreshToggle"]; - }); + + //$(".js-app-settings .icon-settings").removeClass("color-twitter-yellow"); // TODO temp + });*/ // // Block: Disable TweetDeck metrics. diff --git a/Resources/Scripts/update.js b/Resources/Scripts/update.js index 08444ef4..b85cce1e 100644 --- a/Resources/Scripts/update.js +++ b/Resources/Scripts/update.js @@ -164,7 +164,7 @@ <div class='tdu-buttons'> <button class='tdu-btn-download'>Update now</button> <button class='tdu-btn-later'>Remind me later</button> - <button class='tdu-btn-ignore'>Ignore this update</button> + <!-- TODO <button class='tdu-btn-ignore'>Ignore this update</button>--> </div> </div> `).appendTo(document.body).css("display", existed ? "block" : "none"); diff --git a/Updates/UpdateHandler.cs b/Updates/UpdateHandler.cs index d9463d0a..3b857398 100644 --- a/Updates/UpdateHandler.cs +++ b/Updates/UpdateHandler.cs @@ -10,6 +10,8 @@ namespace TweetDuck.Updates{ sealed class UpdateHandler : IDisposable{ + public const bool TemporarilyForceUpdateChecking = true; + public const int CheckCodeUpdatesDisabled = -1; public const int CheckCodeNotOnTweetDeck = -2; @@ -53,7 +55,7 @@ public void StartTimer(){ timer.Stop(); - if (Program.UserConfig.EnableUpdateCheck){ + if (Program.UserConfig.EnableUpdateCheck || TemporarilyForceUpdateChecking){ DateTime now = DateTime.Now; TimeSpan nextHour = now.AddSeconds(60*(60-now.Minute)-now.Second)-now; @@ -67,7 +69,7 @@ public void StartTimer(){ } public int Check(bool force){ - if (Program.UserConfig.EnableUpdateCheck || force){ + if (Program.UserConfig.EnableUpdateCheck || TemporarilyForceUpdateChecking || force){ if (!browser.IsTweetDeckWebsite){ return CheckCodeNotOnTweetDeck; }