File size: 7,130 Bytes
1fa2c88 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | export default {
// Server port
port: parseInt(process.env.PORT || 4000),
// https://expressjs.com/en/guide/behind-proxies.html
trustProxy: boolOrString(process.env.TRUST_PROXY || 'loopback, linklocal, uniquelocal'),
// Jacket instance url
jackettUrl: process.env.JACKETT_URL || 'http://localhost:9117',
// Jacket API key
jackettApiKey: process.env.JACKETT_API_KEY || '',
// The Movie Database Access Token. Configure to use TMDB rather than cinemeta.
tmdbAccessToken: process.env.TMDB_ACCESS_TOKEN || '96ca5e1179f107ab7af156b0a3ae9ca5',
// Data folder for cache database, torrent files ... Must be persistent in production
dataFolder: process.env.DATA_FOLDER || '/tmp',
// Enable localtunnel feature
localtunnel: (process.env.LOCALTUNNEL || 'false') === 'true',
// Addon ID
addonId: process.env.ADDON_ID || 'community.stremio.jackettio',
// Addon Name
addonName: process.env.ADDON_NAME || 'TMDb UFC Jackettio',
// Addon Description
addonDescription: process.env.ADDON_DESCRIPTION || 'Stremio addon that resolve streams using Jackett and Debrid. It seamlessly integrates with private trackers.',
// Addon Icon
addonIcon: process.env.ADDON_ICON || 'https://avatars.githubusercontent.com/u/15383019?s=48&v=4',
// When hosting a public instance with a private tracker, you must configure this setting to:
// - Request the user's passkey on the /configure page.
// - Replace your passkey "REPLACE_PASSKEY" with theirs when sending uncached torrents to the debrid.
// If you do not configure this setting with private tracker, your passkey could be exposed to users who add uncached torrents.
replacePasskey: process.env.REPLACE_PASSKEY || '',
// The URL where the user can locate their passkey (typically the tracker URL).
replacePasskeyInfoUrl: process.env.REPLACE_PASSKEY_INFO_URL || '',
// The passkey pattern
replacePasskeyPattern: process.env.REPLACE_PASSKEY_PATTERN || '[a-zA-Z0-9]+',
// List of config keys that user can't configure
immulatableUserConfigKeys: commaListToArray(process.env.IMMULATABLE_USER_CONFIG_KEYS || 'hideUncached'),
// Welcome message in /configure page. Markdown format
welcomeMessage: process.env.WELCOME_MESSAGE || '',
// Trust the cf-connecting-ip header
trustCfIpHeader: (process.env.TRUST_CF_IP_HEADER || 'false') === 'true',
// Rate limit interval in seconds to resolve stream
rateLimitWindow: parseInt(process.env.RATE_LIMIT_WINDOW || 60 * 60),
// Rate limit the number of requests to resolve stream
rateLimitRequest: parseInt(process.env.RATE_LIMIT_REQUEST || 150),
// Time (in seconds) needed to identify an indexer as slow
slowIndexerDuration: parseInt(process.env.SLOW_INDEXER_DURATION || 20) * 1000,
// Time window (in seconds) to monitor and count slow indexer requests (only requests within this period are considered)
slowIndexerWindow: parseInt(process.env.SLOW_INDEXER_WINDOW || 1800) * 1000,
// Number of consecutive slow requests within the time window to disable the indexer
slowIndexerRequest: parseInt(process.env.SLOW_INDEXER_REQUEST || 5),
defaultUserConfig: {
qualities: commaListToArray(process.env.DEFAULT_QUALITIES || '0, 720, 1080, 2160').map(v => parseInt(v)),
excludeKeywords: commaListToArray(process.env.DEFAULT_EXCLUDE_KEYWORDS || ''),
maxTorrents: parseInt(process.env.DEFAULT_MAX_TORRENTS || 15),
priotizeLanguages: commaListToArray(process.env.DEFAULT_PRIOTIZE_LANGUAGES || ''),
priotizePackTorrents: parseInt(process.env.DEFAULT_PRIOTIZE_PACK_TORRENTS || 2),
forceCacheNextEpisode: (process.env.DEFAULT_FORCE_CACHE_NEXT_EPISODE || 'false') === 'true',
sortCached: sortCommaListToArray(process.env.DEFAULT_SORT_CACHED || 'quality:true, size:true'),
sortUncached: sortCommaListToArray(process.env.DEFAULT_SORT_UNCACHED || 'seeders:true'),
hideUncached: true, // Force hideUncached to always be true
indexers: commaListToArray(process.env.DEFAULT_INDEXERS || 'all'),
indexerTimeoutSec: parseInt(process.env.DEFAULT_INDEXER_TIMEOUT_SEC || '60'),
passkey: '',
// If not defined, the original title is used for search. If defined, the title in the given language is used for search
// format: ISO 639-1, example: en
metaLanguage: process.env.DEFAULT_META_LANGUAGE || '',
enableMediaFlow: (process.env.DEFAULT_ENABLE_MEDIA_FLOW || 'false') === 'true',
mediaflowProxyUrl: process.env.DEFAULT_MEDIA_FLOW_PROXY_URL || '',
mediaflowApiPassword: process.env.DEFAULT_MEDIA_FLOW_API_PASSWORD || '',
mediaflowPublicIp: process.env.DEFAULT_MEDIA_FLOW_PUBLIC_IP || ''
},
qualities: [
{value: 0, label: 'Unknown'},
{value: 360, label: '360p'},
{value: 480, label: '480p'},
{value: 720, label: '720p'},
{value: 1080, label: '1080p'},
{value: 2160, label: '4K'}
],
sorts: [
{value: [['quality', true], ['seeders', true]], label: 'By quality then seeders'},
{value: [['quality', true], ['size', true]], label: 'By quality then size'},
{value: [['seeders', true]], label: 'By seeders'},
{value: [['quality', true]], label: 'By quality'},
{value: [['size', true]], label: 'By size'}
],
languages: [
{value: 'multi', emoji: '๐', iso639: '', pattern: 'multi'},
{value: 'arabic', emoji: '๐ฆ๐ช', iso639: 'ar', pattern: 'arabic'},
{value: 'chinese', emoji: '๐จ๐ณ', iso639: 'zh', pattern: 'chinese'},
{value: 'german', emoji: '๐ฉ๐ช', iso639: 'de', pattern: 'german'},
{value: 'english', emoji: '๐บ๐ธ', iso639: 'en', pattern: '(eng(lish)?)'},
{value: 'spanish', emoji: '๐ช๐ธ', iso639: 'es', pattern: 'spa(nish)?'},
{value: 'french', emoji: '๐ซ๐ท', iso639: 'fr', pattern: 'fre(nch)?'},
{value: 'dutch', emoji: '๐ณ๐ฑ', iso639: 'nl', pattern: 'dutch'},
{value: 'italian', emoji: '๐ฎ๐น', iso639: 'it', pattern: 'ita(lian)?'},
{value: 'lithuanian', emoji: '๐ฑ๐น', iso639: 'lt', pattern: 'lithuanian'},
{value: 'korean', emoji: '๐ฐ๐ท', iso639: 'ko', pattern: 'korean'},
{value: 'portuguese', emoji: '๐ต๐น', iso639: 'pt', pattern: 'portuguese'},
{value: 'russian', emoji: '๐ท๐บ', iso639: 'ru', pattern: 'rus(sian)?'},
{value: 'swedish', emoji: '๐ธ๐ช', iso639: 'sv', pattern: 'swedish'},
{value: 'tamil', emoji: '๐ฎ๐ณ', iso639: 'ta', pattern: 'tamil'},
{value: 'turkish', emoji: '๐น๐ท', iso639: 'tr', pattern: 'turkish'}
].map(lang => {
lang.label = `${lang.emoji} ${lang.value.charAt(0).toUpperCase() + lang.value.slice(1)}`;
lang.pattern = new RegExp(` ${lang.pattern} `, 'i');
return lang;
})
}
function commaListToArray(str){
return str.split(',').map(str => str.trim()).filter(Boolean);
}
function sortCommaListToArray(str){
return commaListToArray(str).map(sort => {
const [key, reverse] = sort.split(':');
return [key.trim(), reverse.trim() == 'true'];
});
}
function boolOrString(str){
if(str.trim().toLowerCase() == 'true'){
return true;
}else if(str.trim().toLowerCase() == 'false'){
return false;
}else{
return str.trim();
}
} |