beast-agent 0.26.3 → 0.26.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/agent/discord.js +22 -2
- package/src/renderer/i18n.js +2 -0
- package/src/renderer/renderer.js +1 -0
package/package.json
CHANGED
package/src/agent/discord.js
CHANGED
|
@@ -48,6 +48,20 @@ function bodySnippet(data) {
|
|
|
48
48
|
return s ? ` — gövde: ${s.slice(0, 140)}` : '';
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
/* Ağ engel sayfası tespiti: Discord API her zaman JSON döner — text/html veya
|
|
52
|
+
erişim-engelle sayfası gelirse ağ seviyesinde blok var demektir (Türkiye'de
|
|
53
|
+
Discord erişimi zaman zaman engellenir). Kullanıcıya net VPN yönlendirmesi. */
|
|
54
|
+
const VPN_HINT = 'Discord bu ağdan ERİŞİME ENGELLİ görünüyor — VPN açıp tekrar dene (engel sayfası döndü)';
|
|
55
|
+
|
|
56
|
+
function looksBlocked(ctype, data) {
|
|
57
|
+
const ct = String(ctype || '');
|
|
58
|
+
const body = String(data || '').slice(0, 4000);
|
|
59
|
+
return (
|
|
60
|
+
ct.includes('text/html') ||
|
|
61
|
+
/erisime[_ ]?engelle|erişime engelle|blocked|block_page/i.test(body)
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
51
65
|
class DiscordBridge {
|
|
52
66
|
constructor({ token, emit, onIncoming }) {
|
|
53
67
|
this.token = String(token || '').trim();
|
|
@@ -101,14 +115,17 @@ class DiscordBridge {
|
|
|
101
115
|
const data = await res.text();
|
|
102
116
|
let j = null;
|
|
103
117
|
try { j = data ? JSON.parse(data) : null; } catch {}
|
|
104
|
-
if (res.ok) return j;
|
|
118
|
+
if (res.ok && j !== null) return j;
|
|
119
|
+
if (j === null && looksBlocked(res.headers.get('content-type'), data)) {
|
|
120
|
+
throw new Error(VPN_HINT + bodySnippet(data));
|
|
121
|
+
}
|
|
105
122
|
throw new Error(
|
|
106
123
|
`discord ${path}: HTTP ${res.status}${j && j.message ? ' ' + j.message : ''}${bodySnippet(data)}`
|
|
107
124
|
);
|
|
108
125
|
} catch (e) {
|
|
109
126
|
/* kendi formatladığımız API hatasıysa yukarı taşı; transport hatasıysa
|
|
110
127
|
Node https yoluna düş (orada esnek TLS şansı var) */
|
|
111
|
-
if (/^discord
|
|
128
|
+
if (/^discord |Discord bu ağ/.test(String((e && e.message) || ''))) throw e;
|
|
112
129
|
}
|
|
113
130
|
}
|
|
114
131
|
|
|
@@ -134,6 +151,9 @@ class DiscordBridge {
|
|
|
134
151
|
let j = null;
|
|
135
152
|
try { j = data ? JSON.parse(data) : null; } catch {}
|
|
136
153
|
if (res.statusCode >= 200 && res.statusCode < 300 && j !== null) return resolve(j);
|
|
154
|
+
if (looksBlocked(ctype, data)) {
|
|
155
|
+
return reject(new Error(VPN_HINT + bodySnippet(data)));
|
|
156
|
+
}
|
|
137
157
|
if (res.statusCode >= 200 && res.statusCode < 300) {
|
|
138
158
|
return reject(new Error(`discord ${path}: bozuk yanıt (HTTP ${res.statusCode}${ctype ? ', ' + ctype : ''})${bodySnippet(data)}`));
|
|
139
159
|
}
|
package/src/renderer/i18n.js
CHANGED
|
@@ -215,6 +215,7 @@
|
|
|
215
215
|
it_dc_token_bad: 'Token doğrulanamadı — Developer Portal\u2019dan aldığın tokenı kontrol et',
|
|
216
216
|
it_dc_id_ph: 'Kullanıcı ID veya @kullanıcı_adı',
|
|
217
217
|
it_dc_note: 'İzin listesi boşsa kimse cevap almaz. Bot oluşturma: discord.com/developers → New Application → Bot → Token. "MESSAGE CONTENT INTENT"i AÇ (yoksa mesajlar boş gelir). Sunucu daveti: OAuth2 → bot yetkisiyle. Kendi ID\u2019ni öğrenmek için geliştirici modunu açıp kendine sağ tıkla → ID\u2019yi kopyala.',
|
|
218
|
+
it_dc_vpn: 'Türkiye\u2019de Discord erişimi zaman zaman engellenir — bağlanamıyorsan VPN açıp tekrar dene.',
|
|
218
219
|
ev_h2: 'Olay Merkezi',
|
|
219
220
|
ev_sub: 'Cron\u2019suz canlı olaylar — kaynakları aç, abonelikleri agent kendisi kurar (event_subscribe). Tetiklenen olay ilgili sohbete düşer, cevap WhatsApp\u2019a gider.',
|
|
220
221
|
ev_on: 'Olay merkezi açık',
|
|
@@ -742,6 +743,7 @@
|
|
|
742
743
|
it_dc_token_bad: 'Token could not be verified — check the token from the Developer Portal',
|
|
743
744
|
it_dc_id_ph: 'User ID or @username',
|
|
744
745
|
it_dc_note: 'Empty allow list = nobody gets a reply. Create a bot: discord.com/developers → New Application → Bot → Token. Turn ON "MESSAGE CONTENT INTENT". Invite via OAuth2 bot URL. To learn your ID: enable developer mode, right-click yourself → Copy ID.',
|
|
746
|
+
it_dc_vpn: 'Discord may be blocked on some networks — if it won\u2019t connect, turn on a VPN and retry.',
|
|
745
747
|
ev_h2: 'Event Center',
|
|
746
748
|
ev_sub: 'Live events without cron — open sources, the agent sets up subscriptions itself (event_subscribe). The triggered event drops into the relevant chat, the reply goes to WhatsApp.',
|
|
747
749
|
ev_on: 'Event center on',
|
package/src/renderer/renderer.js
CHANGED
|
@@ -1557,6 +1557,7 @@ async function renderIntegrationsPane() {
|
|
|
1557
1557
|
<div class="wa-actions" style="margin-top:6px">
|
|
1558
1558
|
<button id="dcStopBtn" class="btn ghost">${_t('it_disconnect')}</button>
|
|
1559
1559
|
</div>
|
|
1560
|
+
<div class="sub" style="margin-top:6px">ⓘ ${_t('it_dc_vpn')}</div>
|
|
1560
1561
|
<div class="divider"></div>
|
|
1561
1562
|
<label class="mem-label" style="margin-top:0">${_t('it_allow_label')} — Discord</label>
|
|
1562
1563
|
<div id="dcAllowChips" class="chips-inline"></div>
|