diff --git a/.github/workflows/close-stale-issues.yaml b/.github/workflows/close-stale-issues.yaml index eece46a3f..e46e9fbe0 100644 --- a/.github/workflows/close-stale-issues.yaml +++ b/.github/workflows/close-stale-issues.yaml @@ -7,6 +7,8 @@ on: jobs: stale: runs-on: ubuntu-latest + # only run this action on `vechain/thor` repository + if: github.repository == 'vechain/thor' permissions: contents: write diff --git a/.github/workflows/qodana-scan.yaml b/.github/workflows/qodana-scan.yaml index cc3300d2f..a3bd636fd 100644 --- a/.github/workflows/qodana-scan.yaml +++ b/.github/workflows/qodana-scan.yaml @@ -7,6 +7,8 @@ on: jobs: scan_qodana: + # only run this action on `vechain/thor` repository + if: github.repository == 'vechain/thor' runs-on: ubuntu-latest steps: - name: Checkout code diff --git a/README.md b/README.md index 04f118bc3..99313baff 100644 --- a/README.md +++ b/README.md @@ -191,7 +191,7 @@ volumes: ## API -Once `thor` has started, the online *OpenAPI* doc can be accessed in your browser. e.g. [http://localhost:8669/](http://localhost:8669) by default. +Once `thor` has started, the online *OpenAPI* documentation can be accessed in your browser. e.g. [http://localhost:8669/](http://localhost:8669) by default. [![Thorest](https://raw.githubusercontent.com/vechain/thor/master/thorest.png)](http://localhost:8669/) @@ -201,6 +201,7 @@ A special shout out to following projects: * [Ethereum](https://github.com/ethereum) * [Swagger](https://github.com/swagger-api) +* [Stoplight Elements](https://github.com/stoplightio/elements) ## Contributing diff --git a/api/api.go b/api/api.go index 7ad18d45c..0797ee47f 100644 --- a/api/api.go +++ b/api/api.go @@ -52,15 +52,15 @@ func New( router := mux.NewRouter() - // to serve api doc and swagger-ui + // to serve api docs router.PathPrefix("/doc").Handler( http.StripPrefix("/doc/", http.FileServer(http.FS(doc.FS))), ) - // redirect swagger-ui + // redirect stoplight-ui router.Path("/").HandlerFunc( func(w http.ResponseWriter, req *http.Request) { - http.Redirect(w, req, "doc/swagger-ui/", http.StatusTemporaryRedirect) + http.Redirect(w, req, "doc/stoplight-ui/", http.StatusTemporaryRedirect) }) accounts.New(repo, stater, callGasLimit, forkConfig). diff --git a/api/doc/README.md b/api/doc/README.md index f1458a3e4..2f2c0ee62 100644 --- a/api/doc/README.md +++ b/api/doc/README.md @@ -1 +1,19 @@ -swagger-ui from https://github.com/swagger-api/swagger-ui @v3.17.6 \ No newline at end of file +## Swagger + +swagger-ui from https://github.com/swagger-api/swagger-ui @v5.11.2 +- Created [window-observer.js](swagger-ui/window-observer.js) to remove `Try it out` functionality for subscription endpoints + +```bash +curl https://unpkg.com/swagger-ui-dist@5.11.2/swagger-ui.css > swagger-ui/swagger-ui.css +curl https://unpkg.com/swagger-ui-dist@5.11.2/swagger-ui-bundle.js > swagger-ui/swagger-ui-bundle.js +curl https://unpkg.com/swagger-ui-dist@5.11.2/swagger-ui-standalone-preset.js > swagger-ui/swagger-ui-standalone-preset.js +``` + +## Stoplight +Spotlight UI from https://github.com/stoplightio/elements @v8.0.3 +- Created [window-observer.js](stoplight-ui/window-observer.js) to remove `Send API Request` functionality for subscription endpoints + +```bash +curl https://unpkg.com/@stoplight/elements@8.0.3/styles.min.css > stoplight-ui/styles.min.css +curl https://unpkg.com/@stoplight/elements@8.0.3/web-components.min.js > stoplight-ui/web-components.min.js +``` diff --git a/api/doc/doc.go b/api/doc/doc.go index 4918426ac..30510f685 100644 --- a/api/doc/doc.go +++ b/api/doc/doc.go @@ -11,7 +11,9 @@ import ( "gopkg.in/yaml.v2" ) -//go:embed swagger-ui thor.yaml +// FS embeds the Open API specs and documentation. +// +//go:embed thor.yaml stoplight-ui swagger-ui icons var FS embed.FS var version string diff --git a/api/doc/icons/favicon-16x16.png b/api/doc/icons/favicon-16x16.png new file mode 100644 index 000000000..e4452b720 Binary files /dev/null and b/api/doc/icons/favicon-16x16.png differ diff --git a/api/doc/icons/favicon-32x32.png b/api/doc/icons/favicon-32x32.png new file mode 100644 index 000000000..ff9278cdc Binary files /dev/null and b/api/doc/icons/favicon-32x32.png differ diff --git a/api/doc/icons/favicon-96x96.png b/api/doc/icons/favicon-96x96.png new file mode 100644 index 000000000..ab97da61e Binary files /dev/null and b/api/doc/icons/favicon-96x96.png differ diff --git a/api/doc/stoplight-ui/index.html b/api/doc/stoplight-ui/index.html new file mode 100644 index 000000000..8bd0656ad --- /dev/null +++ b/api/doc/stoplight-ui/index.html @@ -0,0 +1,24 @@ + + +
+ + +>4){case 15:if(2!=(d=255&e[m=m+1|0])>>6||247>6?b+4|0:24,u=u+256&768;case 13:case 12:v<<=6,v|=(31&u)<<6|63&(d=255&e[m=m+1|0]),b=b+7|0,m {var r=n(26548),o=n(92019)(r);e.exports=o},21359:e=>{e.exports=function(e,t,n,r){for(var o=e.length,i=n+(r?1:-1);r?i--:++i>1,c=-7,f=n?o-1:0,d=n?-1:1,p=e[t+f];for(f+=d,i=p&(1<<-c)-1,p>>=-c,c+=s;c>0;i=256*i+e[t+f],f+=d,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=r;c>0;a=256*a+e[t+f],f+=d,c-=8);if(0===i)i=1-u;else{if(i===l)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),i-=u}return(p?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,l,u=8*i-o-1,c=(1<>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,h=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+f>=1?d/l:d*Math.pow(2,1-f))*l>=2&&(a++,l/=2),a+f>=c?(s=0,a=c):a+f>=1?(s=(t*l-1)*Math.pow(2,o),a+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,o),a=0));o>=8;e[n+p]=255&s,p+=h,s/=256,o-=8);for(a=a<{e.exports=function(e){return e!=e}},6840:(e,t,n)=>{var r=n(61049),o=n(47394),i=n(29259),a=n(87035),s=/^\[object .+?Constructor\]$/,l=Function.prototype,u=Object.prototype,c=l.toString,f=u.hasOwnProperty,d=RegExp("^"+c.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!i(e)||o(e))&&(r(e)?d:s).test(a(e))}},24333:(e,t,n)=>{var r=n(53366),o=n(15125);e.exports=function(e){return o(e)&&"[object RegExp]"==r(e)}},8109:(e,t,n)=>{var r=n(70940),o=n(15125);e.exports=function(e){return o(e)&&"[object Set]"==r(e)}},35522:(e,t,n)=>{var r=n(53366),o=n(61158),i=n(15125),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,e.exports=function(e){return i(e)&&o(e.length)&&!!a[r(e)]}},68286:(e,t,n)=>{var r=n(26423),o=n(74716),i=n(23059),a=n(86152),s=n(65798);e.exports=function(e){return"function"==typeof e?e:null==e?i:"object"==typeof e?a(e)?o(e[0],e[1]):r(e):s(e)}},86411:(e,t,n)=>{var r=n(16001),o=n(54248),i=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return o(e);var t=[];for(var n in Object(e))i.call(e,n)&&"constructor"!=n&&t.push(n);return t}},18390:(e,t,n)=>{var r=n(29259),o=n(16001),i=n(62966),a=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return i(e);var t=o(e),n=[];for(var s in e)("constructor"!=s||!t&&a.call(e,s))&&n.push(s);return n}},93401:(e,t,n)=>{var r=n(24303),o=n(67878);e.exports=function(e,t){var n=-1,i=o(e)?Array(e.length):[];return r(e,(function(e,r,o){i[++n]=t(e,r,o)})),i}},26423:(e,t,n)=>{var r=n(37036),o=n(49882),i=n(73477);e.exports=function(e){var t=o(e);return 1==t.length&&t[0][2]?i(t[0][0],t[0][1]):function(n){return n===e||r(n,e,t)}}},74716:(e,t,n)=>{var r=n(88746),o=n(72579),i=n(95041),a=n(21401),s=n(28792),l=n(73477),u=n(33812);e.exports=function(e,t){return a(e)&&s(t)?l(u(e),t):function(n){var a=o(n,e);return void 0===a&&a===t?i(n,e):r(t,a,3)}}},84565:(e,t,n)=>{var r=n(86571),o=n(28582),i=n(15308),a=n(25561),s=n(29259),l=n(18582),u=n(52434);e.exports=function e(t,n,c,f,d){t!==n&&i(n,(function(i,l){if(d||(d=new r),s(i))a(t,n,l,c,e,f,d);else{var p=f?f(u(t,l),i,l+"",t,n,d):void 0;void 0===p&&(p=i),o(t,l,p)}}),l)}},25561:(e,t,n)=>{var r=n(28582),o=n(92175),i=n(6190),a=n(51522),s=n(78725),l=n(79631),u=n(86152),c=n(93746),f=n(73226),d=n(61049),p=n(29259),h=n(97030),m=n(77598),g=n(52434),y=n(63329);e.exports=function(e,t,n,v,b,E,w){var x=g(e,n),T=g(t,n),_=w.get(T);if(_)r(e,n,_);else{var k=E?E(x,T,n+"",e,t,w):void 0,O=void 0===k;if(O){var S=u(T),C=!S&&f(T),A=!S&&!C&&m(T);k=T,S||C||A?u(x)?k=x:c(x)?k=a(x):C?(O=!1,k=o(T,!0)):A?(O=!1,k=i(T,!0)):k=[]:h(T)||l(T)?(k=x,l(x)?k=y(x):p(x)&&!d(x)||(k=s(T))):O=!1}O&&(w.set(T,k),b(k,T,v,E,w),w.delete(T)),r(e,n,k)}}},70618:(e,t,n)=>{var r=n(50343),o=n(13324),i=n(68286),a=n(93401),s=n(27095),l=n(47826),u=n(18477),c=n(23059),f=n(86152);e.exports=function(e,t,n){t=t.length?r(t,(function(e){return f(e)?function(t){return o(t,1===e.length?e[0]:e)}:e})):[c];var d=-1;t=r(t,l(i));var p=a(e,(function(e,n,o){return{criteria:r(t,(function(t){return t(e)})),index:++d,value:e}}));return s(p,(function(e,t){return u(e,t,n)}))}},92602:(e,t,n)=>{var r=n(93759),o=n(95041);e.exports=function(e,t){return r(e,t,(function(t,n){return o(e,n)}))}},93759:(e,t,n)=>{var r=n(13324),o=n(82857),i=n(17297);e.exports=function(e,t,n){for(var a=-1,s=t.length,l={};++a{e.exports=function(e){return function(t){return null==t?void 0:t[e]}}},82952:(e,t,n)=>{var r=n(13324);e.exports=function(e){return function(t){return r(t,e)}}},45169:(e,t,n)=>{var r=n(50343),o=n(77832),i=n(84190),a=n(47826),s=n(51522),l=Array.prototype.splice;e.exports=function(e,t,n,u){var c=u?i:o,f=-1,d=t.length,p=e;for(e===t&&(t=s(t)),n&&(p=r(e,a(n)));++f=l?u:u*("desc"==n[o]?-1:1)}return e.index-t.index}},51522:e=>{e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n{var r=n(13324),o=n(39872);e.exports=function(e,t){return t.length<2?e:r(e,o(t,0,-1))}},37772:(e,t,n)=>{var r=n(51242),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();e.exports=i},52434:e=>{e.exports=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}},52842:e=>{e.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}},52482:e=>{e.exports=function(e){return this.__data__.has(e)}},16909:e=>{e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}},75251:(e,t,n)=>{var r=n(86532),o=n(97787)(r);e.exports=o},97787:e=>{var t=Date.now;e.exports=function(e){var n=0,r=0;return function(){var o=t(),i=16-(o-r);if(r=o,i>0){if(++n>=800)return arguments[0]}else n=0;return e.apply(void 0,arguments)}}},15243:(e,t,n)=>{var r=n(80235);e.exports=function(){this.__data__=new r,this.size=0}},72858:e=>{e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},4417:e=>{e.exports=function(e){return this.__data__.get(e)}},8605:e=>{e.exports=function(e){return this.__data__.has(e)}},71418:(e,t,n)=>{var r=n(80235),o=n(10326),i=n(96738);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var a=n.__data__;if(!o||a.length<199)return a.push([e,t]),this.size=++n.size,this;n=this.__data__=new i(a)}return n.set(e,t),this.size=n.size,this}},66024:e=>{e.exports=function(e,t,n){for(var r=n-1,o=e.length;++r-1},Kn.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},qn.prototype.clear=function(){this.size=0,this.__data__={hash:new zn,map:new(Tn||Kn),string:new zn}},qn.prototype.delete=function(e){var t=si(this,e).delete(e);return this.size-=t?1:0,t},qn.prototype.get=function(e){return si(this,e).get(e)},qn.prototype.has=function(e){return si(this,e).has(e)},qn.prototype.set=function(e,t){var n=si(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Vn.prototype.add=Vn.prototype.push=function(e){return this.__data__.set(e,a),this},Vn.prototype.has=function(e){return this.__data__.has(e)},Wn.prototype.clear=function(){this.__data__=new Kn,this.size=0},Wn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Wn.prototype.get=function(e){return this.__data__.get(e)},Wn.prototype.has=function(e){return this.__data__.has(e)},Wn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Kn){var r=n.__data__;if(!Tn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new qn(r)}return n.set(e,t),this.size=n.size,this};var cr=No(vr),fr=No(br,!0);function dr(e,t){var n=!0;return cr(e,(function(e,r,o){return n=!!t(e,r,o)})),n}function pr(e,t,n){for(var r=-1,i=e.length;++r0&&n(s)?t>1?mr(s,t-1,n,r,o):Rt(o,s):r||(o[o.length]=s)}return o}var gr=Ro(),yr=Ro(!0);function vr(e,t){return e&&gr(e,t,Ps)}function br(e,t){return e&&yr(e,t,Ps)}function Er(e,t){return Ct(t,(function(t){return Qa(e[t])}))}function wr(e,t){for(var n=0,r=(t=yo(t,e)).length;null!=e&&n