mirror of
https://github.com/Mastermindzh/tidal-hifi.git
synced 2024-11-22 21:42:46 +01:00
Add the cors module and use it with express api
This commit is contained in:
parent
6e43cbb4d7
commit
180d9c97a7
@ -41,6 +41,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@electron/remote": "^2.1.2",
|
"@electron/remote": "^2.1.2",
|
||||||
"axios": "^1.6.8",
|
"axios": "^1.6.8",
|
||||||
|
"cors": "^2.8.5",
|
||||||
"discord-rpc": "^4.0.1",
|
"discord-rpc": "^4.0.1",
|
||||||
"electron-store": "^8.2.0",
|
"electron-store": "^8.2.0",
|
||||||
"express": "^4.19.2",
|
"express": "^4.19.2",
|
||||||
@ -51,6 +52,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@mastermindzh/prettier-config": "^1.0.0",
|
"@mastermindzh/prettier-config": "^1.0.0",
|
||||||
|
"@types/cors": "^2.8.17",
|
||||||
"@types/discord-rpc": "^4.0.8",
|
"@types/discord-rpc": "^4.0.8",
|
||||||
"@types/express": "^4.17.21",
|
"@types/express": "^4.17.21",
|
||||||
"@types/node": "^20.10.6",
|
"@types/node": "^20.10.6",
|
||||||
|
@ -5,12 +5,14 @@ import { settingsStore } from "../../scripts/settings";
|
|||||||
import { addCurrentInfo } from "./features/current";
|
import { addCurrentInfo } from "./features/current";
|
||||||
import { addPlaybackControl } from "./features/player";
|
import { addPlaybackControl } from "./features/player";
|
||||||
import { addLegacyApi } from "./legacy";
|
import { addLegacyApi } from "./legacy";
|
||||||
|
import cors from "cors";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to enable TIDAL Hi-Fi's express api
|
* Function to enable TIDAL Hi-Fi's express api
|
||||||
*/
|
*/
|
||||||
export const startApi = (mainWindow: BrowserWindow) => {
|
export const startApi = (mainWindow: BrowserWindow) => {
|
||||||
const expressApp = express();
|
const expressApp = express();
|
||||||
|
expressApp.use(cors());
|
||||||
expressApp.get("/", (req, res) => res.send("Hello World!"));
|
expressApp.get("/", (req, res) => res.send("Hello World!"));
|
||||||
|
|
||||||
// add features
|
// add features
|
||||||
|
Loading…
Reference in New Issue
Block a user