Files
DemonGatanjieuandClaude Opus 5.5 6f4347d88d Settings -> Network: a proxy for the plugin, and why Civitai cannot be reached
A Bilibili user's scan said Civitai could not be reached while their
browser reached it through a VPN app: the plugin's urllib requests only
use HTTPS_PROXY or the Windows proxy, not a PAC script or a browser-only
proxy.

net_proxy.py: the proxy address saved in api/config.json (NETWORK_PROXY)
that every request of the plugin goes through (Civitai, Hugging Face,
GitHub, translators), handed to the scan process as HTTP(S)_PROXY; empty
keeps the old behaviour. It also names why a request failed (timeout,
refused, dns, ssl, reset, proxy, http:<code>).

Settings -> Network has the address (SOCKS and malformed ones refused
with what to write) and Test connection, which calls 1.60's
/anomalous/civitai_check (brought here unchanged, now through the proxy
and with the failure's name). A scan that loses Civitai records why
(civitai_error) and the scan page and activity log say it with what to
try.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 20:10:34 +08:00

23 lines
865 B
JavaScript

/**
* Why a request of the plugin failed, in words: the codes of net_proxy.py `failure()` ('timeout',
* 'refused', 'http:503' …) as the settings' connection test and the scan results show them.
*/
import { translate as t } from './locales.js';
const WORDS = {
timeout: 'netFailureTimeout', refused: 'netFailureRefused', dns: 'netFailureDns',
ssl: 'netFailureSsl', reset: 'netFailureReset', proxy: 'netFailureProxy',
};
export function failureWords(code) {
const text = String(code || '');
if (text.startsWith('http:')) return t('netFailureHttp', { code: text.slice(5) });
return t(WORDS[text] || 'netFailureOther');
}
/** The line under "Civitai stopped answering": why, and what to try. '' when the reason is unknown. */
export function civitaiDownWhy(code) {
return code ? t('scanCivitaiWhy', { why: failureWords(code) }) : '';
}