Add dedupeName for to puter.apps and Dev Center

This commit is contained in:
jelveh 2024-10-18 18:02:37 -07:00
parent 8ed5db1734
commit b1411cd622
2 changed files with 15 additions and 3 deletions

View File

@ -234,7 +234,7 @@ $(document).on('click', '.create-an-app-btn', async function (e) {
async function create_app(title, source_path = null, items = null) { async function create_app(title, source_path = null, items = null) {
// name // name
let name = slugify(title + '-' + Math.random().toString(36).substring(2), { let name = slugify(title, {
lower: true, lower: true,
strict: true, strict: true,
}); });
@ -257,6 +257,7 @@ async function create_app(title, source_path = null, items = null) {
description: ' ', description: ' ',
maximizeOnStart: false, maximizeOnStart: false,
background: false, background: false,
dedupeName: true,
}) })
.then(async (app) => { .then(async (app) => {
let app_dir; let app_dir;

View File

@ -52,8 +52,16 @@ class Apps{
let indexURL = args[1]; let indexURL = args[1];
let title = args[2] ?? args[0]; let title = args[2] ?? args[0];
options = { object: { name: args[0], index_url: indexURL, title: title}}; options = {
}else if (typeof args[0] === 'object' && args[0] !== null) { object: {
name: args[0],
index_url: indexURL,
title: title
}
};
}
// * allows for: puter.apps.new({name: 'example-app', indexURL: 'https://example.com'}) *
else if (typeof args[0] === 'object' && args[0] !== null) {
let options_raw = args[0]; let options_raw = args[0];
options = { options = {
object: { object: {
@ -66,6 +74,9 @@ class Apps{
background: options_raw.background, background: options_raw.background,
filetype_associations: options_raw.filetypeAssociations, filetype_associations: options_raw.filetypeAssociations,
metadata: options_raw.metadata, metadata: options_raw.metadata,
},
options: {
dedupe_name: options_raw.dedupeName ?? false,
} }
}; };
} }