mikebronner / laravel-caffeine Goto Github PK
View Code? Open in Web Editor NEWKeeping Your Laravel Forms Awake.
Home Page: https://genealabs.com/docs/laravel-caffeine/
License: MIT License
Keeping Your Laravel Forms Awake.
Home Page: https://genealabs.com/docs/laravel-caffeine/
License: MIT License
Why didn't you incorporate the configurable route as proposed in #9? This is really a huge bummer for me and makes me fork your package for just this small change.
When run route /genealabs/laravel-caffeine/drip
it return error 500 with ReflectionException in Container.php line 741:
Class web does not exist
Upon installing laravel caffeine, laravel fails to find the package/service provider.
Composer.json has the correct entry -- "genealabs/laravel-caffeine": "^0.4.1"
Application service provider in config/app has been added - GeneaLabs\LaravelCaffeine\LaravelCaffeineServiceProvider::class,
Yet artisan throws the following error..
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'GeneaLabs\LaravelCaffeine\LaravelCaffeineServiceProvider' not found
Would you be able to explain what the difference between just upping the value of lifetime
is and what caffeine provides? One of your points per the doc is:
removing session-timeout on all pages.
Can't that essentially be achieved by setting lifetime
to a very high value?
Interface 'App\Jobs\SelfHandling' not found this error appear when we update laravel version from 5.1 to 5.4
I just installed for a 5.4 laravel instalation running on forge. It doenst trace any errors. i dont know if it works yet. I openen a form and have being waiting for over 2 hours and it looks it works. But have you test it out? so i can push it to production?
I have just installed laravel-caffeine and there seems to be multiple syntax errors on lines 28, 33 and 38.
Hello. I'm getting TokenMismatchException after Laravel session lifetime, just like closed issue #22. I did the same test as ivanvermeyen did: I set the session lifetime to 3 minutes and caffeine drips to 1 minute. I've checked the chrome network tab and the drips are being sent just like they should be. After 3 minutes (or 3 drips) I submit the form and then I get the TokenMismatchException.
I also noticed one thing: When I did the same test as ivanvermeyen, I had to publish the config file and customize it. After that I'm getting this error when I run an artisan command:
PHP Catchable fatal error: Argument 2 passed to Illuminate\Routing\UrlGenerator::__construct() must be an instance of Illuminate\Http\Request, null given
When I delete the config file, I don't get this error anymore.
I don't know if it has something to do with the TokenMismatchException error, but I think it's a relevant issue.
Laravel Version: 5.2.45
Laravel Caffeine Package Version: 0.3.11
PHP Version: 5.6.22
In a fresh laravel 5.2, caffeine works. But on an existing laravel (from 5.1 to 5.2), it throws this exception:
ReflectionException: Class web does not exist
This commit 2b8a220, added a route group with web
middleware. But I think the web
middleware is optional and may be removed (it's not in vendor
but in app
). So Caffeine has a dependency about an optional middleware (it does not exists on migration and may not exists in modified fresh install).
Anyway, thanks for this package :)
I set the session life time to one minute to test it out, my app is SPA with vuejs so instead of using laravel caffeine middleware I use following code to send drip:
setInterval(function () {
Vue.http.get('/api/drip');
}, 10000);
I define a new drip route like so:
$router->get('api/drip', '\GeneaLabs\LaravelCaffeine\Http\Controllers\LaravelCaffeineController@drip');
I see that in network tabs it sends the drip every 10 seconds, I leave the page open for a while after filled the form and after few minutes hit the submit button and I still get token mismatch exception. Am I missing something?
The url utilized by the middleware is using a path that assumes routing paths for laravel are not changed via .htaccess or other means. This causes the drip logic to not find the controller. The solution is to use the url function to make sure the path is correct.
My fix:
Replace line 32 of LaravelCaffeineDripMiddleware.php with the following:
$content = str_replace('</body>', "<script>setInterval(function(){var e=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject('Microsoft.XMLHTTP');e.open('GET','".url('/genealabs/laravel-caffeine/drip')."',!0),e.send()}," . config('genealabs-laravel-caffeine.dripIntervalInMilliSeconds', 300000) . ");</script></body>", $content);
我安装了他 但是我不知道无法使用他 比如我要创建新的模块时如何使用?
使用composer安装后 是否还需要进行其他操作?
I installed him, but I didn't know I couldn't use him. For example, how do I use the new module when I create it?
Do you need any additional operations after using the composer installation?
working with laravel 5.2.45
installed via composer require genealabs/laravel-caffeine:~0.3.11
inserted in the config/app file
GeneaLabs\LaravelCaffeine\Providers\LaravelCaffeineService::class,
but laravel throws
Class 'GeneaLabs\LaravelCaffeine\Providers\LaravelCaffeineService' not found
error.
g patrick
hi,
i want to know how to force the caffeine dripper to use a https url instead of a http? is there a way to add a setting FORCE_HTTPS?
kind regards
Andy
This package is focused around always keeping forms alive, a bit of a security problem imo that's why the whole expiry thing is default in Laravel.
It would be nice to have an option where the user is prompted (via a model alert) when the session is about to expire and give them a button to stay active (essentially sending the 'drip'). This is a similar same way the banking industry handle form/session expiration.
The way the alert is shown to the user of course will be subjective and need to be styled per app, but if caffeine made it relatively generic and exposed some options or api of events to easily show a custom alert it would be nice.
LaravelCaffeine.start({
alertText: 'Your session is about to expire.',
btnText: 'Click to Continue'
});
LaravelCaffeine.expiring(function(drip) {
// Show custom model and call 'drip' if button was pressed.
});
Hi,
Not an issue but a suggestion : what about setting by default the drip interval in relation of the session time configured ?
Maybe config("session.lifetime")601000/2 on line 27 in the MiddleWare ?
This is because calling $content->render();
in LaravelCaffeineDripMiddleware.php
on line 28.
I noticed this behaviour because in one of my Views I use Session::pull()
. The data are pulled during the first rendering and of course no longer available when the View is rendered the second time (and delivered to the client).
Any suggestions to avoid this?
Ran into this error after upgrading to Laravel 5.2:
Symfony\Component\Debug\Exception\FatalErrorException thrown with message "Interface 'Illuminate\Contracts\Routing\Middleware' not found"
Stacktrace:
#35 Symfony\Component\Debug\Exception\FatalErrorException in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/genealabs/laravel-caffeine/src/Http/Middleware/LaravelCaffeineDripMiddleware.php:7
#34 Symfony\Component\Debug\Exception\FatalErrorException:__construct in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:133
#33 Illuminate\Foundation\Bootstrap\HandleExceptions:fatalExceptionFromError in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:118
#32 Illuminate\Foundation\Bootstrap\HandleExceptions:handleShutdown in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:0
#31 in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/composer/ClassLoader.php:412
#30 Composer\Autoload\includeFile in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/composer/ClassLoader.php:301
#29 Composer\Autoload\ClassLoader:loadClass in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Container/Container.php:736
#28 spl_autoload_call in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Container/Container.php:736
#27 ReflectionClass:__construct in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Container/Container.php:736
#26 Illuminate\Container\Container:build in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Container/Container.php:631
#25 Illuminate\Container\Container:make in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:674
#24 Illuminate\Foundation\Application:make in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:123
#23 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php:64
#22 Illuminate\Foundation\Http\Middleware\VerifyCsrfToken:handle in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124
#21 call_user_func_array:{/home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124} in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124
#20 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php:49
#19 Illuminate\View\Middleware\ShareErrorsFromSession:handle in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124
#18 call_user_func_array:{/home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124} in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124
#17 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php:62
#16 Illuminate\Session\Middleware\StartSession:handle in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124
#15 call_user_func_array:{/home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124} in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124
#14 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php:37
#13 Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse:handle in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124
#12 call_user_func_array:{/home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124} in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124
#11 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php:59
#10 Illuminate\Cookie\Middleware\EncryptCookies:handle in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124
#9 call_user_func_array:{/home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124} in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124
#8 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php:44
#7 Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode:handle in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124
#6 call_user_func_array:{/home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124} in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124
#5 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103
#4 call_user_func:{/home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103} in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103
#3 Illuminate\Pipeline\Pipeline:then in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:132
#2 Illuminate\Foundation\Http\Kernel:sendRequestThroughRouter in /home/vagrant/PhpstormProjects/fvrs-version-2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:99
#1 Illuminate\Foundation\Http\Kernel:handle in /home/vagrant/PhpstormProjects/fvrs-version-2/public/index.php:54
#0 {main} in /home/vagrant/PhpstormProjects/fvrs-version-2/public/index.php:0
Right after the installation of 5.3, I got "ServiceProvider not found" error.
Class 'GeneaLabs\LaravelCaffeine\LaravelCaffeineServiceProvider' not found
I guess service provider path and file name has been changed to...
GeneaLabs\LaravelCaffeine\Providers\LaravelCaffeineService::class,
right?
But, when I change the path and file name, I get type error.
Type error: Return value of GeneaLabs\LaravelCaffeine\Providers\LaravelCaffeineService::middlewareGroupExists() must be of the type boolean, null returned
The url function inside the generated config file breaks the artisan command.
Laravel Framework version 5.1.31 (LTS)
Stacktrace:
Catchable fatal error: Argument 2 passed to Illuminate\Routing\UrlGenerator::__construct() must be an instance of Illuminate\Http\Request, null given, called in /Users/xxx/Documents/xxx/xxx/xxx/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php on line 62 and defined in /Users/xxx/Documents/xxx/xxx/xxx/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php on line 102
Call Stack:
0.2623 3296608 8. url() /home/vagrant/xxx/xxx/xxx/config/genealabs-laravel-caffeine.php:5
due to default $domain always 'null'
$domain = config('genealabs-laravel-caffeine.domain', url('/'));
and you have to set
"domain" => url('/')
will cause the artisan error like:
[Symfony\Component\Debug\Exception\FatalThrowableError]
Type error: Argument 2 passed to Illuminate\Routing\UrlGenerator::__construct() must be an instance of Illuminate\H
ttp\Request, null given, called in /..../vendor/laravel/framewo
rk/src/Illuminate/Routing/RoutingServiceProvider.php on line 64
do this for fix the error.
return [
'dripIntervalInMilliSeconds' => 300000, // every 5 minutes
'domain' => PHP_SAPI === 'cli' ? null : url('/'), // defaults to url('/')
'route' => 'genealabs/laravel-caffeine/drip', // can be customized
];
Laravel 5.4
Just out of curiosity, why does there need to be a middleware? Can't there just be one JavaScript file you include which will check the HTML on ready for a <meta>
or <input>
tag with token?
I personally don't like having too many intercepting middlewares altering the output etc, would much prefer a tiny bit of vanilla js included in each page checking a few tags.
With the package installed I get the following errors when I run vendor/bin/phpunit
in my Laravel v5.2.20 app:
.PHP Fatal error: Cannot redeclare hasWebMiddleware() (previously declared in /home/vagrant/Code/MyProject/vendor/genealabs/laravel-caffeine/src/Http/routes.php:13) in /home/vagrant/Code/MyProject/vendor/genealabs/laravel-caffeine/src/Http/routes.php on line 28
PHP Stack trace:
PHP 1. {main}() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/phpunit:47
PHP 3. PHPUnit_TextUI_Command->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/Command.php:100
PHP 4. PHPUnit_TextUI_TestRunner->doRun() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/Command.php:149
PHP 5. PHPUnit_Framework_TestSuite->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:440
PHP 6. PHPUnit_Framework_TestSuite->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
PHP 7. PHPUnit_Framework_TestCase->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
PHP 8. PHPUnit_Framework_TestResult->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestCase.php:724
PHP 9. PHPUnit_Framework_TestCase->runBare() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestResult.php:612
PHP 10. Illuminate\Foundation\Testing\TestCase->setUp() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestCase.php:764
PHP 11. Illuminate\Foundation\Testing\TestCase->refreshApplication() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:64
PHP 12. TestCase->createApplication() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:85
PHP 13. Illuminate\Foundation\Console\Kernel->bootstrap() /home/vagrant/Code/MyProject/tests/TestCase.php:23
PHP 14. Illuminate\Foundation\Application->bootstrapWith() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:208
PHP 15. Illuminate\Foundation\Bootstrap\BootProviders->bootstrap() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:203
PHP 16. Illuminate\Foundation\Application->boot() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php:17
PHP 17. array_walk() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:718
PHP 18. Illuminate\Foundation\Application->Illuminate\Foundation\{closure}() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:718
PHP 19. Illuminate\Foundation\Application->bootProvider() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:717
PHP 20. Illuminate\Container\Container->call() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:734
PHP 21. call_user_func_array:{/home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507}() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
PHP 22. GeneaLabs\LaravelCaffeine\LaravelCaffeineServiceProvider->boot() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
PHP Fatal error: Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:752
Stack trace:
#0 /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php(633): Illuminate\Container\Container->build('Illuminate\\Cont...', Array)
#1 /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(674): Illuminate\Container\Container->make('Illuminate\\Cont...', Array)
#2 /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(154): Illuminate\Foundation\Application->make('Illuminate\\Cont...')
#3 /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(79): Illuminate\Foundation\Bootstrap\HandleExceptions->getExceptionHandler()
#4 /home/vagrant/Code/Health in /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 752
PHP Stack trace:
PHP 1. {main}() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/phpunit:47
PHP 3. PHPUnit_TextUI_Command->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/Command.php:100
PHP 4. PHPUnit_TextUI_TestRunner->doRun() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/Command.php:149
PHP 5. PHPUnit_Framework_TestSuite->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:440
PHP 6. PHPUnit_Framework_TestSuite->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
PHP 7. PHPUnit_Framework_TestCase->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
PHP 8. PHPUnit_Framework_TestResult->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestCase.php:724
PHP 9. PHPUnit_Framework_TestCase->runBare() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestResult.php:612
PHP 10. Illuminate\Foundation\Testing\TestCase->setUp() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestCase.php:764
PHP 11. Illuminate\Foundation\Testing\TestCase->refreshApplication() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:64
PHP 12. TestCase->createApplication() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:85
PHP 13. Illuminate\Foundation\Console\Kernel->bootstrap() /home/vagrant/Code/MyProject/tests/TestCase.php:23
PHP 14. Illuminate\Foundation\Application->bootstrapWith() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:208
PHP 15. Illuminate\Foundation\Bootstrap\BootProviders->bootstrap() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:203
PHP 16. Illuminate\Foundation\Application->boot() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php:17
PHP 17. array_walk() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:718
PHP 18. Illuminate\Foundation\Application->Illuminate\Foundation\{closure}() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:718
PHP 19. Illuminate\Foundation\Application->bootProvider() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:717
PHP 20. Illuminate\Container\Container->call() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:734
PHP 21. call_user_func_array:{/home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507}() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
PHP 22. GeneaLabs\LaravelCaffeine\LaravelCaffeineServiceProvider->boot() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
Fatal error: Cannot redeclare hasWebMiddleware() (previously declared in /home/vagrant/Code/MyProject/vendor/genealabs/laravel-caffeine/src/Http/routes.php:13) in /home/vagrant/Code/MyProject/vendor/genealabs/laravel-caffeine/src/Http/routes.php on line 28
Call Stack:
0.0003 353920 1. {main}() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/phpunit:0
0.3202 1423064 2. PHPUnit_TextUI_Command::main() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/phpunit:47
0.3202 1423176 3. PHPUnit_TextUI_Command->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/Command.php:100
2.5127 4533856 4. PHPUnit_TextUI_TestRunner->doRun() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/Command.php:149
2.5826 4638848 5. PHPUnit_Framework_TestSuite->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:440
2.5843 4645296 6. PHPUnit_Framework_TestSuite->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
6.3418 13871320 7. PHPUnit_Framework_TestCase->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
6.3418 13871320 8. PHPUnit_Framework_TestResult->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestCase.php:724
6.3418 13871320 9. PHPUnit_Framework_TestCase->runBare() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestResult.php:612
6.3419 13887848 10. Illuminate\Foundation\Testing\TestCase->setUp() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestCase.php:764
6.3419 13887848 11. Illuminate\Foundation\Testing\TestCase->refreshApplication() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:64
6.3419 13887848 12. TestCase->createApplication() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:85
6.3434 13907600 13. Illuminate\Foundation\Console\Kernel->bootstrap() /home/vagrant/Code/MyProject/tests/TestCase.php:23
6.3434 13907600 14. Illuminate\Foundation\Application->bootstrapWith() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:208
6.5850 14038056 15. Illuminate\Foundation\Bootstrap\BootProviders->bootstrap() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:203
6.5850 14038056 16. Illuminate\Foundation\Application->boot() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php:17
6.5850 14038400 17. array_walk() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:718
6.6323 14114144 18. Illuminate\Foundation\Application->Illuminate\Foundation\{closure}() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:718
6.6323 14114144 19. Illuminate\Foundation\Application->bootProvider() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:717
6.6324 14114520 20. Illuminate\Container\Container->call() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:734
6.6324 14114632 21. call_user_func_array:{/home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507}() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
6.6324 14114696 22. GeneaLabs\LaravelCaffeine\LaravelCaffeineServiceProvider->boot() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
Fatal error: Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 752
Call Stack:
0.0003 353920 1. {main}() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/phpunit:0
0.3202 1423064 2. PHPUnit_TextUI_Command::main() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/phpunit:47
0.3202 1423176 3. PHPUnit_TextUI_Command->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/Command.php:100
2.5127 4533856 4. PHPUnit_TextUI_TestRunner->doRun() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/Command.php:149
2.5826 4638848 5. PHPUnit_Framework_TestSuite->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:440
2.5843 4645296 6. PHPUnit_Framework_TestSuite->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
6.3418 13871320 7. PHPUnit_Framework_TestCase->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
6.3418 13871320 8. PHPUnit_Framework_TestResult->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestCase.php:724
6.3418 13871320 9. PHPUnit_Framework_TestCase->runBare() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestResult.php:612
6.3419 13887848 10. Illuminate\Foundation\Testing\TestCase->setUp() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestCase.php:764
6.3419 13887848 11. Illuminate\Foundation\Testing\TestCase->refreshApplication() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:64
6.3419 13887848 12. TestCase->createApplication() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:85
6.3434 13907600 13. Illuminate\Foundation\Console\Kernel->bootstrap() /home/vagrant/Code/MyProject/tests/TestCase.php:23
6.3434 13907600 14. Illuminate\Foundation\Application->bootstrapWith() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:208
6.5850 14038056 15. Illuminate\Foundation\Bootstrap\BootProviders->bootstrap() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:203
6.5850 14038056 16. Illuminate\Foundation\Application->boot() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php:17
6.5850 14038400 17. array_walk() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:718
6.6323 14114144 18. Illuminate\Foundation\Application->Illuminate\Foundation\{closure}() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:718
6.6323 14114144 19. Illuminate\Foundation\Application->bootProvider() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:717
6.6324 14114520 20. Illuminate\Container\Container->call() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:734
6.6324 14114632 21. call_user_func_array:{/home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507}() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
6.6324 14114696 22. GeneaLabs\LaravelCaffeine\LaravelCaffeineServiceProvider->boot() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 752
Call Stack:
0.0003 353920 1. {main}() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/phpunit:0
0.3202 1423064 2. PHPUnit_TextUI_Command::main() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/phpunit:47
0.3202 1423176 3. PHPUnit_TextUI_Command->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/Command.php:100
2.5127 4533856 4. PHPUnit_TextUI_TestRunner->doRun() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/Command.php:149
2.5826 4638848 5. PHPUnit_Framework_TestSuite->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:440
2.5843 4645296 6. PHPUnit_Framework_TestSuite->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
6.3418 13871320 7. PHPUnit_Framework_TestCase->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
6.3418 13871320 8. PHPUnit_Framework_TestResult->run() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestCase.php:724
6.3418 13871320 9. PHPUnit_Framework_TestCase->runBare() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestResult.php:612
6.3419 13887848 10. Illuminate\Foundation\Testing\TestCase->setUp() /home/vagrant/Code/MyProject/vendor/phpunit/phpunit/src/Framework/TestCase.php:764
6.3419 13887848 11. Illuminate\Foundation\Testing\TestCase->refreshApplication() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:64
6.3419 13887848 12. TestCase->createApplication() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:85
6.3434 13907600 13. Illuminate\Foundation\Console\Kernel->bootstrap() /home/vagrant/Code/MyProject/tests/TestCase.php:23
6.3434 13907600 14. Illuminate\Foundation\Application->bootstrapWith() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:208
6.5850 14038056 15. Illuminate\Foundation\Bootstrap\BootProviders->bootstrap() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:203
6.5850 14038056 16. Illuminate\Foundation\Application->boot() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php:17
6.5850 14038400 17. array_walk() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:718
6.6323 14114144 18. Illuminate\Foundation\Application->Illuminate\Foundation\{closure}() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:718
6.6323 14114144 19. Illuminate\Foundation\Application->bootProvider() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:717
6.6324 14114520 20. Illuminate\Container\Container->call() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:734
6.6324 14114632 21. call_user_func_array:{/home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507}() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
6.6324 14114696 22. GeneaLabs\LaravelCaffeine\LaravelCaffeineServiceProvider->boot() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
6.6470 14155696 23. Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:0
6.6604 14192432 24. Illuminate\Foundation\Bootstrap\HandleExceptions->handleException() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:118
6.6604 14192432 25. Illuminate\Foundation\Bootstrap\HandleExceptions->getExceptionHandler() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:79
6.6604 14192432 26. Illuminate\Foundation\Application->make() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:154
6.6604 14192488 27. Illuminate\Container\Container->make() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:674
6.6604 14192488 28. Illuminate\Container\Container->build() /home/vagrant/Code/MyProject/vendor/laravel/framework/src/Illuminate/Container/Container.php:633§
Laravel doesn't seem to be using any routes in /routes anymore, everything returns error 404 not found after I removed this.
config/app.php has been updated accordingly but nothing seem to fix this.
I get "Class 'GeneaLabs\LaravelCaffeine\Providers\LaravelCaffeineService' not found" if I follow the installation instructions on the front page.
Found an old github issue regarding problems with Laravel 5.2 and changed to GeneaLabs\LaravelCaffeine\LaravelCaffeineServiceProvider::class and I get passed the installation. Which one is the correct one for Laravel 5.3, or will there be any problems?
Laravel Version: 5.3.29
Laravel Caffeine Package Version: 0.3.12
PHP Version: 7.1
After installation and add its Service Provider to my config/app.php
GeneaLabs\LaravelCaffeine\Providers\LaravelCaffeineService::class,
An error displayed:
FatalErrorException in ProviderRepository.php line 146: Class 'GeneaLabs\LaravelCaffeine\Providers\LaravelCaffeineServiceProvider' not found
From @larsbo:
Another problem with the hard-coded route is that it doesn't work for laravel installations in subdirectories because the route starts with a /.
What about adding the configurable route to the 0.2.x branch for laravel 5.1 users?
I am getting this error with the v0.3.2
ErrorException in LaravelCaffeineDripMiddleware.php line 32:
preg_match(): Delimiter must not be alphanumeric or backslash
v0.3.1 works fine
I believe it may be related to #10
I just installed this on Laravel 5.2 and configured it according to the instructions on the main page. I left a page up for a while and it gave me a 404 error when trying to call http://mydomain/genealabs/laravel-caffeine/drip
Visiting the url also gives 404.
Could perhaps adding the url to the routes.php file fix this issue?
Hi,
Upon submiting vendor:publish as proposed, in the manual, I get a composer error code 255, on fresh new install on Laravel 5.2.
Generating autoload files
Illuminate\Foundation\ComposerScripts::postInstall
php artisan optimize
Script php artisan optimize handling the post-install-cmd event returned with error code 255.
Please advice,
genealabs/laravel-caffeine 0.4.2 requires illuminate/support 5.1.* || 5.3.* || 5.4.* -> satisfiable by laravel/framework[v5.4.36], illuminate/support[v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.41, v5.1.6, v5.1.8, v5.3.0, v5.3.16, v5.3.23, v5.3.4, v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.36, v5.4.9].
I just installed Caffeine on Laravel 5.2.
How can I verify if I did everything correctly and it's working?
Cheers!
Hi,
does this package also work for ajax request? its currently not working for me. i know it says it works for any page has _token
, is ajax request included?
i did as laravel doc suggests:
<meta name="csrf-token" content="{{ csrf_token() }}">
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
update: i checked LaravelCafineDripMiddleware.php
, and outputed $content
. it turns out that the response content from my server is array
instead of string
since its not returning a view file. also it seems that the middleware is called twice. the first one returns content
as string
, the second one returns array
.
Javascript code here is very small, so it's a shame that we need whole additional http-request to get it.
In terms of client performance it would be better to inline this script, but I don't know how it will affect server-side performance. I have a feeling that it would add less than a millisecond or so, but can't figure out a way to test this assumption reliably.
Another approach would be just add async
attribute to a script tag, so it won't affect page loading.
I've got a form at the following URL:
http://localhost/myproject/public/report/tokenstring
If I leave the page open for the javascript to fire I get the following in my console:
GET http://localhost/genealabs/laravel-caffeine/drip 404 (Not Found)
Am I doing something wrong? If not, is there anyway to modify the URL? Or, could you possibly make the route named:
Route::get('genealabs/laravel-caffeine/drip', [
'as' => 'genealabs.laravel-caffeine.drip',
'uses' => LaravelCaffeineController::class . '@drip']
);
and reference the named route in the middleware file:
$content = str_replace('</body>',
"<script>setInterval(function(){var e=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject('Microsoft.XMLHTTP');e.open('GET','"
. route('genealabs.laravel-caffeine.drip')
. "',!0),e.send()},"
. config('genealabs-laravel-caffeine.dripIntervalInMilliSeconds', 300000)
. ");</script></body>", $content);
Any ideas? Thank you.
Hi
When I leave a form open for a while, I still get a TokenMismatchException
.
I'm using Laravel 5.2.
For testing I've set the session lifetime in config/session.php
to 3 minutes and the drip interval to 1 min (60000ms). The drip route is being called every minute as it should (no errors in the Chrome network tab).
After the first drip I can still send the form, but after 3 drips or minutes I get the Token exception.
TokenMismatchException in VerifyCsrfToken.php line 67:
Seems the session isn't actually being refreshed?
Greetings,
I am implementing CSP (content security policy) within my project and realized the policy is blocking the caffeine script from running. I could add 'unsafe-eval' but wouldn't this open up the possibility of XSS attacks (ref: http://stackoverflow.com/questions/8502307/chrome-18-how-to-allow-inline-scripting-with-a-content-security-policy)? I've attached 3 images (1st is the CSP, 2nd is the error message, 3rd is the script inline). What I have done with my other scripts is put them in a separate .js file and include them in the header.
One idea might be to move the script into a .js file then add a script src = "caffeine.js" on the pages needing this? Thoughts?
One problem I ran into is that my app has many forms throughout which has the effect of preserving a session indefinitely. I would like to be able to, in the configuration, specify pages in which drip can be applied to. I will likely do a pull request for this in the next few weeks. Cheers!
I am trying to install the Groove Widget code into my project but part of the code for laravel-caffeine seems to be injected into the Groove widget code. It looks like the Groove widget creates an iFrame with a body tag and I am not sure if l-c is detecting this additional body tag and injecting code into it, breaking the widget.
Here is sample code for the GrooveHQ Widget as it is in my project
<!-- BEGIN GROOVE WIDGET CODE -->
<script id="grv-widget">
/*<![CDATA[*/
window.groove = window.groove || {}; groove.widget = function(){ groove._widgetQueue.push(Array.prototype.slice.call(arguments)); }; groove._widgetQueue = [];
groove.widget('setWidgetId', 'xxxxxxxxxxxxxx');
!function(g,r,v){var a,c,n=r.createElement("iframe");(n.frameElement||n).style.cssText="width: 0; height: 0; border: 0",n.title="",n.role="presentation",n.src="javascript:false",r.body.appendChild(n);try{a=n.contentWindow.document}catch(b){c=r.domain;var d="javascript:document.write('<head><script>document.domain=\""+c+"\";</",i="script></head><body></body>')";n.src=d+i,a=n.contentWindow.document}var s="https:"==r.location.protocol?"https://":"http://",p="http://groove-widget-production.s3.amazonaws.com".replace("http://",s);n.className="grv-widget-tag",a.open()._l=function(){c&&(this.domain=c);var t=this.createElement("script");t.type="text/javascript",t.charset="utf-8",t.async=!0,t.src=p+"/loader.js",this.body.appendChild(t)},a.write('<body onload="document._l();">'),a.close()}(window,document);
/*]]>*/
</script>
<!-- END GROOVE WIDGET CODE -->
Here is how it renders after laravel-caffeine injects itself into the widget code
<script id="grv-widget">
/*<![CDATA[*/
window.groove = window.groove || {}; groove.widget = function(){ groove._widgetQueue.push(Array.prototype.slice.call(arguments)); }; groove._widgetQueue = [];
groove.widget('setWidgetId', 'xxxxxxxxxxxxxx');
!function(g,r,v){var a,c,n=r.createElement("iframe");(n.frameElement||n).style.cssText="width: 0; height: 0; border: 0",n.title="",n.role="presentation",n.src="javascript:false",r.body.appendChild(n);try{a=n.contentWindow.document}catch(b){c=r.domain;var d="javascript:document.write('<head><script>document.domain=\""+c+"\";</",i="script></head><body><script>setInterval(function(){var e=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject('Microsoft.XMLHTTP');e.open('GET','http://v3.dev/genealabs/laravel-caffeine/drip',!0);e.setRequestHeader('X-Requested-With','XMLHttpRequest');e.send();}, 300000);</script>
')";n.src=d+i,a=n.contentWindow.document}var s="https:"==r.location.protocol?"https://":"http://",p="http://groove-widget-production.s3.amazonaws.com".replace("http://",s);n.className="grv-widget-tag",a.open()._l=function(){c&&(this.domain=c);var t=this.createElement("script");t.type="text/javascript",t.charset="utf-8",t.async=!0,t.src=p+"/loader.js",this.body.appendChild(t)},a.write(''),a.close()}(window,document);
/*]]>*/
<!-- END GROOVE WIDGET CODE -->
I was wondering if there are any solutions or workarounds to get them playing well together.
Laravel 5.3 changed its logout route to be a post, and uses a form in the menu to do so. This has the unintended consequence of keeping the session alive indefinitely, something we don't want.
I would like to explore options to not keep the session alive, yet remain user-friendly. Not sure how feasable this is:
Hello,
I installed Caffeine 0.4.1 on Laravel 5.3: to test, I setup session.lifetime = 1 (minute) and dripIntervalInMilliSeconds = 30000 (30 seconds); so, after one or more minute, I should be able to work on my form 'cause of Caffeine
Instead, I get a TokenMismatchException
Giving some try, I changed Caffeine route parameter to a known one (i.e. '/') and wow, I don't get the TokenMismatchException
anymore
Reverting to default Caffeine route and looking at my route list (php artisan route:list
) I see the genealabs/laravel-caffeine/drip
one, but It's not under the web
middleware: I suspect that this is the problem, am I right? Any fix, please?
Thanks
Hi Mike,
There appears to be an issue when I set a meta tag with the content of {{ csrf_token() }}
. I get the usual error of:
Symfony \ Component \ HttpKernel \ Exception \ BadRequestHttpException
CSRF token validation failed.
My meta tag is:
<meta name="csrf-token" content="{{ csrf_token() }}">
and I register the meta tag in my javascript:
Vue.http.headers.common['X-CSRF-TOKEN'] = $("meta[name='csrf-token']").attr('content');
Needless to say, it absolutely works fine until the token times out.
The domain => url('/') setting is breaking Laravel 5.2 artisan command.
The website works, but the artisan command crashes with a routing error.
PHP Catchable fatal error: Argument 2 passed to Illuminate\Routing\UrlGenerator::__construct() must be an instance of Illuminate\Http\Request, null given, called in /home/vagrant/Code/salunet/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php on line 62 and defined in /home/vagrant/Code/salunet/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php on line 103
Experiencing this issue after the latest updated. Laravel 5.2:
exception 'ErrorException' with message 'in_array() expects parameter 2 to be array, string given'
in /home/vagrant/fvrs-v2/vendor/genealabs/laravel-caffeine/src/Http/routes.php:18
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'in_array() expe...', '/home/vagrant/f...', 18, Array)
#1 /home/vagrant/fvrs-v2/vendor/genealabs/laravel-caffeine/src/Http/routes.php(18): in_array('web', 'web')
#2 /home/vagrant/fvrs-v2/vendor/genealabs/laravel-caffeine/src/Http/routes.php(5): hasWebMiddleware()
#3 /home/vagrant/fvrs-v2/vendor/genealabs/laravel-caffeine/src/LaravelCaffeineServiceProvider.php(12): require('/home/vagrant/f...')
#4 [internal function]: GeneaLabs\LaravelCaffeine\LaravelCaffeineServiceProvider->boot()
#5 /home/vagrant/fvrs-v2/vendor/laravel/framework/src/Illuminate/Container/Container.php(507): call_user_func_array(Array, Array)
#6 /home/vagrant/fvrs-v2/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(734): Illuminate\Container\Container->call(Array)
#7 /home/vagrant/fvrs-v2/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(717): Illuminate\Foundation\Application->bootProvider(Object(GeneaLabs\LaravelCaffeine\LaravelCaffeineServiceProvider))
#8 [internal function]: Illuminate\Foundation\Application->Illuminate\Foundation\{closure}(Object(GeneaLabs\LaravelCaffeine\LaravelCaffeineServiceProvider), 20)
#9 /home/vagrant/fvrs-v2/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(718): array_walk(Array, Object(Closure))
#10 /home/vagrant/fvrs-v2/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\Foundation\Application->boot()
#11 /home/vagrant/fvrs-v2/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(203): Illuminate\Foundation\Bootstrap\BootProviders->bootstrap(Object(Illuminate\Foundation\Application))
#12 /home/vagrant/fvrs-v2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(232): Illuminate\Foundation\Application->bootstrapWith(Array)
#13 /home/vagrant/fvrs-v2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(127): Illuminate\Foundation\Http\Kernel->bootstrap()
#14 /home/vagrant/fvrs-v2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(99): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#15 /home/vagrant/fvrs-v2/public/index.php(54): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#16 {main}
Hi Mike,
Firstly I'm a big fan of the package and many thanks for your work
I just wanted to test some logic with regards to exposing the CSRF token on an unsecured endpoint. I'm using VueJS alongside Laravel to create an application and I like to use Laravel to generate a token in the <script>
section of my <head>
tags. This is of course subjected to token mismatch exceptions when the CSRF times out. I'm ideally trying to find a solution whereby I can keep those tokens refreshed and the most simplest would be to hit a route which serves up the CSRF token.
My question though, is do you believe there are any security issues with having a route which just serves CSRF tokens?
The error isn't gone yet. I replaced the url('') as you requested and this is what happened: The network tab from chrome returned a 404 error from the drip, instead of the usual 204. The replacement fixed the artisan problem, but now it can't find the drip route. Also, the original issue had not been solved, as the TokenMismatchException continues to be thrown.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.