From 182527bfa88162a31b9908d1145ed81d7c3a542c Mon Sep 17 00:00:00 2001 From: CoffeeKnyte <67730400+CoffeeKnyte@users.noreply.github.com> Date: Tue, 30 Apr 2024 11:09:06 -0400 Subject: [PATCH 01/42] Update LibraryController.js used a lighter function to find total author count --- server/controllers/LibraryController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/controllers/LibraryController.js b/server/controllers/LibraryController.js index 30c9c0d932..0a0fb4d4d8 100644 --- a/server/controllers/LibraryController.js +++ b/server/controllers/LibraryController.js @@ -610,7 +610,7 @@ class LibraryController { const bookStats = await libraryItemsBookFilters.getBookLibraryStats(req.library.id) const longestBooks = await libraryItemsBookFilters.getLongestBooks(req.library.id, 10) - stats.totalAuthors = authors.length + stats.totalAuthors = await authorFilters.getAuthorsTotalCount(req.library.id) stats.authorsWithCount = authors stats.totalGenres = genres.length stats.genresWithCount = genres From 95cdb23efbab63d3acccc28f0c891f8c3b3403f5 Mon Sep 17 00:00:00 2001 From: CoffeeKnyte <67730400+CoffeeKnyte@users.noreply.github.com> Date: Tue, 30 Apr 2024 11:14:55 -0400 Subject: [PATCH 02/42] split getAuthorsWithCount to 2 lighter functions getAuthorsWithCount - now only gets the top 10 authors (in that library) by number of books getAuthorsTotalCount - new function to only get total number of authors (in that library) --- server/utils/queries/authorFilters.js | 49 +++++++++++++++++---------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/server/utils/queries/authorFilters.js b/server/utils/queries/authorFilters.js index c6a08a6182..e13158fe8b 100644 --- a/server/utils/queries/authorFilters.js +++ b/server/utils/queries/authorFilters.js @@ -2,35 +2,48 @@ const Sequelize = require('sequelize') const Database = require('../../Database') module.exports = { + /** + * Get authors total count + * @param {string} libraryId + * @returns {{id:string, name:string, count:number}} + */ + async getAuthorsTotalCount(libraryId) { + const authorsCount = await Database.authorModel.count({ + where: { + libraryId: libraryId + } + }); + return authorsCount; + }, + /** * Get authors with count of num books * @param {string} libraryId * @returns {{id:string, name:string, count:number}} */ async getAuthorsWithCount(libraryId) { - const authors = await Database.authorModel.findAll({ - where: [ - { - libraryId - }, - Sequelize.where(Sequelize.literal('count'), { - [Sequelize.Op.gt]: 0 - }) - ], + const authors = await Database.bookAuthorModel.findAll({ + include: [{ + model: Database.authorModel, + as: 'author', // Use the correct alias as defined in your associations + attributes: ['name'], + where: { + libraryId: libraryId + } + }], attributes: [ - 'id', - 'name', - [Sequelize.literal('(SELECT count(*) FROM bookAuthors ba WHERE ba.authorId = author.id)'), 'count'] + 'authorId', + [Sequelize.fn('COUNT', Sequelize.col('authorId')), 'count'] ], - order: [ - ['count', 'DESC'] - ] + group: ['authorId', 'author.id'], // Include 'author.id' to satisfy GROUP BY with JOIN + order: [[Sequelize.literal('count'), 'DESC']], + limit: 10 }) return authors.map(au => { return { - id: au.id, - name: au.name, - count: au.dataValues.count + id: au.authorId, + name: au.author.name, + count: au.get('count') // Use get method to access aliased attributes } }) }, From 7229cfce84ada9e9500523344cdd7a63cdf47d84 Mon Sep 17 00:00:00 2001 From: CoffeeKnyte <67730400+CoffeeKnyte@users.noreply.github.com> Date: Wed, 1 May 2024 07:20:48 -0400 Subject: [PATCH 03/42] Added limit 10 to getAuthorsWithCount() call As per nichwall's request --- server/controllers/LibraryController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/controllers/LibraryController.js b/server/controllers/LibraryController.js index 0a0fb4d4d8..77b79ac065 100644 --- a/server/controllers/LibraryController.js +++ b/server/controllers/LibraryController.js @@ -605,7 +605,7 @@ class LibraryController { } if (req.library.isBook) { - const authors = await authorFilters.getAuthorsWithCount(req.library.id) + const authors = await authorFilters.getAuthorsWithCount(req.library.id, 10) const genres = await libraryItemsBookFilters.getGenresWithCount(req.library.id) const bookStats = await libraryItemsBookFilters.getBookLibraryStats(req.library.id) const longestBooks = await libraryItemsBookFilters.getLongestBooks(req.library.id, 10) From 5041f80cb031bc2006ef3f530eab859f42c90240 Mon Sep 17 00:00:00 2001 From: CoffeeKnyte <67730400+CoffeeKnyte@users.noreply.github.com> Date: Wed, 1 May 2024 07:24:42 -0400 Subject: [PATCH 04/42] Added limit variable to getAuthorsWithCount() - Clarified and updated the comments - added parameter "limit" to getAuthorsWithCount() - the limit is set to 10 when called from LibraryController.js - as per Nichwall's comments --- server/utils/queries/authorFilters.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/utils/queries/authorFilters.js b/server/utils/queries/authorFilters.js index e13158fe8b..e684232b3e 100644 --- a/server/utils/queries/authorFilters.js +++ b/server/utils/queries/authorFilters.js @@ -5,7 +5,7 @@ module.exports = { /** * Get authors total count * @param {string} libraryId - * @returns {{id:string, name:string, count:number}} + * @returns {number} count */ async getAuthorsTotalCount(libraryId) { const authorsCount = await Database.authorModel.count({ @@ -19,9 +19,10 @@ module.exports = { /** * Get authors with count of num books * @param {string} libraryId + * @param {number} limit * @returns {{id:string, name:string, count:number}} */ - async getAuthorsWithCount(libraryId) { + async getAuthorsWithCount(libraryId, limit) { const authors = await Database.bookAuthorModel.findAll({ include: [{ model: Database.authorModel, @@ -37,7 +38,7 @@ module.exports = { ], group: ['authorId', 'author.id'], // Include 'author.id' to satisfy GROUP BY with JOIN order: [[Sequelize.literal('count'), 'DESC']], - limit: 10 + limit: limit }) return authors.map(au => { return { From b0e33970b8f8fa99e3618b99b7684238f971ed9c Mon Sep 17 00:00:00 2001 From: Nicholas Wallace Date: Sun, 5 May 2024 16:35:26 +0000 Subject: [PATCH 05/42] Add more fields to bug report template --- .github/ISSUE_TEMPLATE/bug.yaml | 99 ++++++++++++++++++++++++++++----- 1 file changed, 86 insertions(+), 13 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug.yaml b/.github/ISSUE_TEMPLATE/bug.yaml index 7f47d710f0..05c0165ad4 100644 --- a/.github/ISSUE_TEMPLATE/bug.yaml +++ b/.github/ISSUE_TEMPLATE/bug.yaml @@ -1,40 +1,51 @@ name: 🐞 Bug Report -description: File a bug/issue -title: "[Bug]: " -labels: ["bug", "triage"] +description: File a bug/issue and help us improve Audiobookshelf +title: '[Bug]: ' +labels: ['bug', 'triage'] body: - type: markdown attributes: - value: "### Please first search for your issue and check the [docs](https://audiobookshelf.org/docs)." + value: 'Thank you for filing a bug report! 🐛' - type: markdown attributes: - value: "### Mobile app issues report [here](https://github.com/advplyr/audiobookshelf-app/issues/new/choose)." + value: 'Please first search for your issue and check the [docs](https://audiobookshelf.org/docs).' - type: markdown attributes: - value: "### Join the [discord server](https://discord.gg/HQgCbd6E75) for questions or if you are not sure about a bug." + value: 'Mobile app issues report [here](https://github.com/advplyr/audiobookshelf-app/issues/new/choose).' - type: markdown attributes: - value: "## Be as descriptive as you can. Include screenshots, error logs, browser, file types, everything you can think of that might be relevant." + value: 'Join the [discord server](https://discord.gg/HQgCbd6E75) for questions or if you are not sure about a bug.' - type: textarea id: what-happened attributes: - label: Describe the issue - description: What happened & what did you expect to happen + label: What happened? + description: Don't forget to tell us what steps you took so we can try to reproduce. + placeholder: Tell us what you see! + validations: + required: true + - type: textarea + id: what-was-expected + attributes: + label: What did you expect to happen? + placeholder: Tell us what you expected to see! Be as descriptive as you can and include screenshots if applicable. validations: required: true - type: textarea id: steps-to-reproduce attributes: label: Steps to reproduce the issue - value: "1. " + value: '1. ' validations: required: true + - type: markdown + attributes: + value: '### Install Environment' - type: input id: version attributes: label: Audiobookshelf version description: Do not put 'Latest version', please put the actual version here - placeholder: "e.g. v1.6.60" + placeholder: 'e.g. v1.6.60' validations: required: true - type: dropdown @@ -46,6 +57,68 @@ body: - Debian/PPA - Windows Tray App - Built from source - - Other + - Other (list in "Additional Notes" box) validations: - required: true + required: true + - type: markdown + attributes: + value: '### Desktop Environment' + - type: dropdown + id: desktop-os + label: If the issue is being seen on Desktop, what OS are you running where you see the issue? + attributes: + label: Operating System + options: + - Windows + - macOS + - Linux + - Other (list in "Additional Notes" box) + validations: + required: true + - type: dropdown + id: desktop-browsers + label: If the issue is being seen in the UI, what browsers are you seeing the problem on? + attributes: + label: Desktop Browser + options: + - Chrome + - Firefox + - Safari + - Edge + - Other (list in "Additional Notes" box) + - type: markdown + attributes: + value: '### Mobile Environment' + - type: dropdown + id: mobile-os + label: If the issue is being seen on Mobile, what OS are you running where you see the issue? + attributes: + label: Operating System + options: + - Android + - iOS + - Other (list in "Additional Notes" box) + - type: dropdown + id: mobile-browsers + label: If the issue is being seen in the UI, what browsers are you seeing the problem on? + attributes: + label: Mobile Browser + options: + - Chrome + - Firefox + - Safari + - Edge + - Other (list in "Additional Notes" box) + - type: textarea + id: logs + attributes: + label: Logs + description: Please include any relevant logs here. This field is automatically formatted into code, so you do not need to include any backticks. + placeholder: Paste logs here + render: shell + - type: textarea + id: additional-notes + attributes: + label: Additional Notes + description: Anything else you want to add? + placeholder: 'e.g. I have tried X, Y, and Z.' From dfe6505af0e7f61cf73fa300ee145eae0e8f7077 Mon Sep 17 00:00:00 2001 From: Nicholas Wallace Date: Sun, 5 May 2024 16:37:11 +0000 Subject: [PATCH 06/42] Fix: label placement --- .github/ISSUE_TEMPLATE/bug.yaml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug.yaml b/.github/ISSUE_TEMPLATE/bug.yaml index 05c0165ad4..69b1bdc257 100644 --- a/.github/ISSUE_TEMPLATE/bug.yaml +++ b/.github/ISSUE_TEMPLATE/bug.yaml @@ -65,9 +65,8 @@ body: value: '### Desktop Environment' - type: dropdown id: desktop-os - label: If the issue is being seen on Desktop, what OS are you running where you see the issue? attributes: - label: Operating System + label: If the issue is being seen on Desktop, what OS are you running where you see the issue? options: - Windows - macOS @@ -77,9 +76,8 @@ body: required: true - type: dropdown id: desktop-browsers - label: If the issue is being seen in the UI, what browsers are you seeing the problem on? attributes: - label: Desktop Browser + label: If the issue is being seen in the UI, what browsers are you seeing the problem on? options: - Chrome - Firefox @@ -91,18 +89,16 @@ body: value: '### Mobile Environment' - type: dropdown id: mobile-os - label: If the issue is being seen on Mobile, what OS are you running where you see the issue? attributes: - label: Operating System + label: If the issue is being seen on Mobile, what OS are you running where you see the issue? options: - Android - iOS - Other (list in "Additional Notes" box) - type: dropdown id: mobile-browsers - label: If the issue is being seen in the UI, what browsers are you seeing the problem on? attributes: - label: Mobile Browser + label: If the issue is being seen in the UI, what browsers are you seeing the problem on? options: - Chrome - Firefox From fa5d2b2020e5e7a3271f161e23c769581d784f6d Mon Sep 17 00:00:00 2001 From: Nicholas Wallace Date: Sun, 5 May 2024 16:37:48 +0000 Subject: [PATCH 07/42] Fix: label tabbing --- .github/ISSUE_TEMPLATE/bug.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug.yaml b/.github/ISSUE_TEMPLATE/bug.yaml index 69b1bdc257..de23380836 100644 --- a/.github/ISSUE_TEMPLATE/bug.yaml +++ b/.github/ISSUE_TEMPLATE/bug.yaml @@ -90,7 +90,7 @@ body: - type: dropdown id: mobile-os attributes: - label: If the issue is being seen on Mobile, what OS are you running where you see the issue? + label: If the issue is being seen on Mobile, what OS are you running where you see the issue? options: - Android - iOS From 047c8ec0178b91890f73a339c808c8d6fe340476 Mon Sep 17 00:00:00 2001 From: Nicholas Wallace Date: Sun, 5 May 2024 16:44:00 +0000 Subject: [PATCH 08/42] Formatting updates --- .github/ISSUE_TEMPLATE/bug.yaml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug.yaml b/.github/ISSUE_TEMPLATE/bug.yaml index de23380836..70159801d1 100644 --- a/.github/ISSUE_TEMPLATE/bug.yaml +++ b/.github/ISSUE_TEMPLATE/bug.yaml @@ -11,7 +11,7 @@ body: value: 'Please first search for your issue and check the [docs](https://audiobookshelf.org/docs).' - type: markdown attributes: - value: 'Mobile app issues report [here](https://github.com/advplyr/audiobookshelf-app/issues/new/choose).' + value: 'Report issues with the mobile app [here](https://github.com/advplyr/audiobookshelf-app/issues/new/choose).' - type: markdown attributes: value: 'Join the [discord server](https://discord.gg/HQgCbd6E75) for questions or if you are not sure about a bug.' @@ -19,7 +19,6 @@ body: id: what-happened attributes: label: What happened? - description: Don't forget to tell us what steps you took so we can try to reproduce. placeholder: Tell us what you see! validations: required: true @@ -39,7 +38,7 @@ body: required: true - type: markdown attributes: - value: '### Install Environment' + value: '## Install Environment' - type: input id: version attributes: @@ -62,7 +61,7 @@ body: required: true - type: markdown attributes: - value: '### Desktop Environment' + value: '## Desktop Environment' - type: dropdown id: desktop-os attributes: @@ -86,7 +85,7 @@ body: - Other (list in "Additional Notes" box) - type: markdown attributes: - value: '### Mobile Environment' + value: '## Mobile Environment' - type: dropdown id: mobile-os attributes: From 721dd14c1f7b3bf1f8273ce8a604d99590f58910 Mon Sep 17 00:00:00 2001 From: Nicholas Wallace Date: Sun, 5 May 2024 17:07:35 +0000 Subject: [PATCH 09/42] Add: link to guide for email settings --- client/pages/config/email.vue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/client/pages/config/email.vue b/client/pages/config/email.vue index e161a583c7..ca01be32fc 100644 --- a/client/pages/config/email.vue +++ b/client/pages/config/email.vue @@ -1,6 +1,14 @@