Skip to content

Create build-nodejs.yml #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from
Prev Previous commit
Next Next commit
Update dev.js
  • Loading branch information
ne7359 authored Jan 18, 2025
commit d16bb5b1304ae81828c9c8f3212473c0b61cc89b
14 changes: 7 additions & 7 deletions nodejs/src/dev.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { createServer } from 'http';
import os from 'os';
import { start } from './index.js';
import * as config from './index.config.js';
import os from 'os'; // 新添加用于支持DS源适配猫影视
import { start } from './index.js'; // 新添加用于支持DS源适配猫影视
import * as config from './index.config.js'; // 新添加用于支持DS源适配猫影视

globalThis.catServerFactory = (handle) => {
let port = 0;
const server = createServer((req, res) => {
handle(req, res);
});

//下面新添加用于支持DS源适配猫影视
server.on('listening', () => {
port = server.address().port;

// Get local IP addresses
// 获取本地IP地址
const networkInterfaces = os.networkInterfaces();
const addresses = [];
for (const interfaceName in networkInterfaces) {
Expand All @@ -30,9 +30,9 @@ globalThis.catServerFactory = (handle) => {
}
console.log(`- Node.js version: ${process.version}`);
});

//上面新添加用于支持DS源适配猫影视
server.on('close', () => {
console.log('Server closed on port ' + port);
console.log('Server closed on port ' + port); //上面新添加用于支持DS源适配猫影视
});

return server;
Expand Down