{"version":3,"sources":["webpack:///./node_modules/core-js/modules/es6.array.find-index.js","webpack:///./src/views/common/Api.vue?012b","webpack:///./src/views/common/Api.vue","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","_c","_self","_setupProxy","staticClass","_m","staticStyle","attrs","padding","_v","model","value","isApiEnabled","callback","$$v","expression","token","apiToken","_s","_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,8ECAIW,EAAS,WAAkB,IAAIC,EAAIL,KAAKM,EAAGD,EAAIE,MAAMD,GAAUD,EAAIE,MAAMC,YAAY,OA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UAAWyB,EAAS5B,KAAKG,YAE7B,EAAK0B,KAAK,EAAM,eAAgBD,EAAS5B,KAAK8B,SAC9C,EAAKR,oBAAoB,YAAa,qCAEzCa,OAAM,SAAAC,GACH,EAAKC,uBAAuBD,EAAO,0BAG/CE,MAGRlD,gBAAe,WAAG,WACd,GAAInC,KAAKwD,kBAAmB,CACxB,IAAIT,EAAO,CACP4C,WAAY3F,KAAKqC,gBACjBkD,kBAAmBT,KAAKU,UAAUxF,KAAKyF,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,YAAa,qCAEzCa,OAAM,SAAAC,GACH,EAAKC,uBAAuBD,EAAO,2BAInDxC,mBAAkB,SAACgD,GAAY,WAC3B3F,KAAK8F,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,eAAezC,WAAU,SAAAqG,GAAC,OAAIA,IAAMR,KACzD,EAAKpD,eAAe6D,OAAOF,EAAW,GACtC,EAAK7B,oBAAoB,YAAa,qCAEzCa,OAAM,SAAAC,GACH,EAAKC,uBAAuBD,EAAO,4BAE5CD,OAAM,kBC/ImQ,I,wBCQpRmB,EAAY,eACd,EACAjG,EACAwC,GACA,EACA,KACA,WACA,MAIa,aAAAyD,E","file":"js/chunk-ae3ef990.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=5faf6c9a&prod&scoped=true&lang=css&\"","var render = function render(){var _vm=this,_c=_vm._self._c,_setup=_vm._self._setupProxy;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(100vh - 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)])\n}\nvar staticRenderFns = [function (){var _vm=this,_c=_vm._self._c,_setup=_vm._self._setupProxy;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}]\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=5faf6c9a&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=5faf6c9a&prod&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 \"5faf6c9a\",\n null\n \n)\n\nexport default component.exports"],"sourceRoot":""}