Skip to content

Commit e73d55b

Browse files
committed
Perform getDeveloperProfile only when on puter.com
1 parent f2b551d commit e73d55b

File tree

1 file changed

+39
-37
lines changed

1 file changed

+39
-37
lines changed

src/dev-center/js/dev-center.js

+39-37
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ $(document).ready(function () {
5858
$('#loading').show();
5959

6060
// get dev profile
61-
setTimeout(function () {
61+
setTimeout(async function () {
6262
puter.ui.onLaunchedWithItems(async function (items) {
6363
source_path = items[0].path;
6464
// if source_path is provided, this means that the user is creating a new app/updating an existing app
@@ -71,48 +71,50 @@ $(document).ready(function () {
7171
}
7272
})
7373

74-
puter.apps.getDeveloperProfile(async function (dev_profile) {
75-
developer = dev_profile;
76-
if (dev_profile.approved_for_incentive_program && !dev_profile.joined_incentive_program) {
77-
$('#join-incentive-program').show();
78-
}
74+
if(domain === 'puter.com'){
75+
puter.apps.getDeveloperProfile(async function (dev_profile) {
76+
developer = dev_profile;
77+
if (dev_profile.approved_for_incentive_program && !dev_profile.joined_incentive_program) {
78+
$('#join-incentive-program').show();
79+
}
7980

80-
// show earn money c2a only if dev is not approved for incentive program or has already joined
81-
if (!dev_profile.approved_for_incentive_program || dev_profile.joined_incentive_program) {
82-
puter.kv.get('earn-money-c2a-closed').then((value) => {
83-
if (value?.result || value === true || value === "true")
84-
return;
81+
// show earn money c2a only if dev is not approved for incentive program or has already joined
82+
if (!dev_profile.approved_for_incentive_program || dev_profile.joined_incentive_program) {
83+
puter.kv.get('earn-money-c2a-closed').then((value) => {
84+
if (value?.result || value === true || value === "true")
85+
return;
8586

86-
$('#earn-money').get(0).showModal();
87-
});
88-
}
87+
$('#earn-money').get(0).showModal();
88+
});
89+
}
8990

90-
// get apps
91-
puter.apps.list().then((resp) => {
92-
apps = resp;
91+
// show payout method tab if dev has joined incentive program
92+
if (dev_profile.joined_incentive_program) {
93+
$('.tab-btn[data-tab="payout-method"]').show();
94+
$('#payout-method-email').html(dev_profile.paypal);
95+
}
96+
})
97+
}
98+
// get apps
99+
puter.apps.list().then((resp) => {
100+
apps = resp;
93101

94-
// hide loading
95-
$('#loading').hide();
102+
// hide loading
103+
$('#loading').hide();
96104

97-
// set apps
98-
if (apps.length > 0) {
99-
if (activeTab === 'apps') {
100-
$('#no-apps-notice').hide();
101-
$('#app-list').show();
102-
}
103-
$('.app-card').remove();
104-
apps.forEach(app => {
105-
$('#app-list-table > tbody').append(generate_app_card(app));
106-
});
107-
sort_apps();
108-
} else {
109-
$('#no-apps-notice').show();
105+
// set apps
106+
if (apps.length > 0) {
107+
if (activeTab === 'apps') {
108+
$('#no-apps-notice').hide();
109+
$('#app-list').show();
110110
}
111-
})
112-
// show payout method tab if dev has joined incentive program
113-
if (dev_profile.joined_incentive_program) {
114-
$('.tab-btn[data-tab="payout-method"]').show();
115-
$('#payout-method-email').html(dev_profile.paypal);
111+
$('.app-card').remove();
112+
apps.forEach(app => {
113+
$('#app-list-table > tbody').append(generate_app_card(app));
114+
});
115+
sort_apps();
116+
} else {
117+
$('#no-apps-notice').show();
116118
}
117119
})
118120
}, 1000);

0 commit comments

Comments
 (0)