mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-04-24 16:27:23 +08:00
🐞 fix: 优化远程控制页面HTML路径获取逻辑,支持开发环境与生产环境的路径区分
This commit is contained in:
@@ -213,7 +213,9 @@ function setupRoutes(app: express.Application) {
|
|||||||
app.get('/', (_, res) => {
|
app.get('/', (_, res) => {
|
||||||
try {
|
try {
|
||||||
const resourcesPath = process.resourcesPath || '';
|
const resourcesPath = process.resourcesPath || '';
|
||||||
const finalPath = path.join(resourcesPath, 'html', 'remote-control.html');
|
const isDev = process.env.NODE_ENV === 'development';
|
||||||
|
const htmlPath = path.join(process.cwd(), 'resources', 'html', 'remote-control.html');
|
||||||
|
const finalPath = isDev ? htmlPath : path.join(resourcesPath, 'html', 'remote-control.html');
|
||||||
|
|
||||||
if (fs.existsSync(finalPath)) {
|
if (fs.existsSync(finalPath)) {
|
||||||
res.sendFile(finalPath);
|
res.sendFile(finalPath);
|
||||||
|
|||||||
Reference in New Issue
Block a user