Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow defining active plugins in config #10767

Merged
merged 30 commits into from Jul 25, 2022

Conversation

oplik0
Copy link
Contributor

@oplik0 oplik0 commented Jul 14, 2022

resolves #10766 and supersedes #10036

Things left:

  • Theme selection doesn't inform the user the change also needs to happen in the config on the frontend - the message only appear in the logs.
  • Might be possible to just remove the disable/enable button from ACP rather than throwing errors?
  • Currently I'm using one generic error for all situations, perhaps there should at least be a theme specific one?
  • Add tests

@nodebb-misty
Copy link
Contributor

This pull request was made against the develop branch, which while not strictly disallowed, is unorthodox. If this is intentional, please respond back with the reason for this pull request being made to the develop branch.

Thanks!

@julianlam
Copy link
Member

Ooh, need to update @nodebb-misty's messaging about the develop branch 😁

@NodeBB NodeBB deleted a comment from nodebb-misty Jul 14, 2022
@nodebb-misty
Copy link
Contributor

💡 Friendly Note

This pull request was made against the develop branch, which is reserved for commits destined for a minor or major release.If your commits simply fixes a bug, please rebase this PR against the master instead.

  • patch releases — bug fixes only
  • minor releases — new features, enhancements, and bug fixes
  • major releases — breaking changes, including all of the above

Thanks!

@julianlam
Copy link
Member

There we go 😄

@julianlam julianlam self-assigned this Jul 14, 2022
@oplik0
Copy link
Contributor Author

oplik0 commented Jul 14, 2022

So some updates:

  1. now theme selector requires that the selected theme is already in active plugins if one has them configured - then it does let the user change the theme in ACP.
  2. If it's not present, an error message explaining this will be shown
  3. As for enabling/disabling plugins, I chose to change just the class of the buttons. It provides visual indication and an error will be returned when attempting to change the state explaining the reason. This should be less confusing in my opinion.
  4. Added some basic tests; I can also add one for theme changes, but I'm not sure where to put it.

@oplik0 oplik0 marked this pull request as ready for review July 14, 2022 17:21
app.js Show resolved Hide resolved
public/language/en-GB/error.json Outdated Show resolved Hide resolved
src/cli/manage.js Outdated Show resolved Hide resolved
src/cli/reset.js Outdated Show resolved Hide resolved
src/cli/reset.js Outdated Show resolved Hide resolved
src/plugins/install.js Show resolved Hide resolved
src/views/admin/partials/installed_plugin_item.tpl Outdated Show resolved Hide resolved
@oplik0 oplik0 force-pushed the activate-plugins-in-config branch from 3c64378 to 34b86b7 Compare July 14, 2022 18:49
@oplik0 oplik0 requested a review from julianlam July 14, 2022 21:19
@julianlam julianlam added this to the 2.3.0 milestone Jul 15, 2022
@julianlam julianlam added the LGTM Looks good to me/merge label Jul 15, 2022
@julianlam
Copy link
Member

@oplik0 You have my signoff 📝

@julianlam julianlam merged commit 4833a56 into NodeBB:develop Jul 25, 2022
julianlam added a commit that referenced this pull request Jul 26, 2022
* Revert "Revert "feat: cross origin opener policy options (#10710)""

This reverts commit 46050ac.

* Revert "Revert "chore(i18n): fallback strings for new resources: nodebb.admin-settings-advanced""

This reverts commit 9f291c0.

* feat: closes #10719, don't trim children if category is marked section

* feat: fire hook to allow plugins to filter the pids returned in a user profile

/cc julianlam/nodebb-plugin-support-forum#14

* fix: use `user.hidePrivateData();` more consistently across user retrieval endpoints

* feat: Allow defining active plugins in config

resolves #10766

* fix: assign the db result to files properly

* test: add tests with plugins in config

* feat: better theme change handling

* feat: add visual indication that plugins can't be activated

* test: correct hooks

* test: fix test definitions

* test: remove instead of resetting nconf to avoid affecting other tests

* test: ... I forgot how nconf worked

* fix: remove negation

* docs: improve wording of error message

* feat: reduce code duplication

* style: remove a redundant space

* fix: remove unused imports

* fix: use nconf instead of requiring config.json

* fix: await...

* fix: second missed await

* fix: move back from getActiveIds to getActive

* fix: use paths again?

* fix: typo

* fix: move require into the function

* fix: forgot to change back to getActive

* test: getActive returns only id

* test: accedently commented out some stuff

* feat: added note to top of plugins page if \!canChangeState

Co-authored-by: Julian Lam <julian@nodebb.org>
Co-authored-by: Barış Soner Uşaklı <barisusakli@gmail.com>
julianlam added a commit that referenced this pull request Jul 26, 2022
* Revert "Revert "feat: cross origin opener policy options (#10710)""

This reverts commit 46050ac.

* Revert "Revert "chore(i18n): fallback strings for new resources: nodebb.admin-settings-advanced""

This reverts commit 9f291c0.

* feat: closes #10719, don't trim children if category is marked section

* feat: fire hook to allow plugins to filter the pids returned in a user profile

/cc julianlam/nodebb-plugin-support-forum#14

* fix: use `user.hidePrivateData();` more consistently across user retrieval endpoints

* fix: better looking placeholder text for ACP search

* fix: bug where fallback to forum search was not working due to client-side error

* feat: allow plugins to toggle whether IPs are shown in the users CSV export

* feat: Allow defining active plugins in config (#10767)

* Revert "Revert "feat: cross origin opener policy options (#10710)""

This reverts commit 46050ac.

* Revert "Revert "chore(i18n): fallback strings for new resources: nodebb.admin-settings-advanced""

This reverts commit 9f291c0.

* feat: closes #10719, don't trim children if category is marked section

* feat: fire hook to allow plugins to filter the pids returned in a user profile

/cc julianlam/nodebb-plugin-support-forum#14

* fix: use `user.hidePrivateData();` more consistently across user retrieval endpoints

* feat: Allow defining active plugins in config

resolves #10766

* fix: assign the db result to files properly

* test: add tests with plugins in config

* feat: better theme change handling

* feat: add visual indication that plugins can't be activated

* test: correct hooks

* test: fix test definitions

* test: remove instead of resetting nconf to avoid affecting other tests

* test: ... I forgot how nconf worked

* fix: remove negation

* docs: improve wording of error message

* feat: reduce code duplication

* style: remove a redundant space

* fix: remove unused imports

* fix: use nconf instead of requiring config.json

* fix: await...

* fix: second missed await

* fix: move back from getActiveIds to getActive

* fix: use paths again?

* fix: typo

* fix: move require into the function

* fix: forgot to change back to getActive

* test: getActive returns only id

* test: accedently commented out some stuff

* feat: added note to top of plugins page if \!canChangeState

Co-authored-by: Julian Lam <julian@nodebb.org>
Co-authored-by: Barış Soner Uşaklı <barisusakli@gmail.com>

* feat: show an informative message when no plugins are found after filtering

fixes #10771

* Latest translations and fallbacks

* Latest translations and fallbacks

* chore(deps): bump ace-builds from 1.7.1 to 1.8.1 in /install

Bumps [ace-builds](https://github.com/ajaxorg/ace-builds) from 1.7.1 to 1.8.1.
- [Release notes](https://github.com/ajaxorg/ace-builds/releases)
- [Changelog](https://github.com/ajaxorg/ace-builds/blob/master/CHANGELOG.md)
- [Commits](ajaxorg/ace-builds@v1.7.1...v1.8.1)

---
updated-dependencies:
- dependency-name: ace-builds
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix: swap out icons in ACP > Manage > Categories to more intuitive ones, remove extra placeholder div

* fix: hide expando button if no subcategories; remove attempt at establishing common vars, increased spacing between categories in list

* fix: buggy expando state on category drag/drop

Co-authored-by: Barış Soner Uşaklı <barisusakli@gmail.com>
Co-authored-by: Opliko <opliko.reg@protonmail.com>
Co-authored-by: Misty Release Bot <deploy@nodebb.org>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
julianlam added a commit that referenced this pull request Jul 26, 2022
* Revert "Revert "feat: cross origin opener policy options (#10710)""

This reverts commit 46050ac.

* Revert "Revert "chore(i18n): fallback strings for new resources: nodebb.admin-settings-advanced""

This reverts commit 9f291c0.

* feat: closes #10719, don't trim children if category is marked section

* feat: fire hook to allow plugins to filter the pids returned in a user profile

/cc julianlam/nodebb-plugin-support-forum#14

* fix: use `user.hidePrivateData();` more consistently across user retrieval endpoints

* fix: better looking placeholder text for ACP search

* fix: bug where fallback to forum search was not working due to client-side error

* feat: allow plugins to toggle whether IPs are shown in the users CSV export

* feat: Allow defining active plugins in config (#10767)

* Revert "Revert "feat: cross origin opener policy options (#10710)""

This reverts commit 46050ac.

* Revert "Revert "chore(i18n): fallback strings for new resources: nodebb.admin-settings-advanced""

This reverts commit 9f291c0.

* feat: closes #10719, don't trim children if category is marked section

* feat: fire hook to allow plugins to filter the pids returned in a user profile

/cc julianlam/nodebb-plugin-support-forum#14

* fix: use `user.hidePrivateData();` more consistently across user retrieval endpoints

* feat: Allow defining active plugins in config

resolves #10766

* fix: assign the db result to files properly

* test: add tests with plugins in config

* feat: better theme change handling

* feat: add visual indication that plugins can't be activated

* test: correct hooks

* test: fix test definitions

* test: remove instead of resetting nconf to avoid affecting other tests

* test: ... I forgot how nconf worked

* fix: remove negation

* docs: improve wording of error message

* feat: reduce code duplication

* style: remove a redundant space

* fix: remove unused imports

* fix: use nconf instead of requiring config.json

* fix: await...

* fix: second missed await

* fix: move back from getActiveIds to getActive

* fix: use paths again?

* fix: typo

* fix: move require into the function

* fix: forgot to change back to getActive

* test: getActive returns only id

* test: accedently commented out some stuff

* feat: added note to top of plugins page if \!canChangeState

Co-authored-by: Julian Lam <julian@nodebb.org>
Co-authored-by: Barış Soner Uşaklı <barisusakli@gmail.com>

* feat: show an informative message when no plugins are found after filtering

fixes #10771

* Latest translations and fallbacks

* Latest translations and fallbacks

* chore(deps): bump ace-builds from 1.7.1 to 1.8.1 in /install

Bumps [ace-builds](https://github.com/ajaxorg/ace-builds) from 1.7.1 to 1.8.1.
- [Release notes](https://github.com/ajaxorg/ace-builds/releases)
- [Changelog](https://github.com/ajaxorg/ace-builds/blob/master/CHANGELOG.md)
- [Commits](ajaxorg/ace-builds@v1.7.1...v1.8.1)

---
updated-dependencies:
- dependency-name: ace-builds
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix: swap out icons in ACP > Manage > Categories to more intuitive ones, remove extra placeholder div

* fix: hide expando button if no subcategories; remove attempt at establishing common vars, increased spacing between categories in list

* fix: buggy expando state on category drag/drop

Co-authored-by: Barış Soner Uşaklı <barisusakli@gmail.com>
Co-authored-by: Opliko <opliko.reg@protonmail.com>
Co-authored-by: Misty Release Bot <deploy@nodebb.org>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@Brutus5000
Copy link
Contributor

@oplik0 Is there a way to define the plugin version in the config.json?

@oplik0
Copy link
Contributor Author

oplik0 commented Jan 21, 2023

No, config.json just defines active plugins, replacing the database in that aspect if set. What does and what should define what to install in general is package.json.
If you want it to be the initial configuration, you should run nodebb setup (in docker you can do so before launching by setting the SETUP environment variable. If it's not set NodeBB will just run build).

@Brutus5000
Copy link
Contributor

@oplik0 How is this feature supposed to install plugins?

I always get this error: warn: [plugins] "nodebb-plugin-write-api" is active but not installed
Since I declared it in the config I can not use the command line to install it. So how to install it? I tried setting the SETUP variable too, but that doesn't force installation of the plugins.

@julianlam
Copy link
Member

The variable defines which plugins are considered active by NodeBB, it doesn't do any installation of plugins.

If you want a plugin installed, define it in package.json

@oplik0
Copy link
Contributor Author

oplik0 commented Apr 14, 2023

I think I see the issue now though - modifying package.json is not easy in e.g. kubernetes, so allowing for some way to install plugins without modifying the filesystem beforehand might be a good idea.

I think it would be fine to add an option to do that on setup specifically - I opened #11485 adding that option.

This wouldn't affect container build time, nor normal start time (only with setup and the plugins:autoinstall option set to true).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement LGTM Looks good to me/merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants