Browse Source

Fixes for pictures in portrait mode

Dmitriy Slipak 4 years ago
parent
commit
fb6effa3b4
9 changed files with 442 additions and 126 deletions
  1. 10 5
      client/preview.js
  2. 71 44
      client/theme-editor.js
  3. 1 1
      editor/index.html
  4. 1 2
      editor/theme.html
  5. 137 66
      package-lock.json
  6. 2 1
      package.json
  7. 0 5
      renderer/index.js
  8. 5 1
      server/index.js
  9. 215 1
      settings/themes.json

+ 10 - 5
client/preview.js View File

61
 
61
 
62
 // Resize video and preview canvas to maintain aspect ratio
62
 // Resize video and preview canvas to maintain aspect ratio
63
 function resize(width, height) {
63
 function resize(width, height) {
64
-
65
-  var widthFactor = 640 / width,
66
-      heightFactor = 360 / height,
67
-      factor = Math.min(widthFactor, heightFactor);
64
+  var widthFactor, heightFactor;
65
+  if (height > width) {
66
+    widthFactor = 360 / width;
67
+    heightFactor = 640 / height;
68
+  } else {
69
+    widthFactor = 640 / width;
70
+    heightFactor = 360 / height;
71
+  }
72
+  var factor = Math.min(widthFactor, heightFactor);
68
 
73
 
69
   d3.select("canvas")
74
   d3.select("canvas")
70
     .attr("width", factor * width)
75
     .attr("width", factor * width)
71
     .attr("height", factor * height);
76
     .attr("height", factor * height);
72
-
77
+    
73
   d3.select("#canvas")
78
   d3.select("#canvas")
74
     .style("width", (factor * width) + "px");
79
     .style("width", (factor * width) + "px");
75
 
80
 

+ 71 - 44
client/theme-editor.js View File

7
   	d3.select("#input-new-theme").on("change", updateNewThemeFile).each(updateNewThemeFile);
7
   	d3.select("#input-new-theme").on("change", updateNewThemeFile).each(updateNewThemeFile);
8
   	d3.select("#input-new-caption").on("change keyup", updateNewCaption).each(updateNewCaption);
8
   	d3.select("#input-new-caption").on("change keyup", updateNewCaption).each(updateNewCaption);
9
   	d3.select("#btn-delete-theme").on("click", deleteTheme);
9
   	d3.select("#btn-delete-theme").on("click", deleteTheme);
10
-    d3.select("#btn-save-theme").on("click", saveTheme);
11
     d3.select("#chkNoPattern").on("change", setNoPattern);
10
     d3.select("#chkNoPattern").on("change", setNoPattern);
12
 }
11
 }
13
 
12
 
26
 
25
 
27
   formData.append("newCaption", newCaption);
26
   formData.append("newCaption", newCaption);
28
 
27
 
29
-  $.ajax({
30
-    url: "/theme/upload",
31
-    type: "POST",
32
-    data: formData,
33
-    dataType: "json",
34
-    contentType: false,
35
-    cache: false,
36
-    processData: false,
37
-    success: function () {
38
-      d3.json("/settings/themes.json", function(err, themes){
39
-
40
-        var errorMessage;
41
-
42
-        // Themes are missing or invalid
43
-        if (err || !d3.keys(themes).filter(function(d){ return d !== "default"; }).length) {
44
-          if (err instanceof SyntaxError) {
45
-            errorMessage = "Error in settings/themes.json:<br/><code>" + err.toString() + "</code>";
46
-          } else if (err instanceof ProgressEvent) {
47
-            errorMessage = "Error: no settings/themes.json.";
48
-          } else if (err) {
49
-            errorMessage = "Error: couldn't load settings/themes.json.";
50
-          } else {
51
-            errorMessage = "No themes found in settings/themes.json.";
52
-          }
53
-          d3.select("#loading-bars").remove();
54
-          d3.select("#loading-message").html(errorMessage);
55
-          if (err) {
56
-            throw err;
28
+  var img = new Image();
29
+  img.onload = function() {
30
+    var sizes = {
31
+      width: this.width,
32
+      height: this.height
33
+    };
34
+    URL.revokeObjectURL(this.src);
35
+
36
+    if (sizes.width > sizes.height) {
37
+      if (sizes.width > 1280) {
38
+        sizes.width = 1280;
39
+      }
40
+      if (sizes.height > 720) {
41
+        sizes.height = 720;
42
+      }
43
+    } else {
44
+      if (sizes.height > 1280) {
45
+        sizes.height = 1280;
46
+      }
47
+      if (sizes.width > 720) {
48
+        sizes.width = 720;
49
+      }
50
+    }
51
+    
52
+    formData.append("newWidth", sizes.width);
53
+    formData.append("newHeight", sizes.height);
54
+
55
+    $.ajax({
56
+      url: "/theme/upload",
57
+      type: "POST",
58
+      data: formData,
59
+      dataType: "json",
60
+      contentType: false,
61
+      cache: false,
62
+      processData: false,
63
+      success: function () {
64
+        d3.json("/settings/themes.json", function(err, themes){
65
+
66
+          var errorMessage;
67
+
68
+          // Themes are missing or invalid
69
+          if (err || !d3.keys(themes).filter(function(d){ return d !== "default"; }).length) {
70
+            if (err instanceof SyntaxError) {
71
+              errorMessage = "Error in settings/themes.json:<br/><code>" + err.toString() + "</code>";
72
+            } else if (err instanceof ProgressEvent) {
73
+              errorMessage = "Error: no settings/themes.json.";
74
+            } else if (err) {
75
+              errorMessage = "Error: couldn't load settings/themes.json.";
76
+            } else {
77
+              errorMessage = "No themes found in settings/themes.json.";
78
+            }
79
+            d3.select("#loading-bars").remove();
80
+            d3.select("#loading-message").html(errorMessage);
81
+            if (err) {
82
+              throw err;
83
+            }
84
+            return;
57
           }
85
           }
58
-          return;
59
-        }
60
 
86
 
61
-        location.reload();
87
+          location.reload();
62
 
88
 
63
-      });
64
-    },
65
-    error: function (error) {
66
-      console.log('error', error);
67
-    }
68
-  });
89
+        });
90
+      },
91
+      error: function (error) {
92
+        console.log('error', error);
93
+      }
94
+    });
95
+
96
+  }
97
+  var objectURL = URL.createObjectURL(file);
98
+  img.src = objectURL;
69
 
99
 
70
 }
100
 }
71
 
101
 
77
   }
107
   }
78
 
108
 
79
   newTheme = this.files[0];
109
   newTheme = this.files[0];
110
+
80
   preview.loadNewTheme(newTheme, function (err) {
111
   preview.loadNewTheme(newTheme, function (err) {
81
     if (err) {
112
     if (err) {
82
       setClass("error", "Error updating new theme file");
113
       setClass("error", "Error updating new theme file");
117
 }
148
 }
118
 
149
 
119
 function saveTheme() {
150
 function saveTheme() {
120
-  if(!confirm($("#btn-save-theme").data("confirm"))){
121
-      d3.event.stopImmediatePropagation();
122
-      d3.event.preventDefault();
123
-      return;
124
-  }
125
-
126
   $.ajax({
151
   $.ajax({
127
     url: "/theme/save",
152
     url: "/theme/save",
128
     type: "POST",
153
     type: "POST",
150
   } else {
175
   } else {
151
     theme.noPattern = checked;
176
     theme.noPattern = checked;
152
   }
177
   }
178
+
179
+  saveTheme();
153
 }
180
 }
154
 
181
 
155
 module.exports = {
182
 module.exports = {

+ 1 - 1
editor/index.html View File

48
           <input id="input-caption" name="caption" type="text" autocomplete="off" placeholder="Add a caption" />
48
           <input id="input-caption" name="caption" type="text" autocomplete="off" placeholder="Add a caption" />
49
         </div>
49
         </div>
50
         <div id="preview">
50
         <div id="preview">
51
-          <div style="background-color: black;">
51
+          <div>
52
             <div id="canvas">
52
             <div id="canvas">
53
               <canvas width="640" height="360"></canvas>
53
               <canvas width="640" height="360"></canvas>
54
               <div id="preview-label">Preview</div>
54
               <div id="preview-label">Preview</div>

+ 1 - 2
editor/theme.html View File

36
 
36
 
37
         <div class="row form-row" style="padding-bottom: 40px">
37
         <div class="row form-row" style="padding-bottom: 40px">
38
           <button type="button" id="btn-delete-theme" class="left" data-confirm="Are you sure you want to delete this theme?"><i class="fa fa-trash"></i>Delete</button>
38
           <button type="button" id="btn-delete-theme" class="left" data-confirm="Are you sure you want to delete this theme?"><i class="fa fa-trash"></i>Delete</button>
39
-          <button type="button" id="btn-save-theme" class="left" data-confirm="Are you sure you want to save changes?"><i class="fa fa-save"></i>Save</button>
40
         </div>
39
         </div>
41
 
40
 
42
         <div id="preview">
41
         <div id="preview">
43
-          <div style="background-color: black;">
42
+          <div>
44
             <div id="canvas">
43
             <div id="canvas">
45
               <canvas width="640" height="360"></canvas>
44
               <canvas width="640" height="360"></canvas>
46
               <div id="preview-label">Preview</div>
45
               <div id="preview-label">Preview</div>

+ 137 - 66
package-lock.json View File

28
       }
28
       }
29
     },
29
     },
30
     "acorn": {
30
     "acorn": {
31
-      "version": "7.1.0",
32
-      "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz",
33
-      "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ=="
31
+      "version": "7.4.0",
32
+      "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.0.tgz",
33
+      "integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w=="
34
     },
34
     },
35
     "acorn-node": {
35
     "acorn-node": {
36
       "version": "1.8.2",
36
       "version": "1.8.2",
1516
       },
1516
       },
1517
       "dependencies": {
1517
       "dependencies": {
1518
         "acorn": {
1518
         "acorn": {
1519
-          "version": "5.7.3",
1520
-          "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz",
1521
-          "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw=="
1519
+          "version": "5.7.4",
1520
+          "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz",
1521
+          "integrity": "sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg=="
1522
         }
1522
         }
1523
       }
1523
       }
1524
     },
1524
     },
1565
       "integrity": "sha1-hnqksJP6oF8d4IwG9NeyH9+GmLw="
1565
       "integrity": "sha1-hnqksJP6oF8d4IwG9NeyH9+GmLw="
1566
     },
1566
     },
1567
     "dot-prop": {
1567
     "dot-prop": {
1568
-      "version": "4.2.0",
1569
-      "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz",
1570
-      "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==",
1568
+      "version": "4.2.1",
1569
+      "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.1.tgz",
1570
+      "integrity": "sha512-l0p4+mIuJIua0mhxGoh4a+iNL9bmeK5DvnSVQa6T0OhrVmaEa1XScX5Etc673FePCJOArq/4Pa2cLGODUWTPOQ==",
1571
       "dev": true,
1571
       "dev": true,
1572
       "requires": {
1572
       "requires": {
1573
         "is-obj": "^1.0.0"
1573
         "is-obj": "^1.0.0"
1612
       "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
1612
       "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
1613
     },
1613
     },
1614
     "elliptic": {
1614
     "elliptic": {
1615
-      "version": "6.5.2",
1616
-      "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz",
1617
-      "integrity": "sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==",
1615
+      "version": "6.5.3",
1616
+      "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz",
1617
+      "integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==",
1618
       "requires": {
1618
       "requires": {
1619
         "bn.js": "^4.4.0",
1619
         "bn.js": "^4.4.0",
1620
         "brorand": "^1.0.1",
1620
         "brorand": "^1.0.1",
2250
             "brace-expansion": "^1.1.7"
2250
             "brace-expansion": "^1.1.7"
2251
           }
2251
           }
2252
         },
2252
         },
2253
-        "minimist": {
2254
-          "version": "0.0.8",
2255
-          "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
2256
-          "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
2257
-          "dev": true,
2258
-          "optional": true
2259
-        },
2260
         "minipass": {
2253
         "minipass": {
2261
           "version": "2.9.0",
2254
           "version": "2.9.0",
2262
           "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz",
2255
           "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz",
2279
           }
2272
           }
2280
         },
2273
         },
2281
         "mkdirp": {
2274
         "mkdirp": {
2282
-          "version": "0.5.1",
2283
-          "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
2284
-          "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
2275
+          "version": "0.5.5",
2276
+          "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
2277
+          "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
2285
           "dev": true,
2278
           "dev": true,
2286
           "optional": true,
2279
           "optional": true,
2287
           "requires": {
2280
           "requires": {
2288
-            "minimist": "0.0.8"
2281
+            "minimist": "^1.2.5"
2289
           }
2282
           }
2290
         },
2283
         },
2291
         "ms": {
2284
         "ms": {
2455
           },
2448
           },
2456
           "dependencies": {
2449
           "dependencies": {
2457
             "minimist": {
2450
             "minimist": {
2458
-              "version": "1.2.0",
2459
-              "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
2460
-              "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
2451
+              "version": "1.2.5",
2452
+              "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
2453
+              "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
2461
               "dev": true,
2454
               "dev": true,
2462
               "optional": true
2455
               "optional": true
2463
             }
2456
             }
3203
       "integrity": "sha1-o/Iiqarp+Wb10nx5ZRDigJF2Qhc="
3196
       "integrity": "sha1-o/Iiqarp+Wb10nx5ZRDigJF2Qhc="
3204
     },
3197
     },
3205
     "jquery": {
3198
     "jquery": {
3206
-      "version": "3.4.1",
3207
-      "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.4.1.tgz",
3208
-      "integrity": "sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw=="
3199
+      "version": "3.5.1",
3200
+      "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.5.1.tgz",
3201
+      "integrity": "sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg=="
3209
     },
3202
     },
3210
     "json-stable-stringify": {
3203
     "json-stable-stringify": {
3211
       "version": "0.0.1",
3204
       "version": "0.0.1",
3399
       }
3392
       }
3400
     },
3393
     },
3401
     "minimist": {
3394
     "minimist": {
3402
-      "version": "1.2.0",
3403
-      "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
3404
-      "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
3395
+      "version": "1.2.5",
3396
+      "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
3397
+      "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
3405
     },
3398
     },
3406
     "minipass": {
3399
     "minipass": {
3407
       "version": "2.9.0",
3400
       "version": "2.9.0",
3442
       }
3435
       }
3443
     },
3436
     },
3444
     "mkdirp": {
3437
     "mkdirp": {
3445
-      "version": "0.5.1",
3446
-      "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
3447
-      "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
3438
+      "version": "0.5.5",
3439
+      "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
3440
+      "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
3448
       "requires": {
3441
       "requires": {
3449
-        "minimist": "0.0.8"
3450
-      },
3451
-      "dependencies": {
3452
-        "minimist": {
3453
-          "version": "0.0.8",
3454
-          "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
3455
-          "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
3456
-        }
3442
+        "minimist": "^1.2.5"
3457
       }
3443
       }
3458
     },
3444
     },
3445
+    "mkdirp-classic": {
3446
+      "version": "0.5.3",
3447
+      "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
3448
+      "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==",
3449
+      "dev": true
3450
+    },
3459
     "module-deps": {
3451
     "module-deps": {
3460
       "version": "4.1.1",
3452
       "version": "4.1.1",
3461
       "resolved": "https://registry.npmjs.org/module-deps/-/module-deps-4.1.1.tgz",
3453
       "resolved": "https://registry.npmjs.org/module-deps/-/module-deps-4.1.1.tgz",
3508
         "on-finished": "^2.3.0",
3500
         "on-finished": "^2.3.0",
3509
         "type-is": "^1.6.4",
3501
         "type-is": "^1.6.4",
3510
         "xtend": "^4.0.0"
3502
         "xtend": "^4.0.0"
3503
+      },
3504
+      "dependencies": {
3505
+        "mkdirp": {
3506
+          "version": "0.5.5",
3507
+          "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
3508
+          "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
3509
+          "requires": {
3510
+            "minimist": "^1.2.5"
3511
+          }
3512
+        }
3511
       }
3513
       }
3512
     },
3514
     },
3513
     "nan": {
3515
     "nan": {
3589
         "rimraf": "^2.6.1",
3591
         "rimraf": "^2.6.1",
3590
         "semver": "^5.3.0",
3592
         "semver": "^5.3.0",
3591
         "tar": "^4"
3593
         "tar": "^4"
3594
+      },
3595
+      "dependencies": {
3596
+        "mkdirp": {
3597
+          "version": "0.5.5",
3598
+          "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
3599
+          "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
3600
+          "requires": {
3601
+            "minimist": "^1.2.5"
3602
+          }
3603
+        }
3592
       }
3604
       }
3593
     },
3605
     },
3594
     "nodemon": {
3606
     "nodemon": {
4309
       "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=",
4321
       "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=",
4310
       "dev": true
4322
       "dev": true
4311
     },
4323
     },
4324
+    "resize-image": {
4325
+      "version": "0.1.0",
4326
+      "resolved": "https://registry.npmjs.org/resize-image/-/resize-image-0.1.0.tgz",
4327
+      "integrity": "sha512-78cWCEX/IupMCwKi5Gg5gxjOZKoN6UXinL2eVOB4xzyG2QNjq64z6pJBnyBKg5/BsjEosLz1co5e3DHr99TgFg=="
4328
+    },
4312
     "resolve": {
4329
     "resolve": {
4313
       "version": "1.15.0",
4330
       "version": "1.15.0",
4314
       "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.0.tgz",
4331
       "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.0.tgz",
4944
         "mkdirp": "^0.5.0",
4961
         "mkdirp": "^0.5.0",
4945
         "safe-buffer": "^5.1.2",
4962
         "safe-buffer": "^5.1.2",
4946
         "yallist": "^3.0.3"
4963
         "yallist": "^3.0.3"
4964
+      },
4965
+      "dependencies": {
4966
+        "mkdirp": {
4967
+          "version": "0.5.5",
4968
+          "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
4969
+          "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
4970
+          "requires": {
4971
+            "minimist": "^1.2.5"
4972
+          }
4973
+        }
4947
       }
4974
       }
4948
     },
4975
     },
4949
     "term-size": {
4976
     "term-size": {
5290
       },
5317
       },
5291
       "dependencies": {
5318
       "dependencies": {
5292
         "browserify": {
5319
         "browserify": {
5293
-          "version": "16.5.0",
5294
-          "resolved": "https://registry.npmjs.org/browserify/-/browserify-16.5.0.tgz",
5295
-          "integrity": "sha512-6bfI3cl76YLAnCZ75AGu/XPOsqUhRyc0F/olGIJeCxtfxF2HvPKEcmjU9M8oAPxl4uBY1U7Nry33Q6koV3f2iw==",
5320
+          "version": "16.5.2",
5321
+          "resolved": "https://registry.npmjs.org/browserify/-/browserify-16.5.2.tgz",
5322
+          "integrity": "sha512-TkOR1cQGdmXU9zW4YukWzWVSJwrxmNdADFbqbE3HFgQWe5wqZmOawqZ7J/8MPCwk/W8yY7Y0h+7mOtcZxLP23g==",
5296
           "dev": true,
5323
           "dev": true,
5297
           "requires": {
5324
           "requires": {
5298
             "JSONStream": "^1.0.3",
5325
             "JSONStream": "^1.0.3",
5299
             "assert": "^1.4.0",
5326
             "assert": "^1.4.0",
5300
             "browser-pack": "^6.0.1",
5327
             "browser-pack": "^6.0.1",
5301
-            "browser-resolve": "^1.11.0",
5328
+            "browser-resolve": "^2.0.0",
5302
             "browserify-zlib": "~0.2.0",
5329
             "browserify-zlib": "~0.2.0",
5303
-            "buffer": "^5.0.2",
5330
+            "buffer": "~5.2.1",
5304
             "cached-path-relative": "^1.0.0",
5331
             "cached-path-relative": "^1.0.0",
5305
             "concat-stream": "^1.6.0",
5332
             "concat-stream": "^1.6.0",
5306
             "console-browserify": "^1.1.0",
5333
             "console-browserify": "^1.1.0",
5318
             "inherits": "~2.0.1",
5345
             "inherits": "~2.0.1",
5319
             "insert-module-globals": "^7.0.0",
5346
             "insert-module-globals": "^7.0.0",
5320
             "labeled-stream-splicer": "^2.0.0",
5347
             "labeled-stream-splicer": "^2.0.0",
5321
-            "mkdirp": "^0.5.0",
5322
-            "module-deps": "^6.0.0",
5348
+            "mkdirp-classic": "^0.5.2",
5349
+            "module-deps": "^6.2.3",
5323
             "os-browserify": "~0.3.0",
5350
             "os-browserify": "~0.3.0",
5324
             "parents": "^1.0.1",
5351
             "parents": "^1.0.1",
5325
             "path-browserify": "~0.0.0",
5352
             "path-browserify": "~0.0.0",
5343
             "util": "~0.10.1",
5370
             "util": "~0.10.1",
5344
             "vm-browserify": "^1.0.0",
5371
             "vm-browserify": "^1.0.0",
5345
             "xtend": "^4.0.0"
5372
             "xtend": "^4.0.0"
5373
+          },
5374
+          "dependencies": {
5375
+            "browser-resolve": {
5376
+              "version": "2.0.0",
5377
+              "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-2.0.0.tgz",
5378
+              "integrity": "sha512-7sWsQlYL2rGLy2IWm8WL8DCTJvYLc/qlOnsakDac87SOoCd16WLsaAMdCiAqsTNHIe+SXfaqyxyo6THoWqs8WQ==",
5379
+              "dev": true,
5380
+              "requires": {
5381
+                "resolve": "^1.17.0"
5382
+              },
5383
+              "dependencies": {
5384
+                "resolve": {
5385
+                  "version": "1.17.0",
5386
+                  "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz",
5387
+                  "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==",
5388
+                  "dev": true,
5389
+                  "requires": {
5390
+                    "path-parse": "^1.0.6"
5391
+                  }
5392
+                }
5393
+              }
5394
+            }
5346
           }
5395
           }
5347
         },
5396
         },
5348
         "browserify-zlib": {
5397
         "browserify-zlib": {
5355
           }
5404
           }
5356
         },
5405
         },
5357
         "buffer": {
5406
         "buffer": {
5358
-          "version": "5.4.3",
5359
-          "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.4.3.tgz",
5360
-          "integrity": "sha512-zvj65TkFeIt3i6aj5bIvJDzjjQQGs4o/sNoezg1F1kYap9Nu2jcUdpwzRSJTHMMzG0H7bZkn4rNQpImhuxWX2A==",
5407
+          "version": "5.2.1",
5408
+          "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.1.tgz",
5409
+          "integrity": "sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg==",
5361
           "dev": true,
5410
           "dev": true,
5362
           "requires": {
5411
           "requires": {
5363
             "base64-js": "^1.0.2",
5412
             "base64-js": "^1.0.2",
5406
           "dev": true
5455
           "dev": true
5407
         },
5456
         },
5408
         "module-deps": {
5457
         "module-deps": {
5409
-          "version": "6.2.2",
5410
-          "resolved": "https://registry.npmjs.org/module-deps/-/module-deps-6.2.2.tgz",
5411
-          "integrity": "sha512-a9y6yDv5u5I4A+IPHTnqFxcaKr4p50/zxTjcQJaX2ws9tN/W6J6YXnEKhqRyPhl494dkcxx951onSKVezmI+3w==",
5458
+          "version": "6.2.3",
5459
+          "resolved": "https://registry.npmjs.org/module-deps/-/module-deps-6.2.3.tgz",
5460
+          "integrity": "sha512-fg7OZaQBcL4/L+AK5f4iVqf9OMbCclXfy/znXRxTVhJSeW5AIlS9AwheYwDaXM3lVW7OBeaeUEY3gbaC6cLlSA==",
5412
           "dev": true,
5461
           "dev": true,
5413
           "requires": {
5462
           "requires": {
5414
             "JSONStream": "^1.0.3",
5463
             "JSONStream": "^1.0.3",
5415
-            "browser-resolve": "^1.7.0",
5464
+            "browser-resolve": "^2.0.0",
5416
             "cached-path-relative": "^1.0.2",
5465
             "cached-path-relative": "^1.0.2",
5417
             "concat-stream": "~1.6.0",
5466
             "concat-stream": "~1.6.0",
5418
             "defined": "^1.0.0",
5467
             "defined": "^1.0.0",
5426
             "subarg": "^1.0.0",
5475
             "subarg": "^1.0.0",
5427
             "through2": "^2.0.0",
5476
             "through2": "^2.0.0",
5428
             "xtend": "^4.0.0"
5477
             "xtend": "^4.0.0"
5478
+          },
5479
+          "dependencies": {
5480
+            "browser-resolve": {
5481
+              "version": "2.0.0",
5482
+              "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-2.0.0.tgz",
5483
+              "integrity": "sha512-7sWsQlYL2rGLy2IWm8WL8DCTJvYLc/qlOnsakDac87SOoCd16WLsaAMdCiAqsTNHIe+SXfaqyxyo6THoWqs8WQ==",
5484
+              "dev": true,
5485
+              "requires": {
5486
+                "resolve": "^1.17.0"
5487
+              },
5488
+              "dependencies": {
5489
+                "resolve": {
5490
+                  "version": "1.17.0",
5491
+                  "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz",
5492
+                  "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==",
5493
+                  "dev": true,
5494
+                  "requires": {
5495
+                    "path-parse": "^1.0.6"
5496
+                  }
5497
+                }
5498
+              }
5499
+            }
5429
           }
5500
           }
5430
         },
5501
         },
5431
         "os-browserify": {
5502
         "os-browserify": {
5441
           "dev": true
5512
           "dev": true
5442
         },
5513
         },
5443
         "stream-http": {
5514
         "stream-http": {
5444
-          "version": "3.1.0",
5445
-          "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-3.1.0.tgz",
5446
-          "integrity": "sha512-cuB6RgO7BqC4FBYzmnvhob5Do3wIdIsXAgGycHJnW+981gHqoYcYz9lqjJrk8WXRddbwPuqPYRl+bag6mYv4lw==",
5515
+          "version": "3.1.1",
5516
+          "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-3.1.1.tgz",
5517
+          "integrity": "sha512-S7OqaYu0EkFpgeGFb/NPOoPLxFko7TPqtEeFg5DXPB4v/KETHG0Ln6fRFrNezoelpaDKmycEmmZ81cC9DAwgYg==",
5447
           "dev": true,
5518
           "dev": true,
5448
           "requires": {
5519
           "requires": {
5449
             "builtin-status-codes": "^3.0.0",
5520
             "builtin-status-codes": "^3.0.0",
5450
-            "inherits": "^2.0.1",
5451
-            "readable-stream": "^3.0.6",
5452
-            "xtend": "^4.0.0"
5521
+            "inherits": "^2.0.4",
5522
+            "readable-stream": "^3.6.0",
5523
+            "xtend": "^4.0.2"
5453
           },
5524
           },
5454
           "dependencies": {
5525
           "dependencies": {
5455
             "readable-stream": {
5526
             "readable-stream": {
5456
-              "version": "3.5.0",
5457
-              "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.5.0.tgz",
5458
-              "integrity": "sha512-gSz026xs2LfxBPudDuI41V1lka8cxg64E66SGe78zJlsUofOg/yqwezdIcdfwik6B4h8LFmWPA9ef9X3FiNFLA==",
5527
+              "version": "3.6.0",
5528
+              "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
5529
+              "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
5459
               "dev": true,
5530
               "dev": true,
5460
               "requires": {
5531
               "requires": {
5461
                 "inherits": "^2.0.3",
5532
                 "inherits": "^2.0.3",

+ 2 - 1
package.json View File

31
     "d3": "4.10.0",
31
     "d3": "4.10.0",
32
     "dotenv": "^2.0.0",
32
     "dotenv": "^2.0.0",
33
     "express": "^4.17.1",
33
     "express": "^4.17.1",
34
-    "jquery": "^3.4.1",
34
+    "jquery": "^3.5.1",
35
     "mkdirp": "^0.5.1",
35
     "mkdirp": "^0.5.1",
36
     "morgan": "^1.7.0",
36
     "morgan": "^1.7.0",
37
     "multer": "^1.1.0",
37
     "multer": "^1.1.0",
38
     "node-ffprobe": "^1.2.2",
38
     "node-ffprobe": "^1.2.2",
39
     "redis": "^2.4.2",
39
     "redis": "^2.4.2",
40
+    "resize-image": "^0.1.0",
40
     "rimraf": "^2.5.0",
41
     "rimraf": "^2.5.0",
41
     "smartquotes": "^1.0.0",
42
     "smartquotes": "^1.0.0",
42
     "subtitle": "^2.0.3",
43
     "subtitle": "^2.0.3",

+ 0 - 5
renderer/index.js View File

31
     if (typeof theme.waveLeft !== "number") theme.waveLeft = 0;
31
     if (typeof theme.waveLeft !== "number") theme.waveLeft = 0;
32
     if (typeof theme.waveRight !== "number") theme.waveRight = theme.width;
32
     if (typeof theme.waveRight !== "number") theme.waveRight = theme.width;
33
 
33
 
34
-    /*if (location.pathname === "/theme") {
35
-      const tf = (theme.noPattern === undefined) ? false : theme.noPattern;
36
-      d3.select("#chkNoPattern").property("checked", tf);
37
-    }*/
38
-
39
     wrapText = textWrapper(theme);
34
     wrapText = textWrapper(theme);
40
 
35
 
41
     return this;
36
     return this;

+ 5 - 1
server/index.js View File

84
       res.send(JSON.stringify({status: 500, error: err}));
84
       res.send(JSON.stringify({status: 500, error: err}));
85
     } else {
85
     } else {
86
       var caption = req.body.newCaption;
86
       var caption = req.body.newCaption;
87
+      var width = req.body.newWidth;
88
+      var height = req.body.newHeight;
87
       var themes = JSON.parse(data);
89
       var themes = JSON.parse(data);
88
       themes[caption] = {
90
       themes[caption] = {
89
-        "backgroundImage": req.file.filename
91
+        "backgroundImage": req.file.filename,
92
+        "width": parseInt(width),
93
+        "height": parseInt(height)
90
       };
94
       };
91
       var jt = JSON.stringify(themes);
95
       var jt = JSON.stringify(themes);
92
       fs.writeFile(themesFile, jt, "utf8", function (err) {
96
       fs.writeFile(themesFile, jt, "utf8", function (err) {

File diff suppressed because it is too large
+ 215 - 1
settings/themes.json