1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-09-14 19:32:10 +02:00

Compare commits

..

6 Commits

11 changed files with 122 additions and 73 deletions

View File

@@ -393,7 +393,7 @@ namespace TweetDuck.Core{
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();

View File

@@ -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 @@ namespace TweetDuck.Core.Handling{
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);
} }

View File

@@ -19,7 +19,7 @@ namespace TweetDuck{
public const string BrandName = "TweetDuck"; public const string BrandName = "TweetDuck";
public const string Website = "https://tweetduck.chylex.com"; public const string Website = "https://tweetduck.chylex.com";
public const string VersionTag = "1.14.4"; public const string VersionTag = "1.14.4.1";
public static readonly string ProgramPath = AppDomain.CurrentDomain.BaseDirectory; public static readonly string ProgramPath = AppDomain.CurrentDomain.BaseDirectory;
public static readonly bool IsPortable = File.Exists(Path.Combine(ProgramPath, "makeportable")); public static readonly bool IsPortable = File.Exists(Path.Combine(ProgramPath, "makeportable"));

View File

@@ -64,6 +64,8 @@ After the window closes, three installers will be generated inside the `bld/Outp
#### Notes #### Notes
> When opening **Batch Build**, you will also see `x64` and `AnyCPU` configurations. These are visible due to what I consider a Visual Studio bug, and will not work without significant changes to the project. Manually running the `Resources/PostCefUpdate.ps1` PowerShell script modifies the downloaded CefSharp packages, and removes the invalid configurations.
> There is a small chance running `RUN BUILD.bat` immediately shows a resource error. If that happens, close the console window (which terminates all Inno Setup processes and leaves corrupted installers in the output folder), and run it again. > There is a small chance running `RUN BUILD.bat` immediately shows a resource error. If that happens, close the console window (which terminates all Inno Setup processes and leaves corrupted installers in the output folder), and run it again.
> Running `RUN BUILD.bat` uses about 400 MB of RAM due to high compression. You can lower this to about 140 MB by opening `gen_full.iss` and `gen_port.iss`, and changing `LZMADictionarySize=15360` to `LZMADictionarySize=4096`. > Running `RUN BUILD.bat` uses about 400 MB of RAM due to high compression. You can lower this to about 140 MB by opening `gen_full.iss` and `gen_port.iss`, and changing `LZMADictionarySize=15360` to `LZMADictionarySize=4096`.

View File

@@ -541,7 +541,7 @@ ${iconData.map(entry => `#tduck .icon-${entry[0]}:before{content:\"\\f0${entry[1
#tduck .js-docked-compose .js-drawer-close { margin: 20px 0 0 !important } #tduck .js-docked-compose .js-drawer-close { margin: 20px 0 0 !important }
#tduck .search-input-control .icon { font-size: 20px !important; top: -4px !important } #tduck .search-input-control .icon { font-size: 20px !important; top: -4px !important }
.column-type-icon { margin-top: -1px !important } .js-column-header .column-type-icon { margin-top: -1px !important }
.inline-reply .pull-left .Button--link { margin-top: 3px !important } .inline-reply .pull-left .Button--link { margin-top: 3px !important }
.tweet-action-item .icon-favorite-toggle { font-size: 16px !important; } .tweet-action-item .icon-favorite-toggle { font-size: 16px !important; }

View File

@@ -1,18 +1,60 @@
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
$MainProj = "..\TweetDuck.csproj" try{
$BrowserProj = "..\subprocess\TweetDuck.Browser.csproj" $mainProj = "..\TweetDuck.csproj"
$browserProj = "..\subprocess\TweetDuck.Browser.csproj"
$Match = Select-String -Path $MainProj '<Import Project="packages\\cef\.redist\.x86\.(.*?)\\' $cefMatch = Select-String -Path $mainProj '<Import Project="packages\\cef\.redist\.x86\.(.*?)\\'
$Version = $Match.Matches[0].Groups[1].Value $cefVersion = $cefMatch.Matches[0].Groups[1].Value
Copy-Item "..\packages\cef.redist.x86.${Version}\CEF\devtools_resources.pak" -Destination "..\bld\Resources\" -Force $sharpMatch = Select-String -Path $mainProj '<Import Project="packages\\CefSharp\.Common\.(.*?)\\'
$sharpVersion = $sharpMatch.Matches[0].Groups[1].Value
$Match = Select-String -Path $MainProj '<Import Project="packages\\CefSharp\.Common\.(.*?)\\' $propsFiles = "..\packages\CefSharp.Common.${sharpVersion}\build\CefSharp.Common.props",
$Version = $Match.Matches[0].Groups[1].Value "..\packages\CefSharp.WinForms.${sharpVersion}\build\CefSharp.WinForms.props"
$Contents = [IO.File]::ReadAllText($BrowserProj) # Greetings
$Contents = $Contents -Replace '(?<=<HintPath>\.\.\\packages\\CefSharp\.Common\.)(.*?)(?=\\)', $Version
$Contents = $Contents -Replace '(?<=<Reference Include="CefSharp\.BrowserSubprocess\.Core, Version=)(\d+)', $Version.Split(".")[0]
[IO.File]::WriteAllText($BrowserProj, $Contents) $title = "CEF ${cefVersion}, CefSharp ${sharpVersion}"
Write-Host ("-" * $title.Length)
Write-Host $title
Write-Host ("-" * $title.Length)
# Perform update
Write-Host "Copying dev tools to repository..."
Copy-Item "..\packages\cef.redist.x86.${cefVersion}\CEF\devtools_resources.pak" -Destination "..\bld\Resources\" -Force
Write-Host "Updating browser subprocess reference..."
$contents = [IO.File]::ReadAllText($browserProj)
$contents = $contents -Replace '(?<=<HintPath>\.\.\\packages\\CefSharp\.Common\.)(.*?)(?=\\)', $sharpVersion
$contents = $contents -Replace '(?<=<Reference Include="CefSharp\.BrowserSubprocess\.Core, Version=)(\d+)', $sharpVersion.Split(".")[0]
[IO.File]::WriteAllText($browserProj, $contents)
Write-Host "Removing x64 and AnyCPU from CefSharp props..."
foreach($file in $propsFiles){
$contents = [IO.File]::ReadAllText($file)
$contents = $contents -Replace '(?<=<When Condition=")(''\$\(Platform\)'' == ''(AnyCPU|x64)'')(?=">)', 'false'
[IO.File]::WriteAllText($file, $contents)
}
# Finished
Write-Host ""
Write-Host "Finished. Exiting in 6 seconds..."
Start-Sleep -Seconds 6
}catch{
Write-Host ""
Write-Host "Encountered an error while running PostBuild.ps1 on line" $_.InvocationInfo.ScriptLineNumber
Write-Host $_
$Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
Exit 1
}

View File

@@ -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());
@@ -526,12 +528,14 @@
obj.profileImageURL = realAvatar; obj.profileImageURL = realAvatar;
obj.url = "https://tweetduck.chylex.com"; obj.url = "https://tweetduck.chylex.com";
obj.entities.url.urls = [{ if (obj.entities && obj.entities.url){
url: obj.url, obj.entities.url.urls = [{
expanded_url: obj.url, url: obj.url,
display_url: "tweetduck.chylex.com", expanded_url: obj.url,
indices: [ 0, 23 ] display_url: "tweetduck.chylex.com",
}]; indices: [ 0, 23 ]
}];
}
} }
else if (e && e.url && e.url.urls && e.url.urls.length && e.url.urls[0].expanded_url){ else if (e && e.url && e.url.urls && e.url.urls.length && e.url.urls[0].expanded_url){
obj.url = e.url.urls[0].expanded_url; obj.url = e.url.urls[0].expanded_url;
@@ -1518,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.

View File

@@ -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");

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="packages\CefSharp.WinForms.66.0.0-CI2629\build\CefSharp.WinForms.props" Condition="Exists('packages\CefSharp.WinForms.66.0.0-CI2629\build\CefSharp.WinForms.props')" /> <Import Project="packages\CefSharp.WinForms.66.0.0-CI2629\build\CefSharp.WinForms.props" Condition="Exists('packages\CefSharp.WinForms.66.0.0-CI2629\build\CefSharp.WinForms.props')" />
<Import Project="packages\CefSharp.Common.66.0.0-CI2629\build\CefSharp.Common.props" Condition="Exists('packages\CefSharp.Common.66.0.0-CI2629\build\CefSharp.Common.props')" /> <Import Project="packages\CefSharp.Common.66.0.0-CI2629\build\CefSharp.Common.props" Condition="Exists('packages\CefSharp.Common.66.0.0-CI2629\build\CefSharp.Common.props')" />
@@ -15,25 +15,8 @@
<AssemblyName>TweetDuck</AssemblyName> <AssemblyName>TweetDuck</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp> <UseVSHostingProcess>false</UseVSHostingProcess>
</NuGetPackageImportStamp> <ApplicationIcon>Resources\icon.ico</ApplicationIcon>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'"> <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<StartArguments>-datafolder TweetDuckDebug</StartArguments> <StartArguments>-datafolder TweetDuckDebug</StartArguments>
@@ -47,23 +30,15 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
<UseVSHostingProcess>false</UseVSHostingProcess>
<LangVersion>7</LangVersion> <LangVersion>7</LangVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Resources\icon.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\x86\Release\</OutputPath> <OutputPath>bin\x86\Release\</OutputPath>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies> <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<DefineConstants>
</DefineConstants>
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
<LangVersion>7</LangVersion> <LangVersion>7</LangVersion>
</PropertyGroup> </PropertyGroup>
@@ -330,11 +305,6 @@
<Compile Include="Updates\Events\UpdateEventArgs.cs" /> <Compile Include="Updates\Events\UpdateEventArgs.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5"> <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible> <Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName> <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
@@ -345,11 +315,6 @@
<ProductName>.NET Framework 3.5 SP1</ProductName> <ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install> <Install>false</Install>
</BootstrapperPackage> </BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.4.5">
<Visible>False</Visible>
<ProductName>Windows Installer 4.5</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Core\FormBrowser.resx"> <EmbeddedResource Include="Core\FormBrowser.resx">

View File

@@ -10,6 +10,8 @@ using Timer = System.Windows.Forms.Timer;
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 @@ namespace TweetDuck.Updates{
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 @@ namespace TweetDuck.Updates{
} }
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;
} }

View File

@@ -1,11 +1,11 @@
namespace Unit.Data namespace Unit.Data.Result
open Xunit open Xunit
open TweetDuck.Data open TweetDuck.Data
open System open System
module TestResult_WithValue = module Result_WithValue =
let result = Result<int>(10) let result = Result<int>(10)
[<Fact>] [<Fact>]
@@ -31,7 +31,7 @@ module TestResult_WithValue =
Assert.Equal(20, result.Select(fun x -> x * 2).Value) Assert.Equal(20, result.Select(fun x -> x * 2).Value)
module TestResult_WithException = module Result_WithException =
let result = Result<int>(IndexOutOfRangeException("bad")) let result = Result<int>(IndexOutOfRangeException("bad"))
[<Fact>] [<Fact>]