@nocobase/plugin-license 1.9.0-beta.5 → 1.9.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("ahooks"),require("@nocobase/client"),require("antd")):"function"==typeof define&&define.amd?define("@nocobase/plugin-license",["react","ahooks","@nocobase/client","antd"],t):"object"==typeof exports?exports["@nocobase/plugin-license"]=t(require("react"),require("ahooks"),require("@nocobase/client"),require("antd")):e["@nocobase/plugin-license"]=t(e.react,e.ahooks,e["@nocobase/client"],e.antd)}(self,function(e,t,n,r){return function(){"use strict";var o={772:function(e){e.exports=n},749:function(e){e.exports=t},721:function(e){e.exports=r},156:function(t){t.exports=e}},u={};function i(e){var t=u[e];if(void 0!==t)return t.exports;var n=u[e]={exports:{}};return o[e](n,n.exports,i),n.exports}i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var c={};return!function(){i.r(c),i.d(c,{PluginLicenseClient:function(){return E},default:function(){return A}});var e=i(772),t=i(156),n=i.n(t),r=i(721),o=i(749),u=JSON.parse('{"u2":"@nocobase/plugin-license"}');function a(){var t=(0,e.useApp)();return function(e){return t.i18n.t(e,{ns:[u.u2,"client"]})}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t,n,r,o,u,i){try{var c=e[u](i),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function f(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var u=e.apply(t,n);function i(e){s(u,r,o,i,c,"next",e)}function c(e){s(u,r,o,i,c,"throw",e)}i(void 0)})}}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var u=[],i=!0,c=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(u.push(n.value),!t||u.length!==t);i=!0);}catch(e){c=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(c)throw r}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return l(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){var n,r,o,u,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function c(u){return function(c){var a=[u,c];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}var b=r.Typography.Paragraph;function d(){var u,i=(0,e.useAPIClient)(),c=p((0,t.useState)(!1),2),a=c[0],l=c[1],s=p((0,t.useState)(""),2),d=s[0],v=s[1],h=(u=f(function(){return y(this,function(e){return l(!0),[2,i.request({url:"/license:instance-id",method:"GET"}).then(function(e){var t;return null==e||null==(t=e.data)?void 0:t.data}).finally(function(){l(!1)})]})}),function(){return u.apply(this,arguments)});return(0,o.useAsyncEffect)(f(function(){return y(this,function(e){switch(e.label){case 0:return[4,h()];case 1:return v(e.sent()),[2]}})}),[]),n().createElement(r.Spin,{spinning:a},n().createElement(b,{copyable:!0,ellipsis:!0},d))}var v=function(){var n,o=(0,e.useAPIClient)(),u=p((0,t.useState)(!1),2),i=u[0],c=u[1],l=(0,e.useFormBlockContext)(),s=a(),b=(n=f(function(e){return y(this,function(t){switch(t.label){case 0:c(!0),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,o.request({url:"/license:license-key",method:"POST",data:{licenseKey:e}})];case 2:return t.sent(),c(!1),r.message.success(s("License key saved successfully, please re-run the plugin installation.")),[3,4];case 3:return t.sent(),c(!1),[3,4];case 4:return[2]}})}),function(e){return n.apply(this,arguments)});return{loading:i,onClick:f(function(){var e,t,n;return y(this,function(r){switch(r.label){case 0:return[4,null==(e=l.form)?void 0:e.validate()];case 1:return r.sent(),[4,b(null==(n=l.form)||null==(t=n.values)?void 0:t.licenseKey)];case 2:return r.sent(),[2]}})})}},h=function(u){var i=p((0,t.useState)(!1),2),c=i[0],l=i[1],s=(0,e.useAPIClient)(),b=(0,e.useFormBlockContext)(),d=a();return((0,o.useAsyncEffect)(f(function(){var e,t,n,r;return y(this,function(o){switch(o.label){case 0:return[4,s.request({url:"/license:is-exists",method:"GET"})];case 1:return(null==(n=o.sent())||null==(e=n.data)?void 0:e.data)&&(null==(r=b.form)||r.setFieldState("footer",function(e){e.visible=!1})),l(null==n||null==(t=n.data)?void 0:t.data),[2]}})}),[]),c)?n().createElement(n().Fragment,null,d("License key has been set"),"\xa0",n().createElement(r.Button,{onClick:function(){var e;l(!1),null==(e=b.form)||e.setFieldState("footer",function(e){e.visible=!0})}},d("Change key"))):n().createElement(r.Input.TextArea,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({rows:4},u))};function m(){var t=a(),o={type:"void","x-decorator":"FormBlockProvider","x-decorator-props":{dataSource:"main",collection:"users"},properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useFormBlockProps",properties:{label:{type:"string",title:t("Instance ID"),"x-component":"InstanceId","x-decorator":"FormItem"},licenseKey:{type:"string",title:t("License key"),required:!0,"x-component":"TextArea","x-decorator":"FormItem","x-component-props":{placeholder:t("Enter license key")}},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{submit:{title:'{{t("Submit")}}',"x-component":"Action","x-use-component-props":"useSubmitProps","x-component-props":{type:"primary"}}}}}}}};return n().createElement(r.Card,{bordered:!1},n().createElement(e.SchemaComponent,{scope:{useSubmitProps:v},components:{InstanceId:d,TextArea:h},schema:{type:"void",properties:{form:o}}}))}function g(e,t,n,r,o,u,i){try{var c=e[u](i),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function x(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var u=e.apply(t,n);function i(e){g(u,r,o,i,c,"next",e)}function c(e){g(u,r,o,i,c,"throw",e)}i(void 0)})}}function S(e,t,n){return(S=P()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&O(o,n.prototype),o}).apply(null,arguments)}function w(e){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function O(e,t){return(O=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function k(e){var t="function"==typeof Map?new Map:void 0;return(k=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return S(e,arguments,w(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),O(n,e)})(e)}function P(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(P=function(){return!!e})()}function j(e,t){var n,r,o,u,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function c(u){return function(c){var a=[u,c];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}var E=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=w(e),function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,P()?Reflect.construct(e,t||[],w(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&O(n,e),t=[{key:"afterAdd",value:function(){return x(function(){return j(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return x(function(){return j(this,function(e){return[2]})})()}},{key:"load",value:function(){var e=this;return x(function(){return j(this,function(t){return e.app.pluginSettingsManager.add("license-settings",{title:"{{t(".concat(JSON.stringify("License settings"),", { ns: ['").concat(u.u2,"', 'client'], nsMode: 'fallback' })}}"),icon:"SolutionOutlined",Component:m,aclSnippet:"pm.license-settings"}),[2]})})()}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(k(e.Plugin)),A=E}(),c}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("ahooks"),require("@nocobase/client"),require("@ant-design/icons"),require("antd")):"function"==typeof define&&define.amd?define("@nocobase/plugin-license",["react","ahooks","@nocobase/client","@ant-design/icons","antd"],t):"object"==typeof exports?exports["@nocobase/plugin-license"]=t(require("react"),require("ahooks"),require("@nocobase/client"),require("@ant-design/icons"),require("antd")):e["@nocobase/plugin-license"]=t(e.react,e.ahooks,e["@nocobase/client"],e["@ant-design/icons"],e.antd)}(self,function(e,t,n,r,o){return function(){"use strict";var i={482:function(e){e.exports=r},772:function(e){e.exports=n},749:function(e){e.exports=t},721:function(e){e.exports=o},156:function(t){t.exports=e}},u={};function c(e){var t=u[e];if(void 0!==t)return t.exports;var n=u[e]={exports:{}};return i[e](n,n.exports,c),n.exports}c.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return c.d(t,{a:t}),t},c.d=function(e,t){for(var n in t)c.o(t,n)&&!c.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},c.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},c.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return!function(){c.r(a),c.d(a,{PluginLicenseClient:function(){return C},default:function(){return A}});var e=c(772),t=c(156),n=c.n(t),r=c(721),o=c(749),i=JSON.parse('{"u2":"@nocobase/plugin-license"}');function u(){var t=(0,e.useApp)();return function(e){return t.i18n.t(e,{ns:[i.u2,"client"]})}}var l=c(482);function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function f(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function p(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){f(i,r,o,u,c,"next",e)}function c(e){f(i,r,o,u,c,"throw",e)}u(void 0)})}}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],u=!0,c=!1;try{for(o=o.call(e);!(u=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);u=!0);}catch(e){c=!0,r=e}finally{try{u||null==o.return||o.return()}finally{if(c)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){var a=[i,c];if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}var b=function(e){var t=e.text,n=e.onSuccess,r=e.onError;if(!navigator.clipboard){var o=document.createElement("textarea");o.value=t,o.style.top="0",o.style.left="0",o.style.position="fixed",document.body.appendChild(o),o.focus(),o.select();try{document.execCommand("copy"),null==n||n()}catch(e){null==r||r()}document.body.removeChild(o);return}navigator.clipboard.writeText(t).then(function(){null==n||n()}).catch(function(e){console.error(e),null==r||r()})};function v(){var o,i=(0,e.useAPIClient)(),c=y((0,t.useState)(!1),2),a=c[0],s=c[1],f=y((0,t.useState)(""),2);f[0],f[1];var v=u(),h=(o=p(function(){return d(this,function(e){return s(!0),[2,i.request({url:"/license:instance-id",method:"GET"}).then(function(e){var t;return null==e||null==(t=e.data)?void 0:t.data}).finally(function(){s(!1)})]})}),function(){return o.apply(this,arguments)});return n().createElement(r.Button,{onClick:p(function(){return d(this,function(e){switch(e.label){case 0:return[4,h()];case 1:return b({text:e.sent(),onSuccess:function(){r.message.success(v("Copied"))},onError:function(){r.message.error(v("Failed to copy, please open ./storage/.license/instance-id and copy it"))}}),[2]}})}),loading:a,icon:n().createElement(l.CopyOutlined,null),type:"link"},v("Copy"))}var h=function(){var n,o=(0,e.useAPIClient)(),i=y((0,t.useState)(!1),2),c=i[0],a=i[1],l=(0,e.useFormBlockContext)(),s=u(),f=(n=p(function(e){return d(this,function(t){switch(t.label){case 0:a(!0),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,o.request({url:"/license:license-key",method:"POST",data:{licenseKey:e}})];case 2:return t.sent(),a(!1),r.message.success(s("License key saved successfully, please re-run the plugin installation.")),[3,4];case 3:return t.sent(),a(!1),[3,4];case 4:return[2]}})}),function(e){return n.apply(this,arguments)});return{loading:c,onClick:p(function(){var e,t,n;return d(this,function(r){switch(r.label){case 0:return[4,null==(e=l.form)?void 0:e.validate()];case 1:return r.sent(),[4,f(null==(n=l.form)||null==(t=n.values)?void 0:t.licenseKey)];case 2:return r.sent(),[2]}})})}},m=function(i){var c=y((0,t.useState)(!1),2),a=c[0],l=c[1],s=(0,e.useAPIClient)(),f=(0,e.useFormBlockContext)(),b=u();return((0,o.useAsyncEffect)(p(function(){var e,t,n,r;return d(this,function(o){switch(o.label){case 0:return[4,s.request({url:"/license:is-exists",method:"GET"})];case 1:return(null==(n=o.sent())||null==(e=n.data)?void 0:e.data)&&(null==(r=f.form)||r.setFieldState("footer",function(e){e.visible=!1})),l(null==n||null==(t=n.data)?void 0:t.data),[2]}})}),[]),a)?n().createElement(n().Fragment,null,b("License key has been set"),"\xa0",n().createElement(r.Button,{onClick:function(){var e;l(!1),null==(e=f.form)||e.setFieldState("footer",function(e){e.visible=!0})}},b("Change key"))):n().createElement(r.Input.TextArea,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({rows:4},i))};function g(){var t=u(),o={type:"void","x-decorator":"FormBlockProvider","x-decorator-props":{dataSource:"main",collection:"users"},properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useFormBlockProps",properties:{label:{type:"string",title:t("Instance ID"),"x-component":"InstanceId","x-decorator":"FormItem"},licenseKey:{type:"string",title:t("License key"),required:!0,"x-component":"TextArea","x-decorator":"FormItem","x-component-props":{placeholder:t("Enter license key")}},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{submit:{title:'{{t("Submit")}}',"x-component":"Action","x-use-component-props":"useSubmitProps","x-component-props":{type:"primary"}}}}}}}};return n().createElement(r.Card,{bordered:!1},n().createElement(e.SchemaComponent,{scope:{useSubmitProps:h},components:{InstanceId:v,TextArea:m},schema:{type:"void",properties:{form:o}}}))}function x(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function S(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){x(i,r,o,u,c,"next",e)}function c(e){x(i,r,o,u,c,"throw",e)}u(void 0)})}}function w(e,t,n){return(w=j()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&k(o,n.prototype),o}).apply(null,arguments)}function O(e){return(O=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function k(e,t){return(k=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function P(e){var t="function"==typeof Map?new Map:void 0;return(P=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return w(e,arguments,O(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),k(n,e)})(e)}function j(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(j=function(){return!!e})()}function E(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){var a=[i,c];if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}var C=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=O(e),function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,j()?Reflect.construct(e,t||[],O(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&k(n,e),t=[{key:"afterAdd",value:function(){return S(function(){return E(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return S(function(){return E(this,function(e){return[2]})})()}},{key:"load",value:function(){var e=this;return S(function(){return E(this,function(t){return e.app.pluginSettingsManager.add("license-settings",{title:"{{t(".concat(JSON.stringify("License settings"),", { ns: ['").concat(i.u2,"', 'client'], nsMode: 'fallback' })}}"),icon:"SolutionOutlined",Component:g,aclSnippet:"pm.license-settings"}),[2]})})()}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(P(e.Plugin)),A=C}(),a}()});
|
package/dist/externalVersion.js
CHANGED
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
11
|
"react": "18.2.0",
|
|
12
|
-
"@nocobase/client": "1.9.0-beta.
|
|
12
|
+
"@nocobase/client": "1.9.0-beta.6",
|
|
13
13
|
"antd": "5.24.2",
|
|
14
14
|
"ahooks": "3.7.8",
|
|
15
|
-
"@
|
|
16
|
-
"@nocobase/
|
|
15
|
+
"@ant-design/icons": "5.6.1",
|
|
16
|
+
"@nocobase/server": "1.9.0-beta.6",
|
|
17
|
+
"@nocobase/license-kit": "0.2.17"
|
|
17
18
|
};
|
package/dist/locale/en-US.json
CHANGED
|
@@ -6,5 +6,8 @@
|
|
|
6
6
|
"Enter license key": "Enter license key",
|
|
7
7
|
"Invalid license key": "Invalid license key",
|
|
8
8
|
"Change key": "Change key",
|
|
9
|
-
"License key has been set": "License key has been set"
|
|
9
|
+
"License key has been set": "License key has been set",
|
|
10
|
+
"Copied": "Copied",
|
|
11
|
+
"Copy": "Copy",
|
|
12
|
+
"Failed to copy, please open ./storage/.license/instance-id and copy it": "Failed to copy, please open ./storage/.license/instance-id and copy it"
|
|
10
13
|
}
|
package/dist/locale/zh-CN.json
CHANGED
|
@@ -6,5 +6,8 @@
|
|
|
6
6
|
"Enter license key": "输入授权密钥",
|
|
7
7
|
"Invalid license key": "无效的授权密钥",
|
|
8
8
|
"Change key": "更改密钥",
|
|
9
|
-
"License key has been set": "授权密钥已设置"
|
|
9
|
+
"License key has been set": "授权密钥已设置",
|
|
10
|
+
"Copied": "复制成功",
|
|
11
|
+
"Copy": "复制",
|
|
12
|
+
"Failed to copy, please open ./storage/.license/instance-id and copy it": "复制失败,请打开 ./storage/.license/instance-id 并复制"
|
|
10
13
|
}
|
package/dist/server/utils.js
CHANGED
|
@@ -45,14 +45,10 @@ module.exports = __toCommonJS(utils_exports);
|
|
|
45
45
|
var import_fs = __toESM(require("fs"));
|
|
46
46
|
var import_path = __toESM(require("path"));
|
|
47
47
|
var import_child_process = require("child_process");
|
|
48
|
-
let instanceIdIsCreate = false;
|
|
49
48
|
async function getInstanceId() {
|
|
50
49
|
const dir = import_path.default.resolve(process.cwd(), "storage/.license");
|
|
51
50
|
const filePath = import_path.default.resolve(dir, "instance-id");
|
|
52
|
-
|
|
53
|
-
await createInstanceId(true);
|
|
54
|
-
instanceIdIsCreate = true;
|
|
55
|
-
}
|
|
51
|
+
await createInstanceId(true);
|
|
56
52
|
const id = import_fs.default.readFileSync(filePath, "utf-8");
|
|
57
53
|
return id;
|
|
58
54
|
}
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-license",
|
|
3
|
-
"version": "1.9.0-beta.
|
|
3
|
+
"version": "1.9.0-beta.6",
|
|
4
4
|
"main": "dist/server/index.js",
|
|
5
5
|
"displayName": "License settings",
|
|
6
6
|
"displayName.zh-CN": "授权设置",
|
|
7
7
|
"description": "Instance ID and license key settings",
|
|
8
8
|
"description.zh-CN": "实例 ID 和授权密钥设置",
|
|
9
9
|
"devDependencies": {
|
|
10
|
-
"@nocobase/license-kit": "^0.2.
|
|
10
|
+
"@nocobase/license-kit": "^0.2.17"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
13
13
|
"@nocobase/client": "1.x",
|
|
14
14
|
"@nocobase/server": "1.x",
|
|
15
15
|
"@nocobase/test": "1.x"
|
|
16
16
|
},
|
|
17
|
-
"gitHead": "
|
|
17
|
+
"gitHead": "ada5e359a91135cb9baf605c04c5c380f067a046"
|
|
18
18
|
}
|