-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added an API to add & delete entries from the skippedArtists list in …
…the settings. fixes [#405]
- Loading branch information
1 parent
b481108
commit d47da91
Showing
8 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
POST /settings/skipped-artists HTTP/1.1 | ||
Host: localhost:47836 | ||
Content-Type: application/json | ||
|
||
["abc", "def"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
POST /settings/skipped-artists/current HTTP/1.1 | ||
Host: localhost:47836 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
POST /settings/skipped-artists/delete HTTP/1.1 | ||
Host: localhost:47836 | ||
Content-Type: application/json | ||
|
||
["abc", "def"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
DELETE /settings/skipped-artists/current HTTP/1.1 | ||
Host: localhost:47836 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Request, Router } from "express"; | ||
import { settings } from "../../../../constants/settings"; | ||
import { mediaInfo } from "../../../../scripts/mediaInfo"; | ||
import { | ||
addSkippedArtists, | ||
removeSkippedArtists, | ||
settingsStore, | ||
} from "../../../../scripts/settings"; | ||
import { BrowserWindow } from "electron"; | ||
import { globalEvents } from "../../../../constants/globalEvents"; | ||
|
||
export const addSettingsAPI = (expressApp: Router, mainWindow: BrowserWindow) => { | ||
expressApp.get("/settings/skipped-artists", (req, res) => { | ||
res.json(settingsStore.get<string, string[]>(settings.skippedArtists)); | ||
}); | ||
|
||
expressApp.post("/settings/skipped-artists", (req: Request<object, object, string[]>, res) => { | ||
addSkippedArtists(req.body); | ||
res.sendStatus(200); | ||
}); | ||
|
||
expressApp.post( | ||
"/settings/skipped-artists/delete", | ||
(req: Request<object, object, string[]>, res) => { | ||
removeSkippedArtists(req.body); | ||
res.sendStatus(200); | ||
} | ||
); | ||
|
||
expressApp.post("/settings/skipped-artists/current", (req, res) => { | ||
addSkippedArtists([mediaInfo.artists]); | ||
mainWindow.webContents.send("globalEvent", globalEvents.next); | ||
res.sendStatus(200); | ||
}); | ||
expressApp.delete("/settings/skipped-artists/current", (req, res) => { | ||
removeSkippedArtists([mediaInfo.artists]); | ||
res.sendStatus(200); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters