forked from userbot000/otzaria-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-github-thumbnails.js
More file actions
51 lines (40 loc) ยท 1.39 KB
/
test-github-thumbnails.js
File metadata and controls
51 lines (40 loc) ยท 1.39 KB
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
import dotenv from 'dotenv'
// ืืขื ืืช ื-env ืงืืื!
dotenv.config({ path: '.env.local' })
// ืขืืฉืื import ืืช ืืืืืืืื
const { listImages, loadBookMapping } = await import('./src/lib/github-storage.js')
async function test() {
try {
console.log('๐งช Testing GitHub thumbnails...\n')
// 1. ืืขื ืืืคืื
console.log('๐ Loading book mapping...')
const mapping = await loadBookMapping()
console.log('Mapping:', mapping)
console.log('')
// 2. ืืฆื ืืช ื-ID ืฉื "ืืืืช ืืขืช"
const bookName = 'ืืืืช ืืขืช'
const bookId = Object.entries(mapping).find(([id, name]) => name === bookName)?.[0]
console.log(`๐ Book: "${bookName}"`)
console.log(` ID: ${bookId}`)
console.log('')
if (!bookId) {
console.error('โ Book ID not found!')
return
}
// 3. ืงืื ืชืืื ืืช ื-GitHub
console.log('๐ธ Fetching images from GitHub...')
const images = await listImages(bookId)
console.log(` Found ${images.length} images`)
console.log('')
// 4. ืืฆื ืืื ืืืืืืืช
console.log('๐ผ๏ธ Sample images:')
images.slice(0, 5).forEach(img => {
console.log(` - ${img.pathname}`)
console.log(` ${img.url}`)
})
console.log('\nโ
Test completed!')
} catch (error) {
console.error('โ Test failed:', error)
}
}
test()