king
2021-01-20 0227c25e4ed573d3095ada3f9c9a4ba5f18b0de5
src/utils/utils.js
@@ -48,6 +48,7 @@
    for (let i = 0; i < 6; i++) {
      name.push(_options.substr(Math.floor(Math.random() * 26), 1))
    }
    name.splice(3, 0, new Date().getTime())
    return name.join('')
  }
@@ -131,12 +132,15 @@
      {key: 'sys.', reg: /(^|\s)sys\./ig},
      {key: 'kill', reg: /(^|\s)kill\s/ig}
    ]
    if (type === 'customscript') {
      chars = chars.filter(char => !['insert', 'delete', 'update', 'set', 'if', 'exec'].includes(char.key))
    }
    let error = ''
    sql = sql.replace(/sys\.fn_sqlvarbasetostr\(HashBytes\('MD5'/ig, '') // 跳过MD5加密
    chars.forEach(char => {
      if (!error && char.reg.test(sql)) {
        error = char.key
@@ -165,7 +169,7 @@
    value = value.replace(/%/ig, ' mpercent ')
    // 外联数据库替换
    if (window.GLOB.externalDatabase !== null) {
      value = value.replace(/@db@/ig, `[${window.GLOB.externalDatabase}]..`)
      value = value.replace(/@db@/ig, window.GLOB.externalDatabase)
    }
    // encode编码(中文字符超出base64加密范围)
    value = window.btoa(window.encodeURIComponent(value))
@@ -236,7 +240,7 @@
    value = value.replace(/%/ig, ' mpercent ')
    // 外联数据库替换
    if (window.GLOB.externalDatabase !== null) {
      value = value.replace(/@db@/ig, `[${window.GLOB.externalDatabase}]..`)
      value = value.replace(/@db@/ig, window.GLOB.externalDatabase)
    }
    let encodesql = (val) => {
@@ -695,7 +699,7 @@
    if (process.env.NODE_ENV === 'production') {
      baseurl = document.location.origin + '/' + window.GLOB.service
    } else {
      baseurl = window.GLOB.location + window.GLOB.service
      baseurl = window.GLOB.location + '/' + window.GLOB.service
    }
    let realurl = url.match(/^http/) || url.match(/^\/\//) ? url : baseurl + url