diff --git a/src/dev-center/js/dev-center.js b/src/dev-center/js/dev-center.js index b15da104..752b2ff9 100644 --- a/src/dev-center/js/dev-center.js +++ b/src/dev-center/js/dev-center.js @@ -62,6 +62,7 @@ if(domain === 'puter.localhost'){ static_hosting_domain = 'site.puter.localhost'; } +// port if (URLParams.has('puter.port') && URLParams.get('puter.port')) { static_hosting_domain = static_hosting_domain + `:` + URLParams.get('puter.port'); } @@ -81,7 +82,6 @@ if (URLParams.has('puter.port') && URLParams.get('puter.port')) { $(document).ready(function () { $('#loading').show(); - // get dev profile setTimeout(async function () { puter.ui.onLaunchedWithItems(async function (items) { source_path = items[0].path; @@ -95,6 +95,7 @@ $(document).ready(function () { } }) + // Get dev profile. This is only for puter.com for now as we don't have dev profiles in self-hosted Puter if(domain === 'puter.com'){ puter.apps.getDeveloperProfile(async function (dev_profile) { developer = dev_profile; @@ -119,7 +120,7 @@ $(document).ready(function () { } }) } - // get apps + // Get apps puter.apps.list().then((resp) => { apps = resp; @@ -176,16 +177,16 @@ $(document).on('click', '.tab-btn', function (e) { $(this).addClass('active'); $('section[data-tab="' + $(this).attr('data-tab') + '"]').show(); - // ------------------------------ + // --------------------------------------------------------------- // Apps tab - // ------------------------------ + // --------------------------------------------------------------- if ($(this).attr('data-tab') === 'apps') { refresh_app_list(); activeTab = 'apps'; } - // ------------------------------ + // --------------------------------------------------------------- // Payout Method tab - // ------------------------------ + // --------------------------------------------------------------- else if ($(this).attr('data-tab') === 'payout-method') { activeTab = 'payout-method'; $('#loading').show(); @@ -318,6 +319,7 @@ async function create_app(title, source_path = null, items = null) { }) } + $(document).on('click', '.deploy-btn', function (e) { deploy(currently_editing_app, dropped_items); }) @@ -856,8 +858,6 @@ $('#earn-money::backdrop').click(async function (e) { puter.kv.set('earn-money-c2a-closed', 'true') }) - - $(document).on('click', '.edit-app-open-app-btn', async function (e) { puter.ui.launchApp($(this).attr('data-app-name')) }) @@ -983,8 +983,10 @@ $(document).on('click', '#edit-app-icon', async function (e) { let image = reader.result; // Get file extension let fileExtension = res2.name.split('.').pop(); + // Get MIME type let mimeType = getMimeType(fileExtension); + // Replace MIME type in the data URL image = image.replace('data:application/octet-stream;base64', `data:image/${mimeType};base64`); @@ -1066,10 +1068,7 @@ function generate_app_card(app) { h += ``; h += `