Fix: extension links (#1764)

* fix: open extension link
* fix: do not show `Enable` for admin extensions to non-admin users
This commit is contained in:
Vlad Stan 2023-06-15 19:06:21 +02:00 committed by GitHub
parent 8c0e7725de
commit 49411e58cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 4 deletions

View File

@ -1,6 +1,6 @@
// update cache version every time there is a new deployment // update cache version every time there is a new deployment
// so the service worker reinitializes the cache // so the service worker reinitializes the cache
const CACHE_VERSION = 37 const CACHE_VERSION = 38
const CURRENT_CACHE = `lnbits-${CACHE_VERSION}-` const CURRENT_CACHE = `lnbits-${CACHE_VERSION}-`
const getApiKey = request => { const getApiKey = request => {

View File

@ -185,7 +185,7 @@
flat flat
color="primary" color="primary"
type="a" type="a"
:href="[extension.id, '?usr=', g.user.id].join('')" :href="[extension.id, '/?usr=', g.user.id].join('')"
>{%raw%}{{ $t('open') }}{%endraw%}</q-btn >{%raw%}{{ $t('open') }}{%endraw%}</q-btn
> >
<q-btn <q-btn
@ -199,8 +199,11 @@
> >
{%raw%}{{ $t('disable') }}{%endraw%}</q-btn {%raw%}{{ $t('disable') }}{%endraw%}</q-btn
> >
<q-badge v-if="extension.isAdminOnly && !user.admin">
{%raw%}{{ $t('admin_only') }}{%endraw%}
</q-badge>
<q-btn <q-btn
v-if="extension.isInstalled && !user.extensions.includes(extension.id) && extension.isActive" v-else-if="extension.isInstalled && extension.isActive && !user.extensions.includes(extension.id)"
flat flat
color="primary" color="primary"
type="a" type="a"

View File

@ -128,6 +128,7 @@ async def extensions_install(
"isInstalled": ext.id in installed_exts_ids, "isInstalled": ext.id in installed_exts_ids,
"hasDatabaseTables": ext.id in db_version, "hasDatabaseTables": ext.id in db_version,
"isAvailable": ext.id in all_extensions, "isAvailable": ext.id in all_extensions,
"isAdminOnly": ext.id in settings.lnbits_admin_extensions,
"isActive": ext.id not in inactive_extensions, "isActive": ext.id not in inactive_extensions,
"latestRelease": dict(ext.latest_release) "latestRelease": dict(ext.latest_release)
if ext.latest_release if ext.latest_release

File diff suppressed because one or more lines are too long

View File

@ -100,6 +100,7 @@ window.localisation.en = {
featured: 'Featured', featured: 'Featured',
all: 'All', all: 'All',
only_admins_can_install: '(Only admin accounts can install extensions)', only_admins_can_install: '(Only admin accounts can install extensions)',
admin_only: 'Admin Only',
new_version: 'New Version', new_version: 'New Version',
extension_depends_on: 'Depends on:', extension_depends_on: 'Depends on:',
extension_rating_soon: 'Ratings coming soon', extension_rating_soon: 'Ratings coming soon',