Your Name 2023-05-19 10:28:09 +02:00
parent 27a6d16ff0
commit 4913dc7cb1
3 changed files with 106 additions and 0 deletions

@ -0,0 +1,5 @@
package og
func Home() {
}

@ -0,0 +1,5 @@
package og
func Issue() {
}

@ -7,6 +7,8 @@ import (
gocontext "context"
"net/http"
"code.gitea.io/gitea/routers/web/og"
"code.gitea.io/gitea/models/perm"
"code.gitea.io/gitea/models/unit"
"code.gitea.io/gitea/modules/context"
@ -1329,6 +1331,100 @@ func registerRoutes(m *web.Route) {
m.Get("/*", context.RepoRefByType(context.RepoRefLegacy), repo.Home)
}, repo.SetEditorconfigIfExists)
/// og
/// Title: $username/$reponame
/// Description $repodescription falling back to $orgdescription
/// Image:
/// Preview like GitHub with `$username/$reponame`, language slider, star count, issue count, fork count, org/user profile picture
/// https://opengraph.githubassets.com/9d2ca6532213933ee824399260551cd053de9fd303f60526e747646190f21615/nyxkrage/sanctureplicum
///
/// og/branch/$branchname
/// Title: $username/$reponame
/// Description $repodescription falling back to $orgdescription
/// Image:
/// Show preview like `/og` but also show amount of lines changed between this branch and the default branch
/// If this is the default branch, default to `/og`
///
/// og/tag/$tagname
/// Title: $username/$reponame @ $tagname
/// Description $repodescription falling back to $orgdescription
/// Image:
/// Show preview like `/og` but include tag name
///
/// og/commit/$hash
/// Title: $username/$reponame
/// Description $repodescription falling back to $orgdescription
/// Image:
/// Show lines changed in commit, commit message and commit/author, (perhaps a lock symbol whether the commit was signed)
///
/// og/branch/$branchname/$path (textual file, source, for now svg)
/// Title: $reponame/$path
/// Description: Show latest commit that changed the file
/// Image:
/// Show rendered preview of file, utilizing previous work in this fork
///
/// og/branch/$branchname/$path (markdown files)
/// Title: $reponame/$path
/// Description: Show latest commit that changed the file
/// Image:
/// Show rendered preview of file, utilizing charmbracelet/glow
///
/// og/branch/$branchname/$path (previewable file, for now only images)
/// Title: $reponame/$path
/// Description: Show latest commit that changed the file
/// Image:
/// Show image directly as opengraph
///
/// og/branch/$branchname/$path (binary file)
/// Title: $reponame/$path
/// Description: Show latest commit that changed the file
/// Image:
/// No image
///
/// og/commit/$hash/$path
/// Title: $reponame/$path @ $hash
/// Description: TODO
/// Image:
/// Do the same as the `/og/branch/$branchname` but for the specific commit
///
/// og/pulls/$id
/// Title: $pulltitle
/// Description: $pullbody falling back to $orgdescription if empty
/// Image:
/// Show much like `/og/branch/$branchname` but with the forked branch
///
/// og/actions/*
/// Title: Job Name
/// Description: TODO
/// Image:
/// Show status of job with name and some color coding
///
/// og/packages/*
/// Title: TODO
/// Description: TODO
/// Image:
/// TODO
///
/// og/releases/$tagname
/// Title: $reponame $tagname
/// Description: Commit of tag, show if stable or prerelease
/// Image:
/// Show same info as on the web ui, who created it, when, amount of commits to branch since
m.Group("/og", func() {
m.Get("/branch/*", context.RepoRefByType(context.RepoRefBranch), og.Home)
m.Get("/tag/*", context.RepoRefByType(context.RepoRefTag), og.Home)
m.Get("/commit/*", context.RepoRefByType(context.RepoRefCommit), og.Home)
m.Get("/actions/*", context.RepoRefByType(context.RepoRefCommit), og.Home)
m.Get("/packages/*", context.RepoRefByType(context.RepoRefCommit), og.Home)
m.Get("/releases/*", context.RepoRefByType(context.RepoRefCommit), og.Home)
})
// TODO:
m.Group("/og", func() {
m.Get("/{type:issues|pulls}/{index}", og.Issue)
}, repo.MustAllowPulls)
m.Group("", func() {
m.Get("/forks", repo.Forks)
}, context.RepoRef(), reqRepoCodeReader)