diff --git a/src/dev-center/js/dev-center.js b/src/dev-center/js/dev-center.js index 9604c6f2..9db7d0c1 100644 --- a/src/dev-center/js/dev-center.js +++ b/src/dev-center/js/dev-center.js @@ -234,7 +234,7 @@ $(document).on('click', '.create-an-app-btn', async function (e) { async function create_app(title, source_path = null, items = null) { // name - let name = slugify(title + '-' + Math.random().toString(36).substring(2), { + let name = slugify(title, { lower: true, strict: true, }); @@ -257,6 +257,7 @@ async function create_app(title, source_path = null, items = null) { description: ' ', maximizeOnStart: false, background: false, + dedupeName: true, }) .then(async (app) => { let app_dir; diff --git a/src/puter-js/src/modules/Apps.js b/src/puter-js/src/modules/Apps.js index 4479aa2a..2a9d12b0 100644 --- a/src/puter-js/src/modules/Apps.js +++ b/src/puter-js/src/modules/Apps.js @@ -52,8 +52,16 @@ class Apps{ let indexURL = args[1]; let title = args[2] ?? args[0]; - options = { object: { name: args[0], index_url: indexURL, title: title}}; - }else if (typeof args[0] === 'object' && args[0] !== null) { + options = { + 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]; options = { object: { @@ -66,6 +74,9 @@ class Apps{ background: options_raw.background, filetype_associations: options_raw.filetypeAssociations, metadata: options_raw.metadata, + }, + options: { + dedupe_name: options_raw.dedupeName ?? false, } }; }