mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-12 00:48:11 +00:00
no message
This commit is contained in:
parent
9553e43fa8
commit
2686bfbf5e
46
electron/build.js
vendored
46
electron/build.js
vendored
@ -49,28 +49,30 @@ function genericPublish(url, version) {
|
||||
} else {
|
||||
for (const filename of files) {
|
||||
const localFile = path.join(filePath, filename)
|
||||
const fileStat = fs.statSync(localFile)
|
||||
if (fileStat.isFile()) {
|
||||
const uploadOra = ora(`${filename} uploading...`).start()
|
||||
const formData = new FormData()
|
||||
formData.append("file", fs.createReadStream(localFile));
|
||||
await axios({
|
||||
method: 'post',
|
||||
url: url,
|
||||
data: formData,
|
||||
maxContentLength: Infinity,
|
||||
maxBodyLength: Infinity,
|
||||
headers: {
|
||||
'Generic-Version': version,
|
||||
'Content-Type': 'multipart/form-data;boundary=' + formData.getBoundary(),
|
||||
}
|
||||
}).then(_ => {
|
||||
uploadOra.succeed(`${filename} upload successful`)
|
||||
}).catch(_ => {
|
||||
uploadOra.fail(`${filename} upload fail`)
|
||||
}).finally(_ => {
|
||||
fse.removeSync(localFile)
|
||||
})
|
||||
if (fse.existsSync(localFile)) {
|
||||
const fileStat = fs.statSync(localFile)
|
||||
if (fileStat.isFile()) {
|
||||
const uploadOra = ora(`${filename} uploading...`).start()
|
||||
const formData = new FormData()
|
||||
formData.append("file", fs.createReadStream(localFile));
|
||||
await axios({
|
||||
method: 'post',
|
||||
url: url,
|
||||
data: formData,
|
||||
maxContentLength: Infinity,
|
||||
maxBodyLength: Infinity,
|
||||
headers: {
|
||||
'Generic-Version': version,
|
||||
'Content-Type': 'multipart/form-data;boundary=' + formData.getBoundary(),
|
||||
}
|
||||
}).then(_ => {
|
||||
uploadOra.succeed(`${filename} upload successful`)
|
||||
}).catch(_ => {
|
||||
uploadOra.fail(`${filename} upload fail`)
|
||||
}).finally(_ => {
|
||||
fse.removeSync(localFile)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "DooTask",
|
||||
"version": "0.13.36",
|
||||
"version": "0.13.38",
|
||||
"description": "DooTask is task management system.",
|
||||
"scripts": {
|
||||
"start": "./cmd dev",
|
||||
|
||||
2
public/js/app.js
vendored
2
public/js/app.js
vendored
File diff suppressed because one or more lines are too long
2
public/js/build/558.js
vendored
2
public/js/build/558.js
vendored
File diff suppressed because one or more lines are too long
2
public/js/build/569.js
vendored
2
public/js/build/569.js
vendored
File diff suppressed because one or more lines are too long
2
public/js/build/699.js
vendored
2
public/js/build/699.js
vendored
File diff suppressed because one or more lines are too long
2
public/js/build/963.js
vendored
2
public/js/build/963.js
vendored
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
8670e2bbf86722cc
|
||||
964ec56060e5c9b0
|
||||
|
||||
34
resources/assets/js/functions/common.js
vendored
34
resources/assets/js/functions/common.js
vendored
@ -1004,6 +1004,40 @@
|
||||
window.scrollIntoView(element, options)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 等比缩放尺寸
|
||||
* @param width
|
||||
* @param height
|
||||
* @param maxWidth
|
||||
* @param maxHeight
|
||||
* @returns {{width, height}|{width: number, height: number}}
|
||||
*/
|
||||
scaleToScale(width, height, maxWidth, maxHeight) {
|
||||
let tempWidth;
|
||||
let tempHeight;
|
||||
if (width > 0 && height > 0) {
|
||||
if (width / height >= maxWidth / maxHeight) {
|
||||
if (width > maxWidth) {
|
||||
tempWidth = maxWidth;
|
||||
tempHeight = (height * maxWidth) / width;
|
||||
} else {
|
||||
tempWidth = width;
|
||||
tempHeight = height;
|
||||
}
|
||||
} else {
|
||||
if (height > maxHeight) {
|
||||
tempHeight = maxHeight;
|
||||
tempWidth = (width * maxHeight) / height;
|
||||
} else {
|
||||
tempWidth = width;
|
||||
tempHeight = height;
|
||||
}
|
||||
}
|
||||
return {width: parseInt(tempWidth), height: parseInt(tempHeight)};
|
||||
}
|
||||
return {width, height};
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -174,6 +174,21 @@ export default {
|
||||
}
|
||||
text = text.trim().replace(/(\n\x20*){3,}/g, "\n\n");
|
||||
text = text.replace(/\{\{RemoteURL\}\}/g, $A.apiUrl('../'))
|
||||
const array = text.match(/<img\s+[^>]*?>/g);
|
||||
if (array) {
|
||||
const widthReg = new RegExp("width=\"(\\d+)\"")
|
||||
const heightReg = new RegExp("height=\"(\\d+)\"")
|
||||
array.some(res => {
|
||||
if (widthReg.test(res) && heightReg.test(res)) {
|
||||
let width = parseInt(res.match(widthReg)[1]),
|
||||
height = parseInt(res.match(heightReg)[1]),
|
||||
maxSize = res.indexOf("emoticon") > -1 ? 150 : 220;
|
||||
let scale = $A.scaleToScale(width, height, maxSize, maxSize);
|
||||
let value = res.replace(widthReg, `width=${scale.width}`).replace(heightReg, `height=${scale.height}`)
|
||||
text = text.replace(res, value)
|
||||
}
|
||||
})
|
||||
}
|
||||
return text;
|
||||
},
|
||||
|
||||
@ -290,7 +305,7 @@ export default {
|
||||
} else if (type === 'text') {
|
||||
const baseUrl = $A.apiUrl('../');
|
||||
const array = msg.text.match(/<img\s+class="browse"[^>]*?src="(.*?)"[^>]*?>/g);
|
||||
array.some(res => {
|
||||
array && array.some(res => {
|
||||
list.push(res.match(/<img\s+class="browse"[^>]*?src="(.*?)"[^>]*?>/)[1].replace(/\{\{RemoteURL\}\}/g, baseUrl))
|
||||
})
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user