fruitcake / laravel-telescope-toolbar

A toolbar for Laravel Telescope, based on the Symfony Web Profiler.
MIT License
778 stars 39 forks source link

Assets not loading / breaking Safari #14

Closed tillkruss closed 5 years ago

tillkruss commented 5 years ago

All toolbar routes currently use the telescope middleware stack, which might include the auth middleware.

This causes errors in Safari if the user isn't logged in:

[Error] SyntaxError: Unexpected token '<'
    (anonymous function) (login:1)
[Error] Did not parse stylesheet at 'https://mercatus.test/_tt/assets/styling.css?20190826&lightMode=1' because non CSS MIME types are not allowed in strict mode.
[Error] ReferenceError: Can't find variable: Sfjs
    (anonymous function) (mercatus.test:14)
    Global Code (mercatus.test:15)
[Error] ReferenceError: Can't find variable: Sfjs
    (anonymous function) (mercatus.test:79)
    Global Code (mercatus.test:80)
barryvdh commented 5 years ago

Yeah the idea is that it uses the same middleware so it's only visible when Telescope is. Not sure what is best, separate middleware or check if the assets are loaded to prevent errors? Should Toolbar render when not logged in?

barryvdh commented 5 years ago

Perhaps the assets could render always, and the Ajax request we can catch the 401 error and show a message. And possibly make the middleware configurable.

barryvdh commented 5 years ago

Does https://github.com/fruitcake/laravel-telescope-toolbar/pull/15 work for you?

tillkruss commented 5 years ago

Yes, that’s great. Even tho assets don’t need a middleware at all IMO.

barryvdh commented 5 years ago

Okay tagged it

tillkruss commented 5 years ago

Fantastic, thanks!