Merge branch 'main' of https://github.com/PluralKit/PluralKit
This commit is contained in:
commit
371d677af1
14
.github/workflows/beta-bot.yml
vendored
14
.github/workflows/beta-bot.yml
vendored
@ -1,14 +0,0 @@
|
||||
name: "Update Beta Bot"
|
||||
on:
|
||||
push:
|
||||
branches: [dev]
|
||||
|
||||
jobs:
|
||||
update-bot:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: "Update Beta Bot"
|
||||
uses: fjogeleit/http-request-action@master
|
||||
with:
|
||||
url: https://api-beta.pluralkit.me/v1/update
|
||||
bearerToken: ${{ secrets.WATCHTOWER_TOKEN }}
|
2
.github/workflows/dashboard.yml
vendored
2
.github/workflows/dashboard.yml
vendored
@ -24,7 +24,7 @@ jobs:
|
||||
with:
|
||||
# https://github.com/docker/build-push-action/issues/378
|
||||
context: .
|
||||
file: Dockerfile.dashboard
|
||||
file: dashboard/Dockerfile
|
||||
push: true
|
||||
tags: |
|
||||
ghcr.io/pluralkit/dashboard:${{ env.BRANCH_NAME }}
|
||||
|
2
.github/workflows/gateway.yml
vendored
2
.github/workflows/gateway.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
||||
with:
|
||||
# https://github.com/docker/build-push-action/issues/378
|
||||
context: .
|
||||
file: Dockerfile.gateway
|
||||
file: gateway/Dockerfile
|
||||
push: true
|
||||
tags: |
|
||||
ghcr.io/pluralkit/gateway:${{ env.BRANCH_NAME }}
|
||||
|
3
.github/workflows/scheduled_tasks.yml
vendored
3
.github/workflows/scheduled_tasks.yml
vendored
@ -5,7 +5,6 @@ on:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'scheduled_tasks/**'
|
||||
- 'Dockerfile.scheduled_tasks'
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
@ -25,7 +24,7 @@ jobs:
|
||||
with:
|
||||
# https://github.com/docker/build-push-action/issues/378
|
||||
context: .
|
||||
file: Dockerfile.scheduled_tasks
|
||||
file: scheduled_tasks/Dockerfile
|
||||
push: true
|
||||
tags: |
|
||||
ghcr.io/pluralkit/scheduled_tasks:${{ env.BRANCH_NAME }}
|
||||
|
@ -23,7 +23,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Google.Protobuf" Version="3.13.0"/>
|
||||
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.32.0" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.37.0" PrivateAssets="All"/>
|
||||
<PackageReference Include="Grpc.Tools" Version="2.47.0" PrivateAssets="all" />
|
||||
<PackageReference Include="Polly" Version="7.2.1"/>
|
||||
<PackageReference Include="Polly.Contrib.WaitAndRetry" Version="1.1.1"/>
|
||||
<PackageReference Include="Serilog" Version="2.10.0"/>
|
||||
|
@ -24,9 +24,9 @@
|
||||
},
|
||||
"Grpc.Tools": {
|
||||
"type": "Direct",
|
||||
"requested": "[2.37.0, )",
|
||||
"resolved": "2.37.0",
|
||||
"contentHash": "cud/urkbw3QoQ8+kNeCy2YI0sHrh7td/1cZkVbH6hDLIXX7zzmJbV/KjYSiqiYtflQf+S5mJPLzDQWScN/QdDg=="
|
||||
"requested": "[2.47.0, )",
|
||||
"resolved": "2.47.0",
|
||||
"contentHash": "nInNoLfT/zR7+0VNIC4Lu5nF8azjTz3KwHB1ckwsYUxvof4uSxIt/LlCKb/NH7GPfXfdvqDDinguPpP5t55nuA=="
|
||||
},
|
||||
"Polly": {
|
||||
"type": "Direct",
|
||||
|
@ -32,7 +32,7 @@
|
||||
<PackageReference Include="App.Metrics.Prometheus" Version="4.3.0" />
|
||||
<PackageReference Include="App.Metrics.Reporting.Console" Version="4.3.0" />
|
||||
<PackageReference Include="Google.Protobuf" Version="3.13.0" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.37.0" PrivateAssets="All" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.47.0" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="4.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="4.2.0" />
|
||||
|
@ -53,9 +53,9 @@
|
||||
},
|
||||
"Grpc.Tools": {
|
||||
"type": "Direct",
|
||||
"requested": "[2.37.0, )",
|
||||
"resolved": "2.37.0",
|
||||
"contentHash": "cud/urkbw3QoQ8+kNeCy2YI0sHrh7td/1cZkVbH6hDLIXX7zzmJbV/KjYSiqiYtflQf+S5mJPLzDQWScN/QdDg=="
|
||||
"requested": "[2.47.0, )",
|
||||
"resolved": "2.47.0",
|
||||
"contentHash": "nInNoLfT/zR7+0VNIC4Lu5nF8azjTz3KwHB1ckwsYUxvof4uSxIt/LlCKb/NH7GPfXfdvqDDinguPpP5t55nuA=="
|
||||
},
|
||||
"Microsoft.AspNetCore.Mvc.NewtonsoftJson": {
|
||||
"type": "Direct",
|
||||
|
@ -96,9 +96,9 @@ public class Context
|
||||
|
||||
// if (embed != null)
|
||||
// {
|
||||
// Sensitive information that might want to be deleted by :x: reaction is typically in an embed format (member cards, for example)
|
||||
// but since we can, we just store all sent messages for possible deletion
|
||||
await _commandMessageService.RegisterMessage(msg.Id, msg.ChannelId, Author.Id);
|
||||
// Sensitive information that might want to be deleted by :x: reaction is typically in an embed format (member cards, for example)
|
||||
// but since we can, we just store all sent messages for possible deletion
|
||||
await _commandMessageService.RegisterMessage(msg.Id, msg.ChannelId, Author.Id);
|
||||
// }
|
||||
|
||||
return msg;
|
||||
|
@ -24,7 +24,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Google.Protobuf" Version="3.13.0"/>
|
||||
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.32.0" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.37.0" PrivateAssets="All"/>
|
||||
<PackageReference Include="Grpc.Tools" Version="2.47.0" PrivateAssets="all" />
|
||||
<PackageReference Include="Humanizer.Core" Version="2.8.26"/>
|
||||
<PackageReference Include="Sentry" Version="3.11.1"/>
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.2"/>
|
||||
|
@ -228,6 +228,9 @@ public class ProxyService
|
||||
if (!senderPermissions.HasFlag(PermissionSet.SendMessages))
|
||||
throw new PKError("You don't have permission to send messages in the channel that message is in.");
|
||||
|
||||
// Mangle embeds (for reply embed color changing)
|
||||
var mangledEmbeds = originalMsg.Embeds!.Select(embed => MangleReproxyEmbed(embed, member)).ToArray();
|
||||
|
||||
// Send the reproxied webhook
|
||||
var proxyMessage = await _webhookExecutor.ExecuteWebhook(new ProxyRequest
|
||||
{
|
||||
@ -239,7 +242,7 @@ public class ProxyService
|
||||
Content = match.ProxyContent!,
|
||||
Attachments = originalMsg.Attachments!,
|
||||
FileSizeLimit = guild.FileSizeLimit(),
|
||||
Embeds = originalMsg.Embeds!.ToArray(),
|
||||
Embeds = mangledEmbeds,
|
||||
Stickers = originalMsg.StickerItems!,
|
||||
AllowEveryone = allowEveryone
|
||||
});
|
||||
@ -268,6 +271,28 @@ public class ProxyService
|
||||
}
|
||||
}
|
||||
|
||||
private Embed MangleReproxyEmbed(Embed embed, ProxyMember member)
|
||||
{
|
||||
// XXX: This is a naïve implementation of detecting reply embeds: looking for the same Unicode
|
||||
// characters as used in the reply embed generation, since we don't _really_ have a good way
|
||||
// to detect whether an embed is a PluralKit reply embed right now, whether a message is in
|
||||
// reply to another message isn't currently stored anywhere in the database.
|
||||
//
|
||||
// unicodes: [three-per-em space] [left arrow emoji] [force emoji presentation]
|
||||
if (embed.Author != null && embed.Author!.Name.EndsWith("\u2004\u21a9\ufe0f"))
|
||||
{
|
||||
return new Embed
|
||||
{
|
||||
Type = "rich",
|
||||
Author = embed.Author!,
|
||||
Description = embed.Description!,
|
||||
Color = member.Color?.ToDiscordColor()
|
||||
};
|
||||
}
|
||||
|
||||
return embed;
|
||||
}
|
||||
|
||||
private Embed CreateReplyEmbed(ProxyMatch match, Message trigger, Message repliedTo, string? nickname,
|
||||
string? avatar)
|
||||
{
|
||||
|
@ -173,7 +173,7 @@ public class WebhookExecutorService
|
||||
|
||||
// We don't care about whether the sending succeeds, and we don't want to *wait* for it, so we just fork it off
|
||||
var _ = TrySendRemainingAttachments(webhook, req.Name, req.AvatarUrl, attachmentChunks, req.ThreadId);
|
||||
|
||||
|
||||
// for some reason discord may(?) return a null guildid here???
|
||||
return webhookMessage with { GuildId = webhookMessage.GuildId ?? req.GuildId };
|
||||
}
|
||||
|
@ -24,9 +24,9 @@
|
||||
},
|
||||
"Grpc.Tools": {
|
||||
"type": "Direct",
|
||||
"requested": "[2.37.0, )",
|
||||
"resolved": "2.37.0",
|
||||
"contentHash": "cud/urkbw3QoQ8+kNeCy2YI0sHrh7td/1cZkVbH6hDLIXX7zzmJbV/KjYSiqiYtflQf+S5mJPLzDQWScN/QdDg=="
|
||||
"requested": "[2.47.0, )",
|
||||
"resolved": "2.47.0",
|
||||
"contentHash": "nInNoLfT/zR7+0VNIC4Lu5nF8azjTz3KwHB1ckwsYUxvof4uSxIt/LlCKb/NH7GPfXfdvqDDinguPpP5t55nuA=="
|
||||
},
|
||||
"Humanizer.Core": {
|
||||
"type": "Direct",
|
||||
|
Loading…
Reference in New Issue
Block a user