mirror of
https://github.com/HeyPuter/puter.git
synced 2026-11-13 20:12:57 -10:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1cc00fa977 |
No files matched your search
@@ -705,10 +705,6 @@ async function UIDesktop (options) {
|
||||
data-sort_order="${!options.desktop_fsentry?.sort_order ? 'asc' : options.desktop_fsentry.sort_order}"
|
||||
data-path="${html_encode(window.desktop_path)}"
|
||||
>`;
|
||||
|
||||
// show AI button
|
||||
h += '<div class="btn-show-ai"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-sparkles-icon lucide-sparkles"><path d="M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z"/><path d="M20 2v4"/><path d="M22 4h-4"/><circle cx="4" cy="20" r="2"/></svg></div>';
|
||||
|
||||
h += '</div>';
|
||||
|
||||
// Get window sidebar width
|
||||
@@ -1297,21 +1293,6 @@ async function UIDesktop (options) {
|
||||
window.dispatchEvent(new CustomEvent('desktop:ready'));
|
||||
globalThis.services.emit('gui:ready');
|
||||
|
||||
//--------------------------------------------------------
|
||||
// Open the AI app (best-effort — the `ai` app isn't seeded
|
||||
// in OSS, so swallow 404s / token failures silently here
|
||||
// instead of surfacing a "Couldn't open" alert at boot).
|
||||
//--------------------------------------------------------
|
||||
launch_app({
|
||||
name: 'ai',
|
||||
silent_on_failure: true,
|
||||
window_options: {
|
||||
is_panel: true,
|
||||
},
|
||||
}).catch(err => {
|
||||
console.debug('auto-launch of ai panel skipped:', err?.message ?? err);
|
||||
});
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Determine if an app was launched from URL
|
||||
// i.e. https://puter.com/app/<app_name>
|
||||
@@ -2608,8 +2589,4 @@ window.toggleDesktopIcons = function () {
|
||||
.catch(err => console.warn('Could not save desktop_icons_hidden:', err));
|
||||
};
|
||||
|
||||
$(document).on('click', '.btn-show-ai', function () {
|
||||
$('.window[data-app="ai"]').makeWindowVisible();
|
||||
});
|
||||
|
||||
export default UIDesktop;
|
||||
@@ -75,11 +75,6 @@ function UIPopover (options) {
|
||||
} else {
|
||||
// Default bottom taskbar behavior - center horizontally
|
||||
x_pos = window.innerWidth / 2 - popover_width / 2 - 15;
|
||||
|
||||
// if sidepanel (visible), shift to the left
|
||||
if ( $('.window[data-is_panel][data-is_visible="1"]').length > 0 ) {
|
||||
x_pos -= 200;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( options.position === 'bottom' || options.position === 'top' )
|
||||
|
||||
@@ -547,17 +547,6 @@ window.update_taskbar_position = async function (new_position) {
|
||||
window.adjust_taskbar_item_sizes();
|
||||
}, 10);
|
||||
|
||||
// adjust position if sidepanel is open
|
||||
if ( window.taskbar_position === 'bottom' ) {
|
||||
if ( $('.window[data-is_panel="1"][data-is_visible="1"]').length > 0 ) {
|
||||
$('.taskbar.taskbar-position-bottom').css('left', `calc(50% - ${window.PANEL_WIDTH / 2}px)`);
|
||||
} else if ( $('.window[data-is_panel="1"][data-is_visible="0"]').length > 0 ) {
|
||||
$('.taskbar.taskbar-position-bottom').css('left', 'calc(50%)');
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
// Reinitialize all taskbar item tooltips with new position
|
||||
$('.taskbar-item').each(function () {
|
||||
const $item = $(this);
|
||||
|
||||
@@ -51,14 +51,14 @@ async function UIWindow (options) {
|
||||
}
|
||||
|
||||
// we don't want to increment window_counter for dominant windows
|
||||
if ( !options.dominant && !options.is_panel )
|
||||
if ( !options.dominant )
|
||||
{
|
||||
window.window_counter++;
|
||||
}
|
||||
|
||||
// add this window's id to the window_stack
|
||||
// don't add if invisible
|
||||
if ( options.is_visible && !options.is_panel ) {
|
||||
if ( options.is_visible ) {
|
||||
window.window_stack.push(win_id);
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ async function UIWindow (options) {
|
||||
}
|
||||
|
||||
// left
|
||||
let desktop_width = window.innerWidth - ( is_panel_open() ? PANEL_WIDTH : 0);
|
||||
let desktop_width = window.innerWidth;
|
||||
if ( !options.dominant && !options.center ) {
|
||||
options.left = options.left ?? `${(desktop_width / 2 - options.width / 2) + (window.window_counter - 1) % 10 * 30 }px`;
|
||||
} else if ( !options.dominant && options.center ) {
|
||||
@@ -210,31 +210,6 @@ async function UIWindow (options) {
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
// Panel
|
||||
// --------------------------------------------------------
|
||||
if ( options.is_panel ) {
|
||||
options.width = PANEL_WIDTH;
|
||||
options.has_head = false;
|
||||
options.show_in_taskbar = false;
|
||||
options.is_resizable = false;
|
||||
options.left = `${window.innerWidth - options.width }px`;
|
||||
options.width = `${options.width }px`;
|
||||
options.height = '100%';
|
||||
options.top = 0;
|
||||
options.right = '0 !important';
|
||||
options.border_radius = '0px';
|
||||
options.border = 'none';
|
||||
options.box_shadow = 'none';
|
||||
options.background_color = 'transparent';
|
||||
options.is_visible = false;
|
||||
options.position = 'absolute !important';
|
||||
options.left = 'auto !important';
|
||||
|
||||
// panel is not visible by default
|
||||
options.is_visible = false;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
// Dashboard app chrome
|
||||
// --------------------------------------------------------
|
||||
@@ -303,7 +278,6 @@ async function UIWindow (options) {
|
||||
data-update_window_url = "${options.update_window_url && options.is_visible}"
|
||||
data-custom_path = "${html_encode(options.custom_path)}"
|
||||
data-user_set_url_params = "${html_encode(user_set_url_params)}"
|
||||
data-is_panel ="${options.is_panel ? 1 : 0}"
|
||||
data-is_visible ="${options.is_visible ? 1 : 0}"
|
||||
${options.launched_hidden ? 'data-launched_hidden ="1"' : ''}
|
||||
style=" z-index: ${zindex};
|
||||
@@ -3999,13 +3973,6 @@ $.fn.makeWindowVisible = function (options) {
|
||||
$(this).attr({
|
||||
'data-is_visible': '1',
|
||||
});
|
||||
|
||||
// if sidepanel, shift desktop toolbar to the left
|
||||
if ( $(this).attr('data-is_panel') === '1' ) {
|
||||
$('.toolbar').css('left', `calc(50% - ${window.PANEL_WIDTH / 2}px)`);
|
||||
$('.taskbar.taskbar-position-bottom').css('left', `calc(50% - ${window.PANEL_WIDTH / 2}px)`);
|
||||
$('.window[data-is_panel="0"]').css('transform', `translateX(-${window.PANEL_WIDTH / 2}px)`);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -4037,13 +4004,6 @@ $.fn.makeWindowInvisible = async function (options) {
|
||||
$next.focusWindow();
|
||||
}
|
||||
}
|
||||
// if sidepanel, shift desktop toolbar to the right
|
||||
if ( $(this).attr('data-is_panel') === '1' ) {
|
||||
$('.toolbar').css('left', 'calc(50%)');
|
||||
$('.taskbar.taskbar-position-bottom').css('left', 'calc(50%)');
|
||||
$('.window[data-is_panel="0"]').css('transform', 'translateX(0px)');
|
||||
// update taskbar position
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -4270,10 +4230,6 @@ $.fn.focusWindow = function (event) {
|
||||
window.active_item_container = $(this).find('.item-container').get(0);
|
||||
// grey out all selected items on other windows/desktop
|
||||
$('.item-container').not(window.active_item_container).find('.item-selected').addClass('item-blurred');
|
||||
// update window-stack
|
||||
if ( !$(this).attr('data-is_panel') === '1' ) {
|
||||
window.window_stack.push(parseInt($(this).attr('data-id')));
|
||||
}
|
||||
// remove blurred class from items on this window
|
||||
$(window.active_item_container).find('.item-blurred').removeClass('item-blurred');
|
||||
// Update the tab title to the focused window. The URL itself is
|
||||
@@ -5652,11 +5608,6 @@ window.update_maximized_window_for_taskbar = function (el_window) {
|
||||
let height = window.innerHeight - window.taskbar_height - window.toolbar_height - 6;
|
||||
let width = '100%';
|
||||
|
||||
// any open panels?
|
||||
if ( is_panel_open() ) {
|
||||
width = window.innerWidth - PANEL_WIDTH - 2;
|
||||
}
|
||||
|
||||
$(el_window).css({
|
||||
'top': `${window.toolbar_height }px`,
|
||||
'left': '0',
|
||||
@@ -5666,11 +5617,6 @@ window.update_maximized_window_for_taskbar = function (el_window) {
|
||||
} else if ( position === 'left' ) {
|
||||
let width = window.innerWidth - window.taskbar_height - 1;
|
||||
|
||||
// any open panels?
|
||||
if ( is_panel_open() ) {
|
||||
width = `calc(100% - ${window.taskbar_height + 1}px - ${PANEL_WIDTH}px - 1px)`;
|
||||
}
|
||||
|
||||
$(el_window).css({
|
||||
'top': `${window.toolbar_height }px`,
|
||||
'left': `${window.taskbar_height + 1 }px`,
|
||||
@@ -5710,11 +5656,6 @@ function getSnapDimensions () {
|
||||
start_y = window.toolbar_height;
|
||||
}
|
||||
|
||||
// Adjust for open panel
|
||||
if ( is_panel_open() ) {
|
||||
available_width = available_width - PANEL_WIDTH;
|
||||
}
|
||||
|
||||
return {
|
||||
available_width,
|
||||
available_height,
|
||||
@@ -5723,8 +5664,4 @@ function getSnapDimensions () {
|
||||
};
|
||||
}
|
||||
|
||||
window.is_panel_open = function () {
|
||||
return $('.window[data-is_panel="1"][data-is_visible="1"]').length > 0;
|
||||
};
|
||||
|
||||
export default UIWindow;
|
||||
@@ -6402,57 +6402,6 @@ html.dark-mode .usage-table-show-less:hover {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
* AI Button
|
||||
************************************************************/
|
||||
|
||||
.btn-send-ai{
|
||||
margin-top: 10px;
|
||||
}
|
||||
.btn-show-ai{
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
background-color: #ffffff;
|
||||
z-index: 2;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
padding: 5px;
|
||||
top: 5px;
|
||||
right: 5px;
|
||||
border-radius: 5px;
|
||||
background: linear-gradient(to bottom, #f8f8f8, #e0e0e0);
|
||||
cursor: pointer;
|
||||
}
|
||||
.btn-show-ai svg{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.btn-show-ai:hover{
|
||||
background: linear-gradient(to bottom, #f8f8f8, #eae9e9);
|
||||
}
|
||||
|
||||
.device-desktop .btn-show-ai {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.fullpage-mode .btn-show-ai{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.btn-hide-ai{
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
.update-usage-details{
|
||||
float: right;
|
||||
background: none;
|
||||
|
||||
@@ -229,9 +229,6 @@ window.file_templates = [];
|
||||
// default language
|
||||
window.locale = 'en';
|
||||
|
||||
// the width of the panel
|
||||
window.PANEL_WIDTH = 400;
|
||||
|
||||
// the transaction class
|
||||
window.Transaction = class {
|
||||
constructor (name, attributes = {}) {
|
||||
|
||||
@@ -238,16 +238,14 @@ const launch_app = async (options) => {
|
||||
return fallbackLaunchOutcome ?? { launchResult: redirectedLaunchResult };
|
||||
}
|
||||
|
||||
if ( ! options?.silent_on_failure ) {
|
||||
const deniedAppTitle = app_info.title ?? app_info.name ?? options.name ?? 'this app';
|
||||
const safeDeniedAppTitle = window.html_encode
|
||||
? window.html_encode(deniedAppTitle)
|
||||
: deniedAppTitle;
|
||||
if ( typeof window.UIAlert === 'function' ) {
|
||||
await window.UIAlert(`You don't have access to ${safeDeniedAppTitle}.`);
|
||||
} else {
|
||||
window.alert(`You don't have access to ${deniedAppTitle}.`);
|
||||
}
|
||||
const deniedAppTitle = app_info.title ?? app_info.name ?? options.name ?? 'this app';
|
||||
const safeDeniedAppTitle = window.html_encode
|
||||
? window.html_encode(deniedAppTitle)
|
||||
: deniedAppTitle;
|
||||
if ( typeof window.UIAlert === 'function' ) {
|
||||
await window.UIAlert(`You don't have access to ${safeDeniedAppTitle}.`);
|
||||
} else {
|
||||
window.alert(`You don't have access to ${deniedAppTitle}.`);
|
||||
}
|
||||
|
||||
const deniedLaunchResult = {
|
||||
@@ -547,18 +545,14 @@ const launch_app = async (options) => {
|
||||
tokenResult,
|
||||
});
|
||||
|
||||
// `silent_on_failure` callers (e.g. best-effort auto-launches
|
||||
// like the AI panel on desktop boot) skip the blocking alert.
|
||||
if ( ! options?.silent_on_failure ) {
|
||||
const tokenErrorAppTitle = app_info?.title ?? app_info?.name ?? options?.name ?? 'this app';
|
||||
const safeTokenErrorAppTitle = window.html_encode
|
||||
? window.html_encode(tokenErrorAppTitle)
|
||||
: tokenErrorAppTitle;
|
||||
if ( typeof window.UIAlert === 'function' ) {
|
||||
await window.UIAlert(`Couldn't open ${safeTokenErrorAppTitle}. Please try again.`);
|
||||
} else {
|
||||
window.alert(`Couldn't open ${tokenErrorAppTitle}. Please try again.`);
|
||||
}
|
||||
const tokenErrorAppTitle = app_info?.title ?? app_info?.name ?? options?.name ?? 'this app';
|
||||
const safeTokenErrorAppTitle = window.html_encode
|
||||
? window.html_encode(tokenErrorAppTitle)
|
||||
: tokenErrorAppTitle;
|
||||
if ( typeof window.UIAlert === 'function' ) {
|
||||
await window.UIAlert(`Couldn't open ${safeTokenErrorAppTitle}. Please try again.`);
|
||||
} else {
|
||||
window.alert(`Couldn't open ${tokenErrorAppTitle}. Please try again.`);
|
||||
}
|
||||
|
||||
const tokenFailureLaunchResult = {
|
||||
|
||||
Reference in new issue
Block a user