Просмотр исходного кода

allow disabling individual providers and commands through config

Eugene Pankov 2 лет назад
Родитель
Сommit
19d59a4cfb

+ 3 - 2
tabby-core/src/commands.ts

@@ -27,7 +27,7 @@ export class CoreCommandProvider extends CommandProvider {
     async provide (): Promise<Command[]> {
         return [
             {
-                id: 'profile-selector',
+                id: 'core:profile-selector',
                 locations: [CommandLocation.LeftToolbar, CommandLocation.StartPage],
                 label: this.translate.instant('Profiles & connections'),
                 icon: this.hostApp.platform === Platform.Web
@@ -35,7 +35,8 @@ export class CoreCommandProvider extends CommandProvider {
                     : require('./icons/profiles.svg'),
                 run: async () => this.activate(),
             },
-            ...this.profilesService.getRecentProfiles().map(profile => ({
+            ...this.profilesService.getRecentProfiles().map((profile, index) => ({
+                id: `core:recent-profile-${index}`,
                 label: profile.name,
                 locations: [CommandLocation.StartPage],
                 icon: require('./icons/history.svg'),

+ 2 - 0
tabby-core/src/configDefaults.yaml

@@ -46,6 +46,8 @@ vault: null
 encrypted: false
 enableExperimentalFeatures: false
 pluginBlacklist: []
+commandBlacklist: []
+providerBlacklist: []
 hacks:
   disableGPU: false
   disableVibrancyWhileDragging: false

+ 1 - 1
tabby-core/src/index.ts

@@ -193,7 +193,7 @@ export default class AppModule { // eslint-disable-line @typescript-eslint/no-ex
             }
 
             if (hotkey === 'profile-selector') {
-                commands.run('profile-selector', {})
+                commands.run('core:profile-selector', {})
             }
         })
     }

+ 1 - 0
tabby-core/src/services/commands.service.ts

@@ -71,6 +71,7 @@ export class CommandService {
         }
 
         return commands
+            .filter(c => !this.config.store.commandBlacklist.includes(c.id))
             .sort((a, b) => (a.weight ?? 0) - (b.weight ?? 0))
             .map(command => {
                 const run = command.run

+ 2 - 0
tabby-core/src/services/config.service.ts

@@ -254,7 +254,9 @@ export class ConfigService {
         return services.filter(service => {
             for (const pluginName in this.servicesCache) {
                 if (this.servicesCache[pluginName].includes(service.constructor)) {
+                    const id = `${pluginName}:${service.constructor.name}`
                     return !this.store?.pluginBlacklist?.includes(pluginName)
+                        && !this.store?.providerBlacklist?.includes(id)
                 }
             }
             return true