diff options
author | tjpcc <tjp@ctrl-c.club> | 2023-09-23 13:01:11 -0600 |
---|---|---|
committer | tjpcc <tjp@ctrl-c.club> | 2023-09-23 13:03:19 -0600 |
commit | d59ed1060d354ce911da1e7fb19f651feeafa2c1 (patch) | |
tree | e751e6e113c665c86fd9411fe53caf91c4b0d582 | |
parent | 6cfa6622f31953bd75bfae4c9b10915e3dd6bd78 (diff) |
use :repository as the repo name key
-rw-r--r-- | gemini.go | 34 | ||||
-rw-r--r-- | gopher.go | 36 |
2 files changed, 35 insertions, 35 deletions
@@ -16,37 +16,37 @@ import ( const ( repokey = "syw_repo" - reponamekey = "syw_reponame" + reponamekey = "repository" ) // GeminiRouter builds a router that will handle requests into a directory of git repositories. // // The routes it defines are: -// / gemtext listing of the repositories in the directory -// /:syw_reponame[/] gemtext overview of the repository -// /:syw_reponame/branches gemtext list of branches/heads -// /:syw_reponame/tags gemtext listing of tags -// /:syw_reponame/refs/:ref/ gemtext overview of a ref -// /:syw_reponame/refs/:ref/tree/*path gemtext listing of directories, raw files -// /:syw_reponame/diffstat/:fromref/:toref text/plain diffstat between two refs -// /:syw_reponame/diff/:fromref/:toref text/x-diff between two refs +// / gemtext listing of the repositories in the directory +// /:repository/ gemtext overview of the repository +// /:repository/branches gemtext list of branches/heads +// /:repository/tags gemtext listing of tags +// /:repository/refs/:ref/ gemtext overview of a ref +// /:repository/refs/:ref/tree/*path gemtext listing of directories, raw files +// /:repository/diffstat/:fromref/:toref text/plain diffstat between two refs +// /:repository/diff/:fromref/:toref text/x-diff between two refs // // The overrides argument can provide templates to define the behavior of nearly all of the above // routes. All of them have default implementations so the argument can even be nil, but otherwise // the template names used are: // repo_root.gmi gemtext at / -// repo_home.gmi gemtext at /:syw_reponame/ -// branch_list.gmi gemtext at /:syw_reponame/branches -// tag_list.gmi gemtext at /:syw_reponame/tags -// ref.gmi gemtext at /:syw_reponame/refs/:ref/ -// tree.gmi gemtext for directories requested under /:syw_reponame/refs/:ref/tree/*path +// repo_home.gmi gemtext at /:repository/ +// branch_list.gmi gemtext at /:repository/branches +// tag_list.gmi gemtext at /:repository/tags +// ref.gmi gemtext at /:repository/refs/:ref/ +// tree.gmi gemtext for directories requested under /:repository/refs/:ref/tree/*path // (file paths return the raw files without any template involved) -// diffstat.gmi the plaintext diffstat at /:syw_reponame/diffstat/:fromref/:toref -// diff.gmi the text/x-diff at /:syw_reponame/diff/:fromref/:toref +// diffstat.gmi the plaintext diffstat at /:repository/diffstat/:fromref/:toref +// diff.gmi the text/x-diff at /:repository/diff/:fromref/:toref // // Most of the templates above are rendered with an object with 3 fields: // Ctx: the context.Context from the request -// Repo: a *syw.Repository object corresponding to <repodir>/:syw_reponame +// Repo: a *syw.Repository object corresponding to <repodir>/:repository // Params: a map[string]string of the route parameters // // The only exception is repo_root.gmi, which is rendered with a slice of the repo names instead. @@ -17,33 +17,33 @@ import ( // GopherRouter builds a router that will handle gopher requests in a directory of git repositories. // // The routes it defines are: -// / gophermap listing of the repositories in the directory -// /:syw_reponame gophermap overview of the repository -// /:syw_reponame/branches gophermap list of branches/head -// /:syw_reponame/tags gophermap listing of tags -// /:syw_reponame/refs/:ref gophermap overview of a ref -// /:syw_reponame/refs/:ref/tree gophermap listing of a ref's root directory -// /:syw_reponame/refs/:ref/tree/*path for directories: gophermap list of contents -// for files: raw files (guessed item type text/binary/image/etc) -// /:syw_reponame/diffstat/:fromref/:toref text diffstat between two refs -// /:syw_reponame/diff/:fromref/:toref text diff between two refs +// / gophermap listing of the repositories in the directory +// /:repository gophermap overview of the repository +// /:repository/branches gophermap list of branches/head +// /:repository/tags gophermap listing of tags +// /:repository/refs/:ref gophermap overview of a ref +// /:repository/refs/:ref/tree gophermap listing of a ref's root directory +// /:repository/refs/:ref/tree/*path for directories: gophermap list of contents +// for files: raw files (guessed item type text/binary/image/etc) +// /:repository/diffstat/:fromref/:toref text diffstat between two refs +// /:repository/diff/:fromref/:toref text diff between two refs // // The overrides argument can provide templates to define the behavior of nearly all of the above routes. // All of them have default implementations, so the argument can be nil, but otherwise the template names // used are: // repo_root.gophermap gophermap at / -// repo_home.gophermap gophermap at /:syw_reponame -// branch_list.gophermap gophermap at /:syw_reponame/branches -// tag_list.gophermap gophermap at /:syw_reponame/tags -// ref.gophermap gophermap at /:syw_reponame/refs/:ref -// tree.gophermap gophermap at direcotry paths under /:syw_reponame/refs/:ref/tree/*path +// repo_home.gophermap gophermap at /:repository +// branch_list.gophermap gophermap at /:repository/branches +// tag_list.gophermap gophermap at /:repository/tags +// ref.gophermap gophermap at /:repository/refs/:ref +// tree.gophermap gophermap at direcotry paths under /:repository/refs/:ref/tree/*path // (file paths return the raw files without any template involved) -// diffstat.gophertext plain text diffstat at /:syw_reponame/diffstat/:fromref/:toref -// diff.gophertext plain text diff at /:syw_reponame/diff/:fromref/:toref +// diffstat.gophertext plain text diffstat at /:repository/diffstat/:fromref/:toref +// diff.gophertext plain text diff at /:repository/diff/:fromref/:toref // // Most of the templates above are rendered with an object with 6 fields: // Ctx: the context.Context from the request -// Repo: a *syw.Repository corresponding to <repodir>/:syw_reponame +// Repo: a *syw.Repository corresponding to <repodir>/:repository // Params: the map[string]string of the route parameters // Host: the hostname of the running server // Port: the port number of the running server |