Giter VIP home page Giter VIP logo

Comments (3)

GeopJr avatar GeopJr commented on July 19, 2024

It's the links (as you mentioned), on mastodon every link counts as a static length (on .social it's 23). Not sure what's the best way to do it, running a regex against the content on keypress?

edit:
will have to see if it's worth it performance-wise to check if the content has / or/and . before running the regex

from tuba.

GeopJr avatar GeopJr commented on July 19, 2024

Hmm, this is messier than expected... Mastodon apparently also ignores the domain part of the mentions [at]mastodon[at]mastodon.social counts as [at]mastodon. Needs more investigation on other backends

MENTION REGEX:
https://github.com/mastodon/mastodon/blob/774e1189d26fffd914107a4236f6287043c988f8/app/services/account_search_service.rb#L6

URL REGEX:
https://github.com/mastodon/mastodon/blob/774e1189d26fffd914107a4236f6287043c988f8/app/services/fetch_link_card_service.rb#L7-L15

from tuba.

GeopJr avatar GeopJr commented on July 19, 2024

on further research, every client just does its own thing at this point...

Mastodon has a very specialized regex that's provided from an npm package that was maintained by twitter. That regex includes every valid TLD. https://google.com will match but https://google.foobar won't. Mastodon will count it as the defined amount of characters even if it has less (https://a.com/ will be counted as 23 even if it has less chars)

elk mistook (?) another regex for the url one so it counts any string that starts with https or xmpp (<- mastodon doesnt shorten xmpp uris). It also only sets the value to the defined one (23) if it's longer than that (https://a.com will count as 13)

I don't think we can have such a specialized regex as mastodon's but at least one close to it

from tuba.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.