TheFive / osmbc

Open Street Map Blog Collector
MIT License
28 stars 11 forks source link

Better titles for collected toots #981

Closed call-me-matt closed 1 year ago

call-me-matt commented 1 year ago

If a toot is added as article, the pre-filled title is always the same and does not use the actual title from the linked page.

AS-IS: the title is always: En OSM Town | Mapstodon for OpenStreetMap

TO-BE Take the actual title of the linked page, in the example: eeklyOSM: "👉 https://www.weeklyosm.eu/archives/16390 👈 Issu…" - En OSM Town | Mapstodon for OpenStreetMap

How to reproduce: got to https://en.osm.town, chose any post and add it to OSMBC, for example: https://en.osm.town/@weeklyOSM/110089639818050574

On the linked page, there is also a "domain title" in a script body, maybe a regex gets confused by that?

<script id="initial-state" type="application/json">{"meta":{"streaming_api_base_url":"wss://en.osm.town","access_token":"nRr-GUJEDRFPxWaktrHaCikM9Yw5qlZoGvWX6mUzWjA","locale":"en","domain":"en.osm.town","title":"En OSM Town | Mapstodon for OpenStreetMap","admin":"10939...

Examples: https://osmbc.openstreetmap.de/article/28351 https://osmbc.openstreetmap.de/article/28204 https://osmbc.openstreetmap.de/article/28014

call-me-matt commented 1 year ago

maybe a bug in cheerio lib, as the function seems to be correctly used?

call-me-matt commented 1 year ago

I tried the code outside of OSMBC and it works just fine.

Problem seems to be, that ssrf transforms the URL from https://en.osm.town/@weeklyOSM/110089639818050574 to https://en.osm.town/.

TheFive commented 1 year ago

looks that ssrf reacts on "@"

image

https://www.npmjs.com/package/ssrf

i would suggest that we build a dedicated mastondon converter, wich ignores url check (and replaces is by a check against mastonon standard format, which can be handled by a regex). this may be needs, that the original url is forewarded to the converter (may be by forewarding two urls or using ssrf in the converter).

The more interesting question is, what is a good title for a titleless toot ?

TheFive commented 1 year ago

Simple suggestion Toot By @XXX from dd.mm.yyyy

(titles are only suggested and can be changed by editor, if it is helpful for the process)

Strubbl commented 1 year ago

Simple suggestion Toot By @xxx from dd.mm.yyyy

This. Or one can take the first 100 chars (if they are no URL) and add …

TheFive commented 1 year ago

currently i have just fixed the ssrf rejection of mastodon urls, so the standard mastodon title is now taken.

i would like to have a similar tweet (ä) toot -> collection process as in twitter. but as toots can be very long, the toots have to be truncated.