Codeberg/Community
54
325
Fork
You've already forked Community
12

Codeberg Gists #382

Open
opened 2021年01月09日 07:49:23 +01:00 by circlebuilder · 28 comments

(I thought there was another issue asking something like "What other major services could Codeberg provide?", can't find it though)

How about Gists?


Background:

As (still) a Golang noob I am trying to run Go-Fed apcore activitypub example server. An involved process and I'm keeping notes. Notes are long, mixed of noob misunderstanding, project feedback, and stuff to improve later on with multiple issues + PR's.

There's no good place for the notes. Not suitable as an issue, cannot dump on Matrix, and not suitable for SocialHub forum. So...

I need a Github gist

How nice if I could have Codeberg gist instead, and refer to it from a GH issue in the project's tracker :)

(I thought there was another issue asking something like "What other major services could Codeberg provide?", can't find it though) How about Gists? --- Background: As (still) a Golang noob I am trying to run [Go-Fed apcore](https://github.com/go-fed/apcore) activitypub example server. An involved process and I'm keeping notes. Notes are long, mixed of noob misunderstanding, project feedback, and stuff to improve later on with multiple issues + PR's. There's no good place for the notes. Not suitable as an issue, cannot dump on Matrix, and not suitable for SocialHub forum. So... > I need a **Github** gist How nice if I could have Codeberg gist instead, and refer to it from a GH issue in the project's tracker :)
Member
Copy link
@momar built https://github.com/qbin-io/qbin
Owner
Copy link

Agree. Yes, there are thousands of pastebin services out there, but using a nice one for Codeberg would be pretty cool.

Is there even one developed on Codeberg?

The best thing would be to integrate it into Codeberg, like having a button in the official UI or being able to sign in into the bin service to manage pastes or assign them to users / projects etc ...

Agree. Yes, there are thousands of pastebin services out there, but using a nice one for Codeberg would be pretty cool. Is there even one developed on Codeberg? The best thing would be to integrate it into Codeberg, like having a button in the official UI or being able to sign in into the bin service to manage pastes or assign them to users / projects etc ...

... or being able to sign in into the bin service ...

so you just have to look for a pastebin witch has oauth2 login, create a subdomain and that mainly should it be

https://github.com/awesome-selfhosted/awesome-selfhosted#pastebins

EDIT: I could not find a good fit in the first place :/ so it looks we have to programm it ...

Upstream issue: https://github.com/go-gitea/gitea/issues/693

> ... or being able to sign in into the bin service ... so you just have to look for a pastebin witch has oauth2 login, create a subdomain and that mainly should it be https://github.com/awesome-selfhosted/awesome-selfhosted#pastebins EDIT: I could not find a good fit in the first place :/ so it looks we have to programm it ... Upstream issue: https://github.com/go-gitea/gitea/issues/693

The way that GitHub gists service works, is that it is an oauth application that uses the Github user account to login with.

One benefit of Gist is that each gist is a repo that can be cloned, etc..

A quick way to get started would be to have a "login w/ codeberg" to get oauth2 credentials, and then use the API to create repos & read/write to them.

As for upstream in Gitea, things that would need to be considered are githooks to prevent creating gists w/ folders (to match github gist behaviour), a different way to display them than standard repos (where standard repos only show content of readme, where gists would need to show all files), and also how to display them (likely a different tab from user's profile) so a sql where clause would be needed so they would be excluded from the main repo listing. And maybe comments on gists too (possible forking too)?

The way that GitHub gists service works, is that it is an oauth application that uses the Github user account to login with. One benefit of Gist is that each gist is a repo that can be cloned, etc.. A quick way to get started would be to have a "login w/ codeberg" to get oauth2 credentials, and then use the API to create repos & read/write to them. As for upstream in Gitea, things that would need to be considered are githooks to prevent creating gists w/ folders (to match github gist behaviour), a different way to display them than standard repos (where standard repos only show content of readme, where gists would need to show all files), and also how to display them (likely a different tab from user's profile) so a sql where clause would be needed so they would be excluded from the main repo listing. And maybe comments on gists too (possible forking too)?
Member
Copy link

Would these work somewhat similar to the wiki repos?

Would these work somewhat similar to the wiki repos?

Would these work somewhat similar to the wiki repos?

Indeed.

> Would these work somewhat similar to the wiki repos? Indeed.
Owner
Copy link

Just another idea for a standalone service (without changing Gitea): What about serving a per-user / org repo called gists where you can dump in all your notes that are then fancily displayed via some gists service? If you don't want your the index to be public, you can leave the repo private?

Just another idea for a standalone service (without changing Gitea): What about serving a per-user / org repo called `gists` where you can dump in all your notes that are then fancily displayed via some gists service? If you don't want your the index to be public, you can leave the repo private?

Hello,

I'm working on a gist program which will have features very similar GitHub Gists but with subtle differences:

  • Directories are permitted: multi-file gists are already permitted in all implementations that I surveyed, directories allow for better organization, which is nice.
  • Federation via Activity Pub: I want to support federated comments but to do that, I'll also have to support federated gists(what will users comment on? :D), therefore gists and comments will be federated(federated forking, star/favorite and comments)

Currently, it has a standalone authentication/user management mechanism(i.e people can signup using email IDs), but OAuth integration with Gitea is planned. The full feature list is available on the repository's README.

I would appreciate any inputs you might have :)


Also posted on Gitea issue tracker

Hello, [I'm working on a gist program](https://github.com/realaravinth/gists) which will have features very similar GitHub Gists but with subtle differences: - Directories are permitted: [multi-file gists are already permitted in all implementations that I surveyed](https://github.com/realaravinth/gists/blob/master/docs/ecosystem.md), directories allow for better organization, which is nice. - Federation via Activity Pub: I want to support federated comments but to do that, I'll also have to support federated gists(what will users comment on? :D), therefore gists and comments will be federated(federated forking, star/favorite and comments) Currently, it has a standalone authentication/user management mechanism(i.e people can signup using email IDs), but OAuth integration with Gitea is planned. The full [feature list is available on the repository's README](https://github.com/realaravinth/gists#features). I would appreciate any inputs you might have :) --- [Also posted on Gitea issue tracker](https://github.com/go-gitea/gitea/issues/16670#issuecomment-1044052785)

Very cool! You may also consider posting to forgefriends community in the Projects category. The ActivityPub federation part of Gists are interesting for Forgefriends FSDL incubator project to get documented specs on that.

Very cool! You may also consider posting to [forgefriends community](https://forum.forgefriends.org) in the [Projects](https://forum.forgefriends.org/c/discussions/projects/23) category. The ActivityPub federation part of Gists are interesting for [Forgefriends FSDL](https://forum.forgefriends.org/t/forgefriends-free-software-development-lifecycle-forge-specifications-incubator-project/586) incubator project to get documented specs on that.
Owner
Copy link

@realaravinth Wouldn't you be able to save some backend work by considering the idea I posted above your comment?

With Git already being a storage solution, and Gitea supporting federation in the future, wouldn't it actually be possible to use this for storage (the Gists could then actually be found by other instances who don't host a Gists server).

You could use a repo with folder structure and maybe independent branches for each gist, you could use the upcoming federated comment section as a backend (and e.g. let the title indicate the gist thread).

Just an idea, because looking at your roadmap especially with federation, I suppose you'll have to spent quite a while on reinventing code that was already written + need to spend even more time having it become mature (I'm mainly talking about the Git backend, the implementation in Gitea is not trivial, needs to consider hundreds of edge cases etc).

@realaravinth Wouldn't you be able to save some backend work by considering the idea I posted above your comment? With Git already being a storage solution, and Gitea supporting federation in the future, wouldn't it actually be possible to use this for storage (the Gists could then actually be found by other instances who don't host a Gists server). You could use a repo with folder structure and maybe independent branches for each gist, you could use the upcoming federated comment section as a backend (and e.g. let the title indicate the gist thread). Just an idea, because looking at your roadmap especially with federation, I suppose you'll have to spent quite a while on reinventing code that was already written + need to spend even more time having it become mature (I'm mainly talking about the Git backend, the implementation in Gitea is not trivial, needs to consider hundreds of edge cases etc).

@fnetX: What you are suggesting can save a lot of work but it's difficult to accommodate private gists with a single-repo-for-all-gists mechanism.

Also, reserving a namespace({username}/gists) after the fact might cause issues during upgrades(I'm assuming the reservation will be made in a future Gitea release).

One method to allow for maximum reuse is to make modify Gitea to listen at two different domains: one for the forge and the other for gists but I'm not a Go programmer and I'm not sure if the Gitea folks might like this idea :)

I posted a status report on the GitHub issue tracker, after someone requested an update.

@fnetX: What you are suggesting can save a lot of work but it's difficult to accommodate private gists with a single-repo-for-all-gists mechanism. Also, reserving a namespace(`{username}/gists`) after the fact might cause issues during upgrades(I'm assuming the reservation will be made in a future Gitea release). One method to allow for maximum reuse is to make modify Gitea to listen at two different domains: one for the forge and the other for gists but I'm not a Go programmer and I'm not sure if the Gitea folks might like this idea :) [I posted a status report](https://github.com/go-gitea/gitea/issues/16670#issuecomment-1044101473) on the GitHub issue tracker, after someone requested an update.
Owner
Copy link

No, I meant one gists repo per user, as we already do it with "pages". We also allow other repos and branches, you could get inspired by this, too.

e.g. "gists.giteahost.invalid/user" displays a list of gists in the gists repo,
"gists.giteahost.invalid/user/gist/(files)" displays the gist in the named branch and the files in there and "gists.giteahost.invalid/user/@otherrepo/gist" displays a Gist from another repo, and if private, asks the user to sign in via OAuth to check if the permission was granted to that user.

I think this project should be standalone, so no need to reserve namespaces in Gitea. I think another subdomain is better, and if a site chooses they can probably also install in "giteahost.invalid/gists/..." - we could add a config parameter in Gitea to allow to define an external Git host and URL scheme for this.

No, I meant one gists repo per user, as we already do it with "pages". We also allow other repos and branches, you could get inspired by this, too. e.g. "gists.giteahost.invalid/user" displays a list of gists in the gists repo, "gists.giteahost.invalid/user/gist/(files)" displays the gist in the named branch and the files in there and "gists.giteahost.invalid/user/@otherrepo/gist" displays a Gist from another repo, and if private, asks the user to sign in via OAuth to check if the permission was granted to that user. I think this project should be standalone, so no need to reserve namespaces in Gitea. I think another subdomain is better, and if a site chooses they can probably also install in "giteahost.invalid/gists/..." - we could add a config parameter in Gitea to allow to define an external Git host and URL scheme for this.

What you are suggesting will result in a much tigher integration with Gitea, and as a result, create a heavier dependency on it.

Users of this program should be able to run it without having to run a Gitea isntance. IMHO, the forge experience must be flexible and users should be able to mix and match software as they please.

What you are suggesting will result in a much tigher integration with Gitea, and as a result, create a heavier dependency on it. Users of this program should be able to run it without having to run a Gitea isntance. IMHO, the forge experience must be flexible and users should be able to mix and match software as they please.

What's the current state?
Have we an GIST feature ready to use?

What's the current state? Have we an GIST feature ready to use?

Issue is still open, codeberg currently doens't provide any gist capabilities.

Issue is still open, codeberg currently doens't provide any gist capabilities.

I should mention that @realaravinth also elaborated on a gists app after commenting above, at https://github.com/realaravinth/gitpad

I should mention that @realaravinth also elaborated on a gists app after [commenting above](https://codeberg.org/Codeberg/Community/issues/382#issuecomment-378018), at https://github.com/realaravinth/gitpad

Yeah, I also looked into that, but it seems abandoned.

Yeah, I also looked into that, but it seems abandoned.

I also like to projects who have more maintainers rather than a single man show :D

I also like to projects who have more maintainers rather than a single man show :D

I would like to participate, how can i start or what's the progress here?

I would like to participate, how can i start or what's the progress here?

how can i start or what's the progress here?

The best would be to checkout https://codeberg.org/Codeberg/Contributing/

> how can i start or what's the progress here? The best would be to checkout https://codeberg.org/Codeberg/Contributing/

Now I just settled to create a repository for code snippets and notes in my profile:

https://codeberg.org/harald/Codeschnipselnotizen

Creating a new file in the Codeberg UI is simple enough. I never used github gists really, but seeing how easy the snippets repo is to set up and use, I wonder: what is the point? (No sarcasm or anything, I really don't know.)

Now I just settled to create a repository for code snippets and notes in my profile: https://codeberg.org/harald/Codeschnipselnotizen Creating a new file in the Codeberg UI is simple enough. I never used github gists really, but seeing how easy the snippets repo is to set up and use, I wonder: what is the point? (No sarcasm or anything, I really don't know.)

Maybe there isn't a real point. If you think about it, though, there's no point in an office suite when you could use ASCIIDoc (or HTML + CSS 😉).

Maybe there isn't a real point. If you think about it, though, there's no point in an office suite when you could use ASCIIDoc (or HTML + CSS 😉).

P.S. Checking the repository you shared, the experience of someone browsing your repository is probably not the same experience someone gets when they open a GitHub gist 🙂

P.S. Checking the repository you shared, the experience of someone browsing your repository is probably not the same experience someone gets when they open a GitHub gist 🙂

@kryzet Just looked again at one or two gists on github. I see some code, I can copy it. It has revisions. No idea what specifics you find so different to browsing some files in a repository. But maybe I just don't get it from the simple examples I checked.

Maybe you could write down some bullet points of what makes this gist service special and helpful. It may help to move this issue forward, one way or the other.

@kryzet Just looked again at one or two gists on github. I see some code, I can copy it. It has revisions. No idea what specifics you find so different to browsing some files in a repository. But maybe I just don't get it from the simple examples I checked. Maybe you could write down some bullet points of what makes this gist service special and helpful. It may help to move this issue forward, one way or the other.

For what its worth: I solved this in the same way by making a gists repo to have one-off code there (cf for an example.

The main limitation is that it doesn't allow for commenting/conversation on the same page, but imho for simple things that works well enough.

For what its worth: I solved this in the same way by making a `gists` repo to have one-off code there ([cf for an example](https://codeberg.org/gedankenstuecke/gists/src/branch/main/mastodon-notify-fosstodon.py). The main limitation is that it doesn't allow for commenting/conversation on the same page, but imho for simple things that works well enough.

@harald I just realized that one would normally copy a direct link to the file and not a link to the repository's root, but @gedankenstuecke's point still stands.

@harald I just realized that one would normally copy a direct link to the file and not a link to the repository's root, but @gedankenstuecke's point still stands.

@harald wrote in #382 (comment):

No idea what specifics you find so different to browsing some files in a repository.

The GibLab page on snippets might give an idea. These are encapsulated code chunks unrelated to a particular repository.

Let me offer a use case. I am teaching some course with exercises along the way. On each exercise I wish to point the students to the solution after some time. If the solutions are gathered in a single repository, a single URI leads the students to all solutions. I need an encapsulated URI for each solution, so students remained focused on the exercise at hand. Moreover, students can then comment and propose enhancements to each solution individually.

I am sure similar use cases exist in the corporate world. This would indeed be a useful improvement to Codeberg.

@harald wrote in https://codeberg.org/Codeberg/Community/issues/382#issuecomment-4173359: > No idea what specifics you find so different to browsing some files in a repository. The GibLab [page on snippets](https://docs.gitlab.com/user/snippets/) might give an idea. These are encapsulated code chunks unrelated to a particular repository. Let me offer a use case. I am teaching some course with exercises along the way. On each exercise I wish to point the students to the solution after some time. If the solutions are gathered in a single repository, a single URI leads the students to all solutions. I need an encapsulated URI for each solution, so students remained focused on the exercise at hand. Moreover, students can then comment and propose enhancements to each solution individually. I am sure similar use cases exist in the corporate world. This would indeed be a useful improvement to Codeberg.
Sign in to join this conversation.
No Branch/Tag specified
main
No results found.
Labels
Clear labels
accessibility

Reduces accessibility and is thus a "bug" for certain user groups on Codeberg.
bug

Something is not working the way it should. Does not concern outages.
bug
infrastructure

Errors evidently caused by infrastructure malfunctions or outages
Codeberg

This issue involves Codeberg's downstream modifications and settings and/or Codeberg's structures.
contributions welcome

Please join the discussion and consider contributing a PR!
docs

No bug, but an improvement to the docs or UI description will help
duplicate

This issue or pull request already exists
enhancement

New feature
infrastructure

Involves changes to the server setups, use `bug/infrastructure` for infrastructure-related user errors.
legal

An issue directly involving legal compliance
licence / ToS

involving questions about the ToS, especially licencing compliance
please chill
we are volunteers

Please consider editing your posts and remember that there is a human on the other side. We get that you are frustrated, but it's harder for us to help you this way.
public relations

Things related to Codeberg's external communication
question

More information is needed
question
user support

This issue contains a clearly stated problem. However, it is not clear whether we have to fix anything on Codeberg's end, but we're helping them fix it and/or find the cause.
s/Forgejo

Related to Forgejo. Please also check Forgejo's issue tracker.
s/Forgejo/migration

Migration related issues in Forgejo
s/Pages

Issues related to the Codeberg Pages feature
s/Weblate

Issue is related to the Weblate instance at https://translate.codeberg.org
s/Woodpecker

Woodpecker CI related issue
security

involves improvements to the sites security
service

Add a new service to the Codeberg ecosystem (instead of implementing into Gitea)
upstream

An open issue or pull request to an upstream repository to fix this issue (partially or completely) exists (i.e. Gitea, Forgejo, etc.)
wontfix

Codeberg's current set of contributors are not planning to spend time on delegating this issue.
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
14 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Codeberg/Community#382
Reference in a new issue
Codeberg/Community
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?