{"version":3,"sources":["webpack:///./node_modules/core-js/modules/es6.array.find-index.js","webpack:///./src/views/common/Api.vue?f258","webpack:///./src/views/common/Api.vue?7bac","webpack:///./src/scripts/common/api.js","webpack:///./src/scripts/common/api.js?de98","webpack:///./src/views/common/Api.vue?cb72"],"names":["$export","$find","KEY","forced","Array","P","F","findIndex","callbackfn","this","arguments","length","undefined","render","_vm","_h","$createElement","_c","_self","staticClass","_m","staticStyle","attrs","padding","_v","model","value","callback","$$v","isApiEnabled","expression","token","_s","apiToken","_e","on","$event","copyToClipboard","enabledApi","nativeOn","type","indexOf","_k","keyCode","key","addRestrictions","apply","domainOrIpInput","domainOrIpInputIsValid","domainOrIpList","_l","item","itemIndex","removeRestrictions","staticRenderFns","extends","base","data","endpoint","clientId","secretKey","firstLoad","watch","mounted","getApiInfomations","methods","validDomainOrIP","isValidDomain","test","isValidIP","el","$","val","show","select","focus","document","execCommand","hide","notificationSuccess","api","baseRequest","SETTINGS_DEVELOPER_API","GET_API_INFO","then","response","$set","enabled","JSON","parse","restrictions","$nextTick","catch","error","processCatchApiRequest","actionUpdate","isEnable","deviceInformation","stringify","getInformationClient","ENABLE_API","domainOrIp","ADD_RESTRICTIONS","push","$confirm","confirmButtonText","cancelButtonText","REMOVE_RESTRICTIONS","indexItem","x","splice","component"],"mappings":"kHAEA,IAAIA,EAAU,EAAQ,QAClBC,EAAQ,EAAQ,OAAR,CAA4B,GACpCC,EAAM,YACNC,GAAS,EAETD,IAAO,IAAIE,MAAM,GAAGF,IAAK,WAAcC,GAAS,KACpDH,EAAQA,EAAQK,EAAIL,EAAQM,EAAIH,EAAQ,QAAS,CAC/CI,UAAW,SAAmBC,GAC5B,OAAOP,EAAMQ,KAAMD,EAAYE,UAAUC,OAAS,EAAID,UAAU,QAAKE,MAGzE,EAAQ,OAAR,CAAiCV,I,oCCbjC,W,kECAA,IAAIW,EAAS,WAAa,IAAIC,EAAIL,KAASM,EAAGD,EAAIE,eAAmBC,EAAGH,EAAII,MAAMD,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AAU0B,EAAS5B,KAAKE,SACxBC,UAAWyB,EAAS5B,KAAKG,YAE7B,EAAK0B,KAAK,EAAM,eAAgBD,EAAS5B,KAAK8B,SAC9C,EAAKR,oBAAoB,YAAzB,qCAEHa,OAAM,SAAAC,GACH,EAAKC,uBAAuBD,EAAO,0BAG/CE,MAGRlD,gBAxEK,WAwEa,WACd,GAAIpC,KAAKyD,kBAAmB,CACxB,IAAIT,EAAO,CACP4C,WAAY5F,KAAKsC,gBACjBkD,kBAAmBT,KAAKU,UAAUzF,KAAK0F,yBAE3CnB,OAAIC,YAAYC,OAAuBoB,iBAAkB7C,GACpD2B,MAAK,WACF,EAAKnC,eAAesD,KAAK,EAAKxD,iBAC9B,EAAKuC,KAAK,EAAM,kBAAmB,IACnC,EAAKA,KAAK,EAAM,0BAA0B,GAC1C,EAAKP,oBAAoB,YAAzB,qCAEHa,OAAM,SAAAC,GACH,EAAKC,uBAAuBD,EAAO,2BAInDxC,mBA1FK,SA0FcgD,GAAY,WAC3B5F,KAAK+F,SAAS,sDAAuD,UAAW,CAC5EC,kBAAmB,KACnBC,iBAAkB,SAClBlE,KAAM,YACP4C,MAAK,WACJ,IAAI3B,EAAO,CACP4C,WAAYA,EACZJ,kBAAmBT,KAAKU,UAAU,EAAKC,yBAE3CnB,OAAIC,YAAYC,OAAuByB,oBAAqBlD,GACvD2B,MAAK,WACF,IAAIwB,EAAY,EAAK3D,eAAe1C,WAAU,SAAAsG,GAAC,OAAIA,IAAMR,KACzD,EAAKpD,eAAe6D,OAAOF,EAAW,GACtC,EAAK7B,oBAAoB,YAAzB,qCAEHa,OAAM,SAAAC,GACH,EAAKC,uBAAuBD,EAAO,4BAE5CD,OAAM,kBC/ImQ,I,wBCQpRmB,EAAY,eACd,EACAlG,EACAyC,GACA,EACA,KACA,WACA,MAIa,aAAAyD,E","file":"js/chunk-64f10520.js","sourcesContent":["'use strict';\n// 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined)\nvar $export = require('./_export');\nvar $find = require('./_array-methods')(6);\nvar KEY = 'findIndex';\nvar forced = true;\n// Shouldn't skip holes\nif (KEY in []) Array(1)[KEY](function () { forced = false; });\n$export($export.P + $export.F * forced, 'Array', {\n findIndex: function findIndex(callbackfn /* , that = undefined */) {\n return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\nrequire('./_add-to-unscopables')(KEY);\n","export * from \"-!../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--6-oneOf-1-0!../../../node_modules/css-loader/index.js??ref--6-oneOf-1-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src/index.js??ref--6-oneOf-1-2!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Api.vue?vue&type=style&index=0&id=f491452e&scoped=true&lang=css&\"","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"fixed-rental-container d-flex flex-column\"},[_vm._m(0),_c('div',{staticStyle:{\"background-color\":\"#f5f5f5\"}},[_c('input',{staticClass:\"position-fixed top-0 left-0\",staticStyle:{\"display\":\"none\",\"color\":\"#fff\",\"z-index\":\"99999\",\"opacity\":\"0\"},attrs:{\"type\":\"text\",\"id\":\"apiCopyInput\"}}),_c('el-card',{staticStyle:{\"margin\":\"1rem\"},attrs:{\"body-style\":{ padding: '0px' },\"shadow\":\"never\"}},[_c('div',{staticClass:\"d-flex flex-column flex-fill\"},[_c('VuePerfectScrollbar',{staticStyle:{\"height\":\"calc(100dvh - 9.6rem)\",\"background-color\":\"white\",\"padding\":\"2rem\"}},[_c('div',{staticClass:\"mb-5\"},[_c('h5',[_vm._v(\"Control image with iRender APIs\")]),_c('div',{staticStyle:{\"line-height\":\"1.4rem\"}},[_c('p',{staticClass:\"text-muted\"},[_vm._v(\"\\n We provide the controls as Restful API. It's easy and convenient to integrate interaction with iRender from your application.\"),_c('br'),_vm._v(\"You can easily send API requests to boot the server image, shut it down, etc.\"),_c('br'),_vm._v(\"\\n Don't worry. It won't cost you any extra money to use these APIs.\\n \")])]),_c('hr'),_c('div',{staticClass:\"d-flex align-items-center\"},[_c('div',[_c('el-switch',{staticClass:\"m-0\",model:{value:(_vm.isApiEnabled),callback:function ($$v) {_vm.isApiEnabled=$$v},expression:\"isApiEnabled\"}})],1),_c('div',{staticClass:\"ml-3 pt-1 flex-fill text-muted\"},[_vm._v(\"\\n Enable access to iRender APIs\\n \")])]),(_vm.isApiEnabled)?_c('div',{staticClass:\"mt-3\",staticStyle:{\"max-width\":\"50rem\"}},[_c('div',{staticClass:\"text-muted\"},[_c('p',[_vm._v(\"To make a REST API request, you combine the HTTP \"),_c('code',[_vm._v(\"GET\")]),_vm._v(\", \"),_c('code',[_vm._v(\"POST\")]),_vm._v(\", \"),_c('code',[_vm._v(\"PUT\")]),_vm._v(\", \"),_c('code',[_vm._v(\"PATCH\")]),_vm._v(\", or \"),_c('code',[_vm._v(\"DELETE\")]),_vm._v(\" method, the URL to the API service, the URI to a resource to query, submit data to, update, or delete, and one or more \"),_c('strong',[_vm._v(\"HTTP request headers\")]),_vm._v(\".\")])]),_c('table',{staticClass:\"table table-bordered table-sm text-muted\"},[_c('tbody',[_c('tr',[_c('td',{staticClass:\"text-nowrap\",staticStyle:{\"width\":\"1%\"}},[_vm._v(\"\\n 1.The URL to the API service\\n \")]),_c('td',{staticClass:\"pl-5\"},[_vm._v(\"\\n https://api-m.gpuhub.net\\n \")])]),_c('tr',[_c('td',{staticClass:\"text-nowrap\",staticStyle:{\"width\":\"1%\",\"vertical-align\":\"middle\"}},[_vm._v(\"2.API Token\")]),_c('td',{staticClass:\"pl-5 text-nowrap\",staticStyle:{\"vertical-align\":\"middle\"}},[(_vm.token.apiToken)?_c('span',{staticClass:\"text-nowrap\"},[_vm._v(_vm._s(_vm.token.apiToken))]):_vm._e(),_c('el-button',{staticClass:\"m-0 ml-3 p-2\",attrs:{\"size\":\"small\",\"type\":\"primary\",\"round\":\"\"},on:{\"click\":function($event){return _vm.copyToClipboard(_vm.token.apiToken)}}},[_c('i',{staticClass:\"el-icon-copy-document\"}),_vm._v(\" Copy\\n \")]),_c('el-button',{staticClass:\"m-0 ml-1 p-2\",attrs:{\"size\":\"small\",\"type\":\"primary\",\"round\":\"\"},on:{\"click\":function($event){return _vm.enabledApi(true)}}},[_c('i',{staticClass:\"el-icon-refresh\"}),_vm._v(\" Refresh\\n \")])],1)])])]),_c('div',{staticClass:\"mt-5\"},[_c('h5',[_vm._v(\"Domains & IP address restrictions\")]),_c('div',[_c('p',{staticClass:\"mb-2\"},[_vm._v(\"We only accept requests from domains or IPs in the list below.\")]),_c('div',{staticClass:\"d-flex align-items-start\"},[_c('div',{staticClass:\"mr-2\"},[_c('el-input',{staticStyle:{\"width\":\"20rem\"},attrs:{\"placeholder\":\"Please input domain or IP address\",\"size\":\"small\"},nativeOn:{\"keyup\":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,\"enter\",13,$event.key,\"Enter\")){ return null; }return _vm.addRestrictions.apply(null, arguments)}},model:{value:(_vm.domainOrIpInput),callback:function ($$v) {_vm.domainOrIpInput=$$v},expression:\"domainOrIpInput\"}}),(!_vm.domainOrIpInputIsValid)?_c('div',{staticClass:\"text-danger\",staticStyle:{\"font-size\":\"80%\",\"margin-top\":\"3px\"}},[_c('i',[_vm._v(\"Please input a valid domain or IP address\")])]):_vm._e()],1),_c('div',[_c('el-button',{attrs:{\"type\":\"primary\",\"size\":\"small\",\"disabled\":_vm.domainOrIpInput === ''},on:{\"click\":_vm.addRestrictions}},[_c('i',{staticClass:\"el-icon-circle-plus-outline\"}),_vm._v(\" Add records\\n \")])],1)]),(_vm.domainOrIpList !== null && _vm.domainOrIpList.length > 0)?_c('div',{staticClass:\"mt-4\"},_vm._l((_vm.domainOrIpList),function(item,itemIndex){return _c('el-tag',{key:itemIndex,staticClass:\"mr-2 mb-2\",attrs:{\"closable\":\"\"},on:{\"close\":function($event){return _vm.removeRestrictions(item)}}},[_vm._v(\"\\n \"+_vm._s(item)+\"\\n \")])}),1):_vm._e()])]),_c('div',{staticClass:\"mt-5\"},[_c('h5',[_vm._v(\"API documentation\")]),_c('div',[_c('p',[_vm._v(\"To use the iRender APIs, please refer to the APIs documentation at the link below. The reference includes detailed API parameters and provides the Test tool.\")]),_c('p',[_vm._v(\"Documentation: \"),_c('a',{attrs:{\"target\":\"_blank\",\"href\":\"https://docs.gpuhub.net/system-features/irender-apis/\"}},[_vm._v(\"https://docs.gpuhub.net/system-features/irender-apis/\")])]),_c('p',[_vm._v(\"API test and more: \"),_c('a',{attrs:{\"target\":\"_blank\",\"href\":\"https://api-m.gpuhub.net/index.html\"}},[_vm._v(\"https://api-m.gpuhub.net/index.html\")])])])])]):_vm._e()])])],1)])],1)])}\nvar staticRenderFns = [function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"d-flex align-items-center\",staticStyle:{\"height\":\"3.5rem\",\"border-bottom\":\"1px solid #e0e0e0\"}},[_c('div',{staticStyle:{\"padding-left\":\"1.5rem\",\"color\":\"#42a5f5\"}},[_c('i',{staticClass:\"el-icon-connection\"}),_c('span',{staticClass:\"ml-2\",staticStyle:{\"font-family\":\"Montserrat\"}},[_vm._v(\"iRender APIs\")])])])}]\n\nexport { render, staticRenderFns }","\r\n// Extend\r\nimport base from '@/scripts/base';\r\n\r\n// Api\r\nimport api from '@/api/baseApi';\r\nimport { API_CALL_STATUS } from \"@/constant/baseConstant\";\r\nimport { SETTINGS_DEVELOPER_API } from \"@/constant/apiSettings\";\r\n\r\nexport default {\r\n extends: base,\r\n data() {\r\n return {\r\n endpoint: 'https://api-m.gpuhub.net',\r\n isApiEnabled: false,\r\n token: {\r\n apiToken: null,\r\n clientId: null,\r\n secretKey: null,\r\n },\r\n domainOrIpInput: '',\r\n domainOrIpInputIsValid: true,\r\n domainOrIpList: [],\r\n firstLoad: true\r\n };\r\n },\r\n watch: {\r\n isApiEnabled() {\r\n this.enabledApi(this.isApiEnabled);\r\n }\r\n },\r\n mounted() {\r\n this.getApiInfomations();\r\n },\r\n methods: {\r\n validDomainOrIP() {\r\n if (this.domainOrIpInput === null || this.domainOrIpInput === '') {\r\n this.domainOrIpInputIsValid = false;\r\n return false;\r\n }\r\n\r\n let isValidDomain = /^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9](?:\\.[a-zA-Z]{2,})+$/.test(this.domainOrIpInput);\r\n let isValidIP = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(this.domainOrIpInput);\r\n if (isValidDomain || isValidIP) {\r\n this.domainOrIpInputIsValid = true;\r\n return true;\r\n }\r\n this.domainOrIpInputIsValid = false;\r\n return false;\r\n },\r\n copyToClipboard(value) {\r\n const el = $('#apiCopyInput');\r\n $('#apiCopyInput').val(value);\r\n $('#apiCopyInput').show();\r\n el.select();\r\n el.focus();\r\n var successful = document.execCommand(\"copy\");\r\n $('#apiCopyInput').hide();\r\n this.notificationSuccess('Copied', 'Copied to clipboard');\r\n },\r\n getApiInfomations() {\r\n api.baseRequest(SETTINGS_DEVELOPER_API.GET_API_INFO, null)\r\n .then((response) => {\r\n //console.log('response', response);\r\n this.$set(this, 'token', {\r\n apiToken: response.data.apiToken,\r\n clientId: response.data.clientId,\r\n secretKey: response.data.secretKey,\r\n });\r\n this.$set(this, 'isApiEnabled', response.data.enabled);\r\n this.$set(this, 'domainOrIpList', JSON.parse(response.data.restrictions));\r\n this.$nextTick(() => {\r\n this.firstLoad = false;\r\n });\r\n })\r\n .catch(error => {\r\n this.$nextTick(() => {\r\n this.firstLoad = false;\r\n });\r\n this.processCatchApiRequest(error, \"Request failed ...\")\r\n });\r\n },\r\n enabledApi(isApiEnabled) {\r\n if (!this.firstLoad) {\r\n const actionUpdate = () => {\r\n let data = {\r\n isEnable: isApiEnabled,\r\n deviceInformation: JSON.stringify(this.getInformationClient())\r\n };\r\n api.baseRequest(SETTINGS_DEVELOPER_API.ENABLE_API, data)\r\n .then((response) => {\r\n this.$set(this, 'token', {\r\n apiToken: response.data.apiToken,\r\n clientId: response.data.clientId,\r\n secretKey: response.data.secretKey,\r\n });\r\n this.$set(this, 'isApiEnabled', response.data.enabled);\r\n this.notificationSuccess('Success !', `iRender APIs settings updated.`);\r\n })\r\n .catch(error => {\r\n this.processCatchApiRequest(error, \"Request failed ...\")\r\n });\r\n };\r\n actionUpdate();\r\n }\r\n },\r\n addRestrictions() {\r\n if (this.validDomainOrIP()) {\r\n let data = {\r\n domainOrIp: this.domainOrIpInput,\r\n deviceInformation: JSON.stringify(this.getInformationClient())\r\n };\r\n api.baseRequest(SETTINGS_DEVELOPER_API.ADD_RESTRICTIONS, data)\r\n .then(() => {\r\n this.domainOrIpList.push(this.domainOrIpInput);\r\n this.$set(this, 'domainOrIpInput', '');\r\n this.$set(this, 'domainOrIpInputIsValid', true);\r\n this.notificationSuccess('Success !', `iRender APIs settings updated.`);\r\n })\r\n .catch(error => {\r\n this.processCatchApiRequest(error, \"Request failed ...\")\r\n });\r\n }\r\n },\r\n removeRestrictions(domainOrIp) {\r\n this.$confirm('This will permanently delete the records. Continue?', 'Warning', {\r\n confirmButtonText: 'OK',\r\n cancelButtonText: 'Cancel',\r\n type: 'warning'\r\n }).then(() => {\r\n let data = {\r\n domainOrIp: domainOrIp,\r\n deviceInformation: JSON.stringify(this.getInformationClient())\r\n };\r\n api.baseRequest(SETTINGS_DEVELOPER_API.REMOVE_RESTRICTIONS, data)\r\n .then(() => {\r\n let indexItem = this.domainOrIpList.findIndex(x => x === domainOrIp);\r\n this.domainOrIpList.splice(indexItem, 1);\r\n this.notificationSuccess('Success !', `iRender APIs settings updated.`);\r\n })\r\n .catch(error => {\r\n this.processCatchApiRequest(error, \"Request failed ...\")\r\n });\r\n }).catch(() => { });\r\n \r\n }\r\n }\r\n}","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/eslint-loader/index.js??ref--13-0!./api.js?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/eslint-loader/index.js??ref--13-0!./api.js?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./Api.vue?vue&type=template&id=f491452e&scoped=true&\"\nimport script from \"@/scripts/common/api.js?vue&type=script&lang=js&\"\nexport * from \"@/scripts/common/api.js?vue&type=script&lang=js&\"\nimport style0 from \"./Api.vue?vue&type=style&index=0&id=f491452e&scoped=true&lang=css&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"f491452e\",\n null\n \n)\n\nexport default component.exports"],"sourceRoot":""}