Skip to content

Commit 8ba3aac

Browse files
authored
merge changes from upstream RC branch 0.27.1
2 parents 37b23bf + 37f0129 commit 8ba3aac

26 files changed

+1828
-1705
lines changed

.eslintrc.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
parser: '@babel/eslint-parser',
3+
parserOptions: { requireConfigFile: false },
4+
plugins: ['prettier'],
5+
rules: {
6+
eqeqeq: ['error', 'always'],
7+
'object-shorthand': ['error', 'always'],
8+
'prettier/prettier': 'error',
9+
'no-var': 'error',
10+
},
11+
};

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ public/img/*.svg
1414
public/js/*.min.js
1515
public/css/*.css
1616
public/webfonts
17+
.idea/
18+
.tool-versions
19+
data/

.prettierrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"printWidth": 80,
5+
"tabWidth": 2
6+
}

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ test:
2929
check:
3030
crystal tool format --check
3131
./bin/ameba
32+
yarn lint
3233

3334
arm32v7:
3435
crystal build src/mango.cr --release --progress --error-trace --cross-compile --target='arm-linux-gnueabihf' -o mango-arm32v7

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ The official docker images are available on [Dockerhub](https://hub.docker.com/r
5151
### CLI
5252

5353
```
54-
Mango - Manga Server and Web Reader. Version 0.27.0
54+
Mango - Manga Server and Web Reader. Version 0.27.1
5555
5656
Usage:
5757

gulpfile.js

+50-35
Original file line numberDiff line numberDiff line change
@@ -5,63 +5,78 @@ const minifyCss = require('gulp-minify-css');
55
const less = require('gulp-less');
66

77
gulp.task('copy-img', () => {
8-
return gulp.src('node_modules/uikit/src/images/backgrounds/*.svg')
9-
.pipe(gulp.dest('public/img'));
8+
return gulp
9+
.src('node_modules/uikit/src/images/backgrounds/*.svg')
10+
.pipe(gulp.dest('public/img'));
1011
});
1112

1213
gulp.task('copy-font', () => {
13-
return gulp.src('node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.woff**')
14-
.pipe(gulp.dest('public/webfonts'));
14+
return gulp
15+
.src(
16+
'node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.woff**',
17+
)
18+
.pipe(gulp.dest('public/webfonts'));
1519
});
1620

1721
// Copy files from node_modules
1822
gulp.task('node-modules-copy', gulp.parallel('copy-img', 'copy-font'));
1923

2024
// Compile less
2125
gulp.task('less', () => {
22-
return gulp.src([
23-
'public/css/mango.less',
24-
'public/css/tags.less'
25-
])
26-
.pipe(less())
27-
.pipe(gulp.dest('public/css'));
26+
return gulp
27+
.src(['public/css/mango.less', 'public/css/tags.less'])
28+
.pipe(less())
29+
.pipe(gulp.dest('public/css'));
2830
});
2931

3032
// Transpile and minify JS files and output to dist
3133
gulp.task('babel', () => {
32-
return gulp.src(['public/js/*.js', '!public/js/*.min.js'])
33-
.pipe(babel({
34-
presets: [
35-
['@babel/preset-env', {
36-
targets: '>0.25%, not dead, ios>=9'
37-
}]
38-
],
39-
}))
40-
.pipe(minify({
41-
removeConsole: true,
42-
builtIns: false
43-
}))
44-
.pipe(gulp.dest('dist/js'));
34+
return gulp
35+
.src(['public/js/*.js', '!public/js/*.min.js'])
36+
.pipe(
37+
babel({
38+
presets: [
39+
[
40+
'@babel/preset-env',
41+
{
42+
targets: '>0.25%, not dead, ios>=9',
43+
},
44+
],
45+
],
46+
}),
47+
)
48+
.pipe(
49+
minify({
50+
removeConsole: true,
51+
builtIns: false,
52+
}),
53+
)
54+
.pipe(gulp.dest('dist/js'));
4555
});
4656

4757
// Minify CSS and output to dist
4858
gulp.task('minify-css', () => {
49-
return gulp.src('public/css/*.css')
50-
.pipe(minifyCss())
51-
.pipe(gulp.dest('dist/css'));
59+
return gulp
60+
.src('public/css/*.css')
61+
.pipe(minifyCss())
62+
.pipe(gulp.dest('dist/css'));
5263
});
5364

5465
// Copy static files (includeing images) to dist
5566
gulp.task('copy-files', () => {
56-
return gulp.src([
57-
'public/*.*',
58-
'public/img/**',
59-
'public/webfonts/*',
60-
'public/js/*.min.js'
61-
], {
62-
base: 'public'
63-
})
64-
.pipe(gulp.dest('dist'));
67+
return gulp
68+
.src(
69+
[
70+
'public/*.*',
71+
'public/img/**',
72+
'public/webfonts/*',
73+
'public/js/*.min.js',
74+
],
75+
{
76+
base: 'public',
77+
},
78+
)
79+
.pipe(gulp.dest('dist'));
6580
});
6681

6782
// Set up the public folder for development

package.json

+8-3
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,25 @@
66
"author": "Alex Ling <[email protected]>",
77
"license": "MIT",
88
"devDependencies": {
9+
"@babel/eslint-parser": "^7.18.9",
910
"@babel/preset-env": "^7.11.5",
1011
"all-contributors-cli": "^6.19.0",
12+
"eslint": "^8.22.0",
13+
"eslint-plugin-prettier": "^4.2.1",
1114
"gulp": "^4.0.2",
1215
"gulp-babel": "^8.0.0",
1316
"gulp-babel-minify": "^0.5.1",
1417
"gulp-less": "^4.0.1",
1518
"gulp-minify-css": "^1.2.4",
16-
"less": "^3.11.3"
19+
"less": "^3.11.3",
20+
"prettier": "^2.7.1"
1721
},
1822
"scripts": {
19-
"uglify": "gulp"
23+
"uglify": "gulp",
24+
"lint": "eslint public/js *.js --ext .js"
2025
},
2126
"dependencies": {
2227
"@fortawesome/fontawesome-free": "^5.14.0",
23-
"uikit": "^3.5.4"
28+
"uikit": "~3.14.0"
2429
}
2530
}

public/js/admin.js

+52-54
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,56 @@
11
const component = () => {
2-
return {
3-
progress: 1.0,
4-
generating: false,
5-
scanning: false,
6-
scanTitles: 0,
7-
scanMs: -1,
8-
themeSetting: '',
2+
return {
3+
progress: 1.0,
4+
generating: false,
5+
scanning: false,
6+
scanTitles: 0,
7+
scanMs: -1,
8+
themeSetting: '',
99

10-
init() {
11-
this.getProgress();
12-
setInterval(() => {
13-
this.getProgress();
14-
}, 5000);
10+
init() {
11+
this.getProgress();
12+
setInterval(() => {
13+
this.getProgress();
14+
}, 5000);
1515

16-
const setting = loadThemeSetting();
17-
this.themeSetting = setting.charAt(0).toUpperCase() + setting.slice(1);
18-
},
19-
themeChanged(event) {
20-
const newSetting = $(event.currentTarget).val().toLowerCase();
21-
saveThemeSetting(newSetting);
22-
setTheme();
23-
},
24-
scan() {
25-
if (this.scanning) return;
26-
this.scanning = true;
27-
this.scanMs = -1;
28-
this.scanTitles = 0;
29-
$.post(`${base_url}api/admin/scan`)
30-
.then(data => {
31-
this.scanMs = data.milliseconds;
32-
this.scanTitles = data.titles;
33-
})
34-
.catch(e => {
35-
alert('danger', `Failed to trigger a scan. Error: ${e}`);
36-
})
37-
.always(() => {
38-
this.scanning = false;
39-
});
40-
},
41-
generateThumbnails() {
42-
if (this.generating) return;
43-
this.generating = true;
44-
this.progress = 0.0;
45-
$.post(`${base_url}api/admin/generate_thumbnails`)
46-
.then(() => {
47-
this.getProgress()
48-
});
49-
},
50-
getProgress() {
51-
$.get(`${base_url}api/admin/thumbnail_progress`)
52-
.then(data => {
53-
this.progress = data.progress;
54-
this.generating = data.progress > 0;
55-
});
56-
},
57-
};
16+
const setting = loadThemeSetting();
17+
this.themeSetting = setting.charAt(0).toUpperCase() + setting.slice(1);
18+
},
19+
themeChanged(event) {
20+
const newSetting = $(event.currentTarget).val().toLowerCase();
21+
saveThemeSetting(newSetting);
22+
setTheme();
23+
},
24+
scan() {
25+
if (this.scanning) return;
26+
this.scanning = true;
27+
this.scanMs = -1;
28+
this.scanTitles = 0;
29+
$.post(`${base_url}api/admin/scan`)
30+
.then((data) => {
31+
this.scanMs = data.milliseconds;
32+
this.scanTitles = data.titles;
33+
})
34+
.catch((e) => {
35+
alert('danger', `Failed to trigger a scan. Error: ${e}`);
36+
})
37+
.always(() => {
38+
this.scanning = false;
39+
});
40+
},
41+
generateThumbnails() {
42+
if (this.generating) return;
43+
this.generating = true;
44+
this.progress = 0.0;
45+
$.post(`${base_url}api/admin/generate_thumbnails`).then(() => {
46+
this.getProgress();
47+
});
48+
},
49+
getProgress() {
50+
$.get(`${base_url}api/admin/thumbnail_progress`).then((data) => {
51+
this.progress = data.progress;
52+
this.generating = data.progress > 0;
53+
});
54+
},
55+
};
5856
};

public/js/alert.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const alert = (level, text) => {
2-
$('#alert').empty();
3-
const html = `<div class="uk-alert-${level}" uk-alert><a class="uk-alert-close" uk-close></a><p>${text}</p></div>`;
4-
$('#alert').append(html);
5-
$("html, body").animate({ scrollTop: 0 });
2+
$('#alert').empty();
3+
const html = `<div class="uk-alert-${level}" uk-alert><a class="uk-alert-close" uk-close></a><p>${text}</p></div>`;
4+
$('#alert').append(html);
5+
$('html, body').animate({ scrollTop: 0 });
66
};

0 commit comments

Comments
 (0)