laravel icon indicating copy to clipboard operation
laravel copied to clipboard

Dev console visible from production app

Open avazquez-bit opened this issue 1 year ago • 8 comments
trafficstars

What were you trying to do?

When app is packed and installed, de program can display dev console

image

What happened?

This console is not supposed to be showed in a production app

How to reproduce the bug

Run de app, in view tab open Developer tools

Package Versions

{"installed":[{"name":"nativephp/electron","direct-dependency":true,"homepage":"https://github.com/nativephp/electron","source":"https://github.com/NativePHP/electron/tree/0.6.1","version":"0.6.1","description":"Electron wrapper for the NativePHP framework.","abandoned":false},{"name":"nativephp/laravel","direct-dependency":false,"homepage":"https://github.com/nativephp/laravel","source":"https://github.com/NativePHP/laravel/tree/0.5.0","version":"0.5.0","description":"Laravel wrapper for the NativePHP framework.","abandoned":false},{"name":"nativephp/php-bin","direct-dependency":false,"homepage":"https://nativephp.com","source":"https://github.com/NativePHP/php-bin/tree/0.4.0","version":"0.4.0","description":"PHP binaries used by the NativePHP framework","abandoned":false}]}

PHP Version

8.2.18

Laravel Version

10.10

Node Version

18.8.0

Which operating systems have you seen this occur on?

Windows

OS version

Win 11 (23H2)

Notes

No response

avazquez-bit avatar May 02 '24 22:05 avazquez-bit

@simonhamp

Should we disable Chrome Tools in a packaged application? Or is this something that the developer should decide?

A lot of electron applications include this functionality, such as GitHub Desktop.

Sorry if this is covered somewhere and it's a silly question.

Fludem avatar May 03 '24 18:05 Fludem

I believe dev tools are enabled by default if your application is in debug mode.

Window.php Line 57

You can change the default behaviour by using the showDevTools method on the Window class and passing it true or false. True to enable them and false to disable them.

Window->showDevTools($bool)

@avazquez-bit Would you mind disabling debug or manually calling this function to disable the dev tools and rebuilding your application to see if they're now disabled?

If they are you should have a workaround for now. Improving how this is handled probably requires some thought and input from others, and it is probably not worth Simon's focus on if there's a workaround.

Fludem avatar May 03 '24 20:05 Fludem

Should we disable Chrome Tools in a packaged application? Or is this something that the developer should decide?

@Fludem it's a valid question. I like the flexibility of letting the developer decide... I think the fact that it's in the Window class allows for that.

But what we should have is either:

  1. a sensible default (i.e. we intentionally turn APP_DEBUG=false during the build process); or
  2. show a warning that APP_DEBUG=true at build time.

If we do (1), there's no danger of someone accidentally leaving debug mode on, which has wider implications than just allowing the DevTools to show.

If we only do (2), my feeling is there's a chance that folks either miss it (build output is often messy) or become blind to it.

simonhamp avatar May 03 '24 20:05 simonhamp

@Fludem I'm gonna try, and let you knwo whats happens, i dont see those specifications you mention.

Thanks for the tip

avazquez-bit avatar May 03 '24 20:05 avazquez-bit

Should we disable Chrome Tools in a packaged application? Or is this something that the developer should decide?

@Fludem it's a valid question. I like the flexibility of letting the developer decide... I think the fact that it's in the Window class allows for that.

But what we should have is either:

  1. a sensible default (i.e. we intentionally turn APP_DEBUG=false during the build process); or
  2. show a warning that APP_DEBUG=true at build time.

If we do (1), there's no danger of someone accidentally leaving debug mode on, which has wider implications than just allowing the DevTools to show.

If we only do (2), my feeling is there's a chance that folks either miss it (build output is often messy) or become blind to it.

Yeah I think we should probably go with option 1. Then allow them to pass an argument when they run the command to disable that behavior in case they need a build in debug mode or something

You on board with that?

Fludem avatar May 03 '24 21:05 Fludem

I've tried to change my app debug to false an directly set the function showDevTools ond false, and still appearing

avazquez-bit avatar May 03 '24 21:05 avazquez-bit

Could the option be appearing in the menu because of the menu configuration? 🤔

I'm just thinking it may having nothing to do with those settings

simonhamp avatar May 03 '24 23:05 simonhamp

Could the option be appearing in the menu because of the menu configuration? 🤔

I'm just thinking it may having nothing to do with those settings

I haven't had a proper look I just skimmed over it, but I thought at first glance it seemed like the logical cause.

I'll take a proper look tonight / maybe tomorrow

Fludem avatar May 04 '24 00:05 Fludem

I have updated all packages and i've found the function hideMenu, I don't know if there was before, but now is and this helps to hide the debug bar and options into

avazquez-bit avatar Aug 06 '24 19:08 avazquez-bit