Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const child_process = require('child_process');
const url = require('url');
const querystring = require('querystring');
const vm = require('vm');
const os = require('os');
const zlib = require('zlib');
const events = require('events');
const http = require('http');
const https = require('https');
const auth = require('http-auth');
const socketio = require('socket.io');
const chinachu = require('chinachu-common');
const ip = require("ip");
const geoip = require('geoip-lite');
const mdns = require('mdns-js');
const mirakurun = new (require("mirakurun").default)();
// Directory Checking
if (!fs.existsSync('./data/') || !fs.existsSync('./log/') || !fs.existsSync('./web/')) {
console.error('FATAL: Current working directory is invalid.');
process.exit(1);
}
const apps = require("./processes.json").apps;
const WUI_LOG_FILE = !!process.env.pm_id ? apps[0].out_file : (__dirname + '/log/wui');
const OPERATOR_LOG_FILE = !!process.env.pm_id ? apps[1].out_file : (__dirname + '/log/operator');
const OPERATOR_PID_FILE = (() => {
if (process.env.pm_id) {
const jlist = JSON.parse(child_process.execSync("pm2 jlist"));
const proc = jlist.find(_proc => _proc.name === "chinachu-operator");
return proc.pm2_env.pm_pid_path;
});
// 例外処理
process.on('uncaughtException', (err) => {
console.error('uncaughtException: ' + err.stack);
});
// 追加モジュールのロード
const dateFormat = require('dateformat');
const mkdirp = require('mkdirp');
const Mtwitter = require('mtwitter');
const disk = require('diskusage');
const nodemailer = require("nodemailer");
const sendmail = require("nodemailer-sendmail-transport");
const chinachu = require('chinachu-common');
const mirakurun = new (require("mirakurun").default)();
//
let reserves = [];
let recorded = [];
let recording = [];
// 設定の読み込み
const pkg = require("./package.json");
const config = require(CONFIG_FILE);
// settings
const schedulerIntervalTime = 1000 * 60 * 10;// 最長10分毎
const notifyIntervalTime = 1000 * 60 * 60 * 3;// 3時間毎
const prepTime = 1000 * 15;// 15秒前
const recordingPriority = config.recordingPriority || 2;
const conflictedPriority = config.conflictedPriority || 1;
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
"use strict";
const electron = require("electron");
const app = electron.app;
const settings = require("electron-settings");
const { autoUpdater } = require("electron-updater");
const isDev = require("electron-is-dev");
const Mirakurun = require("mirakurun").default;
const regexp = require("./regexp");
const pkg = require("../package.json");
const mirakurun = global.mirakurun = new Mirakurun();
mirakurun.userAgent = `${pkg.name}/${app.getVersion()}`;
const icon = {
normal: electron.nativeImage.createFromPath(`${__dirname}/images/icon.png`),
normal30: electron.nativeImage.createFromPath(`${__dirname}/images/icon30.png`),
offline: electron.nativeImage.createFromPath(`${__dirname}/images/icon-gray.png`),
active: electron.nativeImage.createFromPath(`${__dirname}/images/icon-active.png`)
};
autoUpdater.on("update-downloaded", () => {
// Wait 5 seconds, then quit and install
// In your application, you don't need to wait 5 seconds.
// You could call autoUpdater.quitAndInstall(); immediately
setTimeout(() => autoUpdater.quitAndInstall(), 5000);
});