mirror of
https://github.com/chylex/Discord-History-Tracker.git
synced 2024-11-25 14:42:44 +01:00
Compare commits
7 Commits
d4d14cab97
...
8aeb590bb3
Author | SHA1 | Date | |
---|---|---|---|
8aeb590bb3 | |||
8dc1adc9f0 | |||
ddf70b02e7 | |||
ef59fd992e | |||
d044627fac | |||
a624745602 | |||
6da3c185e5 |
@ -2,7 +2,8 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:common="clr-namespace:DHT.Desktop.Common"
|
xmlns:common="clr-namespace:DHT.Desktop.Common"
|
||||||
xmlns:system="clr-namespace:System;assembly=System.Runtime"
|
xmlns:system="clr-namespace:System;assembly=System.Runtime"
|
||||||
x:Class="DHT.Desktop.App">
|
x:Class="DHT.Desktop.App"
|
||||||
|
RequestedThemeVariant="Light">
|
||||||
|
|
||||||
<Application.Styles>
|
<Application.Styles>
|
||||||
|
|
||||||
|
@ -14,13 +14,13 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Avalonia" Version="11.0.5" />
|
<PackageReference Include="Avalonia" Version="11.0.6" />
|
||||||
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.0.5" />
|
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.0.6" />
|
||||||
<PackageReference Include="Avalonia.Controls.ItemsRepeater" Version="11.0.5" />
|
<PackageReference Include="Avalonia.Controls.ItemsRepeater" Version="11.0.6" />
|
||||||
<PackageReference Include="Avalonia.Desktop" Version="11.0.5" />
|
<PackageReference Include="Avalonia.Desktop" Version="11.0.6" />
|
||||||
<PackageReference Include="Avalonia.Diagnostics" Version="11.0.5" Condition=" '$(Configuration)' == 'Debug' " />
|
<PackageReference Include="Avalonia.Diagnostics" Version="11.0.6" Condition=" '$(Configuration)' == 'Debug' " />
|
||||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.5" />
|
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.6" />
|
||||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.5" />
|
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.6" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -1,5 +1,23 @@
|
|||||||
// noinspection JSUnresolvedVariable
|
// noinspection JSUnresolvedVariable
|
||||||
|
// noinspection LocalVariableNamingConventionJS
|
||||||
class DISCORD {
|
class DISCORD {
|
||||||
|
|
||||||
|
// https://discord.com/developers/docs/resources/channel#channel-object-channel-types
|
||||||
|
static CHANNEL_TYPE = {
|
||||||
|
DM: 1,
|
||||||
|
GROUP_DM: 3,
|
||||||
|
ANNOUNCEMENT_THREAD: 10,
|
||||||
|
PUBLIC_THREAD: 11,
|
||||||
|
PRIVATE_THREAD: 12
|
||||||
|
};
|
||||||
|
|
||||||
|
// https://discord.com/developers/docs/resources/channel#message-object-message-types
|
||||||
|
static MESSAGE_TYPE = {
|
||||||
|
DEFAULT: 0,
|
||||||
|
REPLY: 19,
|
||||||
|
THREAD_STARTER: 21
|
||||||
|
};
|
||||||
|
|
||||||
static getMessageOuterElement() {
|
static getMessageOuterElement() {
|
||||||
return DOM.queryReactClass("messagesWrapper");
|
return DOM.queryReactClass("messagesWrapper");
|
||||||
}
|
}
|
||||||
@ -53,7 +71,7 @@ class DISCORD {
|
|||||||
*/
|
*/
|
||||||
const onMessageElementsChangedLater = function() {
|
const onMessageElementsChangedLater = function() {
|
||||||
window.clearTimeout(debounceTimer);
|
window.clearTimeout(debounceTimer);
|
||||||
debounceTimer = window.setTimeout(onMessageElementsChanged, 200);
|
debounceTimer = window.setTimeout(onMessageElementsChanged, 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
const observer = new MutationObserver(function () {
|
const observer = new MutationObserver(function () {
|
||||||
@ -191,8 +209,8 @@ class DISCORD {
|
|||||||
|
|
||||||
// https://discord.com/developers/docs/resources/channel#channel-object-channel-types
|
// https://discord.com/developers/docs/resources/channel#channel-object-channel-types
|
||||||
switch (obj.type) {
|
switch (obj.type) {
|
||||||
case 1: type = "DM"; break;
|
case DISCORD.CHANNEL_TYPE.DM: type = "DM"; break;
|
||||||
case 3: type = "GROUP"; break;
|
case DISCORD.CHANNEL_TYPE.GROUP_DM: type = "GROUP"; break;
|
||||||
default: return null;
|
default: return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,7 +248,7 @@ class DISCORD {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (obj.parent_id) {
|
if (obj.type === DISCORD.CHANNEL_TYPE.ANNOUNCEMENT_THREAD || obj.type === DISCORD.CHANNEL_TYPE.PUBLIC_THREAD || obj.type === DISCORD.CHANNEL_TYPE.PRIVATE_THREAD) {
|
||||||
channel["extra"]["parent"] = obj.parent_id;
|
channel["extra"]["parent"] = obj.parent_id;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -86,12 +86,12 @@ const GUI = (function() {
|
|||||||
<label><input id='dht-cfg-autoscroll' type='checkbox'> Autoscroll</label><br>
|
<label><input id='dht-cfg-autoscroll' type='checkbox'> Autoscroll</label><br>
|
||||||
<br>
|
<br>
|
||||||
<label>After reaching the first message in channel...</label><br>
|
<label>After reaching the first message in channel...</label><br>
|
||||||
${radio("afm", "nothing", "Do Nothing")}
|
${radio("afm", "nothing", "Continue Tracking")}
|
||||||
${radio("afm", "pause", "Pause Tracking")}
|
${radio("afm", "pause", "Pause Tracking")}
|
||||||
${radio("afm", "switch", "Switch to Next Channel")}
|
${radio("afm", "switch", "Switch to Next Channel")}
|
||||||
<br>
|
<br>
|
||||||
<label>After reaching a previously saved message...</label><br>
|
<label>After reaching a previously saved message...</label><br>
|
||||||
${radio("asm", "nothing", "Do Nothing")}
|
${radio("asm", "nothing", "Continue Tracking")}
|
||||||
${radio("asm", "pause", "Pause Tracking")}
|
${radio("asm", "pause", "Pause Tracking")}
|
||||||
${radio("asm", "switch", "Switch to Next Channel")}
|
${radio("asm", "switch", "Switch to Next Channel")}
|
||||||
<p id='dht-cfg-note'>It is recommended to disable link and image previews to avoid putting unnecessary strain on your browser.</p>`;
|
<p id='dht-cfg-note'>It is recommended to disable link and image previews to avoid putting unnecessary strain on your browser.</p>`;
|
||||||
|
@ -177,8 +177,7 @@ const STATE = (function() {
|
|||||||
* @param {DiscordMessage[]} discordMessageArray
|
* @param {DiscordMessage[]} discordMessageArray
|
||||||
*/
|
*/
|
||||||
async addDiscordMessages(discordMessageArray) {
|
async addDiscordMessages(discordMessageArray) {
|
||||||
// https://discord.com/developers/docs/resources/channel#message-object-message-types
|
discordMessageArray = discordMessageArray.filter(msg => (msg.type === DISCORD.MESSAGE_TYPE.DEFAULT || msg.type === DISCORD.MESSAGE_TYPE.REPLY || msg.type === DISCORD.MESSAGE_TYPE.THREAD_STARTER) && msg.state === "SENT");
|
||||||
discordMessageArray = discordMessageArray.filter(msg => (msg.type === 0 || msg.type === 19 || msg.type === 21) && msg.state === "SENT");
|
|
||||||
|
|
||||||
if (discordMessageArray.length === 0) {
|
if (discordMessageArray.length === 0) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
const DISCORD = (function() {
|
const DISCORD = (function() {
|
||||||
const regex = {
|
const regex = {
|
||||||
formatBold: /\*\*([\s\S]+?)\*\*(?!\*)/g,
|
formatBold: /\*\*([\s\S]+?)\*\*(?!\*)/g,
|
||||||
formatItalic: /(.)?([_*])([\s\S]+?)\2(?!\2)/g,
|
formatItalic1: /\*([\s\S]+?)\*(?!\*)/g,
|
||||||
|
formatItalic2: /_([\s\S]+?)_(?!_)\b/g,
|
||||||
formatUnderline: /__([\s\S]+?)__(?!_)/g,
|
formatUnderline: /__([\s\S]+?)__(?!_)/g,
|
||||||
formatStrike: /~~([\s\S]+?)~~(?!~)/g,
|
formatStrike: /~~([\s\S]+?)~~(?!~)/g,
|
||||||
formatCodeInline: /(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/g,
|
formatCodeInline: /(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/g,
|
||||||
@ -48,7 +49,8 @@ const DISCORD = (function() {
|
|||||||
.replace(regex.specialEscapedDouble, full => full.replace(/\\/g, "").replace(/(.)/g, escapeHtmlMatch))
|
.replace(regex.specialEscapedDouble, full => full.replace(/\\/g, "").replace(/(.)/g, escapeHtmlMatch))
|
||||||
.replace(regex.formatBold, "<b>$1</b>")
|
.replace(regex.formatBold, "<b>$1</b>")
|
||||||
.replace(regex.formatUnderline, "<u>$1</u>")
|
.replace(regex.formatUnderline, "<u>$1</u>")
|
||||||
.replace(regex.formatItalic, (full, pre, char, match) => pre === "\\" ? full : (pre || "") + "<i>" + match + "</i>")
|
.replace(regex.formatItalic1, "<i>$1</i>")
|
||||||
|
.replace(regex.formatItalic2, "<i>$1</i>")
|
||||||
.replace(regex.formatStrike, "<s>$1</s>");
|
.replace(regex.formatStrike, "<s>$1</s>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,5 +8,5 @@ using DHT.Utils;
|
|||||||
namespace DHT.Utils;
|
namespace DHT.Utils;
|
||||||
|
|
||||||
static class Version {
|
static class Version {
|
||||||
public const string Tag = "38.0.0.0";
|
public const string Tag = "39.0.0.0";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user