Giter Club home page Giter Club logo

bskyrb's Introduction

Hi there ๐Ÿ‘‹

I'm mostly working in Ruby and Elixir these days

You can also find me at Codeberg as shreyan

Ruby library for BlueSky and AT Protocol:

ShreyanJain9/bskyrb

Metrics

bskyrb's People

Contributors

bungoman avatar shreyanjain9 avatar thearchduke avatar tmtm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bskyrb's Issues

Mentions in posts

Just leaving this up here. I'll probably try to figure this out tomorrow.

Links don't seem to be clickable

I've been trying to write an autoposter that just posts "#{title} - #{link}" style posts from a blog, and I absolutely cannot get clickable links to be posted.

As far as I can tell, the link_pattern in the detect_facets method isn't working. I did some tests in local code with a much simpler regex pattern and your function, and this seems to be getting the right response. Unfortunately, I can't for the life of me figure out how to get this code into a local copy of the library that my autoposter will actually work with, because I am apparently hopelessly confused by Ruby's dependency management or how to build this specific gem or something. (I used your provided install-local.sh script with my change to the gem, but no matter what I do I get a uninitialized constant Bskyrb::Credentials (NameError) unless I load from the published Gem, which works flawlessly, except that the facets aren't being processed correctly and the links aren't clickable.)

This is the simple dumb pattern I used and the test. It basically just assumes anything that starts with https:// or http:// is a URL up until the next whitespace character. The only change to the enum_for.each loop is in the URI.parse, where I removed the trailing / (if one exists it will be grabbed by the regex).

text = 'New post: "Foobar" https://mywebsite.net/foo-bar/ and also https://other.com/thing and so on'
link_pattern = /(https?):\/\/(\S+)/

facets = []

text.enum_for(:scan, link_pattern).each do |m|
  index_start = Regexp.last_match.offset(0).first
  index_end = Regexp.last_match.offset(0).last
  m.compact!
  path = "#{m[1]}#{m[2..].join("")}".strip
  facets.push(
    "$type" => "app.bsky.richtext.facet",
    "index" => {
      "byteStart" => index_start,
      "byteEnd" => index_end,
    },
    "features" => [
      {
        "uri" => URI.parse("#{m[0]}://#{path}").normalize.to_s, # this is the matched link
        "$type" => "app.bsky.richtext.facet#link",
      },
    ],
  )
end

puts facets.inspect

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.