Compare commits

...
12 Commits
3 changed files with 31 additions and 10 deletions

No files matched your search

+21
View File
@@ -1,5 +1,26 @@
# Changelog
## [1.0.3](https://github.com/Masutayunikon/FanKarr/compare/v1.0.2...v1.0.3) (2026-03-10)
### Bug Fixes
* organize file ([d6550e9](https://github.com/Masutayunikon/FanKarr/commit/d6550e9961789073be1583e03d599afb6d295004))
## [1.0.2](https://github.com/Masutayunikon/FanKarr/compare/v1.0.1...v1.0.2) (2026-03-10)
### Bug Fixes
* organize use torrent hash and not name ([61901f9](https://github.com/Masutayunikon/FanKarr/commit/61901f9014a759e2950311cd96266ea8201fa902))
## [1.0.1](https://github.com/Masutayunikon/FanKarr/compare/v1.0.0...v1.0.1) (2026-03-10)
### Bug Fixes
* docker errors ([2702764](https://github.com/Masutayunikon/FanKarr/commit/27027642eb55b75adb04446a88e5007e88f75948))
## 1.0.0 (2026-03-10)
+4 -4
View File
@@ -8,7 +8,7 @@ import {
registerDriver, getDriver, getAvailableClients,
listClients, addClient, removeClient, getClient,
sanitizeClient, dispatchDownload, dispatchList
} from './torrent-clients'
} from './torrent-clients/index.js'
import qbittorrentDriver from './torrent-clients/qbittorrent.js'
import { organizeTorrent, autoOrganizeAll } from './organize.js'
@@ -19,7 +19,7 @@ const PORT = 3001
const FANKAI_API = 'https://metadata.fankai.fr'
const TORRENTS_PATH = path.join(process.cwd(), 'data', 'torrent_final.json')
const GITHUB_RAW_URL = process.env.GITHUB_RAW_URL
?? 'https://raw.githubusercontent.com/CHANGE_ME/fankarr-scraper/main/data/torrent_final.json'
?? 'https://raw.githubusercontent.com/masutayunikon/fankarr-scraper/main/data/torrent_final.json'
app.use(express.json())
app.use(cookieParser())
@@ -50,7 +50,7 @@ app.get('/api/torrent-clients/available', requireAuth, (_req, res) => {
res.json(getAvailableClients())
})
app.get('/api/torrent-clients', requireAuth, (_req, res) => {
res.json(listClients().map(c => sanitizeClient(c)))
res.json(listClients().map((c: any) => sanitizeClient(c)))
})
app.post('/api/torrent-clients', requireAuth, (req, res) => {
const { name, type, config } = req.body
@@ -222,7 +222,7 @@ app.post('/api/download', requireAuth, async (req, res) => {
const url = req.body.torrent_url ?? req.body.magnet
if (!url) { res.status(400).json({ error: 'torrent_url ou magnet requis' }); return }
const results = await dispatchDownload(url)
res.status(results.every(r => r.ok) ? 200 : 207).json({ results })
res.status(results.every((r: any) => r.ok) ? 200 : 207).json({ results })
})
// ── Downloads — liste torrents Fankai ──────────────────────────
+6 -6
View File
@@ -49,9 +49,9 @@ function readTorrents(): any[] {
} catch { return [] }
}
function findTorrentByName(name: string): any | null {
function findTorrentByHash(hash: string): any | null {
const torrents = readTorrents()
return torrents.find(t => t.raw === name) ?? null
return torrents.find(t => t.infohash?.toLowerCase() === hash.toLowerCase()) ?? null
}
// ─── Filesystem ops ───────────────────────────────────────────
@@ -98,10 +98,10 @@ export async function organizeTorrent(
const result: OrganizeResult = { total: 0, skipped: 0, done: 0, errors: [] }
// Trouver le torrent dans torrent_final.json
const torrent = findTorrentByName(name)
// Trouver le torrent dans torrent_final.json via infohash
const torrent = findTorrentByHash(hash)
if (!torrent) {
throw new Error(`Torrent introuvable dans torrent_final.json : "${name}"`)
throw new Error(`Torrent introuvable dans torrent_final.json pour le hash : "${hash}"`)
}
const serieTitle = torrent.serie_title || torrent.show_title || name
@@ -228,7 +228,7 @@ export async function autoOrganizeAll(
if (t.state !== 'seeding') continue
// Vérifier si tous les fichiers sont déjà organisés
const torrent = findTorrentByName(t.name)
const torrent = findTorrentByHash(t.hash)
if (!torrent) continue
const files: any[] = torrent.torrent_files ?? []