mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-15 07:00:52 +00:00
d/patches: remove old patch, and disable swagger support
This commit is contained in:
+60
@@ -0,0 +1,60 @@
|
||||
From: =?utf-8?q?Andr=C3=A9_Roth?= <neolynx@gmail.com>
|
||||
Date: Tue, 15 Oct 2024 12:09:33 +0200
|
||||
Subject: disable swagger
|
||||
|
||||
---
|
||||
api/router.go | 16 ++++++++--------
|
||||
docs/index.go | 1 -
|
||||
docs/index.go.disabled | 1 +
|
||||
3 files changed, 9 insertions(+), 9 deletions(-)
|
||||
delete mode 100644 docs/index.go
|
||||
create mode 100644 docs/index.go.disabled
|
||||
|
||||
diff --git a/api/router.go b/api/router.go
|
||||
index d5b6e61..708b892 100644
|
||||
--- a/api/router.go
|
||||
+++ b/api/router.go
|
||||
@@ -12,9 +12,9 @@ import (
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
- _ "github.com/aptly-dev/aptly/docs" // import docs
|
||||
- swaggerFiles "github.com/swaggo/files"
|
||||
- ginSwagger "github.com/swaggo/gin-swagger"
|
||||
+ // _ "github.com/aptly-dev/aptly/docs" // import docs
|
||||
+ // swaggerFiles "github.com/swaggo/files"
|
||||
+ // ginSwagger "github.com/swaggo/gin-swagger"
|
||||
)
|
||||
|
||||
var context *ctx.AptlyContext
|
||||
@@ -72,11 +72,11 @@ func Router(c *ctx.AptlyContext) http.Handler {
|
||||
|
||||
router.Use(gin.Recovery(), gin.ErrorLogger())
|
||||
|
||||
- if c.Config().EnableSwaggerEndpoint {
|
||||
- router.Use(redirectSwagger)
|
||||
- url := ginSwagger.URL("/docs/doc.json")
|
||||
- router.GET("/docs/*any", ginSwagger.WrapHandler(swaggerFiles.Handler, url))
|
||||
- }
|
||||
+ // if c.Config().EnableSwaggerEndpoint {
|
||||
+ // router.Use(redirectSwagger)
|
||||
+ // url := ginSwagger.URL("/docs/doc.json")
|
||||
+ // router.GET("/docs/*any", ginSwagger.WrapHandler(swaggerFiles.Handler, url))
|
||||
+ // }
|
||||
|
||||
if c.Config().EnableMetricsEndpoint {
|
||||
MetricsCollectorRegistrar.Register(router)
|
||||
diff --git a/docs/index.go b/docs/index.go
|
||||
deleted file mode 100644
|
||||
index 5604656..0000000
|
||||
--- a/docs/index.go
|
||||
+++ /dev/null
|
||||
@@ -1 +0,0 @@
|
||||
-package docs
|
||||
diff --git a/docs/index.go.disabled b/docs/index.go.disabled
|
||||
new file mode 100644
|
||||
index 0000000..5604656
|
||||
--- /dev/null
|
||||
+++ b/docs/index.go.disabled
|
||||
@@ -0,0 +1 @@
|
||||
+package docs
|
||||
@@ -1,40 +0,0 @@
|
||||
From: Shengjing Zhu <zhsj@debian.org>
|
||||
Date: Sat, 13 Apr 2019 22:57:46 +0800
|
||||
Subject: Fix time.Time msgpack decoding backwards compatibility
|
||||
|
||||
This allows aptly to decode DB created by old codec library.
|
||||
|
||||
Forwarded: https://github.com/aptly-dev/aptly/pull/830
|
||||
---
|
||||
deb/remote.go | 3 ++-
|
||||
deb/snapshot.go | 3 ++-
|
||||
2 files changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
Index: aptly/deb/remote.go
|
||||
===================================================================
|
||||
--- aptly.orig/deb/remote.go
|
||||
+++ aptly/deb/remote.go
|
||||
@@ -688,7 +688,8 @@ func (repo *RemoteRepo) Decode(input []b
|
||||
decoder := codec.NewDecoderBytes(input, &codec.MsgpackHandle{})
|
||||
err := decoder.Decode(repo)
|
||||
if err != nil {
|
||||
- if strings.HasPrefix(err.Error(), "codec.decoder: readContainerLen: Unrecognized descriptor byte: hex: 80") {
|
||||
+ if strings.HasPrefix(err.Error(), "codec.decoder: readContainerLen: Unrecognized descriptor byte: hex: 80") ||
|
||||
+ strings.Contains(err.Error(), "invalid length of bytes for decoding time") {
|
||||
// probably it is broken DB from go < 1.2, try decoding w/o time.Time
|
||||
var repo11 struct { // nolint: maligned
|
||||
UUID string
|
||||
Index: aptly/deb/snapshot.go
|
||||
===================================================================
|
||||
--- aptly.orig/deb/snapshot.go
|
||||
+++ aptly/deb/snapshot.go
|
||||
@@ -152,7 +152,8 @@ func (s *Snapshot) Decode(input []byte)
|
||||
decoder := codec.NewDecoderBytes(input, &codec.MsgpackHandle{})
|
||||
err := decoder.Decode(s)
|
||||
if err != nil {
|
||||
- if strings.HasPrefix(err.Error(), "codec.decoder: readContainerLen: Unrecognized descriptor byte: hex: 80") {
|
||||
+ if strings.HasPrefix(err.Error(), "codec.decoder: readContainerLen: Unrecognized descriptor byte: hex: 80") ||
|
||||
+ strings.Contains(err.Error(), "invalid length of bytes for decoding time") {
|
||||
// probably it is broken DB from go < 1.2, try decoding w/o time.Time
|
||||
var snapshot11 struct {
|
||||
UUID string
|
||||
Vendored
+1
-2
@@ -1,2 +1 @@
|
||||
Fix-time.Time-msgpack-decoding-backwards-compatibili.patch
|
||||
|
||||
0001-disable-swagger.patch
|
||||
|
||||
Reference in New Issue
Block a user