allow extensions to hide themselves.
This commit is contained in:
parent
61c8d70fe7
commit
b2efd71d3c
|
@ -15,6 +15,7 @@ class Extension(NamedTuple):
|
|||
short_description: Optional[str] = None
|
||||
icon: Optional[str] = None
|
||||
contributors: Optional[List[str]] = None
|
||||
hidden: bool = False
|
||||
|
||||
|
||||
class ExtensionManager:
|
||||
|
@ -49,6 +50,7 @@ class ExtensionManager:
|
|||
config.get("short_description"),
|
||||
config.get("icon"),
|
||||
config.get("contributors"),
|
||||
config.get("hidden") or False,
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -88,7 +88,15 @@ window.LNbits = {
|
|||
map: {
|
||||
extension: function (data) {
|
||||
var obj = _.object(
|
||||
['code', 'isValid', 'name', 'shortDescription', 'icon'],
|
||||
[
|
||||
'code',
|
||||
'isValid',
|
||||
'name',
|
||||
'shortDescription',
|
||||
'icon',
|
||||
'contributors',
|
||||
'hidden'
|
||||
],
|
||||
data
|
||||
)
|
||||
obj.url = ['/', obj.code, '/'].join('')
|
||||
|
@ -304,6 +312,9 @@ window.windowMixin = {
|
|||
.map(function (data) {
|
||||
return window.LNbits.map.extension(data)
|
||||
})
|
||||
.filter(function (obj) {
|
||||
return !obj.hidden
|
||||
})
|
||||
.map(function (obj) {
|
||||
if (user) {
|
||||
obj.isEnabled = user.extensions.indexOf(obj.code) !== -1
|
||||
|
|
Loading…
Reference in New Issue
Block a user