HEX
Server: Apache/2.4.63 (Unix)
System: Linux TOMS-220NAS 4.4.302+ #86009 SMP Wed Nov 26 18:19:17 CST 2025 x86_64
User: flavio87 (1026)
PHP: 8.3.27
Disabled: NONE
Upload Files
File: //var/packages/MariaDB10/target/ui/mariadb_vue.js
/*! /* Copyright (c) 2003-2024 Synology Inc. All rights reserved. * / */!function(e){var o={};function t(r){if(o[r])return o[r].exports;var s=o[r]={i:r,l:!1,exports:{}};return e[r].call(s.exports,s,s.exports,t),s.l=!0,s.exports}t.m=e,t.c=o,t.d=function(e,o,r){t.o(e,o)||Object.defineProperty(e,o,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,o){if(1&o&&(e=t(e)),8&o)return e;if(4&o&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&o&&"string"!=typeof e)for(var s in e)t.d(r,s,function(o){return e[o]}.bind(null,s));return r},t.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(o,"a",o),o},t.o=function(e,o){return Object.prototype.hasOwnProperty.call(e,o)},t.p="",t(t.s=1)}([function(e,o){e.exports=Vue},function(e,o,t){e.exports=t(2)},function(e,o,t){"use strict";t.r(o);var r=t(0),s=t.n(r);function n(...e){return e.join(":")}var a={created(){this._T=window._T||n,this._TT=window._TT||n}};const i=[{required:!0},{validator:(e,o,t)=>{var r={mixed_case:-1!==o.search("(?=.*[a-z])(?=.*[A-Z])"),included_special_char:-1!==o.search("(?=.*[^A-Za-z0-9])"),included_numeric_char:-1!==o.search("(?=.*[0-9])"),min_length_enable:-1!==o.search("(?=.{10,})")},s=[],n="";for(n in r)!1===r[n]&&("min_length_enable"===n?s.push(_T("passwd",n)+" 10"):s.push(_T("passwd",n)),!1);if(0!==s.length)return t(new Error(_T("passwd","passwd_strength_warn")+s.join(", ")+_T("common","period")));t()}}];function l(e,o){return"ui"===e?_TT("SYNO.SDS.MARIADB10.Instance",e,o):_T(e,o)}function d(e,o){switch(e){case 1e3:case 1001:return _T("error","error_unknown");case 1002:return l("ui","db_connect_error");case 1003:return String.format(l("ui","container_port_conflict"),o);default:return l("error","error_unknown")}}function p(e,o,t,r,s,n,a,i){var l,d="function"==typeof e?e.options:e;if(o&&(d.render=o,d.staticRenderFns=t,d._compiled=!0),r&&(d.functional=!0),n&&(d._scopeId="data-v-"+n),a?(l=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),s&&s.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},d._ssrRegister=l):s&&(l=i?function(){s.call(this,(d.functional?this.parent:this).$root.$options.shadowRoot)}:s),l)if(d.functional){d._injectStyles=l;var p=d.render;d.render=function(e,o){return l.call(o),p(e,o)}}else{var c=d.beforeCreate;d.beforeCreate=c?[].concat(c,l):[l]}return{exports:e,options:d}}var c=p({mixins:[a],data(){return{rules:{password:i,passwordConfirm:{required:!0,validator:this.passwordConfirmCheck}},password:"",passwordConfirm:""}},methods:{async save(){return!!await this.$refs.form.validate()&&(this.$refs.window.setStatusBusy(null,_T("common","applying")),await this.applyPassword(),this.$refs.window.clearStatus(),this.$refs.window.doClose(),!0)},async cancel(){return this.close()},close(){return this.$refs.form.resetFields(),this.$refs.window.doClose(),!0},async applyPassword(){try{await synowebapi.promises.request({api:"SYNO.MariaDB10.lib",method:"reset_root_password",version:1,encryption:["password"],params:{password:this.password}})}catch(e){this.$refs.window.getToastBox(d(e.code))}},passwordConfirmCheck(e,o,t){if(o!==this.password)return t(new Error(_T("error","error_repswd")));t()}}},(function(){var e=this,o=e.$createElement,t=e._self._c||o;return t("v-modal-window",{ref:"window",attrs:{title:e._TT("SYNO.SDS.MARIADB10.Instance","ui","reset_root_password"),beforeClose:e.cancel,width:"465",height:"250"}},[t("v-panel",{attrs:{confirm:e.save,cancel:e.cancel},scopedSlots:e._u([{key:"body",fn:function(){return[t("v-form",{ref:"form",attrs:{rules:e.rules}},[t("v-form-item",{attrs:{prop:"password",label:e._TT("SYNO.SDS.MARIADB10.Instance","ui","db_new_password")}},[t("v-input",{attrs:{name:"password",type:"password"},model:{value:e.password,callback:function(o){e.password=o},expression:"password"}})],1),e._v(" "),t("v-form-item",{attrs:{prop:"passwordConfirm",label:e._TT("SYNO.SDS.MARIADB10.Instance","ui","db_confirm_password")}},[t("v-input",{attrs:{name:"passwordConfirm",type:"password"},model:{value:e.passwordConfirm,callback:function(o){e.passwordConfirm=o},expression:"passwordConfirm"}})],1)],1)]},proxy:!0}])})],1)}),[],!1,null,null,null).exports,u=p({mixins:[a],data:()=>({rootPassword:""}),methods:{async login(){this.$refs.window.setStatusBusy();const e=await this.loginAndGetUserInfo();return this.$refs.window.clearStatus(),void 0!==e&&void 0!==e.user&&(this.$emit("root-logged-in",this.rootPassword,e.user),this.$refs.window.doClose(),!0)},async cancel(){return this.$refs.window.doClose(),!0},async loginAndGetUserInfo(){try{return await synowebapi.promises.request({api:"SYNO.MariaDB10.lib",method:"get_user",version:1,encryption:["dbpass"],params:{dbpass:this.rootPassword}})}catch(e){this.$refs.window.getToastBox(d(e.code))}}}},(function(){var e=this,o=e.$createElement,t=e._self._c||o;return t("v-modal-window",{ref:"window",attrs:{title:e._TT("SYNO.SDS.MARIADB10.Instance","ui","db_login"),beforeClose:e.cancel,width:"500",height:"210"}},[t("v-panel",{attrs:{confirm:e.login,cancel:e.cancel},scopedSlots:e._u([{key:"body",fn:function(){return[t("v-form",{ref:"form",attrs:{rules:e.rules}},[t("v-form-item",{attrs:{prop:"rootPassword",label:e._TT("SYNO.SDS.MARIADB10.Instance","ui","db_login")}},[t("v-input",{attrs:{name:"rootPassword",type:"password"},model:{value:e.rootPassword,callback:function(o){e.rootPassword=o},expression:"rootPassword"}})],1)],1)]},proxy:!0}])})],1)}),[],!1,null,null,null).exports,f=p({mixins:[a],props:{users:{type:Array,default:()=>[]},rootPassword:{type:String,default:""}},data(){return{rules:{password:i,passwordConfirm:{required:!0,validator:this.passwordConfirmCheck}},password:"",passwordConfirm:"",optionsUsers:this.users.map(e=>({label:e.name,value:e.name})),username:"root"}},methods:{async save(){return!!await this.$refs.form.validate()&&(await this.applyPassword(),this.$refs.window.doClose(),!0)},close(){return this.$refs.window.doClose(),!0},async applyPassword(){try{await synowebapi.promises.request({api:"SYNO.MariaDB10.lib",method:"change_password",version:1,encryption:["password","dbpass"],params:{username:this.username,password:this.password,dbpass:this.rootPassword}})}catch(e){this.$refs.window.getToastBox(d(e.code))}},passwordConfirmCheck(e,o,t){if(o!==this.password)return t(new Error(_T("error","error_repswd")));t()}}},(function(){var e=this,o=e.$createElement,t=e._self._c||o;return t("v-modal-window",{ref:"window",attrs:{title:e._TT("SYNO.SDS.MARIADB10.Instance","ui","change_password"),width:"500",height:"250"}},[t("v-panel",{attrs:{confirm:e.save,cancel:e.close},scopedSlots:e._u([{key:"body",fn:function(){return[t("v-form",{ref:"form",attrs:{rules:e.rules}},[t("v-form-item",{attrs:{label:e._TT("SYNO.SDS.MARIADB10.Instance","ui","db_username")}},[t("v-single-select",{attrs:{options:e.optionsUsers},model:{value:e.username,callback:function(o){e.username=o},expression:"username"}})],1),e._v(" "),t("v-form-item",{attrs:{prop:"password",label:e._TT("SYNO.SDS.MARIADB10.Instance","ui","db_new_password")}},[t("v-input",{attrs:{name:"password",type:"password"},model:{value:e.password,callback:function(o){e.password=o},expression:"password"}})],1),e._v(" "),t("v-form-item",{attrs:{prop:"passwordConfirm",label:e._TT("SYNO.SDS.MARIADB10.Instance","ui","db_confirm_password")}},[t("v-input",{attrs:{name:"passwordConfirm",type:"password"},model:{value:e.passwordConfirm,callback:function(o){e.passwordConfirm=o},expression:"passwordConfirm"}})],1)],1)]},proxy:!0}])})],1)}),[],!1,null,null,null).exports;const m=[{required:!0},{validator:(e,o,t)=>{if(null===o)return t(new Error(_JSLIBSTR("extlang","fieldblank")));const r=parseInt(o,10);return isNaN(r)?t(new Error(_JSLIBSTR("extlang","invalidText"))):r<1024||r>65535?t(new Error(_TT("SYNO.SDS.MARIADB10.Instance","ui","port_range"))):void t()}}],w=Vue.extend(c),_=Vue.extend(u),S=Vue.extend(f);var h=p({mixins:[a],async mounted(){this.$refs.appWindow.setStatusBusy();try{await this.doLoad(),await this.loadMemorySize()}catch(e){this.$refs.appWindow.getToastBox(d(e.code))}finally{this.$refs.appWindow.clearStatus()}},computed:{supportBufferPoolAdjustment(){const e=parseInt(_D("mem_min_mb"));return!isNaN(e)&&e>=1024}},data(){return{rules:{port:m,innodbBufferPoolSize:[{required:!0},{validator:(e,o,t)=>{if(null===o)return t(new Error(_JSLIBSTR("extlang","fieldblank")));const r=parseInt(o,10);if(isNaN(r))return t(new Error(_JSLIBSTR("extlang","invalidText")));const s=Math.floor(this.memorySize*this.memoryUpperBoundRatio);if(r<10||r>s){const e=SYNO.SDS.formatString(_TT("SYNO.SDS.MARIADB10.Instance","ui","innodb_buffer_pool_size_range"),s);return t(new Error(e))}t()}}]},form:{enableNetworking:!1,port:3306,innodbBufferPoolSize:16},memoryUpperBoundRatio:.2,memorySize:128,socketPath:"/run/mysqld/mysqld10.sock",memorySizeRangeText:""}},methods:{async save(){return await this.$refs.form.isDirty()?!!await this.$refs.form.validate()&&(await this.doSave(),await this.doLoad(),!0):(this.$refs.appWindow.getToastBox(_T("error","nochange_subject")),!1)},async reset(){this.$refs.form.resetFields()},async doLoad(){try{const e=await synowebapi.promises.request({api:"SYNO.MariaDB10.lib",method:"get_info",version:1}),o={enableNetworking:0==e.skip_networking,port:e.port,innodbBufferPoolSize:e.innodb_buffer_pool_size};this.form=o}catch(e){this.$refs.appWindow.getToastBox(d(e.code))}await this.$nextTick(),this.$refs.form.commit()},async doSave(){this.$refs.appWindow.setStatusBusy(null,_T("common","applying"));let e={skip_networking:this.form.enableNetworking?0:1};this.supportBufferPoolAdjustment&&(e.innodb_buffer_pool_size=this.form.innodbBufferPoolSize),this.form.enableNetworking&&(e.port=this.form.port);try{await synowebapi.promises.request({api:"SYNO.MariaDB10.lib",method:"apply",version:1,params:e}),await this.$nextTick(),this.$refs.form.commit()}catch(o){this.$refs.appWindow.getToastBox(d(o.code,e.port))}finally{this.$refs.appWindow.clearStatus()}},async loadMemorySize(){try{const e=await synowebapi.promises.request({api:"SYNO.Core.System",method:"info",version:3});this.memorySize=e.ram_size,this.memorySizeRangeText=SYNO.SDS.formatString(_TT("SYNO.SDS.MARIADB10.Instance","ui","innodb_buffer_pool_size_range"),this.memorySize*this.memoryUpperBoundRatio)}catch(e){this.$refs.appWindow.getToastBox(d(e.code))}},openResetRootPasswordDialog(){this.$refs.appWindow.openModalWindow(w,{showClose:!0})},openRootLoginDialog(){const{component:e}=this.$refs.appWindow.openModalWindow(_,{showClose:!0});e.$on("root-logged-in",this.openPasswordChangeDialog)},openPasswordChangeDialog(e,o){this.$refs.appWindow.openModalWindow(S,{showClose:!0,rootPassword:e,users:o})}}},(function(){var e=this,o=e.$createElement,t=e._self._c||o;return t("v-app-instance",{attrs:{"class-name":"SYNO.SDS.MARIADB10.Instance"}},[t("v-app-window",{ref:"appWindow",attrs:{"window-name":"SYNO.SDS.MARIADB10.Instance.AppWindow",width:"600",minWidth:"600",height:"550",minHeight:"550",resizable:!1}},[t("v-panel",{attrs:{confirm:e.save,cancel:e.reset,cancelText:e._T("common","reset")},scopedSlots:e._u([{key:"body",fn:function(){return[t("v-form",{ref:"form",attrs:{model:e.form,rules:e.rules}},[t("v-fieldset",{attrs:{title:e._TT("SYNO.SDS.MARIADB10.Instance","ui","user_db"),collapsible:!1}},[t("div",{staticClass:"wrapper"},[t("v-button",{on:{click:e.openRootLoginDialog}},[e._v(e._s(e._TT("SYNO.SDS.MARIADB10.Instance","ui","change_user_password")))]),e._v(" "),t("v-button",{on:{click:e.openResetRootPasswordDialog}},[e._v(e._s(e._TT("SYNO.SDS.MARIADB10.Instance","ui","reset_root_password")))])],1)]),e._v(" "),t("v-fieldset",{attrs:{title:e._TT("SYNO.SDS.MARIADB10.Instance","ui","connection"),collapsible:!1}},[t("v-form-item",{attrs:{prop:"form.enableNetworking","hide-label":""}},[t("v-checkbox",{model:{value:e.form.enableNetworking,callback:function(o){e.$set(e.form,"enableNetworking",o)},expression:"form.enableNetworking"}},[e._v("\n                "+e._s(e._TT("SYNO.SDS.MARIADB10.Instance","ui","enable_tcp_ip_connection"))+"\n                "),t("v-whitetip",{attrs:{size:"small",content:e._TT("SYNO.SDS.MARIADB10.Instance","ui","tooltip_enable_tcp_ip_connection")}})],1)],1),e._v(" "),t("v-form-item",{attrs:{prop:"port",indent:"1",label:e._TT("SYNO.SDS.MARIADB10.Instance","ui","port")}},[t("v-input",{attrs:{name:"port",placeholder:e._TT("SYNO.SDS.MARIADB10.Instance","ui","port_range"),"number-only":!0,disabled:!e.form.enableNetworking},model:{value:e.form.port,callback:function(o){e.$set(e.form,"port",o)},expression:"form.port"}})],1)],1),e._v(" "),e.supportBufferPoolAdjustment?t("v-fieldset",{attrs:{title:e._TT("SYNO.SDS.MARIADB10.Instance","ui","innodb_buffer_pool_size_title"),collapsible:!1}},[t("v-form-item",{attrs:{prop:"innodbBufferPoolSize",label:e._TT("SYNO.SDS.MARIADB10.Instance","ui","innodb_buffer_pool_size")},scopedSlots:e._u([{key:"after",fn:function(){return[t("v-whitetip",[e._v(e._s(e._TT("SYNO.SDS.MARIADB10.Instance","ui","innodb_buffer_pool_tips")))])]},proxy:!0}],null,!1,1990826452)},[e._v(" "),t("v-input",{attrs:{name:"innodb_buffer_pool_size",placeholder:e.memorySizeRangeText,"number-only":!0},scopedSlots:e._u([{key:"suffix",fn:function(){return[e._v("MB")]},proxy:!0}],null,!1,4059353893),model:{value:e.form.innodbBufferPoolSize,callback:function(o){e.$set(e.form,"innodbBufferPoolSize",o)},expression:"form.innodbBufferPoolSize"}})],1),e._v(" "),t("v-form-item",{attrs:{hideLabel:!0}},[t("font",{staticClass:"note-font"},[e._v(e._s(e._TT("SYNO.SDS.MARIADB10.Instance","ui","note_header")))]),e._v("\n              "+e._s(e._TT("SYNO.SDS.MARIADB10.Instance","ui","innodb_buffer_pool_note"))+"\n            ")],1)],1):e._e(),e._v(" "),t("v-fieldset",{attrs:{title:e._TT("SYNO.SDS.MARIADB10.Instance","ui","information"),collapsible:!1}},[t("v-form-item",{attrs:{label:e._TT("SYNO.SDS.MARIADB10.Instance","ui","socket"),textonly:""}},[t("v-copy-cut-field",{attrs:{type:"copy"},model:{value:e.socketPath,callback:function(o){e.socketPath=o},expression:"socketPath"}})],1)],1)],1)]},proxy:!0}])})],1)],1)}),[],!1,null,null,null).exports;Ext.ns("SYNO.SDS.MARIADB10"),SYNO.SDS.MARIADB10.Instance=s.a.extend(h)}]);