Skip to content

Commit 403af71

Browse files
authored
Merge pull request #20 from christophernewton/master
Frontend update
2 parents 2a9cd87 + 31cd72c commit 403af71

File tree

5 files changed

+1474
-95
lines changed

5 files changed

+1474
-95
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ npm install
4242
### [Docker](https://hub.docker.com/r/foxxmd/multi-scrobbler)
4343

4444
```
45-
foxxmd/spotify-scrobbler:latest
45+
foxxmd/multi-scrobbler:latest
4646
```
4747

4848
## Setup
@@ -61,7 +61,7 @@ SPOTIFY_CLIENT_ID=yourId SPOTIFY_CLIENT_SECRET=yourSecret MALOJA_URL=http://doma
6161
#### Docker
6262

6363
```bash
64-
docker run -e "SPOTIFY_CLIENT_ID=yourId" -e "SPOTIFY_CLIENT_SECRET=yourSecret" -e "MALOJA_URL=http://domain.tld" -e "MALOJA_API_KEY=1234" -v /path/on/host/config:/home/node/app/config foxxmd/spotify-scrobbler
64+
docker run -e "SPOTIFY_CLIENT_ID=yourId" -e "SPOTIFY_CLIENT_SECRET=yourSecret" -e "MALOJA_URL=http://domain.tld" -e "MALOJA_API_KEY=1234" -v /path/on/host/config:/home/node/app/config foxxmd/multi-scrobbler
6565
```
6666

6767
**But I want to use json for configuration?**

index.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ const {transports} = winston;
3535
let output = []
3636
const stream = new Writable()
3737
stream._write = (chunk, encoding, next) => {
38-
output.unshift(chunk.toString().replace('\n', ''));
38+
let formatString = chunk.toString().replace('\n', '<br />')
39+
.replace(/(debug)/gi, '<span class="debug text-pink-400">$1</span>')
40+
.replace(/(warn)/gi, '<span class="warn text-blue-400">$1</span>')
41+
.replace(/(info)/gi, '<span class="info text-yellow-500">$1</span>')
42+
.replace(/(error)/gi, '<span class="error text-red-400">$1</span>')
43+
output.unshift(formatString);
3944
output = output.slice(0, 101);
4045
next()
4146
}
@@ -198,9 +203,9 @@ app.use(bodyParser.json());
198203
clients: clientData,
199204
logs: {
200205
output: slicedLog,
201-
limit: [10, 20, 50, 100].map(x => `<a class="capitalize ${logConfig.limit === x ? 'bold' : ''}" href="logs/settings/update?limit=${x}">${x}</a>`).join(' | '),
202-
sort: ['ascending', 'descending'].map(x => `<a class="capitalize ${logConfig.sort === x ? 'bold' : ''}" href="logs/settings/update?sort=${x}">${x}</a>`).join(' | '),
203-
level: availableLevels.map(x => `<a class="capitalize ${logConfig.level === x ? 'bold' : ''}" href="logs/settings/update?level=${x}">${x}</a>`).join(' | ')
206+
limit: [10, 20, 50, 100].map(x => `<a class="capitalize ${logConfig.limit === x ? 'font-bold no-underline pointer-events-none' : ''}" href="logs/settings/update?limit=${x}">${x}</a>`).join(' | '),
207+
sort: ['ascending', 'descending'].map(x => `<a class="capitalize ${logConfig.sort === x ? 'font-bold no-underline pointer-events-none' : ''}" href="logs/settings/update?sort=${x}">${x}</a>`).join(' | '),
208+
level: availableLevels.map(x => `<a class="capitalize ${logConfig.level === x ? 'font-bold no-underline pointer-events-none' : ''}" href="logs/settings/update?level=${x}">${x}</a>`).join(' | ')
204209
}
205210
});
206211
})

0 commit comments

Comments
 (0)