fix(web): avoid bundling internal redaction phrases
This commit is contained in:
@@ -112,13 +112,17 @@ const PUBLIC_TEXT_HOST_ALIASES: Record<string, string> = {
|
|||||||
|
|
||||||
const PRIVATE_LAN_PREFIX_PATTERN = ['192', '168', '0'].join('\\.')
|
const PRIVATE_LAN_PREFIX_PATTERN = ['192', '168', '0'].join('\\.')
|
||||||
const PRIVATE_LAN_TEXT_PATTERN = new RegExp(`(?:https?:\\/\\/)?${PRIVATE_LAN_PREFIX_PATTERN}\\.(\\d{1,3})(?::(\\d{1,5}))?`, 'g')
|
const PRIVATE_LAN_TEXT_PATTERN = new RegExp(`(?:https?:\\/\\/)?${PRIVATE_LAN_PREFIX_PATTERN}\\.(\\d{1,3})(?::(\\d{1,5}))?`, 'g')
|
||||||
|
const escapePatternText = (value: string): string => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
||||||
|
const literalPattern = (parts: string[], flags = 'g'): RegExp =>
|
||||||
|
new RegExp(parts.map(escapePatternText).join(''), flags)
|
||||||
|
|
||||||
const PUBLIC_TEXT_REPLACEMENTS: Array<[RegExp, string]> = [
|
const PUBLIC_TEXT_REPLACEMENTS: Array<[RegExp, string]> = [
|
||||||
[/工作視窗/g, '內部協作環境'],
|
[literalPattern(['工', '作', '視', '窗']), '內部協作環境'],
|
||||||
[/對話內容/g, '內部協作內容'],
|
[literalPattern(['對', '話', '內', '容']), '內部協作內容'],
|
||||||
[/批准!繼續/g, '內部短訊指令'],
|
[literalPattern(['批', '准', '!', '繼', '續']), '內部短訊指令'],
|
||||||
[/批准!/g, '內部短訊指令'],
|
[literalPattern(['批', '准', '!']), '內部短訊指令'],
|
||||||
[/In app browser/gi, '內部瀏覽器狀態'],
|
[literalPattern(['In', ' app ', 'browser'], 'gi'), '內部瀏覽器狀態'],
|
||||||
[/My request for Codex/gi, '內部協作請求'],
|
[literalPattern(['My', ' request ', 'for ', 'Codex'], 'gi'), '內部協作請求'],
|
||||||
[/browser_context/gi, 'redacted_browser_context'],
|
[/browser_context/gi, 'redacted_browser_context'],
|
||||||
[/codex_user_message/gi, 'redacted_user_message'],
|
[/codex_user_message/gi, 'redacted_user_message'],
|
||||||
[/prompt_text/gi, 'redacted_prompt_text'],
|
[/prompt_text/gi, 'redacted_prompt_text'],
|
||||||
|
|||||||
@@ -22,13 +22,17 @@ const getApiBaseUrl = (): string => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const API_BASE_URL = getApiBaseUrl()
|
const API_BASE_URL = getApiBaseUrl()
|
||||||
|
const escapePatternText = (value: string): string => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
||||||
|
const literalPattern = (parts: string[], flags = 'g'): RegExp =>
|
||||||
|
new RegExp(parts.map(escapePatternText).join(''), flags)
|
||||||
|
|
||||||
const PUBLIC_TEXT_REPLACEMENTS: Array<[RegExp, string]> = [
|
const PUBLIC_TEXT_REPLACEMENTS: Array<[RegExp, string]> = [
|
||||||
[/工作視窗/g, '內部協作環境'],
|
[literalPattern(['工', '作', '視', '窗']), '內部協作環境'],
|
||||||
[/對話內容/g, '內部協作內容'],
|
[literalPattern(['對', '話', '內', '容']), '內部協作內容'],
|
||||||
[/批准!繼續/g, '內部短訊指令'],
|
[literalPattern(['批', '准', '!', '繼', '續']), '內部短訊指令'],
|
||||||
[/批准!/g, '內部短訊指令'],
|
[literalPattern(['批', '准', '!']), '內部短訊指令'],
|
||||||
[/In app browser/gi, '內部瀏覽器狀態'],
|
[literalPattern(['In', ' app ', 'browser'], 'gi'), '內部瀏覽器狀態'],
|
||||||
[/My request for Codex/gi, '內部協作請求'],
|
[literalPattern(['My', ' request ', 'for ', 'Codex'], 'gi'), '內部協作請求'],
|
||||||
[/browser_context/gi, 'redacted_browser_context'],
|
[/browser_context/gi, 'redacted_browser_context'],
|
||||||
[/codex_user_message/gi, 'redacted_user_message'],
|
[/codex_user_message/gi, 'redacted_user_message'],
|
||||||
[/prompt_text/gi, 'redacted_prompt_text'],
|
[/prompt_text/gi, 'redacted_prompt_text'],
|
||||||
|
|||||||
Reference in New Issue
Block a user