configure.py 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. import json
  2. import os
  3. from pathlib import Path
  4. def _local_secrets():
  5. path = Path(__file__).resolve().parent / "config" / "secrets.json"
  6. if not path.exists():
  7. return {}
  8. with path.open(encoding="utf-8") as stream:
  9. return json.load(stream)
  10. _SECRETS = _local_secrets()
  11. def _setting(name, default=""):
  12. return os.environ.get(name, _SECRETS.get(name, default))
  13. CLOUD_API_BASE_URL = _setting("CLOUD_API_BASE_URL", "https://api.text.skin")
  14. CLOUD_API_TOKEN = _setting("CLOUD_API_TOKEN")
  15. # LLM General Captcha recognition config (supports OpenAI, Qwen, DeepSeek compatible endpoints)
  16. CAPTCHA_LLM_CONFIG = None
  17. CAPTCHA_LLM_CONFIG = {
  18. "base_url": "https://dashscope.aliyuncs.com/compatible-mode/v1",
  19. "api_key": _setting("CAPTCHA_LLM_API_KEY"),
  20. "model": "qwen3-vl-plus",
  21. "timeout": 30.0,
  22. }
  23. REDIS_CFG = {
  24. "host": _setting("REDIS_HOST", "text.skin"),
  25. "port": int(_setting("REDIS_PORT", "6379")),
  26. "db": int(_setting("REDIS_DB", "0")),
  27. "password": _setting("REDIS_PASSWORD") or None
  28. }
  29. # Test task: when configured, task rotation directly uses this task
  30. TEST_TASK = None
  31. # TEST_TASK = {
  32. # "status": "running",
  33. # "priority": 10,
  34. # "config": {
  35. # "select": "random",
  36. # "alias_email": "mariaandrews2240@gmail-app.com",
  37. # "time_filter": ["AM","PM"],
  38. # "exclude_dates": [],
  39. # "include_today": True,
  40. # "allowed_weekdays": [1,2,3,4,5],
  41. # "include_tomorrow": True
  42. # },
  43. # "user_inputs": {
  44. # "email": "mariaandrews2240@gmail-app.com",
  45. # "password": "Visafly@111",
  46. # "username": "mariaandrews2240@gmail-app.com",
  47. # "support_pta": False,
  48. # "expected_end_date": "2026-06-30",
  49. # "expected_start_date": "2026-05-01"
  50. # },
  51. # "grabbed_history": {},
  52. # "meta": None,
  53. # "id": 0,
  54. # "order_id": "ORD-20260415100806-0fdee58d",
  55. # "routing_key": "auto.slot.lon.fr.tourist",
  56. # "script_version": "latest",
  57. # "attempt_count": 0,
  58. # "notify_count": 0,
  59. # "created_at": "2000-01-01T01:00:00",
  60. # "updated_at": "2000-01-01T01:00:00",
  61. # "expire_at": "2000-01-01T01:00:00"
  62. # }
  63. # Test account: when configured, account rotation directly uses this account
  64. TEST_ACCOUNT = None
  65. # TEST_ACCOUNT = {
  66. # "pool_name": "tls.gb.fr.sentinel",
  67. # "username": "robertolord2257@gmail-app.com",
  68. # "password": "Visafly@111",
  69. # "extra_data": {},
  70. # "status": "active",
  71. # "next_use_time": "2000-01-01T01:00:00",
  72. # "id": 0,
  73. # "created_at": "2000-01-01T01:00:00",
  74. # "updated_at": "2000-01-01T01:00:00"
  75. # }
  76. # Test proxy: when configured, proxy rotation directly uses this proxy
  77. TEST_PROXY = None
  78. # TEST_PROXY = {
  79. # "pool_name": "local",
  80. # "proto": "http",
  81. # "ip": "127.0.0.1",
  82. # "port": 7890,
  83. # "username": "",
  84. # "password": "",
  85. # "id": 0
  86. # }
  87. # Node ID config: highest priority, then NODE_ID env var, then default "node01"
  88. NODE_ID = None
  89. # NODE_ID = "node"
  90. # Chrome binary path: highest priority, then CHROME_BIN env var, then default
  91. CHROME_PATH = None
  92. # CHROME_PATH = "E:/ungoogled-chromium_148.0.7778.215-1.1_windows_x64/chrome.exe"
  93. # Mihomo binary path: highest priority, then MIHOMO_BIN env var, then default
  94. MIHOMO_BIN_PATH = None
  95. # MIHOMO_BIN_PATH = 'downloads/mihomo'
  96. # Proxy tunnel relay nodes, randomly chosen from list
  97. MIHOMO_RELAY_NODES = None
  98. # MIHOMO_RELAY_NODES = [
  99. # {
  100. # "name": "RelayNode jp 01 | 1x",
  101. # "type": "ss",
  102. # "server": "odko6qmr.mobilfunk.top",
  103. # "port": 12012,
  104. # "cipher": "aes-128-gcm",
  105. # "password": "haMLMXirByn6rGVh",
  106. # "plugin": "obfs",
  107. # "plugin-opts": {
  108. # "mode": "http",
  109. # "host": "c0f69828a7c1.microsoft.com"
  110. # },
  111. # "udp": True
  112. # },
  113. # {
  114. # "name": "RelayNode hk 01 | 1x",
  115. # "type": "ss",
  116. # "server": "e0405950-3002-4dc8-860b-8fac3ffdd76c.drive-glicloudccp.com",
  117. # "port": 12022,
  118. # "cipher": "aes-128-gcm",
  119. # "password": "haMLMXirByn6rGVh",
  120. # "plugin": "obfs",
  121. # "plugin-opts": {
  122. # "mode": "http",
  123. # "host": "c0f69828a7c1.microsoft.com"
  124. # },
  125. # "udp": True
  126. # },
  127. # {
  128. # "name": "RelayNode hk 02 | 1x",
  129. # "type": "ss",
  130. # "server": "e0405950-3002-4dc8-860b-8fac3ffdd76c.drive-glicloudccp.com",
  131. # "port": 12023,
  132. # "cipher": "aes-128-gcm",
  133. # "password": "haMLMXirByn6rGVh",
  134. # "plugin": "obfs",
  135. # "plugin-opts": {
  136. # "mode": "http",
  137. # "host": "c0f69828a7c1.microsoft.com"
  138. # },
  139. # "udp": True
  140. # },
  141. # {
  142. # "name": "RelayNode hk 03 | 1x",
  143. # "type": "ss",
  144. # "server": "e0405950-3002-4dc8-860b-8fac3ffdd76c.drive-glicloudccp.com",
  145. # "port": 12024,
  146. # "cipher": "aes-128-gcm",
  147. # "password": "haMLMXirByn6rGVh",
  148. # "plugin": "obfs",
  149. # "plugin-opts": {
  150. # "mode": "http",
  151. # "host": "c0f69828a7c1.microsoft.com"
  152. # },
  153. # "udp": True
  154. # }
  155. # ]
  156. # Temporary test for booking submission
  157. TLS_TEST_BOOK_AFTER_QUERY = False