diff --git a/go.mod b/go.mod index 10d800f..640c304 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,10 @@ module github.com/go-swagno/swagno-fiber go 1.18 -require github.com/gofiber/fiber/v2 v2.37.0 +require ( + github.com/go-swagno/swagno-files v0.1.3 + github.com/gofiber/fiber/v2 v2.37.0 +) require ( github.com/andybalholm/brotli v1.0.4 // indirect @@ -10,5 +13,6 @@ require ( github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasthttp v1.39.0 // indirect github.com/valyala/tcplisten v1.0.0 // indirect - golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 // indirect + golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b // indirect + golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 // indirect ) diff --git a/go.sum b/go.sum index 93260ae..ac7a955 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,7 @@ github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= +github.com/go-swagno/swagno-files v0.1.3 h1:L8qWWbClOXXIBZiknHydygLU77bDawzUXCJg4evDfMA= +github.com/go-swagno/swagno-files v0.1.3/go.mod h1:SY6IrcEspFFlVKxduEU1qnrZnu+E6HJKaWfsssvu8Ts= github.com/gofiber/fiber/v2 v2.37.0 h1:KVboSQ7e0wDbSFXNjXKqoigwp9HYUqgWn4uGFaUO1P8= github.com/gofiber/fiber/v2 v2.37.0/go.mod h1:xm3pDGlfE1xqVKb77iH8weLU0FFoTeWeK3nbiYM2Nh0= github.com/klauspost/compress v1.15.0 h1:xqfchp4whNFxn5A4XFyyYtitiWI8Hy5EW59jEwcyL6U= @@ -13,12 +15,15 @@ github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7Fw golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b h1:ZmngSVLe/wycRns9MKikG9OWIEjGcGAkacif7oYQaUY= +golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 h1:nhht2DYV/Sn3qOayu8lM+cU1ii9sTLUeBQwQQfUHtrs= golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 h1:v6hYoSR9T5oet+pMXwUWkbiVqx/63mlHjefrHmxwfeY= +golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= diff --git a/swagger/handler.go b/swagger/handler.go index 663a6e9..cb1cfce 100644 --- a/swagger/handler.go +++ b/swagger/handler.go @@ -1,8 +1,7 @@ package swagger import ( - "net/http" - + swaggerUi "github.com/go-swagno/swagno-files" "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/middleware/filesystem" ) @@ -28,6 +27,6 @@ func SwaggerHandler(a *fiber.App, doc []byte, config ...Config) { return c.SendString(swaggerDoc) }) a.Use(defaultConfig.Prefix, filesystem.New(filesystem.Config{ - Root: http.Dir("./swaggerFiles"), + Root: swaggerUi.HTTP, })) } diff --git a/swagger/swaggerFiles/favicon-16x16.png b/swagger/swaggerFiles/favicon-16x16.png deleted file mode 100644 index 8b194e6..0000000 Binary files a/swagger/swaggerFiles/favicon-16x16.png and /dev/null differ diff --git a/swagger/swaggerFiles/favicon-32x32.png b/swagger/swaggerFiles/favicon-32x32.png deleted file mode 100644 index 249737f..0000000 Binary files a/swagger/swaggerFiles/favicon-32x32.png and /dev/null differ diff --git a/swagger/swaggerFiles/index.css b/swagger/swaggerFiles/index.css deleted file mode 100644 index f2376fd..0000000 --- a/swagger/swaggerFiles/index.css +++ /dev/null @@ -1,16 +0,0 @@ -html { - box-sizing: border-box; - overflow: -moz-scrollbars-vertical; - overflow-y: scroll; -} - -*, -*:before, -*:after { - box-sizing: inherit; -} - -body { - margin: 0; - background: #fafafa; -} diff --git a/swagger/swaggerFiles/index.html b/swagger/swaggerFiles/index.html deleted file mode 100644 index 84ae62d..0000000 --- a/swagger/swaggerFiles/index.html +++ /dev/null @@ -1,19 +0,0 @@ - - - -
- ->16&255,u[c++]=t>>8&255,u[c++]=255&t;2===s&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[c++]=255&t);1===s&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t);return u},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,a=[],i=16383,s=0,l=n-o;s0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function u(e,t,n){for(var o,a,i=[],s=t;ss&&(r=s-l),a=r;a>=0;a--){let r=!0;for(let n=0;n>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let a=!1;for(;;)switch(n){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":case"latin1":case"binary":return x(this,e,t,r);case"base64":return _(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const C=4096;function O(e,t,r){let n="";r=Math.min(e.length,r);for(let o=t;o