Simplify custom app install with new /apps/manifest route

This commit is contained in:
Alexandre Aubin 2021-04-16 00:49:13 +02:00
parent c3d86065fa
commit 1efb23e26d
4 changed files with 8 additions and 24 deletions

View file

@ -54,6 +54,7 @@
"app_info_change_url_disabled_tooltip": "This feature hasn't been implemented in this app yet", "app_info_change_url_disabled_tooltip": "This feature hasn't been implemented in this app yet",
"app_info_uninstall_desc": "Remove this application.", "app_info_uninstall_desc": "Remove this application.",
"app_install_custom_no_manifest": "No manifest.json file", "app_install_custom_no_manifest": "No manifest.json file",
"app_install_parameters": "Install settings",
"app_manage_label_and_tiles": "Manage label and tiles", "app_manage_label_and_tiles": "Manage label and tiles",
"app_make_default": "Make default", "app_make_default": "Make default",
"app_no_actions": "This application doesn't have any actions", "app_no_actions": "This application doesn't have any actions",
@ -115,7 +116,6 @@
"connection": "Connection", "connection": "Connection",
"created_at": "Created at", "created_at": "Created at",
"custom_app_install": "Install custom app", "custom_app_install": "Install custom app",
"custom_app_url_only_github": "Currently only from GitHub",
"day_validity": " Expired | 1 day | {count} days", "day_validity": " Expired | 1 day | {count} days",
"dead": "Inactive", "dead": "Inactive",
"delete": "Delete", "delete": "Delete",
@ -266,7 +266,7 @@
"migrations_no_done": "No previous migrations", "migrations_no_done": "No previous migrations",
"migrations_disclaimer_check_message": "I read and understood this disclaimer", "migrations_disclaimer_check_message": "I read and understood this disclaimer",
"migrations_disclaimer_not_checked": "This migration require you to acknowledge its disclaimer before running it.", "migrations_disclaimer_not_checked": "This migration require you to acknowledge its disclaimer before running it.",
"multi_instance": "Multi instance", "multi_instance": "Can be installed several times",
"myserver": "myserver", "myserver": "myserver",
"next": "Next", "next": "Next",
"no": "No", "no": "No",

View file

@ -7,6 +7,7 @@
"app_info_default_desc": "Redirige la racine du domaine vers cette application ({domain}).", "app_info_default_desc": "Redirige la racine du domaine vers cette application ({domain}).",
"app_info_uninstall_desc": "Supprimer cette application.", "app_info_uninstall_desc": "Supprimer cette application.",
"app_install_custom_no_manifest": "Aucun fichier manifest.json", "app_install_custom_no_manifest": "Aucun fichier manifest.json",
"app_install_parameters": "Paramètres d'installation",
"app_make_default": "Définir par défaut", "app_make_default": "Définir par défaut",
"app_state_inprogress": "ne fonctionne pas encore", "app_state_inprogress": "ne fonctionne pas encore",
"app_state_notworking": "Non fonctionnelle", "app_state_notworking": "Non fonctionnelle",
@ -89,7 +90,7 @@
"manage_apps": "Gérer les applications", "manage_apps": "Gérer les applications",
"manage_domains": "Gérer les domaines", "manage_domains": "Gérer les domaines",
"manage_users": "Gérer les utilisateurs", "manage_users": "Gérer les utilisateurs",
"multi_instance": "Instance multiple", "multi_instance": "Peut être installée plusieurs fois",
"myserver": "monserveur", "myserver": "monserveur",
"next": "Suivant", "next": "Suivant",
"no": "Non", "no": "Non",

View file

@ -193,10 +193,9 @@ export default {
customInstall: { customInstall: {
field: { field: {
label: this.$i18n.t('url'), label: this.$i18n.t('url'),
description: this.$i18n.t('custom_app_url_only_github'),
props: { props: {
id: 'custom-install', id: 'custom-install',
placeholder: 'https://github.com/USER/REPOSITORY' placeholder: 'https://some.git.forge.tld/USER/REPOSITORY'
} }
}, },
url: '' url: ''

View file

@ -2,7 +2,7 @@
<view-base :loading="loading"> <view-base :loading="loading">
<template v-if="infos"> <template v-if="infos">
<!-- BASIC INFOS --> <!-- BASIC INFOS -->
<card :title="`${$t('infos')} — ${name}`" icon="info-circle"> <card :title="`${name}`" icon="download">
<b-row <b-row
v-for="(info, key) in infos" :key="key" v-for="(info, key) in infos" :key="key"
no-gutters class="row-line" no-gutters class="row-line"
@ -19,7 +19,7 @@
<!-- INSTALL FORM --> <!-- INSTALL FORM -->
<card-form <card-form
:title="$t('operations')" icon="wrench" :submit-text="$t('install')" :title="$t('app_install_parameters')" icon="cog" :submit-text="$t('install')"
:validation="$v" :server-error="serverError" :validation="$v" :server-error="serverError"
@submit.prevent="performInstall" @submit.prevent="performInstall"
> >
@ -79,21 +79,6 @@ export default {
}, },
methods: { methods: {
getExternalManifest () {
const url = this.id.replace('github.com', 'raw.githubusercontent.com') + 'master/manifest.json'
return fetch(url).then(response => {
if (response.ok) return response.json()
else {
throw Error('No manifest found at ' + url)
}
}).catch(() => {
this.infos = null
})
},
getApiManifest () {
return api.get('apps/catalog?full').then(response => response.apps[this.id].manifest)
},
formatManifestData (manifest) { formatManifestData (manifest) {
this.name = manifest.name this.name = manifest.name
@ -138,9 +123,8 @@ export default {
}, },
created () { created () {
const isCustom = this.$route.name === 'app-install-custom'
Promise.all([ Promise.all([
isCustom ? this.getExternalManifest() : this.getApiManifest(), api.get('apps/manifest?app=' + this.id).then(response => response),
api.fetchAll([ api.fetchAll([
['GET', { uri: 'domains' }], ['GET', { uri: 'domains' }],
['GET', { uri: 'domains/main', storeKey: 'main_domain' }], ['GET', { uri: 'domains/main', storeKey: 'main_domain' }],