Update files

This commit is contained in:
glpshchn 2025-12-08 02:07:09 +03:00
parent 63b7c0d8f0
commit 0305e87ce5
3 changed files with 11 additions and 15 deletions

View File

@ -241,12 +241,10 @@ const handleInlineQuery = async (inlineQuery) => {
return;
}
const E621_USER_AGENT = 'NakamaApp/1.0 (by glpshchn00 on e621; Telegram: @glpshchn00)';
const E621_USER_AGENT = 'NakamaApp/1.0 (by glpshchn on e621)';
// e621 использует Basic Auth с username:api_key
// Если username не указан, используем API ключ как username и пустой пароль
// Или можно использовать формат :api_key (пустой username)
const username = config.e621Username || config.e621ApiKey;
// e621 использует Basic Auth с username:api_key (как в документации)
const username = config.e621Username || 'glpshchn';
const auth = Buffer.from(`${username}:${config.e621ApiKey}`).toString('base64');
const response = await axios.get('https://e621.net/posts.json', {

View File

@ -37,7 +37,7 @@ module.exports = {
gelbooruUserId: process.env.GELBOORU_USER_ID || '1844464',
// e621 API
e621Username: process.env.E621_USERNAME || '', // Опционально, можно оставить пустым
e621Username: process.env.E621_USERNAME || 'glpshchn',
e621ApiKey: process.env.E621_API_KEY || 'MWYMw57r2Gu6Yxvw1YvepNvZ',
// Frontend URL

View File

@ -6,7 +6,7 @@ const { proxyLimiter } = require('../middleware/rateLimiter');
const config = require('../config');
// e621 требует описательный User-Agent с контактами
const E621_USER_AGENT = 'NakamaApp/1.0 (by glpshchn00 on e621; Telegram: @glpshchn00)';
const E621_USER_AGENT = 'NakamaApp/1.0 (by glpshchn on e621)';
const CACHE_TTL_MS = 60 * 1000; // 1 минута
const searchCache = new Map();
@ -91,8 +91,8 @@ router.get('/proxy/:encodedUrl', async (req, res) => {
// Если это e621, добавляем авторизацию (если есть API ключ)
if (urlObj.hostname.includes('e621.net') && config.e621ApiKey) {
try {
// Если username не указан, используем API ключ как username
const username = config.e621Username || config.e621ApiKey;
// e621 использует Basic Auth с username:api_key
const username = config.e621Username || 'glpshchn';
const auth = Buffer.from(`${username}:${config.e621ApiKey}`).toString('base64');
headers['Authorization'] = `Basic ${auth}`;
} catch (error) {
@ -142,9 +142,8 @@ router.get('/furry', authenticate, async (req, res) => {
// e621 API автоматически обрабатывает теги через пробел в параметре tags
try {
// Базовая авторизация для e621 API
// Если username не указан, используем API ключ как username
const username = config.e621Username || config.e621ApiKey;
// Базовая авторизация для e621 API (формат: username:api_key)
const username = config.e621Username || 'glpshchn';
const auth = Buffer.from(`${username}:${config.e621ApiKey}`).toString('base64');
const response = await axios.get('https://e621.net/posts.json', {
@ -350,9 +349,8 @@ router.get('/furry/tags', authenticate, async (req, res) => {
}
try {
// Базовая авторизация для e621 API
// Если username не указан, используем API ключ как username
const username = config.e621Username || config.e621ApiKey;
// Базовая авторизация для e621 API (формат: username:api_key)
const username = config.e621Username || 'glpshchn';
const auth = Buffer.from(`${username}:${config.e621ApiKey}`).toString('base64');
const response = await axios.get('https://e621.net/tags.json', {