mirror of
				https://github.com/chylex/Discord-History-Tracker.git
				synced 2025-10-30 17:17:16 +01:00 
			
		
		
		
	Compare commits
	
		
			6 Commits
		
	
	
		
			v35.1
			...
			1a6346677e
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 1a6346677e | |||
| 261be50463 | |||
| f93f5c8fdd | |||
| 039c55eb1e | |||
| a54242de8a | |||
| 578e51dc17 | 
| @@ -51,3 +51,5 @@ Run the `app/build.sh` script, and read the [Distribution](#distribution) sectio | ||||
| #### Distribution | ||||
|  | ||||
| The mentioned build scripts will prepare `Release` builds ready for distribution. Once the script finishes, the `app/bin` folder will contain self-contained executables for each major operating system, and a portable version that works on all other systems but requires .NET 5 to be installed. | ||||
|  | ||||
| Note that when building on Windows, the generated `.zip` files for Linux and Mac will not have correct file permissions, so it will not be possible to run them by double-clicking `DiscordHistoryTracker`. I tried using Python to re-create the archives with correct file permissions, but found that Linux `zip` tools could not see them. The only working solution is building the Windows + portable version on Windows, and Linux + Mac version on Linux. | ||||
|   | ||||
| @@ -34,8 +34,8 @@ | ||||
|  | ||||
|     <StackPanel Margin="20"> | ||||
|         <ScrollViewer MaxHeight="400"> | ||||
|             <ItemsControl Items="{Binding Items}"> | ||||
|                 <ItemsControl.ItemTemplate> | ||||
|             <ItemsRepeater Items="{Binding Items}"> | ||||
|                 <ItemsRepeater.ItemTemplate> | ||||
|                     <DataTemplate> | ||||
|                         <CheckBox IsChecked="{Binding Checked}"> | ||||
|                             <Label> | ||||
| @@ -43,8 +43,8 @@ | ||||
|                             </Label> | ||||
|                         </CheckBox> | ||||
|                     </DataTemplate> | ||||
|                 </ItemsControl.ItemTemplate> | ||||
|             </ItemsControl> | ||||
|                 </ItemsRepeater.ItemTemplate> | ||||
|             </ItemsRepeater> | ||||
|         </ScrollViewer> | ||||
|         <Panel Classes="buttons"> | ||||
|             <WrapPanel Classes="left"> | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| #app-mount > div[class*="app-"] { | ||||
| #app-mount div[class*="app-"] { | ||||
|   margin-bottom: 48px !important; | ||||
| } | ||||
|  | ||||
| @@ -8,6 +8,7 @@ | ||||
|   width: 100%; | ||||
|   height: 48px; | ||||
|   background-color: #fff; | ||||
|   z-index: 1000000; | ||||
| } | ||||
|  | ||||
| #dht-ctrl button { | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|   background-color: #000; | ||||
|   opacity: 0.5; | ||||
|   display: block; | ||||
|   z-index: 1000; | ||||
|   z-index: 1000001; | ||||
| } | ||||
|  | ||||
| #dht-cfg { | ||||
| @@ -20,7 +20,7 @@ | ||||
|   margin-top: -131px; | ||||
|   padding: 8px; | ||||
|   background-color: #fff; | ||||
|   z-index: 1001; | ||||
|   z-index: 1000002; | ||||
| } | ||||
|  | ||||
| #dht-cfg-note { | ||||
|   | ||||
| @@ -1,5 +1,6 @@ | ||||
| using System.Collections.Generic; | ||||
| using System.Collections.Immutable; | ||||
| using System.Diagnostics.CodeAnalysis; | ||||
| using System.Linq; | ||||
| using System.Net; | ||||
| using System.Text.Json; | ||||
| @@ -8,6 +9,7 @@ using DHT.Server.Data; | ||||
| using DHT.Server.Data.Filters; | ||||
| using DHT.Server.Database; | ||||
| using DHT.Server.Service; | ||||
| using DHT.Utils.Collections; | ||||
| using DHT.Utils.Http; | ||||
| using Microsoft.AspNetCore.Http; | ||||
|  | ||||
| @@ -53,12 +55,16 @@ namespace DHT.Server.Endpoints { | ||||
| 			Reactions = json.HasKey("reactions") ? ReadReactions(json.RequireArray("reactions", path + ".reactions"), path + ".reactions[]").ToImmutableArray() : ImmutableArray<Reaction>.Empty | ||||
| 		}; | ||||
|  | ||||
| 		[SuppressMessage("ReSharper", "ConvertToLambdaExpression")] | ||||
| 		private static IEnumerable<Attachment> ReadAttachments(JsonElement.ArrayEnumerator array, string path) => array.Select(ele => new Attachment { | ||||
| 			Id = ele.RequireSnowflake("id", path), | ||||
| 			Name = ele.RequireString("name", path), | ||||
| 			Type = ele.HasKey("type") ? ele.RequireString("type", path) : null, | ||||
| 			Url = ele.RequireString("url", path), | ||||
| 			Size = (ulong) ele.RequireLong("size", path) | ||||
| 		}).DistinctByKeyStable(static attachment => { | ||||
| 			// Some Discord messages have duplicate attachments with the same id for unknown reasons. | ||||
| 			return attachment.Id; | ||||
| 		}); | ||||
|  | ||||
| 		private static IEnumerable<Embed> ReadEmbeds(JsonElement.ArrayEnumerator array, string path) => array.Select(ele => new Embed { | ||||
|   | ||||
							
								
								
									
										18
									
								
								app/Utils/Collections/LinqExtensions.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								app/Utils/Collections/LinqExtensions.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
|  | ||||
| namespace DHT.Utils.Collections { | ||||
| 	public static class LinqExtensions { | ||||
| 		public static IEnumerable<TItem> DistinctByKeyStable<TItem, TKey>(this IEnumerable<TItem> collection, Func<TItem, TKey> getKeyFromItem) where TKey : IEquatable<TKey> { | ||||
| 			HashSet<TKey>? seenKeys = null; | ||||
| 			 | ||||
| 			foreach (var item in collection) { | ||||
| 				seenKeys ??= new HashSet<TKey>(); | ||||
| 				 | ||||
| 				if (seenKeys.Add(getKeyFromItem(item))) { | ||||
| 					yield return item; | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| @@ -7,6 +7,6 @@ using DHT.Utils; | ||||
|  | ||||
| namespace DHT.Utils { | ||||
| 	static class Version { | ||||
| 		public const string Tag = "35.1.0.0"; | ||||
| 		public const string Tag = "35.3.0.0"; | ||||
| 	} | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user