feat: scalar auth persist.
This commit is contained in:
+12
-3
@@ -54,13 +54,13 @@ func SetupRouter() *gin.Engine {
|
|||||||
ginSwagger.PersistAuthorization(true),
|
ginSwagger.PersistAuthorization(true),
|
||||||
))
|
))
|
||||||
|
|
||||||
// Scalar 精美API文档(持久化鉴权信息)
|
// Scalar 精美API文档
|
||||||
r.GET("/scalar", func(c *gin.Context) {
|
r.GET("/scalar", func(c *gin.Context) {
|
||||||
c.Header("Content-Type", "text/html; charset=utf-8")
|
c.Header("Content-Type", "text/html; charset=utf-8")
|
||||||
c.String(http.StatusOK, `<!doctype html>
|
c.String(http.StatusOK, `<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>智能心率采集分析平台 API 文档</title>
|
<title>API Reference</title>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<style>
|
<style>
|
||||||
@@ -68,7 +68,16 @@ func SetupRouter() *gin.Engine {
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script id="api-reference" data-url="/swagger/doc.json" src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
|
<div id="app"></div>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
|
||||||
|
<script>
|
||||||
|
Scalar.createApiReference('#app', {
|
||||||
|
spec: {
|
||||||
|
url: '/swagger/doc.json',
|
||||||
|
},
|
||||||
|
persistAuth: true,
|
||||||
|
})
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>`)
|
</html>`)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user