mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-02 02:34:08 +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);
|
FormSettings form = new FormSettings(this, plugins, updates, analytics, startTab);
|
||||||
|
|
||||||
form.FormClosed += (sender, args) => {
|
form.FormClosed += (sender, args) => {
|
||||||
if (!prevEnableUpdateCheck && Config.EnableUpdateCheck){
|
if (!prevEnableUpdateCheck && Config.EnableUpdateCheck && !UpdateHandler.TemporarilyForceUpdateChecking){
|
||||||
Config.DismissedUpdate = null;
|
Config.DismissedUpdate = null;
|
||||||
Config.Save();
|
Config.Save();
|
||||||
|
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
using CefSharp;
|
using System.Text.RegularExpressions;
|
||||||
|
using CefSharp;
|
||||||
using TweetDuck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDuck.Core.Handling{
|
namespace TweetDuck.Core.Handling{
|
||||||
sealed class RequestHandlerBrowser : RequestHandlerBase{
|
sealed class RequestHandlerBrowser : RequestHandlerBase{
|
||||||
|
private static readonly Regex TmpResourceRedirect = new Regex(@"dist\/(.*?)\.(.*?)\.js$", RegexOptions.Compiled);
|
||||||
|
|
||||||
public string BlockNextUserNavUrl { get; set; }
|
public string BlockNextUserNavUrl { get; set; }
|
||||||
|
|
||||||
public RequestHandlerBrowser() : base(true){}
|
public RequestHandlerBrowser() : base(true){}
|
||||||
@ -31,6 +34,30 @@ public override bool OnResourceResponse(IWebBrowser browserControl, IBrowser bro
|
|||||||
request.Url = TwitterUtils.LoadingSpinner.Url;
|
request.Url = TwitterUtils.LoadingSpinner.Url;
|
||||||
return true;
|
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);
|
return base.OnResourceResponse(browserControl, browser, frame, request, response);
|
||||||
}
|
}
|
||||||
|
@ -398,6 +398,8 @@
|
|||||||
let menu = $(".js-dropdown-content").children("ul").first();
|
let menu = $(".js-dropdown-content").children("ul").first();
|
||||||
return if menu.length === 0;
|
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>');
|
let button = $('<li class="is-selectable" data-tweetduck><a href="#" data-action>TweetDuck</a></li>');
|
||||||
button.insertBefore(menu.children(".drp-h-divider").last());
|
button.insertBefore(menu.children(".drp-h-divider").last());
|
||||||
|
|
||||||
@ -1520,10 +1522,17 @@
|
|||||||
//
|
//
|
||||||
// Block: Disable default TweetDeck update notification.
|
// 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");
|
let events = $._data(document, "events");
|
||||||
delete events["uiSuggestRefreshToggle"];
|
delete events["uiSuggestRefreshToggle"];
|
||||||
});
|
|
||||||
|
//$(".js-app-settings .icon-settings").removeClass("color-twitter-yellow"); // TODO temp
|
||||||
|
});*/
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Disable TweetDeck metrics.
|
// Block: Disable TweetDeck metrics.
|
||||||
|
@ -164,7 +164,7 @@
|
|||||||
<div class='tdu-buttons'>
|
<div class='tdu-buttons'>
|
||||||
<button class='tdu-btn-download'>Update now</button>
|
<button class='tdu-btn-download'>Update now</button>
|
||||||
<button class='tdu-btn-later'>Remind me later</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>
|
||||||
</div>
|
</div>
|
||||||
`).appendTo(document.body).css("display", existed ? "block" : "none");
|
`).appendTo(document.body).css("display", existed ? "block" : "none");
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
namespace TweetDuck.Updates{
|
namespace TweetDuck.Updates{
|
||||||
sealed class UpdateHandler : IDisposable{
|
sealed class UpdateHandler : IDisposable{
|
||||||
|
public const bool TemporarilyForceUpdateChecking = true;
|
||||||
|
|
||||||
public const int CheckCodeUpdatesDisabled = -1;
|
public const int CheckCodeUpdatesDisabled = -1;
|
||||||
public const int CheckCodeNotOnTweetDeck = -2;
|
public const int CheckCodeNotOnTweetDeck = -2;
|
||||||
|
|
||||||
@ -53,7 +55,7 @@ public void StartTimer(){
|
|||||||
|
|
||||||
timer.Stop();
|
timer.Stop();
|
||||||
|
|
||||||
if (Program.UserConfig.EnableUpdateCheck){
|
if (Program.UserConfig.EnableUpdateCheck || TemporarilyForceUpdateChecking){
|
||||||
DateTime now = DateTime.Now;
|
DateTime now = DateTime.Now;
|
||||||
TimeSpan nextHour = now.AddSeconds(60*(60-now.Minute)-now.Second)-now;
|
TimeSpan nextHour = now.AddSeconds(60*(60-now.Minute)-now.Second)-now;
|
||||||
|
|
||||||
@ -67,7 +69,7 @@ public void StartTimer(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int Check(bool force){
|
public int Check(bool force){
|
||||||
if (Program.UserConfig.EnableUpdateCheck || force){
|
if (Program.UserConfig.EnableUpdateCheck || TemporarilyForceUpdateChecking || force){
|
||||||
if (!browser.IsTweetDeckWebsite){
|
if (!browser.IsTweetDeckWebsite){
|
||||||
return CheckCodeNotOnTweetDeck;
|
return CheckCodeNotOnTweetDeck;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user