Skip to content

Commit 906d729

Browse files
committed
Fixed #47. the layers were not consistent so now a global variable is used to register proxy only once.
Updated Axios version Minor changes to readme
1 parent 9072a06 commit 906d729

3 files changed

Lines changed: 9 additions & 15 deletions

File tree

README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -364,18 +364,14 @@ The following properties can be configured:
364364
</tr>
365365
<tr>
366366
<td><code>mode</code></td>
367-
<td>The mode of operation for the module. Valid options are 'memory', 'album', 'search'(Experimental), 'random', or 'anniversary' and depending on which is chosen, additional settings are required.<br>
367+
<td>The mode of operation for the module. Valid options are 'memory', 'album', 'search', 'random', or 'anniversary' and depending on which is chosen, additional settings are required.<br>
368368
<br><b>Example:</b> <code>memory</code> for memory mode
369-
<br><b>Example:</b> <code>album</code> for album mode
370-
<br><b>Example:</b> <code>search</code> for search mode
371-
<br><b>Example:</b> <code>random</code> for random mode
372-
<br><b>Example:</b> <code>anniversary</code> for anniversary mode
373369
<br>This value is <b>REQUIRED</b>
374370
</td>
375371
</tr>
376372
<tr>
377373
<td><code>numDaysToInclude</code></td>
378-
<td>The number of days to go back and collect images for. Use this to make sure you always have images to display since there could be days where no pictures were taken over the years.<br>
374+
<td>The number of days to go back and collect images for. Use this to make sure you always have images to display since there could be days where no pictures were taken over the years. Max value allowed is 14 days.<br>
379375
<br><b>Example:</b> <code>7</code> for 7 days
380376
<br>This value is <b>REQUIRED</b> if <i>mode</i> is set to <i>memory</i>
381377
</td>

immichApi.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
const Log = console;
2-
// const Log = require('logger');
1+
// const Log = console;
2+
const Log = require('logger');
33
const axios = require('axios');
44
const { createProxyMiddleware } = require("http-proxy-middleware");
55

66
const LOG_PREFIX = 'MMM-ImmichSlideShow :: immichApi :: ';
77
const IMMICH_PROXY_URL = '/immichslideshow/';
8+
let IS_PROXY_REGISTERED = false;
89

910
const immichApi = {
1011
apiUrls: {
@@ -121,13 +122,10 @@ const immichApi = {
121122
throw('Failed to get Immich version. Cannot proceed.');
122123
}
123124

124-
// Now setup our proxy service if not already registered
125-
const proxyRegistered = expressApp.router.stack.some(layer => {
126-
return layer.path && IMMICH_PROXY_URL.indexOf(layer.path) === 0;
127-
});
128125
// Only register the proxy if not already registered
129-
if (!proxyRegistered) {
126+
if (!IS_PROXY_REGISTERED) {
130127
Log.debug('Registering proxy for immich');
128+
IS_PROXY_REGISTERED = true;
131129
const self = this;
132130
expressApp.use(IMMICH_PROXY_URL, createProxyMiddleware({
133131
changeOrigin: true,

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mmm-immichslideshow",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"description": "A plugin for MagicMirror2 to show slideshows from Immich",
55
"author": "Pelaxa Inc.",
66
"license": "MIT",
@@ -20,7 +20,7 @@
2020
"url": "git+https://github.com/pelaxa/MMM-ImmichSlideShow"
2121
},
2222
"dependencies": {
23-
"axios": "1.14.0",
23+
"axios": "1.15.0",
2424
"http-proxy-middleware": "^3.0.5"
2525
},
2626
"engines": {

0 commit comments

Comments
 (0)