Compare commits

..
8 Commits
4 changed files with 44 additions and 19 deletions

No files matched your search

+14
View File
@@ -1,5 +1,19 @@
# Changelog
## [1.8.1](https://github.com/Masutayunikon/FanKarr/compare/v1.8.0...v1.8.1) (2026-03-13)
### Bug Fixes
* nfo settings and add json file when not existing ([0b6bfa6](https://github.com/Masutayunikon/FanKarr/commit/0b6bfa6a81d99353be877ed6d99687ad3d55adbc))
## [1.8.0](https://github.com/Masutayunikon/FanKarr/compare/v1.7.3...v1.8.0) (2026-03-12)
### Features
* cache images ([da460de](https://github.com/Masutayunikon/FanKarr/commit/da460de60c4eec6851ea58ce0ae646a1208f6018))
## [1.7.3](https://github.com/Masutayunikon/FanKarr/compare/v1.7.2...v1.7.3) (2026-03-12)
+19 -3
View File
@@ -42,8 +42,8 @@ app.get('/api/settings', requireAuth, (_req, res) => {
res.json(readSettings())
})
app.post('/api/settings', requireAuth, (req, res) => {
const { mediaPath, completePath, organizeMode, category } = req.body
res.json(writeSettings({ mediaPath, completePath, organizeMode, category }))
const { mediaPath, completePath, organizeMode, category, nfoSupport } = req.body
res.json(writeSettings({ mediaPath, completePath, organizeMode, category, nfoSupport }))
})
// ── Torrent clients ────────────────────────────────────────────
@@ -495,7 +495,23 @@ if (fs.existsSync(PUBLIC_PATH)) {
}
// ── Start ──────────────────────────────────────────────────────
app.listen(PORT, () => {
app.listen(PORT, async () => {
// Télécharger torrent_final.json si absent
if (!fs.existsSync(TORRENTS_PATH)) {
try {
console.log('[fankarr] torrent_final.json absent → téléchargement...')
const response = await fetch(GITHUB_RAW_URL)
if (!response.ok) throw new Error(`GitHub a répondu ${response.status}`)
const data = await response.json() as unknown[]
if (!Array.isArray(data)) throw new Error('Format invalide')
fs.mkdirSync(path.dirname(TORRENTS_PATH), { recursive: true })
fs.writeFileSync(TORRENTS_PATH, JSON.stringify(data, null, 2), 'utf-8')
console.log(`[fankarr] ${data.length} torrents téléchargés`)
} catch (err) {
console.warn(`[fankarr] ⚠ Téléchargement échoué: ${err instanceof Error ? err.message : err}`)
}
}
try {
const data = JSON.parse(fs.readFileSync(TORRENTS_PATH, 'utf-8'))
const count = Array.isArray(data) ? data.length : 0
+9
View File
@@ -61,6 +61,8 @@ export const useSeriesStore = defineStore('series', () => {
const loadingDetail = ref(false)
const error = ref<string | null>(null)
const _imageCache = new Set<string>()
async function fetchSeries() {
loadingSeries.value = true
error.value = null
@@ -69,6 +71,13 @@ export const useSeriesStore = defineStore('series', () => {
if (!res.ok) throw new Error(`Erreur ${res.status}`)
const data = await res.json()
series.value = data.series
// Précache des posters en arrière-plan
for (const s of data.series as Serie[]) {
if (s.poster_image && !_imageCache.has(s.poster_image)) {
_imageCache.add(s.poster_image)
new Image().src = s.poster_image
}
}
} catch (err) {
error.value = err instanceof Error ? err.message : 'Erreur inconnue'
} finally {
+2 -16
View File
@@ -276,23 +276,10 @@ async function fetchOrganizeNotifs() {
}
// ── Cache images ───────────────────────────────────────────────
const imageCache = new Set<string>()
function precacheImages(series: any[]) {
for (const s of series) {
if (s.poster_image && !imageCache.has(s.poster_image)) {
imageCache.add(s.poster_image)
const img = new Image()
img.src = s.poster_image
}
}
}
// Géré directement dans le store series.ts
onMounted(async () => {
if (store.series.length === 0) {
await store.fetchSeries()
precacheImages(store.series)
}
if (store.series.length === 0) await store.fetchSeries()
fetchActiveDownloads()
fetchOrganizeNotifs()
dlInterval = setInterval(() => {
@@ -304,7 +291,6 @@ onMounted(async () => {
// Refresh au retour sur le catalogue (après update ou scan)
onActivated(async () => {
await store.fetchSeries()
precacheImages(store.series)
fetchActiveDownloads()
})