Преглед изворни кода

'增加了max_epoch的限制,防止用户误操作使服务器繁忙'

master
刘冬煜 пре 4 година
родитељ
комит
b0e3b9034c
39 измењених фајлова са 25 додато и 8 уклоњено
  1. BIN
      style-transform-master/.vs/style-transform-master/v16/.suo
  2. +1
    -4
      style-transform-master/style-transform-master/html/index.html
  3. +14
    -0
      style-transform-master/style-transform-master/html/invalidParam.html
  4. BIN
      style-transform-master/style-transform-master/obj/Debug/style-transform-master.njsprojAssemblyReference.cache
  5. +0
    -0
      style-transform-master/style-transform-master/public/uploads/0b9e1f6ea0eec93b0e95489ede81efe9
  6. BIN
      style-transform-master/style-transform-master/public/uploads/176b3478124094634bb8c1aceda8d75ea236a21175a.jpg
  7. BIN
      style-transform-master/style-transform-master/public/uploads/176b348fcce3fc160596c09a98cbe47ee2a086c42bd.jpg
  8. BIN
      style-transform-master/style-transform-master/public/uploads/176b34907171b5597171b2e24a6430897b21314cf27.jpg
  9. BIN
      style-transform-master/style-transform-master/public/uploads/176b62ef69c4504039867a3f22459b274ae77a5a606.jpg
  10. BIN
      style-transform-master/style-transform-master/public/uploads/176b62eff03da3fa8f3183c02663d14ec6478fcf1b4.jpg
  11. +0
    -0
      style-transform-master/style-transform-master/public/uploads/176b62f08e950bdb22703fd224699f89a11f22b9a51.jpg
  12. BIN
      style-transform-master/style-transform-master/public/uploads/31cb74097c0f137cda202f97fc82c39c
  13. +0
    -0
      style-transform-master/style-transform-master/public/uploads/4174dad3fa965a41812ef3e270ebed52
  14. BIN
      style-transform-master/style-transform-master/public/uploads/4a528c2b3d548f21efd498d6fcc6ee3e
  15. +0
    -0
      style-transform-master/style-transform-master/public/uploads/5916e283b8605d7eb9abb6f300979d86
  16. +0
    -0
      style-transform-master/style-transform-master/public/uploads/5afecf4af2d51997c1ef512ca938e049
  17. BIN
      style-transform-master/style-transform-master/public/uploads/5d12f10fc144097bef3ce8d7227800cf
  18. BIN
      style-transform-master/style-transform-master/public/uploads/7b5ee265b28a6127e1655142523c6ce4
  19. BIN
      style-transform-master/style-transform-master/public/uploads/8d3e625b6df9503dd5e7edd271165c38
  20. BIN
      style-transform-master/style-transform-master/public/uploads/9529e38e01e4ade24d1939ae029ea7ba
  21. BIN
      style-transform-master/style-transform-master/public/uploads/a66b7d24b2ae85efd87692b33e8e69d1
  22. +0
    -0
      style-transform-master/style-transform-master/public/uploads/a8cdf543e7ed700c2820fbc9b84458ff
  23. BIN
      style-transform-master/style-transform-master/public/uploads/b68ae966a5ac0ce4ef5c59feff613a2e
  24. BIN
      style-transform-master/style-transform-master/public/uploads/c0c0d564976eb7c53c1436be2333f31e
  25. BIN
      style-transform-master/style-transform-master/public/uploads/caa0e5cfcb3f4597e4c0ed7790275f31
  26. BIN
      style-transform-master/style-transform-master/public/uploads/ce4073057a801b2ca993fb1469a15e99
  27. BIN
      style-transform-master/style-transform-master/public/uploads/d6a0e417d27ad4937da8f0ce7a826fd4
  28. BIN
      style-transform-master/style-transform-master/public/uploads/e634459ff4fd2d759b4691375f922723
  29. +0
    -0
      style-transform-master/style-transform-master/public/uploads/fb3657ced22b1a0053d4c5aa897b838b
  30. BIN
      style-transform-master/style-transform-master/public/uploads/fe5269e79229d462114741c0ffadf28a
  31. +7
    -4
      style-transform-master/style-transform-master/server.js
  32. +3
    -0
      style-transform-master/style-transform-master/style-transform-master.njsproj

BIN
style-transform-master/.vs/style-transform-master/v16/.suo Прегледај датотеку


+ 1
- 4
style-transform-master/style-transform-master/html/index.html Прегледај датотеку

@ -161,15 +161,12 @@
<h2><span class="highlight-text">START HERE</span></h2>
<p class="col-md-8 col-sm-10 col-xs-12 col-md-offset-2 col-sm-offset-1">
We love feedback. Fill out
the form below and we'll get back to you as soon as possible. in minus distinctio dolores ipsam.
请选择内容图片、风格图片、训练轮数(不超过2000的正整数)。
</p>
</div>
<!-- Section Header End -->
<div class="contact-details">
<!-- Contact Form -->
<div class="contact-form wow bounceInRight">

+ 14
- 0
style-transform-master/style-transform-master/html/invalidParam.html Прегледај датотеку

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Error</title>
</head>
<body>
<script type="text/javascript">
alert("无效参数!\n");
window.location.replace('./');
</script>
</body>
</html>

BIN
style-transform-master/style-transform-master/obj/Debug/style-transform-master.njsprojAssemblyReference.cache Прегледај датотеку


style-transform-master/style-transform-master/public/uploads/6be77319ed4f40cb3764c9d17a0e3e6d → style-transform-master/style-transform-master/public/uploads/0b9e1f6ea0eec93b0e95489ede81efe9 Прегледај датотеку


BIN
style-transform-master/style-transform-master/public/uploads/176b3478124094634bb8c1aceda8d75ea236a21175a.jpg Прегледај датотеку

Before After
Width: 512  |  Height: 384  |  Size: 60 KiB

BIN
style-transform-master/style-transform-master/public/uploads/176b348fcce3fc160596c09a98cbe47ee2a086c42bd.jpg Прегледај датотеку

Before After
Width: 512  |  Height: 384  |  Size: 60 KiB

BIN
style-transform-master/style-transform-master/public/uploads/176b34907171b5597171b2e24a6430897b21314cf27.jpg Прегледај датотеку

Before After
Width: 512  |  Height: 384  |  Size: 45 KiB

BIN
style-transform-master/style-transform-master/public/uploads/176b62ef69c4504039867a3f22459b274ae77a5a606.jpg Прегледај датотеку

Before After
Width: 512  |  Height: 512  |  Size: 82 KiB

BIN
style-transform-master/style-transform-master/public/uploads/176b62eff03da3fa8f3183c02663d14ec6478fcf1b4.jpg Прегледај датотеку

Before After
Width: 512  |  Height: 384  |  Size: 62 KiB

style-transform-master/style-transform-master/public/uploads/176b344f40c982f6168b63a0165c869a89be89c8537.jpg → style-transform-master/style-transform-master/public/uploads/176b62f08e950bdb22703fd224699f89a11f22b9a51.jpg Прегледај датотеку


BIN
style-transform-master/style-transform-master/public/uploads/31cb74097c0f137cda202f97fc82c39c Прегледај датотеку

Before After
Width: 680  |  Height: 510  |  Size: 93 KiB

style-transform-master/style-transform-master/public/uploads/a0e8ff26bdf39d016052c3338fd11ab9 → style-transform-master/style-transform-master/public/uploads/4174dad3fa965a41812ef3e270ebed52 Прегледај датотеку


BIN
style-transform-master/style-transform-master/public/uploads/4a528c2b3d548f21efd498d6fcc6ee3e Прегледај датотеку

Before After
Width: 680  |  Height: 510  |  Size: 93 KiB

style-transform-master/style-transform-master/public/uploads/24140d7a8f001e552893569e61c45022 → style-transform-master/style-transform-master/public/uploads/5916e283b8605d7eb9abb6f300979d86 Прегледај датотеку


style-transform-master/style-transform-master/public/uploads/f8abae0975cdc75a23d08fdf7c22b90c → style-transform-master/style-transform-master/public/uploads/5afecf4af2d51997c1ef512ca938e049 Прегледај датотеку


BIN
style-transform-master/style-transform-master/public/uploads/5d12f10fc144097bef3ce8d7227800cf Прегледај датотеку

Before After
Width: 200  |  Height: 200  |  Size: 47 KiB

BIN
style-transform-master/style-transform-master/public/uploads/7b5ee265b28a6127e1655142523c6ce4 Прегледај датотеку

Before After
Width: 680  |  Height: 510  |  Size: 93 KiB

BIN
style-transform-master/style-transform-master/public/uploads/8d3e625b6df9503dd5e7edd271165c38 Прегледај датотеку

Before After
Width: 200  |  Height: 200  |  Size: 47 KiB

BIN
style-transform-master/style-transform-master/public/uploads/9529e38e01e4ade24d1939ae029ea7ba Прегледај датотеку

Before After
Width: 300  |  Height: 312  |  Size: 23 KiB

BIN
style-transform-master/style-transform-master/public/uploads/a66b7d24b2ae85efd87692b33e8e69d1 Прегледај датотеку

Before After
Width: 300  |  Height: 312  |  Size: 23 KiB

style-transform-master/style-transform-master/public/uploads/248baa6862e643126e7cc271f5c0db43 → style-transform-master/style-transform-master/public/uploads/a8cdf543e7ed700c2820fbc9b84458ff Прегледај датотеку


BIN
style-transform-master/style-transform-master/public/uploads/b68ae966a5ac0ce4ef5c59feff613a2e Прегледај датотеку

Before After
Width: 300  |  Height: 312  |  Size: 23 KiB

BIN
style-transform-master/style-transform-master/public/uploads/c0c0d564976eb7c53c1436be2333f31e Прегледај датотеку

Before After
Width: 680  |  Height: 510  |  Size: 93 KiB

BIN
style-transform-master/style-transform-master/public/uploads/caa0e5cfcb3f4597e4c0ed7790275f31 Прегледај датотеку

Before After
Width: 680  |  Height: 510  |  Size: 93 KiB

BIN
style-transform-master/style-transform-master/public/uploads/ce4073057a801b2ca993fb1469a15e99 Прегледај датотеку

Before After
Width: 680  |  Height: 510  |  Size: 93 KiB

BIN
style-transform-master/style-transform-master/public/uploads/d6a0e417d27ad4937da8f0ce7a826fd4 Прегледај датотеку

Before After
Width: 680  |  Height: 510  |  Size: 93 KiB

BIN
style-transform-master/style-transform-master/public/uploads/e634459ff4fd2d759b4691375f922723 Прегледај датотеку

Before After
Width: 300  |  Height: 312  |  Size: 23 KiB

style-transform-master/style-transform-master/public/uploads/40bf7fff77f209858c92692c1643db05 → style-transform-master/style-transform-master/public/uploads/fb3657ced22b1a0053d4c5aa897b838b Прегледај датотеку


BIN
style-transform-master/style-transform-master/public/uploads/fe5269e79229d462114741c0ffadf28a Прегледај датотеку

Before After
Width: 300  |  Height: 312  |  Size: 23 KiB

+ 7
- 4
style-transform-master/style-transform-master/server.js Прегледај датотеку

@ -83,20 +83,23 @@ function run_child(taskID) {
}
server.post('/generate', upload.fields([{ name: 'content_image', maxCount: 1 }, { name: 'style_image', maxCount: 1 }]), function (req, res) {
let max_epoch = req.body.max_epoch;
let max_epoch = parseInt(req.body.max_epoch || "100");
let md5 = crypto.createHash('md5');
console.log(req.files);
console.log("Epoch = " + max_epoch);
if (!req.files.content_image || !req.files.style_image) {
progress[taskID] = {percentage: 0, max_epoch: 0, status: -2};
if (max_epoch > 2000 || max_epoch <= 0 || !req.files.content_image || !req.files.style_image) {
res.writeHead(444, { 'Content-type': 'text/html' });
res.end(fs.readFileSync("./html/invalidParam.html"));
return;
}
let taskID = Date.now().toString(16) + md5.update(req.files.content_image[0].filename + req.files.style_image[0].filename).digest('hex');
relationfile[taskID] = {content: req.files.content_image[0].filename, style: req.files.style_image[0].filename};
progress[taskID] = {percentage: 0, max_epoch: parseInt(max_epoch), status: 0, wait: totalTask + queue.length + 1};
progress[taskID] = {percentage: 0, max_epoch: max_epoch, status: 0, wait: totalTask + queue.length + 1};
if (isIdle) {
isIdle = false;

+ 3
- 0
style-transform-master/style-transform-master/style-transform-master.njsproj Прегледај датотеку

@ -33,6 +33,9 @@
</Content>
<Content Include="html\generate.html" />
<Content Include="html\index.html" />
<Content Include="html\invalidParam.html">
<SubType>Code</SubType>
</Content>
<Content Include="html\success.html">
<SubType>Code</SubType>
</Content>

Loading…
Откажи
Сачувај