NativePHP / laravel

Laravel wrapper for the NativePHP framework
https://nativephp.com
MIT License
3.08k stars 158 forks source link

Dev console visible from production app #290

Closed avazquez-bit closed 1 month ago

avazquez-bit commented 4 months ago

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

Fludem commented 4 months ago

@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 commented 4 months ago

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.

simonhamp commented 4 months ago

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.

avazquez-bit commented 4 months ago

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

Thanks for the tip

Fludem commented 4 months ago

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?

avazquez-bit commented 4 months ago

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

simonhamp commented 4 months ago

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

Fludem commented 4 months ago

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

avazquez-bit commented 1 month ago

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