mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-04-20 19:38:39 +00:00
Allow requesting the unrendered dot graph from the graph endpoint
When api/graph.{dot,gv} is requested the raw string for dot gets returned.
This allows client-side rendering rather than server-side. It also makes
the optional dependency on graphivz for dot unnecessary to use the graph
endpoint.
This commit is contained in:
@@ -39,6 +39,13 @@ func apiGraph(c *gin.Context) {
|
||||
|
||||
buf := bytes.NewBufferString(graph.String())
|
||||
|
||||
if ext == "dot" || ext == "gv" {
|
||||
// If the raw dot data is requested, return it as string.
|
||||
// This allows client-side rendering rather than server-side.
|
||||
c.String(200, buf.String())
|
||||
return
|
||||
}
|
||||
|
||||
command := exec.Command("dot", "-T"+ext)
|
||||
command.Stderr = os.Stderr
|
||||
|
||||
|
||||
Reference in New Issue
Block a user