museria 0.2.48 → 0.2.49

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * museria face
3
- * @version 0.2.48
3
+ * @version 0.2.49
4
4
  * {@link https://github.com/ortexx/museria}
5
5
  */
6
6
  /*!
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "museria",
3
- "version": "0.2.48",
3
+ "version": "0.2.49",
4
4
  "description": "Decentralized music storage",
5
5
  "main": "./src/index.js",
6
6
  "bin": {
package/src/node.js CHANGED
@@ -57,12 +57,12 @@ module.exports = (Parent) => {
57
57
  relevanceTime: '14d',
58
58
  prepareTitle: true,
59
59
  prepareCover: true,
60
- coverQuality: 85,
60
+ coverQuality: 80,
61
61
  coverMinSize: 200,
62
62
  coverMaxSize: 500,
63
63
  coverMaxFileSize: '110kb'
64
64
  },
65
- storage: {
65
+ storage: {
66
66
  autoCleanSize: '30mb',
67
67
  tempLifetime: '10m',
68
68
  dataSize: '95% - 2gb',
@@ -387,8 +387,7 @@ module.exports = (Parent) => {
387
387
  width = Math.floor(width / dev);
388
388
  height = Math.floor(height / dev);
389
389
  const size = width > height? height: width;
390
-
391
- const buff = await image
390
+ let buff = await image
392
391
  .jpeg({ quality: this.options.music.coverQuality })
393
392
  .resize(width, height)
394
393
  .extract({
@@ -399,6 +398,10 @@ module.exports = (Parent) => {
399
398
  })
400
399
  .toBuffer();
401
400
 
401
+ if(buff.byteLength > metadata.size) {
402
+ buff = buffer;
403
+ }
404
+
402
405
  if(buff.byteLength > maxFileSize) {
403
406
  throw new errors.WorkError(`Maximum size of a cover file is ${maxFileSize} byte(s)`, 'ERR_MUSERIA_COVER_MAX_FILE_SIZE');
404
407
  }