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

Possibility for plugins to update settings options value #6327

Open
kontrollanten opened this issue Apr 12, 2024 · 0 comments
Open

Possibility for plugins to update settings options value #6327

kontrollanten opened this issue Apr 12, 2024 · 0 comments
Labels
Component: PeerTube Plugin 📦 Features that can be developed in a plugin, but require PeerTube plugin API development Type: Feature Request ✨

Comments

@kontrollanten
Copy link
Contributor

Describe the problem to be solved

We've a plugin setting that populates its options based on a REST API response:

    try {
      stripePlans = await getStripeSubscriptionPlans(apiKey)
    } catch (err: any) {
      logger.info('Couldn\'t fetch Stripe plans', { err })
    }

    registerSetting({
      name: SETTING_STRIPE_SUBSCRIPTION_PLAN_ID,
      label: 'Stripe plan used for subscription',
      type: 'select',
      options: stripePlans.map((plan) => ({
        value: plan.id,
        label: (plan.product as Stripe.Product)?.name ?? plan.id
      })),
      private: true
    })

Therefore we need to be able to update the available options. When calling registerSettings multiple times it will create a new setting for each call, instead we would like to just update the options.

Describe the solution you would like

Some way of updating the options. Possible solutions:

a) When calling registerSetting with a name that already exists, the new options will override the existing.
b) Add unregisterSetting where you pass the setting name as argument.
c) Add deleteSetting to settingsManager API.

@Chocobozzz Chocobozzz added Type: Feature Request ✨ Component: PeerTube Plugin 📦 Features that can be developed in a plugin, but require PeerTube plugin API development labels Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: PeerTube Plugin 📦 Features that can be developed in a plugin, but require PeerTube plugin API development Type: Feature Request ✨
Projects
None yet
Development

No branches or pull requests

2 participants