Social auto-posting (phase 1): daily applicant digest to Telegram/Bale + Instagram caption
CI/CD / CI · dotnet build (push) Successful in 1m51s
CI/CD / Deploy · hamkadr (push) Successful in 2m51s

Adds a «شبکه‌های اجتماعی» admin section + scheduler that publishes a daily
«کادر آماده‌به‌کار امروز» digest:

- AppSetting: social toggles, posts-per-day, editable header/footer,
  per-channel bot token + chat id (Telegram, Bale), Instagram enable +
  extra hashtags, proxy toggle, last-posted timestamp (+ migration).
- SocialPostService: builds today's talent digest as text, posts to
  Telegram and Bale via their bot sendMessage APIs (proxy-aware), and
  produces an Instagram caption + auto hashtags (role/city based).
- SocialPostWorker: posts N times/day, evenly spaced, self-paced; reads
  settings live so it's togglable without redeploy.
- /Admin/Social: credentials + header/footer + posts/day, live preview of
  today's message, «ارسال اکنون» button, and an Instagram caption pack
  with copy button (semi-automatic — you post the image manually).
- Nav link added.

Telegram/Bale post as TEXT (per request). The Vazirmatn image card for
Instagram is phase 2 (needs SkiaSharp+HarfBuzz + a TTF font).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-08 09:20:49 +03:30
parent 2bb8771ade
commit fb02c81830
10 changed files with 2186 additions and 0 deletions
+26
View File
@@ -104,6 +104,32 @@ public class AppSetting
[MaxLength(200)] public string? VapidPrivateKey { get; set; }
[MaxLength(120)] public string? VapidSubject { get; set; } = "mailto:admin@hamkadr.ir";
// --- Social auto-posting: a daily «کادر آماده به کار» digest to Telegram/Bale (text) + an
// Instagram caption/hashtags pack (you post the image manually). ---
public bool SocialEnabled { get; set; } = false;
/// <summary>How many digests to publish per day (evenly spaced).</summary>
public int SocialPostsPerDay { get; set; } = 3;
/// <summary>Lines added above/below the auto-generated body (your branding, links, etc.).</summary>
[MaxLength(1000)] public string? SocialHeader { get; set; }
[MaxLength(1000)] public string? SocialFooter { get; set; }
/// <summary>Route the bot calls through the ingestion proxy (Telegram is filtered in Iran).</summary>
public bool SocialUseProxy { get; set; } = true;
public bool SocialTelegramEnabled { get; set; } = false;
[MaxLength(200)] public string? SocialTelegramBotToken { get; set; }
/// <summary>Channel/chat to post to — «@channelusername» or a numeric chat id.</summary>
[MaxLength(120)] public string? SocialTelegramChatId { get; set; }
public bool SocialBaleEnabled { get; set; } = false;
[MaxLength(200)] public string? SocialBaleBotToken { get; set; }
[MaxLength(120)] public string? SocialBaleChatId { get; set; }
public bool SocialInstagramEnabled { get; set; } = false;
/// <summary>Extra hashtags appended to the generated Instagram caption (space/line separated).</summary>
[MaxLength(1000)] public string? InstagramHashtags { get; set; }
public DateTime? SocialLastPostedAt { get; set; }
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
/// <summary>Split a textarea (newline/comma separated) into trimmed non-empty items.</summary>