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) {
// 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;

View File

@ -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,
}
};
}