cloudcmd icon indicating copy to clipboard operation
cloudcmd copied to clipboard

feat: Supports injecting scripts into the client

Open wll8 opened this issue 3 years ago • 9 comments

Supports injecting scripts into the client, which is convenient for adjusting page content, customizing functions...

E.g:

Now there is no way to clearly identify the text, if the official does not provide skin or configuration, but provides the function of injecting code.

image

This will let me solve this problem very quickly.

I tried to query the documentation and code of jq-console and console-io, but there is no customizable solution in cloudcmd.

wll8 avatar Jun 17 '22 07:06 wll8

Try User Menu

coderaiser avatar Jun 17 '22 11:06 coderaiser

If I want to modify the styles on the page, do I think of the [User Menu]?

wll8 avatar Jun 17 '22 12:06 wll8

You can load any styles you want with help of User Menu, and then load Console.

coderaiser avatar Jun 17 '22 12:06 coderaiser

Is there a way to have the script execute on the page without triggering the user menu?

wll8 avatar Jun 17 '22 12:06 wll8

There was such way as plugins but support was dropped inf favor of User Menu.

I suggest you to start from User Menu, and then if you will have ideas how to make it in another way we can try :).

coderaiser avatar Jun 17 '22 12:06 coderaiser

thanks. I would try the plugin way first

wll8 avatar Jun 17 '22 12:06 wll8

thanks. I would try the plugin way first

Plugins not supported since Cloud Commander v11.

coderaiser avatar Jun 17 '22 12:06 coderaiser

T_T......

app.use(prefix, cloudcmd({
    socket, // used by Config, Edit (optional) and Console (required)
    config, // config data (optional)
    modules, // optional
    configManager, // optional
}));

This place might implement a service via express and deliver index.html to the browser.

You can try inside app.use ,

Through middleware,

Rewrite index.html and inject the script.

wll8 avatar Jun 17 '22 13:06 wll8

Yes, but why not just use User Menu :)? As I said, this already was implemented...

coderaiser avatar Jun 17 '22 18:06 coderaiser