Atualizar readme.md
This commit is contained in:
93
readme.md
93
readme.md
@@ -382,10 +382,13 @@ Códigos conhecidos nesta versão:
|
||||
| `LOGIN_EXPIRED` | Mensagens contendo acesso expirado/vencido. | Mostrar aviso de renovação. |
|
||||
| `LOGIN_INVALID` | Falha de usuário/senha, HTTP 401 ou texto de login inválido. | Mostrar usuário/senha inválidos. |
|
||||
| `LOGIN_LIMIT` | Mensagens de limite/conexões excedidas. | Mostrar limite de conexões atingido. |
|
||||
| `PROXY_HTTP_101` | HTTP 101, normalmente `Switching Protocols`/WebSocket aceito. | Mostrar proxy/payload aceito e continuar aguardando autenticação/conexão. |
|
||||
| `PROXY_HTTP_200`, `PROXY_HTTP_2xx` | HTTP 200 até 299, exceto 101. O código real entra no final, exemplo `PROXY_HTTP_200`. | Mostrar que o proxy respondeu com sucesso. |
|
||||
| `PROXY_REDIRECT_301`, `PROXY_REDIRECT_302`, `PROXY_REDIRECT_3xx` | HTTP 300 até 399. O código real entra no final, exemplo `PROXY_REDIRECT_302`. | Mostrar que o bughost/proxy redirecionou a conexão. |
|
||||
| `PROXY_FORBIDDEN` | HTTP 403 ou `Forbidden`. | Mostrar proxy/bughost bloqueado. |
|
||||
| `PROXY_BAD_REQUEST` | HTTP 400 ou `Bad Request`. | Mostrar payload/proxy inválido. |
|
||||
| `PROXY_RATE_LIMITED` | HTTP 429 ou `Too Many Requests`. | Mostrar muitas tentativas/limite temporário. |
|
||||
| `PROXY_SERVER_ERROR` | HTTP 500/502, `Bad Gateway` ou erro interno. | Mostrar falha no proxy/servidor remoto. |
|
||||
| `PROXY_SERVER_ERROR` | HTTP 500/502/503/504, `Bad Gateway`, `Service Unavailable`, `Gateway Timeout` ou erro interno. | Mostrar falha no proxy/servidor remoto. |
|
||||
| `AUTH_FAILED` | Falha de autenticação sem classificação mais específica. | Mostrar falha genérica de autenticação. |
|
||||
|
||||
Exemplo de uso direto:
|
||||
@@ -399,6 +402,9 @@ function renderLastError() {
|
||||
LOGIN_EXPIRED: 'Seu login expirou. Renove seu acesso.',
|
||||
LOGIN_INVALID: 'Usuário ou senha inválidos.',
|
||||
LOGIN_LIMIT: 'Limite de conexões atingido.',
|
||||
PROXY_HTTP_101: 'Proxy aceitou WebSocket/101 Switching Protocols.',
|
||||
PROXY_HTTP_200: 'Proxy respondeu 200 OK.',
|
||||
PROXY_REDIRECT_302: 'Proxy/bughost redirecionou a conexão.',
|
||||
PROXY_FORBIDDEN: 'Proxy/bughost bloqueou a conexão.',
|
||||
PROXY_BAD_REQUEST: 'Payload ou proxy retornou Bad Request.',
|
||||
PROXY_RATE_LIMITED: 'Muitas tentativas. Tente novamente mais tarde.',
|
||||
@@ -926,6 +932,8 @@ Exemplo:
|
||||
{ "14:03:56": "Authenticating" },
|
||||
{ "14:03:57": "Server Message: welcome" },
|
||||
{ "14:03:58": "Proxy Status [HTTP_PROXY]: HTTP/1.1 101 Switching Protocols" },
|
||||
{ "14:03:59": "Proxy Status [PROXY_SSL]: HTTP/1.1 101 Switching Protocols" },
|
||||
{ "14:04:00": "Proxy Status [PROXY_SSL]: HTTP/1.1 302 Found" },
|
||||
{ "14:04:01": "Proxy Status [SSH_DIRECT]: HTTP/1.1 302 Found" }
|
||||
]
|
||||
```
|
||||
@@ -934,12 +942,18 @@ O patch faz o bridge mostrar também respostas HTTP/proxy relevantes para o tema
|
||||
|
||||
- `Proxy Status [HTTP_PROXY]: HTTP/1.1 101 ...`
|
||||
- `Proxy Status [HTTP_PROXY]: HTTP/1.1 302 ...`
|
||||
- `Proxy Status [PROXY_SSL]: HTTP/1.1 101 ...`
|
||||
- `Proxy Status [PROXY_SSL]: HTTP/1.1 200 ...`
|
||||
- `Proxy Status [PROXY_SSL]: HTTP/1.1 302 ...`
|
||||
- `Proxy Status [SSH_DIRECT]: HTTP/1.1 101 ...`
|
||||
- `Proxy Status [SSH_DIRECT]: HTTP/1.1 302 ...`
|
||||
- `HTTP/1.1 400`, `401`, `403`, `404`, `429`, `500`, `502`
|
||||
- mensagens como `Unauthorized`, `Forbidden`, `Bad Request`, `Too Many Requests` e `Bad Gateway`
|
||||
- `HTTP/1.0`, `HTTP/1.1` ou qualquer primeira linha que comece com `HTTP/`
|
||||
- `HTTP 100`, `101`, `200`, `301`, `302`, `400`, `401`, `403`, `404`, `407`, `429`, `500`, `502`, `503`, `504`
|
||||
- mensagens como `Unauthorized`, `Proxy Authentication Required`, `Forbidden`, `Bad Request`, `Too Many Requests`, `Bad Gateway`, `Service Unavailable` e `Gateway Timeout`
|
||||
|
||||
A diferença importante é o `SSH_DIRECT`: quando o campo de servidor SSH é usado como proxy/bughost e o servidor real está dentro do payload, o app agora faz uma leitura curta e segura da primeira resposta. Se vier HTTP, ele mostra o status para o HTML. Se vier banner SSH, ele preserva os bytes e não quebra o handshake.
|
||||
A diferença importante é o `PROXY_SSL`: em **Proxy + Payload SSL** (`SSL_PROXY` / `SSH_SSL_PROXY`), o app agora registra a primeira linha HTTP real recebida do proxy com o formato `Proxy Status [PROXY_SSL]: HTTP/...`. Antes, esse caminho podia trocar `101` por `200` internamente ou lançar erro antes do WebView receber o status correto. Agora o tema consegue ver o código real, como `101`, `200`, `302`, `407`, `500`, etc.
|
||||
|
||||
A outra diferença é o `SSH_DIRECT`: quando o campo de servidor SSH é usado como proxy/bughost e o servidor real está dentro do payload, o app faz uma leitura curta e segura da primeira resposta. Se vier HTTP, ele mostra o status para o HTML. Se vier banner SSH, ele preserva os bytes e não quebra o handshake.
|
||||
|
||||
Helper de renderização:
|
||||
|
||||
@@ -973,6 +987,68 @@ window.dtLogsUpdatedListener = function(logsJson) {
|
||||
|
||||
O buffer de logs nativo exposto ao HTML é limitado a entradas recentes de status, mensagens de banner do servidor e mensagens úteis de proxy. Ele não é o logcat/debug completo.
|
||||
|
||||
|
||||
### 11.1 Como extrair o código HTTP do proxy no tema
|
||||
|
||||
Quando o app recebe uma linha `HTTP/...`, o classificador do bridge também atualiza `DtGetLastConnectionError.execute()` e dispara `dtConnectionErrorListener(error)` quando o status for relevante para o tema.
|
||||
|
||||
Exemplos de códigos normalizados:
|
||||
|
||||
| Linha recebida no log | Código normalizado esperado |
|
||||
|---|---|
|
||||
| `Proxy Status [PROXY_SSL]: HTTP/1.1 101 Switching Protocols` | `PROXY_HTTP_101` |
|
||||
| `Proxy Status [PROXY_SSL]: HTTP/1.1 200 OK` | `PROXY_HTTP_200` |
|
||||
| `Proxy Status [PROXY_SSL]: HTTP/1.1 302 Found` | `PROXY_REDIRECT_302` |
|
||||
| `Proxy Status [PROXY_SSL]: HTTP/1.1 400 Bad Request` | `PROXY_BAD_REQUEST` |
|
||||
| `Proxy Status [PROXY_SSL]: HTTP/1.1 401 Unauthorized` | `LOGIN_INVALID` |
|
||||
| `Proxy Status [PROXY_SSL]: HTTP/1.1 407 Proxy Authentication Required` | `LOGIN_INVALID` |
|
||||
| `Proxy Status [PROXY_SSL]: HTTP/1.1 403 Forbidden` | `PROXY_FORBIDDEN` |
|
||||
| `Proxy Status [PROXY_SSL]: HTTP/1.1 429 Too Many Requests` | `PROXY_RATE_LIMITED` |
|
||||
| `Proxy Status [PROXY_SSL]: HTTP/1.1 500 Internal Server Error` | `PROXY_SERVER_ERROR` |
|
||||
| `Proxy Status [PROXY_SSL]: HTTP/1.1 502 Bad Gateway` | `PROXY_SERVER_ERROR` |
|
||||
| `Proxy Status [PROXY_SSL]: HTTP/1.1 503 Service Unavailable` | `PROXY_SERVER_ERROR` |
|
||||
| `Proxy Status [PROXY_SSL]: HTTP/1.1 504 Gateway Timeout` | `PROXY_SERVER_ERROR` |
|
||||
|
||||
Helper simples para pegar o último status HTTP dos logs:
|
||||
|
||||
```js
|
||||
function getLatestProxyHttpStatus() {
|
||||
let rows = [];
|
||||
try { rows = JSON.parse(DtGetLogs.execute() || '[]'); } catch (e) {}
|
||||
|
||||
for (let i = rows.length - 1; i >= 0; i--) {
|
||||
const message = String(Object.values(rows[i] || {})[0] || '');
|
||||
const match = message.match(/Proxy Status \[([^\]]+)\]:\s*(HTTP\/\S+\s+(\d{3})[^<]*)/i);
|
||||
if (match) {
|
||||
return {
|
||||
source: match[1],
|
||||
line: match[2].trim(),
|
||||
code: Number(match[3])
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
```
|
||||
|
||||
Exemplo de UI para Proxy + Payload SSL:
|
||||
|
||||
```js
|
||||
window.dtLogsUpdatedListener = function(logsJson) {
|
||||
const status = getLatestProxyHttpStatus();
|
||||
if (!status) return;
|
||||
|
||||
if (status.source === 'PROXY_SSL') {
|
||||
renderProxyStatus(`Proxy SSL respondeu ${status.code}`);
|
||||
} else if (status.source === 'HTTP_PROXY') {
|
||||
renderProxyStatus(`Proxy HTTP respondeu ${status.code}`);
|
||||
} else if (status.source === 'SSH_DIRECT') {
|
||||
renderProxyStatus(`SSH_DIRECT/proxy respondeu ${status.code}`);
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 12. Modal de perfil / check-user
|
||||
@@ -1422,7 +1498,7 @@ Antes de publicar um tema, verifique:
|
||||
|
||||
---
|
||||
|
||||
## 21. Resumo dos bridges novos do patch V2/V3/V4/V5
|
||||
## 21. Resumo dos bridges novos do patch V2/V3/V4/V5/V6
|
||||
|
||||
Esta versão do patch adiciona/atualiza estes pontos para temas HTML OnlineConfig:
|
||||
|
||||
@@ -1434,7 +1510,9 @@ Esta versão do patch adiciona/atualiza estes pontos para temas HTML OnlineConfi
|
||||
| Callback de erro | `dtConnectionErrorListener(error)` | Tema recebe o erro ao vivo como objeto JS. |
|
||||
| Callback de auth/compatibilidade | `dtAuthErrorListener(error)` | Alias compatível para temas que tratam erro de autenticação separado. |
|
||||
| Callback de logs | `dtLogsUpdatedListener(logsJson)` | Tema recebe logs recentes sempre que uma mensagem visível é adicionada. |
|
||||
| Status de proxy HTTP | `DtGetLogs.execute()` | Logs agora incluem `Proxy Status [HTTP_PROXY]` e `Proxy Status [SSH_DIRECT]`. |
|
||||
| Status de proxy HTTP | `DtGetLogs.execute()` | Logs incluem `Proxy Status [HTTP_PROXY]`, `Proxy Status [PROXY_SSL]` e `Proxy Status [SSH_DIRECT]`. |
|
||||
| Proxy + Payload SSL | logs + erro classificado | Em `SSL_PROXY` / `SSH_SSL_PROXY`, o app preserva o status real do proxy, incluindo `101`, `200`, `302`, `407`, `500`, etc., usando a origem `PROXY_SSL`. |
|
||||
| Códigos HTTP normalizados | `DtGetLastConnectionError.execute()` + `dtConnectionErrorListener(error)` | Status `101` vira `PROXY_HTTP_101`, status `2xx` vira `PROXY_HTTP_<codigo>` e redirects `3xx` viram `PROXY_REDIRECT_<codigo>`. |
|
||||
| SSH_DIRECT com payload/proxy | logs + erro classificado | Mesmo em SSH direto, o app tenta detectar resposta HTTP inicial do proxy sem quebrar banner SSH. |
|
||||
| Proxy local foreground | `DtStartHotSpotService.execute()` | Inicia `ProxyService` com notificação foreground em vez de ligar apenas o socket interno. |
|
||||
| Permissão de notificação | abertura do `OnlineConfigWebActivity` e start do proxy | Android 13+ pede `POST_NOTIFICATIONS`; se negar, o tema deve confirmar o status do proxy. |
|
||||
@@ -1464,6 +1542,9 @@ window.dtConnectionErrorListener = function(error) {
|
||||
LOGIN_EXPIRED: 'Seu login expirou. Renove seu acesso.',
|
||||
LOGIN_INVALID: 'Usuário ou senha inválidos.',
|
||||
LOGIN_LIMIT: 'Limite de conexões atingido.',
|
||||
PROXY_HTTP_101: 'Proxy aceitou 101 Switching Protocols.',
|
||||
PROXY_HTTP_200: 'Proxy respondeu 200 OK.',
|
||||
PROXY_REDIRECT_302: 'Proxy/bughost redirecionou a conexão.',
|
||||
PROXY_FORBIDDEN: 'Proxy/bughost bloqueou a conexão.',
|
||||
PROXY_BAD_REQUEST: 'Payload ou proxy inválido.',
|
||||
PROXY_RATE_LIMITED: 'Muitas tentativas no proxy.',
|
||||
|
||||
Reference in New Issue
Block a user