mirror of
https://github.com/HeyPuter/puter.git
synced 2025-02-02 14:18:43 +08:00
dev: app pseudonyms
This commit is contained in:
parent
8bc4122bea
commit
4febd81169
@ -194,6 +194,7 @@ async function UIWindow(options) {
|
||||
id="window-${win_id}"
|
||||
data-allowed_file_types = "${html_encode(options.allowed_file_types)}"
|
||||
data-app="${html_encode(options.app)}"
|
||||
data-app_pseudonym="${html_encode(options.pseudonym)}"
|
||||
data-app_uuid="${html_encode(options.app_uuid ?? '')}"
|
||||
data-disable_parent_window = "${html_encode(options.disable_parent_window)}"
|
||||
data-name="${html_encode(options.title)}"
|
||||
@ -3357,8 +3358,9 @@ $.fn.focusWindow = function(event) {
|
||||
$(window.active_item_container).find('.item-blurred').removeClass('item-blurred');
|
||||
//change window URL
|
||||
const update_window_url = $(this).attr('data-update_window_url');
|
||||
const url_app_name = $(this).attr('data-app_pseudonym') || $(this).attr('data-app');
|
||||
if(update_window_url === 'true' || update_window_url === null){
|
||||
window.history.replaceState({window_id: $(this).attr('data-id')}, '', '/app/'+$(this).attr('data-app')+$(this).attr('data-user_set_url_params'));
|
||||
window.history.replaceState({window_id: $(this).attr('data-id')}, '', '/app/'+url_app_name+$(this).attr('data-user_set_url_params'));
|
||||
document.title = $(this).attr('data-name');
|
||||
}
|
||||
$(`.taskbar .taskbar-item[data-app="${$(this).attr('data-app')}"]`).addClass('taskbar-item-active');
|
||||
|
@ -139,6 +139,7 @@ const launch_app = async (options)=>{
|
||||
is_dir: true,
|
||||
app: 'explorer',
|
||||
...window_options,
|
||||
...(options.pseudonym ? {pseudonym: options.pseudonym} : {}),
|
||||
is_maximized: options.maximized,
|
||||
});
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ export class ExecService extends Service {
|
||||
}
|
||||
|
||||
// This method is exposed to apps via IPCService.
|
||||
async launchApp ({ app_name, args }, { ipc_context, msg_id } = {}) {
|
||||
async launchApp ({ app_name, args, pseudonym }, { ipc_context, msg_id } = {}) {
|
||||
const app = ipc_context?.caller?.app;
|
||||
const process = ipc_context?.caller?.process;
|
||||
|
||||
@ -33,6 +33,7 @@ export class ExecService extends Service {
|
||||
// The "body" of this method is in a separate file
|
||||
const child_process = await launch_app({
|
||||
name: app_name,
|
||||
pseudonym,
|
||||
args: args ?? {},
|
||||
parent_instance_id: app?.appInstanceID,
|
||||
uuid: child_instance_id,
|
||||
|
@ -972,11 +972,16 @@ class UI extends EventListener {
|
||||
|
||||
// Returns a Promise<AppConnection>
|
||||
launchApp = async function launchApp(app_name, args, callback) {
|
||||
let pseudonym = undefined;
|
||||
if ( app_name.includes('#(as)') ) {
|
||||
[app_name, pseudonym] = app_name.split('#(as)');
|
||||
}
|
||||
const app_info = await this.#ipc_stub({
|
||||
method: 'launchApp',
|
||||
callback,
|
||||
parameters: {
|
||||
app_name,
|
||||
pseudonym,
|
||||
args,
|
||||
},
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user