spark icon indicating copy to clipboard operation
spark copied to clipboard

feat: Add support for gists

Open qoomon opened this issue 1 year ago • 33 comments
trafficstars

This time I've tested everything is working :-) (shame on me for #6)

This PR will add support for gist stargazers e.g. https://stars.medv.io/qoomon/gist:5dfcdf8eec66a051ecd85625518cfd13.svg

  • render.js
    • add gist support
  • api.js
    • move rateLimit in graphQL queries (render.js) to api.js by reading limits from response header (recommended way by GitHub API docs)
    • replace r2 package with node-fetch package
  • svg.js
    • refactor parameter to array of Date objects instead of epoch timestamp

qoomon avatar Feb 11 '24 15:02 qoomon

Please deploy your version, so I can test my self

antonmedv avatar Feb 11 '24 20:02 antonmedv

Where should I deploy? Or just anywhere?

qoomon avatar Feb 12 '24 07:02 qoomon

Just anywhere

antonmedv avatar Feb 12 '24 08:02 antonmedv

feel free to test http://ec2-3-72-47-194.eu-central-1.compute.amazonaws.com

qoomon avatar Feb 12 '24 11:02 qoomon

Looks stuck at http://ec2-3-72-47-194.eu-central-1.compute.amazonaws.com/ image image

antonmedv avatar Feb 12 '24 13:02 antonmedv

Also I don't like hot a title for gists are shown .

image

antonmedv avatar Feb 12 '24 13:02 antonmedv

Maybe we should have a separate url for gists? gist.stars.medv.io?

antonmedv avatar Feb 12 '24 13:02 antonmedv

You have used a wrong url pattern you need to use it like this <baseUrl>/<owner>/gist:<gistHash> e.g. http://ec2-3-72-47-194.eu-central-1.compute.amazonaws.com/qoomon/gist:5dfcdf8eec66a051ecd85625518cfd13

qoomon avatar Feb 12 '24 14:02 qoomon

This is my point. This is very unintuitive what this sort support gists as well. So we can somehow highlight this in ui. Or maybe deploy at a separate url and name it Gist Sparklines?

antonmedv avatar Feb 12 '24 17:02 antonmedv

Or what about following convention?

  • <baseUrl>/<owner>/<repoName>
  • <baseUrl>/gist/<owner>/<gistHash>
  • or back to the initial idea <baseUrl>/gist:<owner>/<gistHash>

I thinks repos(files and directories repos) and gist (file only repos) are so alike that is seems odd to have two deployments for that

qoomon avatar Feb 12 '24 18:02 qoomon

At least every thing is now working as expected, I fixed all issues.

qoomon avatar Feb 12 '24 19:02 qoomon

I've deployed a version with the initial url pattern <baseUrl>/gist:<owner>/<gistHash>

see http://ec2-3-72-47-194.eu-central-1.compute.amazonaws.com/gist:qoomon/5dfcdf8eec66a051ecd85625518cfd13

I think this is the most appealing variant

qoomon avatar Feb 13 '24 10:02 qoomon

Super! Now it looks more cool.

One more thing. Lets get name of the gist from GraphQL api.

image

And use it here: image

How difficult it will be to implement?

antonmedv avatar Feb 13 '24 10:02 antonmedv

Unfortunately it would be a complete refactoring. The header always shows the name of the first file (even if there a multiple files in one gist) And just an extra note /<firstFileName> is not guaranteed to be unique for a user.

qoomon avatar Feb 13 '24 15:02 qoomon

I mean we can still use sha1, but only display name in the title. This will require saving gist names locally?

antonmedv avatar Feb 13 '24 16:02 antonmedv

I'd suggest that we release this version first, and then we add the gist display name later.

This will require saving gist names locally?

Yes that would be one option. Another option would be to call fetch('https://api.github.com/gists/<gistHash>') and resolve name on the fly

qoomon avatar Feb 14 '24 08:02 qoomon

I've implemented the gist display name, see http://ec2-3-72-47-194.eu-central-1.compute.amazonaws.com/gist:qoomon/5dfcdf8eec66a051ecd85625518cfd13

qoomon avatar Feb 14 '24 12:02 qoomon

WDYT?

qoomon avatar Feb 18 '24 14:02 qoomon

@antonmedv can we merge it so I can stop my instance again?

qoomon avatar Feb 21 '24 14:02 qoomon

Will try to take a look tonight and deploy.

antonmedv avatar Feb 21 '24 14:02 antonmedv

@antonmedv do you still need the server? I'd like to shut it down.

qoomon avatar Feb 23 '24 08:02 qoomon

No, you can shut it down.

antonmedv avatar Feb 23 '24 13:02 antonmedv

cool, looking forward to the merge and release

qoomon avatar Feb 23 '24 21:02 qoomon

@antonmedv can you estimate when you will merge this feature?

qoomon avatar Feb 28 '24 15:02 qoomon

Sometime soon?... There is no SLO, so you get it -)))

antonmedv avatar Feb 28 '24 17:02 antonmedv

👀

qoomon avatar Mar 04 '24 23:03 qoomon

🥺

qoomon avatar Mar 16 '24 23:03 qoomon

Still didn’t find any time. Will try tonight.

antonmedv avatar Mar 17 '24 07:03 antonmedv

Is there any rough estimation of a release date?

qoomon avatar May 31 '24 14:05 qoomon

Can I support to get this PR to be merged?

qoomon avatar Jun 22 '24 15:06 qoomon