mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-11 12:15:44 +02:00
Delay the apocalypse (freeze TweetDeck JS resources, force update checking)
This commit is contained in:
parent
30a169171a
commit
e065983c95
Core
Resources/Scripts
Updates
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user