Compare commits

..

7 Commits

Author SHA1 Message Date
9ab29a3a15 Update some packages 2025-04-24 19:07:52 +03:30
6c5fe1bc00 Added cors 2025-04-24 19:07:43 +03:30
8f9396c791 Minor UX improvement to web UI 2025-03-10 15:58:48 +03:30
83023a31a7 Minor improvements to broken images handling in web UI 2025-03-10 15:43:13 +03:30
a1aab1ac1f Change webUI font 2025-03-04 15:00:00 +03:30
bb950b97a7 Update .dockerignore
Some checks failed
release / Build and push Docker image (push) Has been cancelled
2025-02-26 14:00:26 +03:30
4ce1b29d86 Update some packages - Add some personal notes 2025-02-26 13:59:41 +03:30
6 changed files with 29 additions and 9 deletions

View File

@@ -22,4 +22,5 @@
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
README.md
PersonalNotes

5
PersonalNotes/faster-query.md Executable file
View File

@@ -0,0 +1,5 @@
# How did I go from 4 second on each API request to under 1 second?
### 1. Using projection to limit fields
### 2. Using proper indexes
### 3. Using $sample along with aggregation

View File

@@ -2,6 +2,7 @@
using CatsOfMastodonBot.Models;
using CatsOfMastodonBot.Services;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using mstdnCats.Services;
@@ -41,12 +42,22 @@ public class MastodonBot
{
options.ListenAnyIP(5005); // Listen on port 5005
});
webBuilder.ConfigureServices(services =>
{
services.AddCors(options =>
{
options.AddDefaultPolicy(options =>
{
options.AllowAnyHeader()
.AllowAnyMethod()
.AllowAnyOrigin();
});
});
} );
ServerStartup.Serverstartup(db);
webBuilder.UseStartup<ServerStartup>();
})
.Build();
// Setup bot
TelegramBotClient bot;

View File

@@ -19,7 +19,7 @@ public class ServerStartup
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseRouting();
app.UseCors();
app.UseEndpoints(endpoints =>
{
endpoints.MapGet("/", async context =>

View File

@@ -3,9 +3,10 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cats of Mastodon!</title><style>
<title>Cats of Mastodon! - Mahdium</title><style>
@import url('https://fonts.googleapis.com/css2?family=Atma:wght@300;400;500;600;700&display=swap');
body {
font-family: 'Comic Neue', cursive;
font-family: "Atma", system-ui;
display: flex;
flex-direction: column;
justify-content: center;
@@ -197,7 +198,7 @@
</head>
<body>
<h2 class="mastodon-title">Cats of Mastodon!</h2>
<p class="welcome-message">Welcome to Daily Catventures! Get your daily dose of purr-fectly adorable feline fun! <span></span><br>Posts gathered across Mastodon 🤝</p>
<p class="welcome-message">Welcome to Daily Catventures! </br> Get your daily dose of purr-fectly adorable feline fun! <span></span><br>Posts gathered across Mastodon 🤝</p>
<div class="post-container">
<div class="post-content" style="display: none;">
@@ -268,11 +269,13 @@
postImage.onload = () => {
postImage.classList.remove('loading');
window.scrollTo(0, document.body.scrollHeight);
};
postImage.onerror = () => {
console.error("Error loading image:", imageUrl);
postImage.src = "https://s6.uupload.ir/files/a69d5fc9e900cc51_1920_kmnr.png";
loadNewPost();
postImage.classList.remove('loading');
};

View File

@@ -11,8 +11,8 @@
<ItemGroup>
<PackageReference Include="DotNetEnv" Version="3.1.1" />
<PackageReference Include="MongoDB.Driver" Version="3.1.0" />
<PackageReference Include="Telegram.Bot" Version="22.3.0" />
<PackageReference Include="MongoDB.Driver" Version="3.3.0" />
<PackageReference Include="Telegram.Bot" Version="22.4.4" />
</ItemGroup>
<ItemGroup>