diff --git a/client/src/components/apps/form.vue b/client/src/components/apps/form.vue
index 3ffb0d9c..88acf7de 100644
--- a/client/src/components/apps/form.vue
+++ b/client/src/components/apps/form.vue
@@ -1653,10 +1653,9 @@ export default defineComponent({
this.loadClusterIssuers();
this.getDomains();
- if (this.$route.query.template && this.$route.query.catalogId) {
- const catalogId = this.$route.query.catalogId as string;
+ if (this.$route.query.template) {
const template = this.$route.query.template as string;
- this.loadTemplate(catalogId, template);
+ this.loadTemplate(template);
}
//this.buildPipeline = this.$vuetify.buildPipeline
@@ -1709,8 +1708,8 @@ export default defineComponent({
this.letsecryptClusterIssuer = response.data.id;
});
},
- loadTemplate(catalogId: string, template: string) {
- axios.get('/api/templates/'+catalogId+'/'+template).then(response => {
+ loadTemplate(template: string) {
+ axios.get('/api/templates/'+template).then(response => {
this.appname = response.data.name;
this.containerPort = response.data.image.containerPort;
diff --git a/client/src/components/settings/form-templates.vue b/client/src/components/settings/form-templates.vue
index 67a41bdb..2df18e1e 100644
--- a/client/src/components/settings/form-templates.vue
+++ b/client/src/components/settings/form-templates.vue
@@ -43,17 +43,17 @@
-
+ >
-
+
+
-
-
-
Load template
@@ -153,6 +153,7 @@ type Template = {
website: string,
screenshots: string[],
dirname: string,
+ template: string,
}
type Templates = {
@@ -209,9 +210,10 @@ export default defineComponent({
}
this.dialog = false;
},
- openInstall(templatename: string, pipeline: string, phase: string, catalogId: number) {
+ openInstall(templateurl: string, pipeline: string, phase: string) {
// redirect to install page
- this.$router.push({ name: 'App Form', params: { pipeline: pipeline, phase: phase, app: 'new'}, query: { template: templatename, catalogId: catalogId }})
+ const templateurlB64 = btoa(templateurl);
+ this.$router.push({ name: 'App Form', params: { pipeline: pipeline, phase: phase, app: 'new'}, query: { template: templateurlB64 }})
},
openInstallDialog(template: Template) {
diff --git a/server/src/kubero.ts b/server/src/kubero.ts
index 670505c2..e4456b15 100644
--- a/server/src/kubero.ts
+++ b/server/src/kubero.ts
@@ -858,7 +858,6 @@ export class Kubero {
{
name: 'Kubero',
description: 'Kubero Templates',
- templateBasePath: 'https://raw.githubusercontent.com/kubero-dev/kubero/main/services/',
index: {
url: 'https://raw.githubusercontent.com/kubero-dev/templates/main/index.json',
format: 'json',
@@ -1458,10 +1457,6 @@ export class Kubero {
return this.config.templates;
}
- public async getTemplateBasePath(catalogId: number) {
- return this.config.templates.catalogs[catalogId].templateBasePath;
- }
-
public getTemplateEnabled() {
return this.config.templates.enabled;
}
diff --git a/server/src/modules/config.ts b/server/src/modules/config.ts
index 06c41666..07263032 100644
--- a/server/src/modules/config.ts
+++ b/server/src/modules/config.ts
@@ -94,7 +94,7 @@ export class KuberoConfig {
{
name: string;
description: string;
- templateBasePath: string;
+ templateBasePath?: string; // deprecated v2.4.4
index: {
url: string;
format: string;
diff --git a/server/src/routes/templates.ts b/server/src/routes/templates.ts
index 7e9c18be..9d696811 100644
--- a/server/src/routes/templates.ts
+++ b/server/src/routes/templates.ts
@@ -8,46 +8,18 @@ export const auth = new Auth();
auth.init();
export const authMiddleware = auth.getAuthMiddleware();
export const bearerMiddleware = auth.getBearerMiddleware();
-/*
-// load all services from github repo
-Router.get('/services', authMiddleware, async function (req: Request, res: Response) {
- // #swagger.tags = ['UI']
- // #swagger.summary = 'Get all services'
-
- axios.get('https://raw.githubusercontent.com/kubero-dev/kubero/main/services/index.yaml')
-});
-
-
-// load a specific service from github repo
-Router.get('/services/:name', authMiddleware, async function (req: Request, res: Response) {
- // #swagger.tags = ['UI']
- // #swagger.summary = 'Get a specific service'
- // #deprecated = true // since v1.11.0
-
- const serviceName = req.params.name.replace(/[^\w.-]+/g, '');
-
- const service = await axios.get('https://raw.githubusercontent.com/kubero-dev/kubero/main/services/' + serviceName + '/app.yaml')
- .catch((err) => {
- res
- .status(500)
- .send(err);
- });
- if (service) {
- const ret = YAML.parse(service.data);
- res.send(ret.spec);
- }
-});
-*/
// load a specific service from github repo
-Router.get('/templates/:catalogId/:template', authMiddleware, async function (req: Request, res: Response) {
+Router.get('/templates/:template', authMiddleware, async function (req: Request, res: Response) {
// #swagger.tags = ['UI']
// #swagger.summary = 'Get a specific template'
+ // #swagger.description = 'Get a specific template from a catalog'
+ // #swagger.parameters['template'] = { description: 'A base64 encoded URL', type: 'string' }
- const templateName = req.params.template.replace(/[^\w.-]+/g, '');
- const templateBasePath = await req.app.locals.kubero.getTemplateBasePath(parseInt(req.params.catalogId));
+ // decode the base64 encoded URL
+ const templateUrl = Buffer.from(req.params.template, 'base64').toString('ascii');
- const template = await axios.get(templateBasePath + templateName + '/app.yaml')
+ const template = await axios.get(templateUrl)
.catch((err) => {
res
.status(500)
@@ -58,15 +30,3 @@ Router.get('/templates/:catalogId/:template', authMiddleware, async function (re
res.send(ret.spec);
}
});
-
-// load a specific service from github repo
-Router.get('/templates/:catalogId', authMiddleware, async function (req: Request, res: Response) {
- // #swagger.tags = ['UI']
- // #swagger.summary = 'Get a specific template'
-
- const templateBasePath = await req.app.locals.kubero.getTemplateBasePath(parseInt(req.params.catalogId));
-
-
- axios.get(templateBasePath + '/index.yaml')
-});
-
diff --git a/server/src/types.ts b/server/src/types.ts
index e895c2ca..c2cc4c1a 100644
--- a/server/src/types.ts
+++ b/server/src/types.ts
@@ -384,7 +384,7 @@ export interface IKuberoConfig {
{
name: string;
description: string;
- templateBasePath: string;
+ templateBasePath?: string; // deprecated v2.4.4
index: {
url: string;
format: string;