Files
im_webapp/web/src/lib/config.ts
T
Your NameandClaude Sonnet 5 5c3f3b7653 feat(web): complete groups/contacts/favorites/settings/calls/system domains + extensive review-round fixes
Rounds out the full rewrite with the remaining feature domains: group
management (admin panel, mute, files, announcements, QR-based invite/join),
contacts (friend profile, add-friend, blocklist, new-friends), favorites
(real media rendering across text/image/video/voice/file/link), settings
(profile/security/privacy/general/about), calls (Agora-backed audio/video
signaling + call history), and system messages/file assistant.

Also folds in a large batch of live-verified fixes surfaced by repeated
fresh code-review passes and hands-on E2E testing against the real
backend, including: WS reconnect not resubscribing any topic after a
disconnect, missing x-im-client-mid on every send path (protocol
compliance for retry dedup), group mute/member-settings/self-profile
endpoint corrections, relationship-state type fixes across search/QR/
friend-profile, tenant-switch logout gap, password-policy now read from
the real per-tenant config instead of guessed, NavRail highlight/
aria-current desync, several call-state-machine races, and responsive
layout fixes across all four breakpoints (mobile/tablet/laptop/desktop)
including a full mobile rebuild of favorites, call UI, and the settings
home/sub-list split.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-09 20:16:33 +08:00

87 lines
3.4 KiB
TypeScript

// Ported from the previous im_webapp's src/config.js. These values encode real constraints that
// must match the backend (server/*.go) -- they are not stylistic choices, so the numbers/strings
// themselves carry over unchanged even though this is a from-scratch rewrite.
/** Version-independent product name (Firebase app name, in-app copy, etc.). */
export const BASE_APP_NAME = 'MeetingIM';
/** Name used in the Tinode client's User-Agent string. */
export const APP_NAME = `${BASE_APP_NAME}/${__APP_VERSION__}`;
/**
* Tinode API key for the WS handshake ({hi} packet) and every REST call's X-MeetingIM-APIKey
* header. Generated with https://github.com/tinode/chat/tree/master/keygen against this
* deployment's own API_KEY_SALT -- the fallback below only works against a backend still using
* the upstream sample salt, same caveat as the old app.
*/
export const API_KEY = import.meta.env.VITE_TINODE_API_KEY || 'AQEAAAABAAD_rAp4DJh05a1HAwFT3A6K';
export const KNOWN_HOSTS = { hosted: 'web.118im.com', local: 'localhost:6060' } as const;
export const DEFAULT_HOST = KNOWN_HOSTS.hosted;
// Tinode's own verbose logging prints every WS packet to the console, including the login
// secret (base64 username:password) and full plaintext message content -- dev-only, never in a
// production build.
export const LOGGING_ENABLED = import.meta.env.DEV;
/** Minimum time between two keypress notifications, ms. */
export const KEYPRESS_DELAY = 3_000;
/** Delay before sending a read notification, ms. */
export const READ_DELAY = 1_500;
export const MIN_TAG_LENGTH = 2;
export const MAX_TAG_LENGTH = 96;
export const MAX_TAG_COUNT = 16;
export const DEFAULT_P2P_ACCESS_MODE = 'JRWPS';
export const NEW_GRP_ACCESS_MODE = 'JRWPSAO';
export const CHANNEL_ACCESS_MODE = 'JR';
export const NO_ACCESS_MODE = 'N';
/** Design breakpoints, px. Four tiers per the new design handoff (was a single 640 cut before). */
export const BREAKPOINTS = { sm: 640, md: 960, lg: 1280 } as const;
export const AVATAR_SIZE = 384;
export const MAX_AVATAR_BYTES = 4096;
export const BROKEN_IMAGE_SIZE = 32;
export const NO_DIMENSIONS_VIDEO = 128;
export const MESSAGES_PAGE = 24;
/** Scroll-to-top threshold (px) that triggers loading an older page of history. */
export const FETCH_PAGE_TRIGGER = 40;
/** Poll interval (ms) for the throttled read-receipt queue. */
export const NOTIFICATION_EXEC_INTERVAL = 300;
export const MAX_INBAND_ATTACHMENT_SIZE = 262_144;
export const MAX_EXTERN_ATTACHMENT_SIZE = 1 << 23;
export const MAX_IMAGE_DIM = 1024;
export const IMAGE_PREVIEW_DIM = 64;
export const VIDEO_PREVIEW_DIM = 96;
export const IMAGE_THUMBNAIL_DIM = 36;
export const VIDEO_THUMBNAIL_WIDTH = 48;
export const MAX_ONLINE_IN_TOPIC = 4;
export const MAX_TITLE_LENGTH = 60;
/** docs/IM-前后端对接文档.md:1445 -- "description 可省略或传空字符串,最长 200 字符". */
export const MAX_TOPIC_DESCRIPTION_LENGTH = 200;
export const MAX_PEER_TITLE_LENGTH = 24;
export const MESSAGE_PREVIEW_LENGTH = 80;
export const QUOTED_REPLY_LENGTH = 30;
export const FORWARDED_PREVIEW_LENGTH = 84;
export const EDIT_PREVIEW_LENGTH = 48;
export const MIN_DURATION = 2_000;
export const MAX_DURATION = 600_000;
export const IMMEDIATE_P2P_SUBSCRIPTION = false;
export const CLICKABLE_URL_SCHEMES = ['http', 'https', 'ftp', 'ftps'];
export const QRCODE_SIZE = 128;
export const WAKE_UP_TIMEOUT = 80_000;
export const WAKE_UP_TICK = 1_000;
export const TOAST_DURATION = 2_500;