Discussion
Loading...

Post

  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
Stylus
@stylus@social.afront.org  ·  activity timestamp 3 weeks ago

I've tried & failed to write a commandline program to upload to a codeberg repo via the /contents/ API... I just get a "500" response. And I've failed to find any examples of anyone else doing this. If I could just upload to a public repo without bothering with having a git repo locally that gets me most of what I would want from a gist replacement except possibly embedding. but it just doesn't quite work...

  • Copy link
  • Flag this post
  • Block
Stylus
@stylus@social.afront.org replied  ·  activity timestamp 3 weeks ago

Sweet, I got it working! Now, I can use my codeberg repo "junkdrawer" as a semi-replacement for github gists.

It's not super clear from the API documentation, but for a file that does not exist yet, you have to POST it; for a file that exists, you have to PUT it and include the sha1sum of the file to be replaced.

I've used junk.py to post itself to my junkdrawer: https://codeberg.org/jepler/junkdrawer/src/branch/main/aygdu2e9/junk.py

This script conforms to PEP723 so you can run it with uv run.

#codeberg #forgejo #dumpGitHub

  • Copy link
  • Flag this comment
  • Block
Stylus
@stylus@social.afront.org replied  ·  activity timestamp 2 weeks ago

I also created a very rough way to embed junkdrawer items (or any codeberg code, really!) and showcased it in a blog post: https://emergent.unpythonic.net/01764173359

  • Copy link
  • Flag this comment
  • Block
Stylus
@stylus@social.afront.org replied  ·  activity timestamp 2 weeks ago

I'm not nuts about the syntax highlighting color set, I need to look into whether there are some other themes available.

  • Copy link
  • Flag this comment
  • Block
Log in

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.1-alpha.8 no JS en
Automatic federation enabled
  • Explore
  • About
  • Members
  • Code of Conduct
Home
Login