Skip to content

Commit 98a5416

Browse files
authored
Merge pull request #162 from SchneeHertz/development
Development
2 parents b6128c2 + 2ba742d commit 98a5416

24 files changed

+2623
-657
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file. Dates are d
44

55
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
66

7+
#### [v1.6.0](https://github.com/SchneeHertz/exhentai-manga-manager/compare/v1.5.17...v1.6.0)
8+
9+
> 26 July 2024
10+
11+
- Development [`#154`](https://github.com/SchneeHertz/exhentai-manga-manager/pull/154)
12+
- Development [`#153`](https://github.com/SchneeHertz/exhentai-manga-manager/pull/153)
13+
- add opds server [`6133e1b`](https://github.com/SchneeHertz/exhentai-manga-manager/commit/6133e1b2ae2de44cca29712d9401ddbb52131a55)
14+
- remove g6 [`399b6d7`](https://github.com/SchneeHertz/exhentai-manga-manager/commit/399b6d7d2b6df467e48ab1f029e07c9ef927a52d)
15+
- update manga server [`d52daf7`](https://github.com/SchneeHertz/exhentai-manga-manager/commit/d52daf7b0918317094200faa749441bd1256d1b8)
16+
717
#### [v1.5.17](https://github.com/SchneeHertz/exhentai-manga-manager/compare/v1.5.16...v1.5.17)
818

919
> 29 June 2024

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
中文介绍 | [English Readme](https://github.com/SchneeHertz/exhentai-manga-manager/blob/master/README_EN.md) | [日本語の説明](https://github.com/SchneeHertz/exhentai-manga-manager/blob/master/README_JA.md)
2828

29+
**[FAQ](https://github.com/SchneeHertz/exhentai-manga-manager/wiki/FAQ)**
30+
2931
</div>
3032

3133
![cover.jpg](https://raw.githubusercontent.com/SchneeHertz/exhentai-manga-manager/master/screenshots/cover.jpg)

eslint.config.mjs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import globals from 'globals';
2+
import pluginVue from 'eslint-plugin-vue';
3+
4+
5+
export default [
6+
{ files: ['**/*.{js,mjs,cjs,vue}'] },
7+
{ files: ['**/*.js'], languageOptions: { sourceType: 'commonjs' } },
8+
{ languageOptions: { globals: globals.browser } },
9+
...pluginVue.configs['flat/essential'],
10+
{
11+
rules: {
12+
'no-const-assign': 'error',
13+
'vue/multi-word-component-names': ['error', {
14+
'ignores': ['Setting', 'Graph']
15+
}]
16+
}
17+
},
18+
]

fileLoader/archive.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ const { getRootPath } = require('../modules/utils.js')
99

1010
const _7z = path.join(getRootPath(), 'resources/extraResources/7z.exe')
1111

12-
let getArchivelist = async (libraryPath)=>{
13-
let list = globSync('**/*.@(rar|7z|cb7|cbr)', {
12+
const getArchivelist = async (libraryPath) => {
13+
const list = globSync('**/*.@(rar|7z|cb7|cbr)', {
1414
cwd: libraryPath,
1515
nocase: true,
1616
follow: true,
@@ -19,16 +19,16 @@ let getArchivelist = async (libraryPath)=>{
1919
return list
2020
}
2121

22-
let solveBookTypeArchive = async (filepath, TEMP_PATH, COVER_PATH)=>{
23-
let tempFolder = path.join(TEMP_PATH, nanoid(8))
24-
let output = await spawnPromise(_7z, ['l', filepath, '-slt', '-p123456'])
25-
let pathlist = _.filter(output.split(/\r\n/), s=>_.startsWith(s, 'Path') && !_.includes(s, '__MACOSX'))
26-
pathlist = pathlist.map(p=>{
27-
let match = /(?<== ).*$/.exec(p)
22+
const solveBookTypeArchive = async (filepath, TEMP_PATH, COVER_PATH) => {
23+
const tempFolder = path.join(TEMP_PATH, nanoid(8))
24+
const output = await spawnPromise(_7z, ['l', filepath, '-slt', '-p123456'])
25+
let pathlist = _.filter(output.split(/\r\n/), s => _.startsWith(s, 'Path') && !_.includes(s, '__MACOSX'))
26+
pathlist = pathlist.map(p => {
27+
const match = /(?<== ).*$/.exec(p)
2828
return match ? match[0] : ''
2929
})
30-
let imageList = _.filter(pathlist, p=>['.jpg','.jpeg','.png','.webp','.avif', '.gif'].includes(path.extname(p).toLowerCase()))
31-
imageList = imageList.sort((a,b)=>a.localeCompare(b, undefined, {numeric: true, sensitivity: 'base'}))
30+
let imageList = _.filter(pathlist, p => ['.jpg','.jpeg','.png','.webp','.avif', '.gif'].includes(path.extname(p).toLowerCase()))
31+
imageList = imageList.sort((a, b) => a.localeCompare(b, undefined, {numeric: true, sensitivity: 'base'}))
3232

3333
let targetFile
3434
let targetFilePath
@@ -55,42 +55,42 @@ let solveBookTypeArchive = async (filepath, TEMP_PATH, COVER_PATH)=>{
5555

5656
coverPath = path.join(COVER_PATH, nanoid() + '.webp')
5757

58-
let fileStat = await fs.promises.stat(filepath)
58+
const fileStat = await fs.promises.stat(filepath)
5959
return {targetFilePath, tempCoverPath, coverPath, pageCount: imageList.length, bundleSize: fileStat?.size, mtime: fileStat?.mtime}
6060
}
6161

62-
let getImageListFromArchive = async (filepath, VIEWER_PATH)=>{
63-
let tempFolder = path.join(VIEWER_PATH, nanoid(8))
62+
const getImageListFromArchive = async (filepath, VIEWER_PATH) => {
63+
const tempFolder = path.join(VIEWER_PATH, nanoid(8))
6464
await spawnPromise(_7z, ['x', filepath, '-o' + tempFolder, '-p123456'])
6565
let list = globSync('**/*.@(jpg|jpeg|png|webp|avif|gif)', {
6666
cwd: tempFolder,
6767
nocase: true
6868
})
69-
list = _.filter(list, s=>!_.includes(s, '__MACOSX'))
70-
list = list.sort((a,b)=>a.localeCompare(b, undefined, {numeric: true, sensitivity: 'base'})).map(f=>path.join(tempFolder, f))
69+
list = _.filter(list, s => !_.includes(s, '__MACOSX'))
70+
list = list.sort((a, b) => a.localeCompare(b, undefined, {numeric: true, sensitivity: 'base'})).map(f => path.join(tempFolder, f))
7171
return list
7272
}
7373

74-
let deleteImageFromArchive = async (filename, filepath) => {
74+
const deleteImageFromArchive = async (filename, filepath) => {
7575
await spawnPromise(_7z, ['d', filepath, filename, '-p123456'])
7676
return true
7777
}
7878

79-
let spawnPromise = (commmand, argument)=>{
80-
return new Promise((resolve, reject)=>{
79+
const spawnPromise = (commmand, argument) => {
80+
return new Promise((resolve, reject) => {
8181
const spawned = spawn(commmand, argument)
82-
let output = []
83-
spawned.on('error', data=>{
82+
const output = []
83+
spawned.on('error', data => {
8484
reject(data)
8585
})
86-
spawned.on('exit', code=>{
86+
spawned.on('exit', code => {
8787
if (code === 0) {
8888
setTimeout(() => resolve(output.join('\r\n')), 50)
8989
} else {
9090
reject('close code is ' + code)
9191
}
9292
})
93-
spawned.stdout.on('data', data=>{
93+
spawned.stdout.on('data', data => {
9494
output.push(iconv.decode(data, 'gbk'))
9595
})
9696
})

fileLoader/folder.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ const dirSize = async dir => {
1717
return (await Promise.all(filesize)).flat(Infinity).reduce((i, size) => i + size, 0)
1818
}
1919

20-
let getFolderlist = async (libraryPath)=>{
21-
let imageList = globIterate('**/*.@(jpg|jpeg|png|webp|avif|gif)', {
20+
const getFolderlist = async (libraryPath) => {
21+
const imageList = globIterate('**/*.@(jpg|jpeg|png|webp|avif|gif)', {
2222
cwd: libraryPath,
2323
nocase: true,
2424
follow: true,
@@ -32,36 +32,36 @@ let getFolderlist = async (libraryPath)=>{
3232
return list
3333
}
3434

35-
let solveBookTypeFolder = async (folderpath, TEMP_PATH, COVER_PATH)=>{
35+
const solveBookTypeFolder = async (folderpath, TEMP_PATH, COVER_PATH) => {
3636
let list = globSync('*.@(jpg|jpeg|png|webp|avif|gif)', {
3737
cwd: folderpath,
3838
nocase: true
3939
})
40-
list = list.sort((a,b)=>a.localeCompare(b, undefined, {numeric: true, sensitivity: 'base'})).map(f=>path.join(folderpath, f))
40+
list = list.sort((a, b) => a.localeCompare(b, undefined, {numeric: true, sensitivity: 'base'})).map(f => path.join(folderpath, f))
4141
let targetFilePath
4242
if (list.length > 8) {
4343
targetFilePath = list[7]
4444
} else {
4545
targetFilePath = list[0]
4646
}
47-
let tempCoverPath = list[0]
48-
let coverPath = path.join(COVER_PATH, nanoid() + '.webp')
49-
let fileStat = await stat(folderpath)
50-
let bundleSize = await dirSize(folderpath)
47+
const tempCoverPath = list[0]
48+
const coverPath = path.join(COVER_PATH, nanoid() + '.webp')
49+
const fileStat = await stat(folderpath)
50+
const bundleSize = await dirSize(folderpath)
5151
return {targetFilePath, tempCoverPath, coverPath, pageCount: list.length, bundleSize, mtime: fileStat?.mtime}
5252
}
5353

54-
let getImageListFromFolder = async (folderpath, VIEWER_PATH)=>{
54+
const getImageListFromFolder = async (folderpath, VIEWER_PATH) => {
5555
let list = globSync('*.@(jpg|jpeg|png|webp|avif|gif)', {
5656
cwd: folderpath,
5757
nocase: true
5858
})
59-
list = list.sort((a,b)=>a.localeCompare(b, undefined, {numeric: true, sensitivity: 'base'})).map(f=>path.join(folderpath, f))
59+
list = list.sort((a, b) => a.localeCompare(b, undefined, {numeric: true, sensitivity: 'base'})).map(f => path.join(folderpath, f))
6060
return list
6161
}
6262

63-
let deleteImageFromFolder = async (filename, folderpath) => {
64-
let filepath = path.join(folderpath, filename)
63+
const deleteImageFromFolder = async (filename, folderpath) => {
64+
const filepath = path.join(folderpath, filename)
6565
await shell.trashItem(filepath)
6666
return true
6767
}

fileLoader/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ const { getArchivelist, solveBookTypeArchive, getImageListFromArchive, deleteIma
88
const { getZipFilelist, solveBookTypeZip } = require('./zip.js')
99
const { TEMP_PATH, COVER_PATH, VIEWER_PATH } = require('../modules/init_folder_setting.js')
1010

11-
let getBookFilelist = async (library) => {
12-
let folderList = await getFolderlist(library)
13-
let archiveList = await getArchivelist(library)
14-
let zipList = await getZipFilelist(library)
11+
const getBookFilelist = async (library) => {
12+
const folderList = await getFolderlist(library)
13+
const archiveList = await getArchivelist(library)
14+
const zipList = await getZipFilelist(library)
1515
return [
1616
...folderList.map(filepath => ({ filepath, type: 'folder' })),
1717
...archiveList.map(filepath => ({ filepath, type: 'archive' })),
1818
...zipList.map(filepath => ({ filepath, type: 'zip' })),
1919
]
2020
}
2121

22-
let geneCover = async (filepath, type) => {
22+
const geneCover = async (filepath, type) => {
2323
let targetFilePath, coverPath, tempCoverPath, pageCount, bundleSize, mtime
2424
switch (type) {
2525
case 'folder':
@@ -39,8 +39,8 @@ let geneCover = async (filepath, type) => {
3939
break
4040
}
4141

42-
let coverHash = createHash('sha1').update(fs.readFileSync(tempCoverPath)).digest('hex')
43-
let copyTempCoverPath = path.join(TEMP_PATH, nanoid(8) + path.extname(tempCoverPath))
42+
const coverHash = createHash('sha1').update(fs.readFileSync(tempCoverPath)).digest('hex')
43+
const copyTempCoverPath = path.join(TEMP_PATH, nanoid(8) + path.extname(tempCoverPath))
4444
await fs.promises.copyFile(tempCoverPath, copyTempCoverPath)
4545
await sharp(copyTempCoverPath, { failOnError: false })
4646
.resize(500, 707, {

fileLoader/zip.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const AdmZip = require('adm-zip')
55
const { nanoid } = require('nanoid')
66
const _ = require('lodash')
77

8-
let getZipFilelist = async (libraryPath)=>{
9-
let list = globSync('**/*.@(zip|cbz)', {
8+
const getZipFilelist = async (libraryPath) => {
9+
const list = globSync('**/*.@(zip|cbz)', {
1010
cwd: libraryPath,
1111
nocase: true,
1212
follow: true,
@@ -15,16 +15,16 @@ let getZipFilelist = async (libraryPath)=>{
1515
return list
1616
}
1717

18-
let solveBookTypeZip = async (filepath, TEMP_PATH, COVER_PATH)=>{
19-
let tempFolder = path.join(TEMP_PATH, nanoid(8))
20-
let zip = new AdmZip(filepath)
21-
let zipFileList = zip.getEntries()
22-
let findZFile = (entryName)=>{
23-
return _.find(zipFileList, zFile=>zFile.entryName == entryName)
18+
const solveBookTypeZip = async (filepath, TEMP_PATH, COVER_PATH) => {
19+
const tempFolder = path.join(TEMP_PATH, nanoid(8))
20+
const zip = new AdmZip(filepath)
21+
const zipFileList = zip.getEntries()
22+
const findZFile = (entryName) => {
23+
return _.find(zipFileList, zFile => zFile.entryName == entryName)
2424
}
25-
let fileList = zipFileList.map(zFile=>zFile.entryName)
26-
let imageList = _.filter(fileList, filepath=>_.includes(['.jpg', ',jpeg', '.png', '.webp', '.avif', '.gif'], path.extname(filepath).toLowerCase()))
27-
imageList = imageList.sort((a,b)=>a.localeCompare(b, undefined, {numeric: true, sensitivity: 'base'}))
25+
const fileList = zipFileList.map(zFile => zFile.entryName)
26+
let imageList = _.filter(fileList, filepath => _.includes(['.jpg', ',jpeg', '.png', '.webp', '.avif', '.gif'], path.extname(filepath).toLowerCase()))
27+
imageList = imageList.sort((a, b) => a.localeCompare(b, undefined, {numeric: true, sensitivity: 'base'}))
2828

2929
let targetFile
3030
let targetFilePath
@@ -52,20 +52,20 @@ let solveBookTypeZip = async (filepath, TEMP_PATH, COVER_PATH)=>{
5252

5353
coverPath = path.join(COVER_PATH, nanoid() + '.webp')
5454

55-
let fileStat = await fs.promises.stat(filepath)
55+
const fileStat = await fs.promises.stat(filepath)
5656
return {targetFilePath, tempCoverPath, coverPath, pageCount: imageList.length, bundleSize: fileStat?.size, mtime: fileStat?.mtime}
5757
}
5858

59-
let getImageListFromZip = async (filepath, VIEWER_PATH)=>{
60-
let zip = new AdmZip(filepath)
61-
let tempFolder = path.join(VIEWER_PATH, nanoid(8))
59+
const getImageListFromZip = async (filepath, VIEWER_PATH) => {
60+
const zip = new AdmZip(filepath)
61+
const tempFolder = path.join(VIEWER_PATH, nanoid(8))
6262
zip.extractAllTo(tempFolder, true)
6363
let list = globSync('**/*.@(jpg|jpeg|png|webp|avif|gif)', {
6464
cwd: tempFolder,
6565
nocase: true
6666
})
67-
list = _.filter(list, s=>!_.includes(s, '__MACOSX'))
68-
list = list.sort((a,b)=>a.localeCompare(b, undefined, {numeric: true, sensitivity: 'base'})).map(f=>path.join(tempFolder, f))
67+
list = _.filter(list, s => !_.includes(s, '__MACOSX'))
68+
list = list.sort((a, b) => a.localeCompare(b, undefined, {numeric: true, sensitivity: 'base'})).map(f => path.join(tempFolder, f))
6969
return list
7070
}
7171

0 commit comments

Comments
 (0)