mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-30 10:27:49 +00:00
fix: use short 12-char code in bot and cabinet share links
GIFTCODE_ prefix (9 chars) + full 64-char token = 73 chars, exceeding Telegram's 64-char start parameter limit. Now all share links use the same short code shown in the UI (first 12 chars). Backend already supports prefix-based lookup.
This commit is contained in:
@@ -9,10 +9,6 @@ import { AnimatedCheckmark } from '@/components/ui/AnimatedCheckmark';
|
|||||||
import { AnimatedCrossmark } from '@/components/ui/AnimatedCrossmark';
|
import { AnimatedCrossmark } from '@/components/ui/AnimatedCrossmark';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
|
|
||||||
function formatGiftCode(token: string): string {
|
|
||||||
return `GIFT-${token.slice(0, 12)}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
const MAX_POLL_MS = 10 * 60 * 1000; // 10 minutes
|
const MAX_POLL_MS = 10 * 60 * 1000; // 10 minutes
|
||||||
|
|
||||||
const KNOWN_WARNINGS = new Set(['telegram_unresolvable']);
|
const KNOWN_WARNINGS = new Set(['telegram_unresolvable']);
|
||||||
@@ -56,12 +52,11 @@ function CodeOnlySuccessState({
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [copied, setCopied] = useState(false);
|
const [copied, setCopied] = useState(false);
|
||||||
|
|
||||||
const giftCode = formatGiftCode(purchaseToken);
|
const shortCode = purchaseToken.slice(0, 12);
|
||||||
|
const giftCode = `GIFT-${shortCode}`;
|
||||||
const botUsername = import.meta.env.VITE_TELEGRAM_BOT_USERNAME as string | undefined;
|
const botUsername = import.meta.env.VITE_TELEGRAM_BOT_USERNAME as string | undefined;
|
||||||
const botLink = botUsername
|
const botLink = botUsername ? `https://t.me/${botUsername}?start=GIFTCODE_${shortCode}` : null;
|
||||||
? `https://t.me/${botUsername}?start=GIFTCODE_${purchaseToken}`
|
const cabinetLink = `${window.location.origin}/gift?tab=activate&code=${shortCode}`;
|
||||||
: null;
|
|
||||||
const cabinetLink = `${window.location.origin}/gift?tab=activate&code=${purchaseToken}`;
|
|
||||||
|
|
||||||
const fullMessage = [
|
const fullMessage = [
|
||||||
t('gift.shareText', 'I have a gift for you! Activate it here:'),
|
t('gift.shareText', 'I have a gift for you! Activate it here:'),
|
||||||
|
|||||||
@@ -982,9 +982,10 @@ function ShareModal({ gift, onClose }: { gift: SentGift; onClose: () => void })
|
|||||||
};
|
};
|
||||||
}, [onClose]);
|
}, [onClose]);
|
||||||
|
|
||||||
|
const shortCode = gift.token.slice(0, 12);
|
||||||
const botUsername = import.meta.env.VITE_TELEGRAM_BOT_USERNAME as string | undefined;
|
const botUsername = import.meta.env.VITE_TELEGRAM_BOT_USERNAME as string | undefined;
|
||||||
const botLink = botUsername ? `https://t.me/${botUsername}?start=GIFTCODE_${gift.token}` : null;
|
const botLink = botUsername ? `https://t.me/${botUsername}?start=GIFTCODE_${shortCode}` : null;
|
||||||
const cabinetLink = `${window.location.origin}/gift?tab=activate&code=${gift.token}`;
|
const cabinetLink = `${window.location.origin}/gift?tab=activate&code=${shortCode}`;
|
||||||
|
|
||||||
const fullMessage = [
|
const fullMessage = [
|
||||||
t('gift.shareText'),
|
t('gift.shareText'),
|
||||||
|
|||||||
Reference in New Issue
Block a user