Losing all content when panel login times out

panel

#1

I have now lost the contents of a new article/post twice when trying to save:

1 - Type content in the panel, wait a bit
2 - Hit the save button
3 - Login has timed out, so login window pops up
4 - I log back in
5 - I am taken back to the panel, but I am now no longer in the text editor
6 - Re-open the page or post in question
7 - No content is there, or the edits are all missing.

I am a bit surprised that there is no auto-save function. That would seem to be the standard for most editor interfaces this century.

So how can I prevent this from happening again?


#2

Have you changed any blueprints during editing or added language support after creating the content? This can confuse the panel because you end up with two content files with the same name site.txt and site.en.txt.

My usual fix for content that wont save properly is to open the page in the Kirby panel, then open the markdown file in a text editor like sublime or atom. Remove all content from the markdown file by select all then press delete. Then press save in the Kirby panel - you should see your content reappear properly formatted in the markdown file in the code editor.

Sometimes during the development of a site you can end up with duplicate keys in content files or old content.

Have you got debugging turned on? is it throwing an error while saving?


#3

There is already an issue on GitHub: https://github.com/getkirby/panel/issues/1045

Unfortunately, this will require some bigger changes and is scheduled for Kirby 3. In the meantime, I’m afraid, better save one time too often.

Edit: You can also try to prolong the session time: https://getkirby.com/docs/cheatsheet/options/panel-session-timeout


#4

Kirby responds to keyboard commands like CMD+S … If your on a mac you can probably use apple script / automator to press cmd+s every two minutes if the Kirby edit page is open in browser. Little hacky, but will do until Kirby 3.


#5

Haven’t been on a Mac in years :slight_smile:

I do know about the keyboard save (Ctrl+s in Windows) but two minutes default session time is way too short, imho. I’ve now set it to 10000. My fear is that waiting too long means I have to select all/copy every time before I hit save, just to be sure. Very kludgy.

Maybe there is an auto-keystroke utility for Windows out there. I’ll look into that. Thanks for the idea!


#6

No worries. At least that way you will just loose a little bit at worst rather than the whole darn thing.


#7

Alternatively, you know you don’t have to use the panel, right? Its just Markdown. I use write.app on a Mac for long articles. Caret will probably serve you well. I work on local server on my machine then push to live so this may work for you. Not so much if you do all your work on live domain, although write.app can connect to a remote location via FTP and work off that.


#8

This is all on my Raspberry Pi at home. My laptop and work computers are Windows, and I connect remotely, so the panel is just easier. Some day I’ll probably try to configure a more text-based workflow, but not yet…


#9

Two hours is the default, the unit for the timeout option is minutes already.

But as @texnixe wrote above, we will definitely improve this with Kirby 3 by having a more robust auto save.


#10

I wasn’t running a timer, but I could swear it was asking me for another login long before two hours. Then again, my home internet may have dropped for a couple of minutes. Hard to say…


#11

Are you sure? Ive had it log me out way before two hours is up. Was more like 30 - 60 minutes of inactivity. Sometimes i wonder off and watch TV for that long and leave it logged in and bumps me out when I come back.


#12

I sometimes have a feeling that the Panel session has its own will and doesn’t care about these settings at all. Very often, I find myself still being logged in the next day, sometimes I’m logged out after a relative short time (talking about localhost and standard settings).


#13

Well, it’s not only the Panel that controls this. Maybe the browser deleted the session cookie because of inactivity? Or maybe your IP address changed (which invalidates the session for security reasons)? Or maybe the server cleaned up PHP’s session files?

There are way too many variables in session handling, which is why we’re probably going to use a different strategy as the new Panel will be based on a stateless API anyway.


#14

Yes, I’m well aware of that. I am more surprised the other way round. Shouldn’t the Panel log me out after two hours, or what is it that keeps the session active for ages (standard Starterkit, no changes whatsoever)?


#15

The timeout is implemented in the Toolkit. It logs you out if the time defined by the timeout value has passed since the last “activity”. And activity means loading any page that accesses the Kirby session. I have just verified this by reading through the code, but there may well be a bug somewhere in there.


#16

If it helps at all I use Opera 46 as my main browser. It’s definitely never as much as two hours before i get logged out.