代码拉取完成,页面将自动刷新
同步操作将从 yeti/psitransfer 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
const https = require('https');
const fs = require('fs');
const config = require('./config');
const app = require('./lib/endpoints');
const eventBus = require('./lib/eventBus');
/**
* Naming:
* sid: Group of files
* key: File
* fid: {sid}++{key}
*/
let server;
if(config.port) {
// HTTP Server
server = app.listen(config.port, config.iface, () => {
console.log(`PsiTransfer listening on http://${config.iface}:${config.port}`);
eventBus.emit('listen', server);
});
}
let httpsServer;
if(config.sslPort && config.sslKeyFile && config.sslCertFile) {
// HTTPS Server
const sslOpts = {
key: fs.readFileSync(config.sslKeyFile),
cert: fs.readFileSync(config.sslCertFile)
};
httpsServer = https.createServer(sslOpts, app)
.listen(config.sslPort, config.iface, () => {
console.log(`PsiTransfer listening on https://${config.iface}:${config.sslPort}`);
eventBus.emit('listen', httpsServer);
});
}
// graceful shutdown
function shutdown() {
console.log('PsiTransfer shutting down...');
eventBus.emit('shutdown', server || httpsServer);
if(server) {
server.close(() => {
server = false;
if(!server && !httpsServer) process.exit(0);
});
}
if(httpsServer) {
httpsServer.close(() => {
httpsServer = false;
if(!server && !httpsServer) process.exit(0);
});
}
setTimeout(function() {
console.log('Could not close connections in time, forcefully shutting down');
process.exit(1);
}, 15 * 1000);
}
process.on('SIGTERM', shutdown);
process.on('SIGINT', shutdown);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。