Closed jamietanna closed 3 years ago
I think you're right: it's a consequence of the server properties being too large to store in the cookie. It was fine to use a cookie for storing a few strings/IDs, but not for a large JSON blob.
We could switch to using Redis or another datastore, but I'd like to avoid adding a dependency if possible.
If the config is fetched from the Micropub server each time the form is rendered that would add time to each request but would at least mean we keep below the 4K limit. That may be the best option right now. Any other ideas?
That makes sense - I guess before we go that route, does the redirect
need to be in the session, or can it be in the /redirect
querystring?
I'm not sure why I passed the post URL in the session, perhaps to avoid abuse, but as long as you're logged in it should be fine to use the querystring.
Re: using Redis to cache data, I've been thinking, there's no reason why it couldn't be optional, i.e. if there's no Redis server configured, then fetch from the server's endpoint on each request. You should be safe with 512Mb to store your server properties :wink:
Fixed in #65
I've noticed that recently, when publishing posts to my staging server (and I think sometimes my Production server, too) I don't get the handy redirect functionality I love in Micropublish.
I'd thought it was due to the way that I'd made my Micropub endpoint perform content-negotiation, and return an HTML representation if HTML was
accept
able, but it looks like it's due to session limits, as running locally, I see:When dumping the session before it adds the URL, I see the below object, which is ~5200 bytes already:
Sanitised session dump
```json { "session_id": "................................................................", "state": "ICQ1Ogbhr7BzjiNDdGZn", "scope": "create update delete undelete", "me": "https://www.staging.jvt.me/", "code_verifier": "....................................................................................................", "micropub": "https://www-api.staging.jvt.me/micropub", "authorization_endpoint": "https://indieauth.jvt.me/authorize", "token_endpoint": "https://indieauth.jvt.me/token", "token": "........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................", "flash": { "type": "success", "message": "You are now signed in successfully\n as \"https://www.staging.jvt.me/\".\n Submit content to your site via Micropub using the links\n below. Please\n read the docs for\n more information and help." }, "config": { "syndicate-to": [ { "uid": "https://brid.gy/publish/github", "name": "Brid.gy GitHub Syndication" }, { "uid": "https://news.indieweb.org/en", "name": "IndieNews" }, { "uid": "https://indieweb.xyz/en/blogging", "name": "/en/Blogging" }, { "uid": "https://indieweb.xyz/en/indieweb", "name": "/en/IndieWeb" }, { "uid": "https://indieweb.xyz/en/tools", "name": "/en/Tools" }, { "uid": "https://indieweb.xyz/en/microformats", "name": "/en/Microformats" }, { "uid": "https://brid.gy/publish/twitter", "name": "Brid.gy Twitter Syndication" }, { "uid": "https://brid.gy/publish/meetup", "name": "Brid.gy Meetup Syndication" } ], "media-endpoint": "https://www-api.staging.jvt.me/micropub/media", "q": [ "post-types", "contact", "syndicate-to", "source", "category", "config", "properties" ], "post-types": [ { "type": "bookmark", "name": "Bookmark", "h": "entry", "properties": [ "bookmark-of", "name", "published", "category", "content", "syndication" ], "required-properties": [ "bookmark-of", "name", "published" ] }, { "type": "like", "name": "Like", "h": "entry", "properties": [ "like-of", "published", "category", "content", "name", "syndication" ], "required-properties": [ "like-of", "published" ] }, { "type": "reply", "name": "Reply", "h": "entry", "properties": [ "content", "in-reply-to", "published", "category", "name", "photo", "syndication", "mp-photo-alt" ], "required-properties": [ "content", "in-reply-to", "published" ] }, { "type": "reads", "name": "Reading", "h": "entry", "properties": [ "published", "read-of", "read-status" ], "required-properties": [ "published", "read-of", "read-status" ] }, { "type": "repost", "name": "Repost", "h": "entry", "properties": [ "published", "repost-of", "content", "category", "syndication" ], "required-properties": [ "published", "repost-of" ] }, { "type": "rsvp", "name": "RSVP", "h": "entry", "properties": [ "in-reply-to", "published", "rsvp", "category", "content", "syndication" ], "required-properties": [ "in-reply-to", "published", "rsvp" ] }, { "type": "note", "name": "Note", "h": "entry", "properties": [ "content", "published", "category", "syndication" ], "required-properties": [ "content", "published" ] }, { "type": "photo", "name": "Photo", "h": "entry", "properties": [ "photo", "published", "mp-photo-alt", "category", "content", "syndication" ], "required-properties": [ "photo", "published", "mp-photo-alt" ] }, { "type": "step", "name": "Step Counts", "h": "measure", "properties": [ "unit", "num", "published", "start", "end" ], "required-properties": [ "unit", "num", "published", "start", "end" ] }, { "type": "event", "name": "Event", "h": "event", "properties": [ "end", "name", "published", "start", "content", "url" ], "required-properties": [ "end", "name", "published", "start" ] }, { "type": "contact", "name": "Contact", "h": "card", "properties": [ "name", "nickname", "url", "rel=twitter" ], "required-properties": [ "name", "nickname", "url" ] } ] }, "post_types": { "bookmark": { "name": "Bookmark", "icon": "bookmark", "properties": [ "bookmark-of", "name", "published", "category", "content", "syndication" ], "required": [ "bookmark-of", "name", "published" ] }, "like": { "name": "Like", "icon": "heart", "properties": [ "like-of", "published", "category", "content", "name", "syndication" ], "required": [ "like-of", "published" ] }, "reply": { "name": "Reply", "icon": "reply", "properties": [ "content", "in-reply-to", "published", "category", "name", "photo", "syndication", "mp-photo-alt" ], "required": [ "content", "in-reply-to", "published" ] }, "repost": { "name": "Repost", "icon": "retweet", "properties": [ "published", "repost-of", "content", "category", "syndication" ], "required": [ "published", "repost-of" ] }, "rsvp": { "name": "RSVP", "icon": "calendar-check-o", "properties": [ "in-reply-to", "published", "rsvp", "category", "content", "syndication" ], "required": [ "in-reply-to", "published", "rsvp" ] }, "note": { "name": "Note", "icon": "comment", "properties": [ "content", "published", "category", "syndication" ], "required": [ "content", "published" ] } } } ```Sample staging post URL
``` https://www.staging.jvt.me/post#ewogICJkYXRlIiA6ICIyMDIxLTAyLTEwVDEyOjU1OjE3WiIsCiAgImRlbGV0ZWQiIDogZmFsc2UsCiAgImgiIDogImgtZW50cnkiLAogICJwcm9wZXJ0aWVzIiA6IHsKICAgICJzeW5kaWNhdGlvbiIgOiBbICJodHRwczovL2JyaWQuZ3kvcHVibGlzaC90d2l0dGVyIiBdLAogICAgInB1Ymxpc2hlZCIgOiBbICIyMDIxLTAyLTEwVDEyOjU1OjE3WiIgXSwKICAgICJjb250ZW50IiA6IFsgewogICAgICAiaHRtbCIgOiAiIiwKICAgICAgInZhbHVlIiA6ICJmc2QiCiAgICB9IF0KICB9LAogICJraW5kIiA6ICJub3RlcyIsCiAgInNsdWciIDogIjIwMjEvMDIvZ3F5eGkiLAogICJjbGllbnRfaWQiIDogImh0dHA6Ly9sb2NhbGhvc3Q6OTI5MiIKfQ== ```Thought it'd be interesting to share, and definitely an artefact of the verbosity of the proposed Micropub server properties syntax, and may only affect me, in which case I'm happy leaving it as-is, or whether we look at the url being passed into the querystring (if that also doesn't hit limits)