ani-auto 1.4.3 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/anime/LICENSE +21 -0
  2. package/anime/api/index.js +110 -0
  3. package/anime/app.js +79 -0
  4. package/anime/controllers/animeInfoController.js +48 -0
  5. package/anime/controllers/animeListController.js +21 -0
  6. package/anime/controllers/homeController.js +42 -0
  7. package/anime/controllers/playController.js +140 -0
  8. package/anime/controllers/queueController.js +20 -0
  9. package/anime/controllers/testController.js +667 -0
  10. package/anime/index.js +139 -0
  11. package/anime/middleware/cache.js +64 -0
  12. package/anime/middleware/errorHandler.js +33 -0
  13. package/anime/middleware/rateLimiter.js +73 -0
  14. package/anime/models/animeInfoModel.js +193 -0
  15. package/anime/models/animeListModel.js +69 -0
  16. package/anime/models/homeModel.js +33 -0
  17. package/anime/models/playModel.js +528 -0
  18. package/anime/models/queueModel.js +22 -0
  19. package/anime/package.json +27 -0
  20. package/anime/pnpm-lock.yaml +1774 -0
  21. package/anime/readme.md +236 -0
  22. package/anime/routes/animeInfoRoutes.js +9 -0
  23. package/anime/routes/animeListRoutes.js +9 -0
  24. package/anime/routes/homeRoutes.js +10 -0
  25. package/anime/routes/playRoutes.js +11 -0
  26. package/anime/routes/queueRoutes.js +8 -0
  27. package/anime/routes/testRoutes.js +325 -0
  28. package/anime/routes/webhookRoutes.js +23 -0
  29. package/anime/scrapers/animepahe.js +1053 -0
  30. package/anime/test-server.js +10 -0
  31. package/anime/test.sh +275 -0
  32. package/anime/utils/browser.js +172 -0
  33. package/anime/utils/config.js +209 -0
  34. package/anime/utils/dataProcessor.js +172 -0
  35. package/anime/utils/diskCache.js +228 -0
  36. package/anime/utils/flaresolverr.js +361 -0
  37. package/anime/utils/jsParser.js +19 -0
  38. package/anime/utils/redis.js +64 -0
  39. package/anime/utils/requestManager.js +706 -0
  40. package/anime/utils/urlConverter.js +88 -0
  41. package/anime/utils/webhookNotifier.js +190 -0
  42. package/cookiereader.py +291 -0
  43. package/package.json +14 -6
  44. package/src/anilist.js +19 -2
  45. package/src/api/anilist.js +32 -0
  46. package/src/api/anime.js +181 -0
  47. package/src/api/cf-bypass.js +131 -0
  48. package/src/api/config.js +134 -0
  49. package/src/api/daemon.js +62 -0
  50. package/src/api/download.js +98 -0
  51. package/src/api/match.js +58 -0
  52. package/src/api/runs.js +15 -0
  53. package/src/api/update.js +96 -0
  54. package/src/cli.js +18 -2
  55. package/src/config.js +14 -2
  56. package/src/daemon.js +1 -1
  57. package/src/db.js +38 -11
  58. package/src/engine.js +66 -13
  59. package/src/notify.js +82 -7
  60. package/src/scraper.js +2 -2
  61. package/src/server.js +108 -0
  62. package/utils.js +21 -21
  63. package/web/index.html +13 -0
  64. package/web/package-lock.json +1420 -0
  65. package/web/package.json +24 -0
  66. package/web/src/App.vue +200 -0
  67. package/web/src/api/client.js +75 -0
  68. package/web/src/assets/styles/base.css +961 -0
  69. package/web/src/components/UpdateModal.vue +157 -0
  70. package/web/src/components/sidebar/SidebarResizable.vue +170 -0
  71. package/web/src/components/sidebar/sidebarConfig.js +24 -0
  72. package/web/src/main.js +104 -0
  73. package/web/src/router/index.js +44 -0
  74. package/web/src/stores/config.js +27 -0
  75. package/web/src/stores/download.js +107 -0
  76. package/web/src/stores/update.js +73 -0
  77. package/web/src/views/About.vue +42 -0
  78. package/web/src/views/AniListSync.vue +122 -0
  79. package/web/src/views/AnimeDetail.vue +202 -0
  80. package/web/src/views/AnimeList.vue +110 -0
  81. package/web/src/views/CFResult.vue +312 -0
  82. package/web/src/views/DaemonControl.vue +83 -0
  83. package/web/src/views/Dashboard.vue +187 -0
  84. package/web/src/views/DownloadCenter.vue +153 -0
  85. package/web/src/views/MatchFinder.vue +131 -0
  86. package/web/src/views/OAuthCallback.vue +44 -0
  87. package/web/src/views/Onboarding.vue +93 -0
  88. package/web/src/views/RunHistory.vue +122 -0
  89. package/web/src/views/Settings.vue +410 -0
  90. package/web/vite.config.js +23 -0
package/utils.js CHANGED
@@ -16,10 +16,9 @@ function loadConfig() {
16
16
  }
17
17
 
18
18
  const config = loadConfig();
19
- const API_DOMAIN = config.apiBaseUrl || 'https://aor-rex-anikuro-api.hf.space';
20
- const SEARCH_API = `${API_DOMAIN}/api/anime/search`;
21
- const RELEASES_API = `${API_DOMAIN}/api/anime`;
22
- const IMAGE_PROXY_API = `${API_DOMAIN}/api/anime/image`;
19
+ const API_DOMAIN = `http://localhost:${process.env.PORT || 2640}`;
20
+ const SEARCH_API = `${API_DOMAIN}/api/pahe/search`;
21
+ const RELEASES_API = `${API_DOMAIN}/api/pahe`;
23
22
  const USER_AGENT = 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Mobile Safari/537.36';
24
23
 
25
24
  // --- Helpers ---
@@ -37,7 +36,7 @@ const formatBytes = (bytes, decimals = 2) => {
37
36
  };
38
37
 
39
38
  // --- Download Logic ---
40
- async function downloadFile(url, filename, folder, multiBar, episode) {
39
+ async function downloadFile(url, filename, folder, multiBar, episode, eventBus = null, animeId = null, animeTitle = null) {
41
40
  const filePath = path.join(folder, filename);
42
41
  let downloadedBytes = 0;
43
42
  let fileExists = false;
@@ -108,6 +107,7 @@ async function downloadFile(url, filename, folder, multiBar, episode) {
108
107
  let currentProgress = downloadedBytes;
109
108
  const startTime = Date.now();
110
109
 
110
+ let lastEmit = 0;
111
111
  while (true) {
112
112
  const { done, value } = await reader.read();
113
113
  if (done) break;
@@ -115,6 +115,22 @@ async function downloadFile(url, filename, folder, multiBar, episode) {
115
115
  fileStream.write(Buffer.from(value));
116
116
  currentProgress += value.length;
117
117
 
118
+ if (eventBus && (currentProgress - lastEmit > 524288 || currentProgress === downloadedBytes + 1)) {
119
+ lastEmit = currentProgress;
120
+ const elapsed = (Date.now() - startTime) / 1000;
121
+ const speed = elapsed > 0 ? (currentProgress - downloadedBytes) / elapsed : 0;
122
+ const percent = totalBytes ? Math.round((currentProgress / totalBytes) * 100) : 0;
123
+ eventBus.emit('broadcast', 'episode:progress', {
124
+ animeId,
125
+ title: animeTitle,
126
+ episode,
127
+ percent,
128
+ speed: formatBytes(speed) + '/s',
129
+ downloaded: currentProgress,
130
+ total: totalBytes,
131
+ });
132
+ }
133
+
118
134
  if (progressBar) {
119
135
  const elapsed = (Date.now() - startTime) / 1000;
120
136
  const speed = elapsed > 0 ? (currentProgress - downloadedBytes) / elapsed : 0;
@@ -144,28 +160,12 @@ async function _fetchWithCookie(url, headers, resumeFrom) {
144
160
  return fetch(url, { headers });
145
161
  }
146
162
 
147
- function proxifyPosterUrl(url) {
148
- if (!url) return null;
149
- try {
150
- const parsed = new URL(url);
151
- const host = parsed.hostname.toLowerCase();
152
- if (host.includes('animepahe') || host.includes('kwik') || host.includes('pahe') || host.includes('uwucdn') || host.includes('owocdn') || host.includes('hakunaymatata')) {
153
- return `${IMAGE_PROXY_API}?url=${encodeURIComponent(url)}`;
154
- }
155
- return url;
156
- } catch {
157
- return url;
158
- }
159
- }
160
-
161
163
  module.exports = {
162
164
  SEARCH_API,
163
165
  RELEASES_API,
164
- IMAGE_PROXY_API,
165
166
  USER_AGENT,
166
167
  sleep,
167
168
  getTerminalWidth,
168
169
  formatBytes,
169
170
  downloadFile,
170
- proxifyPosterUrl,
171
171
  };
package/web/index.html ADDED
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en" class="dark">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>ani-auto</title>
7
+ <link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><text y='28' font-size='28' fill='%23CC0000'>A</text></svg>" />
8
+ </head>
9
+ <body>
10
+ <div id="app"></div>
11
+ <script type="module" src="/src/main.js"></script>
12
+ </body>
13
+ </html>