mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-09 03:03:24 +08:00
fix: preserve Telegram compatibility and stabilize Office
This commit is contained in:
parent
7f114e1c36
commit
24e690498b
23 changed files with 1679 additions and 314 deletions
|
|
@ -1,9 +1,24 @@
|
|||
import { TOKEN_BOT_ENDPOINTS, createTokenChannelApi } from '../shared/token-api.js';
|
||||
|
||||
export const TELEGRAM_RPC_CHANNEL = '/telegram';
|
||||
export const TELEGRAM_ENDPOINTS = TOKEN_BOT_ENDPOINTS;
|
||||
export const TELEGRAM_ENDPOINTS = Object.freeze({
|
||||
...TOKEN_BOT_ENDPOINTS,
|
||||
setAccessPolicy: 'bot.access-policy.set',
|
||||
});
|
||||
|
||||
const api = createTokenChannelApi('Telegram', ' Bot API 长轮询');
|
||||
const api = createTokenChannelApi('Telegram', ' Bot API 长轮询', {
|
||||
normalizeBotExtension: (value) => {
|
||||
const source = value?.accessPolicy;
|
||||
const accessMode = source?.accessMode === 'private-allowlist'
|
||||
? 'private-allowlist' : 'compatible';
|
||||
const allowedUsers = Array.isArray(source?.allowedUsers)
|
||||
? [...new Set(source.allowedUsers.filter((entry) => (
|
||||
typeof entry === 'string' && /^[1-9]\d{0,15}$/.test(entry)
|
||||
)))]
|
||||
: [];
|
||||
return { accessPolicy: { accessMode, allowedUsers } };
|
||||
},
|
||||
});
|
||||
|
||||
export const unwrapRpcResult = api.unwrapRpcResult;
|
||||
export const normalizeSnapshot = api.normalizeSnapshot;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue