fixes
This commit is contained in:
parent
ba15e2f32f
commit
b2e84a187d
13 changed files with 261 additions and 6 deletions
File diff suppressed because one or more lines are too long
1
cmd/telesrv-admin/web/dist/assets/index-DjPaQXsn.css
vendored
Normal file
1
cmd/telesrv-admin/web/dist/assets/index-DjPaQXsn.css
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
cmd/telesrv-admin/web/dist/index.html
vendored
4
cmd/telesrv-admin/web/dist/index.html
vendored
|
|
@ -23,8 +23,8 @@
|
|||
})();
|
||||
</script>
|
||||
|
||||
<script type="module" crossorigin src="/assets/index-obB6Caem.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-DWxQF996.css">
|
||||
<script type="module" crossorigin src="/assets/index-SClW8slv.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-DjPaQXsn.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
|
|
|||
|
|
@ -27,6 +27,11 @@ export function LoginPage({ onLogin }: { onLogin: (actor: string) => void }) {
|
|||
|
||||
return (
|
||||
<main className="login-page">
|
||||
<div className="bg-orbs" aria-hidden="true">
|
||||
<div className="bg-orb bg-orb--1" />
|
||||
<div className="bg-orb bg-orb--2" />
|
||||
<div className="bg-orb bg-orb--3" />
|
||||
</div>
|
||||
<section className="login-panel">
|
||||
<div className="login-head">
|
||||
<div className="brand brand-elevated">
|
||||
|
|
|
|||
|
|
@ -82,6 +82,8 @@
|
|||
--shadow: 0 28px 70px -36px rgba(5, 5, 8, 0.35);
|
||||
--shadow-sm: 0 2px 10px rgba(24, 39, 56, 0.05);
|
||||
--shadow-brand: 0 8px 22px rgba(37, 99, 235, 0.22);
|
||||
--hero-glow: rgba(37, 99, 235, 0.14);
|
||||
--hero-grid: rgba(5, 5, 8, 0.04);
|
||||
|
||||
/* Radii */
|
||||
--radius-xs: 8px;
|
||||
|
|
@ -157,6 +159,8 @@
|
|||
--shadow: 0 16px 40px rgba(0, 0, 0, 0.46);
|
||||
--shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.38);
|
||||
--shadow-brand: 0 8px 22px rgba(91, 157, 255, 0.26);
|
||||
--hero-glow: rgba(91, 157, 255, 0.25);
|
||||
--hero-grid: rgba(255, 255, 255, 0.04);
|
||||
}
|
||||
|
||||
* {
|
||||
|
|
|
|||
|
|
@ -176,11 +176,91 @@
|
|||
}
|
||||
|
||||
.login-page {
|
||||
position: relative;
|
||||
display: grid;
|
||||
min-height: 100vh;
|
||||
place-items: center;
|
||||
padding: 24px;
|
||||
background: var(--bg);
|
||||
background-image:
|
||||
radial-gradient(900px 480px at 50% -8%, var(--hero-glow) 0%, rgba(0, 0, 0, 0) 70%),
|
||||
linear-gradient(var(--hero-grid) 1px, transparent 1px),
|
||||
linear-gradient(90deg, var(--hero-grid) 1px, transparent 1px);
|
||||
background-size: auto, 44px 44px, 44px 44px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.login-page .bg-orbs {
|
||||
position: absolute;
|
||||
inset: -60px;
|
||||
z-index: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.login-page .bg-orb {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
filter: blur(100px);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.login-page .bg-orb--1 {
|
||||
top: -15%;
|
||||
left: -10%;
|
||||
width: 700px;
|
||||
height: 700px;
|
||||
background: color-mix(in srgb, var(--brand-2) 40%, transparent);
|
||||
animation: loginOrbFloat1 20s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.login-page .bg-orb--2 {
|
||||
top: 25%;
|
||||
right: -15%;
|
||||
width: 600px;
|
||||
height: 600px;
|
||||
background: color-mix(in srgb, var(--brand) 38%, transparent);
|
||||
animation: loginOrbFloat2 24s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.login-page .bg-orb--3 {
|
||||
bottom: -15%;
|
||||
left: 30%;
|
||||
width: 500px;
|
||||
height: 500px;
|
||||
background: color-mix(in srgb, var(--brand-2) 30%, transparent);
|
||||
animation: loginOrbFloat3 28s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes loginOrbFloat1 {
|
||||
0%, 100% { transform: translate(0, 0) scale(1); }
|
||||
33% { transform: translate(60px, -40px) scale(1.08); }
|
||||
66% { transform: translate(-30px, 30px) scale(.92); }
|
||||
}
|
||||
@keyframes loginOrbFloat2 {
|
||||
0%, 100% { transform: translate(0, 0) scale(1); }
|
||||
33% { transform: translate(-50px, -35px) scale(.93); }
|
||||
66% { transform: translate(45px, 25px) scale(1.07); }
|
||||
}
|
||||
@keyframes loginOrbFloat3 {
|
||||
0%, 100% { transform: translate(0, 0) scale(1); }
|
||||
33% { transform: translate(40px, 45px) scale(1.06); }
|
||||
66% { transform: translate(-55px, -25px) scale(.94); }
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.login-page .bg-orb { filter: blur(60px); }
|
||||
.login-page .bg-orb--1 { width: 350px; height: 350px; }
|
||||
.login-page .bg-orb--2 { width: 300px; height: 300px; }
|
||||
.login-page .bg-orb--3 { width: 250px; height: 250px; }
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.login-page .bg-orb { animation: none; }
|
||||
}
|
||||
|
||||
.login-page .login-panel {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.login-panel {
|
||||
|
|
|
|||
|
|
@ -508,6 +508,16 @@ func run(logger *zap.Logger) error {
|
|||
} else if seeded {
|
||||
logger.Info("BotFather 头像种子导入完成", zap.Int64("photo_id", domain.BotFatherUserPhotoID))
|
||||
}
|
||||
if seeded, err := filesService.SeedStickersBotAvatar(ctx); err != nil {
|
||||
return fmt.Errorf("seed stickers bot avatar: %w", err)
|
||||
} else if seeded {
|
||||
logger.Info("@Stickers 头像种子导入完成", zap.Int64("photo_id", domain.StickersBotUserPhotoID))
|
||||
}
|
||||
if seeded, err := filesService.SeedChatBotAvatar(ctx); err != nil {
|
||||
return fmt.Errorf("seed chatbot avatar: %w", err)
|
||||
} else if seeded {
|
||||
logger.Info("@ChatBot 头像种子导入完成", zap.Int64("photo_id", domain.ChatBotUserPhotoID))
|
||||
}
|
||||
if stats, err := filesService.WarmCaches(ctx); err != nil {
|
||||
logger.Warn("媒体资源缓存预热失败", zap.Error(err))
|
||||
} else if stats.StickerSets > 0 || stats.Documents > 0 || stats.Blobs > 0 {
|
||||
|
|
|
|||
54
internal/app/files/chatbot_avatar_seed.go
Normal file
54
internal/app/files/chatbot_avatar_seed.go
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
package files
|
||||
|
||||
import (
|
||||
"context"
|
||||
_ "embed"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"telesrv/internal/domain"
|
||||
)
|
||||
|
||||
//go:embed seedassets/chatbot_avatar.png
|
||||
var chatBotAvatarPNG []byte
|
||||
|
||||
// SeedChatBotAvatar idempotently seeds the built-in @ChatBot account's
|
||||
// profile photo from the bundled avatar, mirroring SeedBotFatherAvatar:
|
||||
// writes it under the fixed domain.ChatBotUserPhotoID so the photo/blob
|
||||
// layer and the pure domain.ChatBotUser() struct literal stay in sync
|
||||
// across restarts, and registers it as the account's *current* profile photo
|
||||
// so users.getFullUser resolves it too. Returns true if it actually wrote a
|
||||
// new photo.
|
||||
func (s *Service) SeedChatBotAvatar(ctx context.Context) (bool, error) {
|
||||
photoID := domain.ChatBotUserPhotoID
|
||||
wrote := false
|
||||
if _, found, err := s.media.GetPhoto(ctx, photoID); err != nil {
|
||||
return false, err
|
||||
} else if !found {
|
||||
sizes, err := s.putPhotoStaticSizes(ctx, photoID, chatBotAvatarPNG, photoSizeSpecsForAvatar(chatBotAvatarPNG))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
photo := domain.Photo{
|
||||
ID: photoID,
|
||||
AccessHash: domain.ChatBotUserPhotoAccessHash,
|
||||
FileReference: randomFileReference(),
|
||||
Date: int(time.Now().Unix()),
|
||||
DCID: s.dc,
|
||||
Sizes: sizes,
|
||||
}
|
||||
if err := s.media.PutPhoto(ctx, photo); err != nil {
|
||||
return false, err
|
||||
}
|
||||
wrote = true
|
||||
}
|
||||
photo, ok, err := s.SetCurrentProfilePhoto(ctx, domain.PeerTypeUser, domain.ChatBotUserID, photoID, int(time.Now().Unix()))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if !ok {
|
||||
return false, fmt.Errorf("chatbot avatar photo %d not found after seeding", photoID)
|
||||
}
|
||||
domain.SetChatBotAvatar(photo.DCID, domain.StrippedFromSizes(photo.Sizes))
|
||||
return wrote, nil
|
||||
}
|
||||
BIN
internal/app/files/seedassets/chatbot_avatar.png
Normal file
BIN
internal/app/files/seedassets/chatbot_avatar.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 981 KiB |
BIN
internal/app/files/seedassets/stickers_avatar.png
Normal file
BIN
internal/app/files/seedassets/stickers_avatar.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 452 KiB |
54
internal/app/files/stickers_bot_avatar_seed.go
Normal file
54
internal/app/files/stickers_bot_avatar_seed.go
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
package files
|
||||
|
||||
import (
|
||||
"context"
|
||||
_ "embed"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"telesrv/internal/domain"
|
||||
)
|
||||
|
||||
//go:embed seedassets/stickers_avatar.png
|
||||
var stickersBotAvatarPNG []byte
|
||||
|
||||
// SeedStickersBotAvatar idempotently seeds the built-in @Stickers account's
|
||||
// profile photo from the bundled avatar, mirroring SeedBotFatherAvatar:
|
||||
// writes it under the fixed domain.StickersBotUserPhotoID so the photo/blob
|
||||
// layer and the pure domain.StickersBotUser() struct literal stay in sync
|
||||
// across restarts, and registers it as the account's *current* profile photo
|
||||
// so users.getFullUser resolves it too. Returns true if it actually wrote a
|
||||
// new photo.
|
||||
func (s *Service) SeedStickersBotAvatar(ctx context.Context) (bool, error) {
|
||||
photoID := domain.StickersBotUserPhotoID
|
||||
wrote := false
|
||||
if _, found, err := s.media.GetPhoto(ctx, photoID); err != nil {
|
||||
return false, err
|
||||
} else if !found {
|
||||
sizes, err := s.putPhotoStaticSizes(ctx, photoID, stickersBotAvatarPNG, photoSizeSpecsForAvatar(stickersBotAvatarPNG))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
photo := domain.Photo{
|
||||
ID: photoID,
|
||||
AccessHash: domain.StickersBotUserPhotoAccessHash,
|
||||
FileReference: randomFileReference(),
|
||||
Date: int(time.Now().Unix()),
|
||||
DCID: s.dc,
|
||||
Sizes: sizes,
|
||||
}
|
||||
if err := s.media.PutPhoto(ctx, photo); err != nil {
|
||||
return false, err
|
||||
}
|
||||
wrote = true
|
||||
}
|
||||
photo, ok, err := s.SetCurrentProfilePhoto(ctx, domain.PeerTypeUser, domain.StickersBotUserID, photoID, int(time.Now().Unix()))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if !ok {
|
||||
return false, fmt.Errorf("stickers bot avatar photo %d not found after seeding", photoID)
|
||||
}
|
||||
domain.SetStickersBotAvatar(photo.DCID, domain.StrippedFromSizes(photo.Sizes))
|
||||
return wrote, nil
|
||||
}
|
||||
|
|
@ -25,11 +25,19 @@ const (
|
|||
StickersBotUserID int64 = 1063110917
|
||||
// StickersBotAccessHash 固定不变;与 postgres 种子行双写,必须保持一致。
|
||||
StickersBotAccessHash int64 = 5213187021149032991
|
||||
// StickersBotUserPhotoID/AccessHash 是 @Stickers 头像 photo 的固定 id,
|
||||
// 与 files.Service.SeedStickersBotAvatar 种子写入的行保持一致。
|
||||
StickersBotUserPhotoID int64 = 10631109170001
|
||||
StickersBotUserPhotoAccessHash int64 = 4636293356791048892
|
||||
|
||||
// ChatBotUserID 是内置 @ChatBot 账号。它把私聊文本转给 server AI provider 链。
|
||||
ChatBotUserID int64 = 1250000007
|
||||
// ChatBotAccessHash 固定不变;与 postgres 种子行双写,必须保持一致。
|
||||
ChatBotAccessHash int64 = 6332902371644871201
|
||||
// ChatBotUserPhotoID/AccessHash 是 @ChatBot 头像 photo 的固定 id,
|
||||
// 与 files.Service.SeedChatBotAvatar 种子写入的行保持一致。
|
||||
ChatBotUserPhotoID int64 = 12500000070001
|
||||
ChatBotUserPhotoAccessHash int64 = 8748578814399338333
|
||||
)
|
||||
|
||||
// officialSystemUserPhotoDCID/Stripped 由 files.Service.SeedOfficialSystemAvatar
|
||||
|
|
@ -61,6 +69,34 @@ func SetBotFatherAvatar(dcID int, stripped []byte) {
|
|||
botFatherPhotoStripped = stripped
|
||||
}
|
||||
|
||||
// stickersBotPhotoDCID/Stripped 由 files.Service.SeedStickersBotAvatar 在启动时
|
||||
// 通过 SetStickersBotAvatar 写入一次;写入前 StickersBotUser() 不带头像(PhotoID==0)。
|
||||
var (
|
||||
stickersBotPhotoDCID int
|
||||
stickersBotPhotoStripped []byte
|
||||
)
|
||||
|
||||
// SetStickersBotAvatar 记录 @Stickers 头像所在的 DC 与内联缩略图字节。
|
||||
// 只应在启动阶段、头像 seed 完成后调用一次。
|
||||
func SetStickersBotAvatar(dcID int, stripped []byte) {
|
||||
stickersBotPhotoDCID = dcID
|
||||
stickersBotPhotoStripped = stripped
|
||||
}
|
||||
|
||||
// chatBotPhotoDCID/Stripped 由 files.Service.SeedChatBotAvatar 在启动时
|
||||
// 通过 SetChatBotAvatar 写入一次;写入前 ChatBotUser() 不带头像(PhotoID==0)。
|
||||
var (
|
||||
chatBotPhotoDCID int
|
||||
chatBotPhotoStripped []byte
|
||||
)
|
||||
|
||||
// SetChatBotAvatar 记录 @ChatBot 头像所在的 DC 与内联缩略图字节。
|
||||
// 只应在启动阶段、头像 seed 完成后调用一次。
|
||||
func SetChatBotAvatar(dcID int, stripped []byte) {
|
||||
chatBotPhotoDCID = dcID
|
||||
chatBotPhotoStripped = stripped
|
||||
}
|
||||
|
||||
// OfficialSystemUser 返回第一阶段内置的官方系统账号。
|
||||
func OfficialSystemUser() User {
|
||||
u := User{
|
||||
|
|
@ -101,7 +137,7 @@ func BotFatherUser() User {
|
|||
|
||||
// StickersBotUser 返回内置 @Stickers 账号。username 不以 bot 结尾属种子例外(与官方一致)。
|
||||
func StickersBotUser() User {
|
||||
return User{
|
||||
u := User{
|
||||
ID: StickersBotUserID,
|
||||
AccessHash: StickersBotAccessHash,
|
||||
FirstName: "Stickers",
|
||||
|
|
@ -110,11 +146,17 @@ func StickersBotUser() User {
|
|||
Bot: true,
|
||||
BotInfoVersion: 2,
|
||||
}
|
||||
if stickersBotPhotoDCID != 0 {
|
||||
u.PhotoID = StickersBotUserPhotoID
|
||||
u.PhotoDCID = stickersBotPhotoDCID
|
||||
u.PhotoStripped = stickersBotPhotoStripped
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// ChatBotUser 返回内置 @ChatBot 账号。
|
||||
func ChatBotUser() User {
|
||||
return User{
|
||||
u := User{
|
||||
ID: ChatBotUserID,
|
||||
AccessHash: ChatBotAccessHash,
|
||||
FirstName: "ChatBot",
|
||||
|
|
@ -123,6 +165,12 @@ func ChatBotUser() User {
|
|||
Bot: true,
|
||||
BotInfoVersion: 1,
|
||||
}
|
||||
if chatBotPhotoDCID != 0 {
|
||||
u.PhotoID = ChatBotUserPhotoID
|
||||
u.PhotoDCID = chatBotPhotoDCID
|
||||
u.PhotoStripped = chatBotPhotoStripped
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// SystemUserByID 返回内置系统账号;非系统账号返回 ok=false。
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue