-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ATProto: when post or profile bio text is truncated, store full text in custom field in record #1092
Comments
Bryan also suggested that it could make sense to also store the URL of the original post as another field (regardless of the (optional) embed). |
From #986:
|
The other prior art from Bridgy Fed itself is the "uri": "at://did:plc:bg5udl25mvzg3rt7l5n2hzet/app.bsky.actor.profile/self",
"cid": "bafyreicyi7lbvpu7zvrif4si63c32c5gc5jmizcz7kwnylsmsdvvwgsr6y",
"value": {
"$type": "app.bsky.actor.profile",
"avatar": {
"$type": "blob",
"ref": {
"$link": "bafkreibs7fzsi2ejadqnptikhkv5klrprdnjpikp5rropgeoj2kgssavea"
},
"mimeType": "image/png",
"size": 170358
},
"description": "Follow me on the fediverse at [@snarfed.org](https://fed.brid.gy/r/https://snarfed.org/)! This account is just for DMs, testing, etc. 😎\n\n[bridged from https://indieweb.social/@snarfed on the fediverse by https://fed.brid.gy/ ]",
"displayName": "Ryan Barrett",
"labels": {
"$type": "com.atproto.label.defs#selfLabels",
"values": [
{
"val": "bridged-from-bridgy-fed-activitypub"
}
]
}
}
} |
Another useful point here: there's a ton of prior art in the standards community on this kind of vendor prefixing. Notably, my understanding is that they generally now discourage it and believe it did more harm than good in ecosystems like CSS, HTTP headers, even C++, etc where it was adopted to some degree. Haven't found a great description of this arc and history, but https://css-tricks.com/is-vendor-prefixing-dead/ and https://alistapart.com/article/the-vendor-prefix-predicament-alas-eric-meyer-interviews-tantek-celik/ are maybe decent starting points. cc @tantek et al. TLDR: vendor prefixes last forever, confuse developers, cause bugs, rot over time, split and hurt compatibility/interop, and lead to tools like autoprefixer that exacerbate all of those issues. Maybe we should follow that advice here, instead of re-learning those lessons hard way? Specifically, maybe we name generic fields like this generically, eg |
@mackuba interesting note here: the original text from the fediverse for posts and and profile bios is often HTML, not plain text. Does that change anything about how you'd want to consume it in Skythread? I convert to plain text, so I could store that in the custom field instead, but I'm inclined to store the original HTML instead. |
Hmm, I think it would make sense to keep the original version, i.e. with HTML. Since it's possible to make plain text from HTML but not always the other way around ;) Right now I'm showing the full text by loading it from the Mastodon API, and I'm also getting HTML there, so I had to add an HTML sanitization library for this. |
Re: vendor prefixes - I don't think this is a good comparison… because in browsers they were replaced by unprefixed properties, but crucially, ones that are only accessible if an opt-in flag is enabled in the settings (until the property is standardized). So there's no risk of naming collision between browser API and websites JS, except on the developer machines of people who know what they're doing; and no risk of collisions between experimental properties and standard ones, because it's the same browser vendor that's adding both. Here, the problem we have is potential collisions between records created/read by different 3rd party apps, and between 3rd parties and Bluesky. And fields in a record aren't hidden behind a feature flag, they just either are there or aren't there; so this is a different situation. Also, experimental JS properties almost always are the first step with the goal of eventually becoming a normal standardized property shared by everyone, and here it's not clear at all if such property would make sense to everyone or not. |
Just thinking about this a bit more… Unlike properties in JS code, fields in records stay there forever, you can't edit old records. So if we add a field e.g. |
I'm a little hesitant to weigh in because this is an area it is kind of nice to have other folks experiment with towards consensus. But! Here are my current thoughts:
|
@bnewbold A slight offtopic while we're talking about record fields :) has there been any thinking about a "client/app" field that tells what app made the record and could be shown on the site below posts, like the classic "Twitter for iPhone" on Twitter? I've seen that some apps add a "via" field, but in this case it would have to be standardized to be any useful, and like you've said, this is a very obvious/generic field name. |
Thanks all, good conversation! @bnewbold, definitely understood that you all probably recommend vendor prefixing! I don't know that the authority part is actually that different; standardized namespaces like CSS properties and HTTP headers have an authority too, the standards body. But you're right that lexicon owners will usually be more unilateral in how they evolve their lexicons, vs standards bodies that often try to pave cowpaths. @mackuba re |
Well, in this case it's like the one specific case where prefixing definitely doesn't make sense, because the value would be duplicating the key :) |
For redundancy, true. But the goal of vendor prefixing isn't efficiency, it's future-proofing and avoiding possible conflict with the lexicon owner, in case they ever add an official version of the field themselves with a different type, or name, or different limits, or anything else incompatible. |
…riginalUrl fields for snarfed/bridgy-fed#1092
…ields_prefix kwarg for snarfed/bridgy-fed#1092
OK! I went with Profileat://did:plc:bg5udl25mvzg3rt7l5n2hzet/app.bsky.actor.profile/self {
"$type": "app.bsky.actor.profile",
"displayName": "Ryan Barrett",
"description": "Follow me on the fediverse at @snarfed.org! This account is just for DMs, testing, etc. 😎\n\n[bridged from https://indieweb.social/@snarfed on the fediverse by https://fed.brid.gy/ ]",
"bridgyOriginalDescription": "<p>Follow me on the fediverse at <span class=\"h-card\" translate=\"no\"><a href=\"https://fed.brid.gy/r/https://snarfed.org/about\" class=\"u-url mention\">@<span>snarfed.org</span></a></span>! This account is just for DMs, testing, etc. 😎</p>",
"bridgyOriginalUrl": "https://indieweb.social/@snarfed",
"..."
} Postat://did:plc:bg5udl25mvzg3rt7l5n2hzet/app.bsky.feed.post/3kur6sp777oe2 {
"$type" : "app.bsky.feed.post",
"text" : "here's an original post with\nsome\nwhitespace\n\n#ok",
"createdAt" : "2024-06-12T22:40:00.000Z",
"bridgyOriginalText" : "<p>here's an original post with<br /> some<br /> whitespace</p><p><a href=\"https://indieweb.social/tags/ok\" class=\"mention hashtag\" rel=\"tag\">#<span>ok</span></a></p>",
"bridgyOriginalUrl" : "https://indieweb.social/@snarfed/112606052401093326",
"..."
} |
Awesome! Sounds good to me 👍 |
Thanks for avoiding a potential collision issue: |
...or maybe always do this, regardless of whether it's truncated?
This would help with eg #986 (comment)
The text was updated successfully, but these errors were encountered: