Skip to content

Commit

Permalink
node 10 対応
Browse files Browse the repository at this point in the history
  • Loading branch information
l3tnun committed Nov 3, 2018
1 parent cb3dcc7 commit d3f3f0c
Show file tree
Hide file tree
Showing 13 changed files with 80 additions and 75 deletions.
2 changes: 1 addition & 1 deletion .npmrc
@@ -1,2 +1,2 @@
package-lock=false
package-lock=true
save-exact=true
49 changes: 25 additions & 24 deletions gulpfile.js
Expand Up @@ -99,14 +99,14 @@ gulp.task('tslint-server', () => {
}));
});

gulp.task('build-server', ['clean-server', 'tslint-server'],() => {
gulp.task('build-server', gulp.series('clean-server', 'tslint-server', () => {
return gulp.src(config.server.src)
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(typescript(config.server.options))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(config.server.dst));
});
}));

// client
gulp.task('clean-client', () => {
Expand All @@ -123,19 +123,19 @@ gulp.task('tslint-client', () => {
}));
});

gulp.task('build-client', ['clean-client', 'tslint-client'], () => {
gulp.task('build-client', gulp.series('clean-client', 'tslint-client', () => {
return gulp.src(config.client.src)
.pipe(plumber())
.pipe(webpackStream(webpackConfig, webpack))
.pipe(gulp.dest(config.client.dst))
.on('error', (error) => {
console.error(error);
});
});
}));

gulp.task('clean-client-css', () => {
return del([config.client.css.dst]);
})
});

gulp.task('client-css-build', () => {
let result = gulp.src(config.client.css.src)
Expand All @@ -156,25 +156,26 @@ gulp.task('client-css-build', () => {
});

// clean
gulp.task('clean', ['clean-server', 'clean-client', 'clean-client-css']);
gulp.task('clean', gulp.series('clean-server', 'clean-client', 'clean-client-css'));

// build
gulp.task('build', ['clean', 'build-server', 'build-client', 'client-css-build']);

gulp.task('watch', [
'clean-server',
'tslint-server',
'build-server',
'clean-client',
'tslint-client',
'build-client',
'clean-client-css',
'client-css-build'
], () => {
gulp.watch(config.server.src, ['clean-server', 'tslint-server', 'build-server']);
gulp.watch(config.client.src, ['clean-client', 'build-client']);
gulp.watch(config.client.css.src, ['clean-client-css', 'client-css-build']);
});

gulp.task('default', ['watch']);
gulp.task('build', gulp.series('clean', 'build-server', 'build-client', 'client-css-build'));

gulp.task('watch', gulp.series(
'clean-server',
'tslint-server',
'build-server',
'clean-client',
'tslint-client',
'build-client',
'clean-client-css',
'client-css-build',
() => {
gulp.watch(config.server.src, gulp.task('build-server'));
gulp.watch(config.client.src, gulp.task('build-client'));
gulp.watch(config.client.css.src, gulp.task('client-css-build'));
})
);

gulp.task('default', gulp.series('watch'));

77 changes: 39 additions & 38 deletions package.json
Expand Up @@ -31,69 +31,70 @@
"node": "^6.x.x || ~8"
},
"dependencies": {
"aribts": "2.1.10",
"basic-auth": "2.0.0",
"aribts": "^2.1.12",
"basic-auth": "2.0.1",
"body-parser": "1.18.3",
"chart.js": "2.7.2",
"diskusage": "0.2.4",
"express": "4.16.3",
"chart.js": "2.7.3",
"diskusage": "0.2.6",
"express": "4.16.4",
"express-ipfilter": "0.3.1",
"express-openapi": "1.6.2",
"fs-extra": "6.0.1",
"hls.js": "0.9.1",
"js-yaml": "3.11.0",
"lodash": "4.17.10",
"log4js": "2.7.0",
"express-openapi": "3.1.0",
"fs-extra": "7.0.0",
"hls.js": "0.11.0",
"js-yaml": "3.12.0",
"lodash": "4.17.11",
"log4js": "3.0.6",
"material-design-icons": "3.0.1",
"material-design-lite": "1.3.0",
"minimist": "1.2.0",
"mirakurun": "^2.7.0",
"mirakurun": "^2.7.4",
"mithril": "1.1.6",
"mkdirp": "0.5.1",
"multer": "1.3.0",
"mysql": "2.15.0",
"pg": "7.4.3",
"request": "2.86.0",
"multer": "1.4.1",
"mysql": "2.16.0",
"openapi-types": "1.3.2",
"pg": "7.6.0",
"request": "2.88.0",
"socket.io": "2.1.1",
"socket.io-client": "2.1.1",
"sqlite3": "4.0.0",
"swagger-ui-express": "3.0.9",
"sqlite3": "4.0.3",
"swagger-ui-express": "4.0.1",
"url-join": "4.0.0"
},
"devDependencies": {
"@types/basic-auth": "1.1.2",
"@types/body-parser": "1.17.0",
"@types/chart.js": "2.7.18",
"@types/express": "4.11.1",
"@types/hls.js": "0.8.1",
"@types/js-yaml": "3.11.1",
"@types/lodash": "4.14.109",
"@types/chart.js": "2.7.40",
"@types/express": "4.16.0",
"@types/hls.js": "0.10.2",
"@types/js-yaml": "3.11.2",
"@types/lodash": "4.14.117",
"@types/material-design-lite": "1.1.15",
"@types/minimist": "1.2.0",
"@types/mithril": "1.1.12",
"@types/mithril": "1.1.13",
"@types/mkdirp": "0.5.2",
"@types/multer": "1.3.6",
"@types/mysql": "2.15.4",
"@types/node": "10.1.2",
"@types/pg": "7.4.9",
"@types/request": "2.47.0",
"@types/socket.io": "1.4.33",
"@types/multer": "1.3.7",
"@types/mysql": "2.15.5",
"@types/node": "10.12.2",
"@types/pg": "7.4.11",
"@types/request": "2.48.0",
"@types/socket.io": "2.1.0",
"@types/socket.io-client": "1.4.32",
"@types/sqlite3": "3.1.3",
"@types/url-join": "0.8.2",
"del": "3.0.0",
"gulp": "3.9.1",
"gulp-clean-css": "3.9.4",
"gulp": "4.0.0",
"gulp-clean-css": "3.10.0",
"gulp-concat": "2.6.1",
"gulp-plumber": "1.2.0",
"gulp-sass": "4.0.1",
"gulp-sass": "4.0.2",
"gulp-sourcemaps": "2.6.4",
"gulp-tslint": "8.1.3",
"gulp-typescript": "4.0.2",
"ts-loader": "4.3.0",
"tslint": "5.10.0",
"typescript": "2.8.3",
"webpack": "4.8.3",
"webpack-stream": "4.0.3"
"ts-loader": "5.3.0",
"tslint": "5.11.0",
"typescript": "3.1.6",
"webpack": "4.24.0",
"webpack-stream": "5.1.1"
}
}
2 changes: 1 addition & 1 deletion src/server/Model/Operator/ProgramExternalProcessModel.ts
Expand Up @@ -55,7 +55,7 @@ class ProgramExternalProcessModel extends QueueProcessBaseModel implements Progr
DESCRIPTION: program.description,
EXTENDED: program.extended,
},
});
} as any);

child.on('exit', () => {
this.log.system.info(`${ name } process is fin`);
Expand Down
2 changes: 1 addition & 1 deletion src/server/Model/Operator/RecordedExternalProcessModel.ts
Expand Up @@ -58,7 +58,7 @@ class RecordedExternalProcessModel extends QueueProcessBaseModel implements Reco
RECPATH: program.recPath,
LOGPATH: program.logPath,
},
});
} as any);

child.on('exit', () => {
this.log.system.info(`${ name } process is fin`);
Expand Down
2 changes: 1 addition & 1 deletion src/server/Model/Service/Encode/EncodeManageModel.ts
Expand Up @@ -454,7 +454,7 @@ class EncodeManageModel extends Model implements EncodeManageModelInterface {
GENRE1: program.recordedProgram.genre1,
GENRE2: program.recordedProgram.genre2,
},
});
} as any);
} catch (err) {
this.log.system.error('encode process create error');
this.finalize();
Expand Down
7 changes: 5 additions & 2 deletions src/server/Service/Server.ts
Expand Up @@ -10,6 +10,7 @@ import * as yaml from 'js-yaml';
import * as log4js from 'log4js';
import * as mkdirp from 'mkdirp';
import * as multer from 'multer';
import { OpenAPIV2 } from 'openapi-types';
import * as path from 'path';
import * as swaggerUi from 'swagger-ui-express';
import * as urljoin from 'url-join';
Expand Down Expand Up @@ -48,7 +49,7 @@ class Server extends Base {
const pkg = require(path.join('..', '..', '..', 'package.json'));

// read api.yml
const api = <openapi.OpenApi.ApiDefinition> yaml.safeLoad(fs.readFileSync(path.join(__dirname, '..', '..', '..', 'api.yml'), 'utf-8'));
const api = <OpenAPIV2.Document> yaml.safeLoad(fs.readFileSync(path.join(__dirname, '..', '..', '..', 'api.yml'), 'utf-8'));
api.basePath = this.createUrl('/api');
api.info = {
title: pkg.name,
Expand Down Expand Up @@ -135,7 +136,9 @@ class Server extends Base {
errorTransformer: (openApi) => {
this.log.system.error(<any> openApi);

return openApi.message;
return {
message: (<any> openApi).message,
};
},
exposeApiDocs: true,
paths: path.join(__dirname, 'api'),
Expand Down
2 changes: 1 addition & 1 deletion src/server/Service/api/iptv/channel.m3u8.ts
Expand Up @@ -7,7 +7,7 @@ export const get: Operation = async(req, res) => {
const iptv = <IPTVModelInterface> factory.get('IPTVModel');

try {
const result = await iptv.getChannelList(req.headers.host, req.header('x-forwarded-proto') === 'https', req.query.mode);
const result = await iptv.getChannelList(req.headers.host!, req.header('x-forwarded-proto') === 'https', req.query.mode);
res.setHeader('Content-Type', 'application/x-mpegURL; charset="UTF-8"');
res.status(200);
res.end(result);
Expand Down
2 changes: 1 addition & 1 deletion src/server/Service/api/recorded/{id}/kodi.ts
Expand Up @@ -7,7 +7,7 @@ export const post: Operation = async(req, res) => {
const recordeds = <RecordedModelInterface> factory.get('RecordedModel');

try {
await recordeds.sendToKodi(req.headers.host, req.header('x-forwarded-proto') === 'https', req.body.kodi, req.params.id, req.body.encodedId);
await recordeds.sendToKodi(req.headers.host!, req.header('x-forwarded-proto') === 'https', req.body.kodi, req.params.id, req.body.encodedId);
api.responseJSON(res, 200, { code: 200, result: 'ok' });
} catch (err) {
if (err.message === RecordedModelInterface.NotFoundRecordedFileError) {
Expand Down
2 changes: 1 addition & 1 deletion src/server/Service/api/recorded/{id}/playlist.ts
Expand Up @@ -7,7 +7,7 @@ export const get: Operation = async(req, res) => {
const recordeds = <RecordedModelInterface> factory.get('RecordedModel');

try {
const list = await recordeds.getM3u8(req.headers.host, req.header('x-forwarded-proto') === 'https', req.params.id, req.query.encodedId);
const list = await recordeds.getM3u8(req.headers.host!, req.header('x-forwarded-proto') === 'https', req.params.id, req.query.encodedId);
api.responsePlayList(req, res, list);
} catch (err) {
if (err.message === RecordedModelInterface.NotFoundRecordedFileError) {
Expand Down
Expand Up @@ -7,7 +7,7 @@ export const get: Operation = async(req, res) => {
const streams = <StreamsModelInterface> factory.get('StreamsModel');

try {
const list = await streams.getLiveM3u8(req.headers.host, req.header('x-forwarded-proto') === 'https', req.params.id, req.query.mode);
const list = await streams.getLiveM3u8(req.headers.host!, req.header('x-forwarded-proto') === 'https', req.params.id, req.query.mode);
api.responsePlayList(req, res, list);
} catch (err) {
if (err.message === StreamsModelInterface.channleIsNotFoundError) {
Expand Down
4 changes: 2 additions & 2 deletions src/server/Service/api/streams/recorded/{id}/mpegts.ts
Expand Up @@ -27,7 +27,7 @@ export const get: Operation = async(req, res) => {
req.params.id,
req.query.mode,
req.query.ss,
typeof req.headers.range === 'undefined' ? null : req.headers.range,
typeof req.headers.range === 'string' ? req.headers.range : null,
);

res.status(200);
Expand All @@ -41,7 +41,7 @@ export const get: Operation = async(req, res) => {
req.params.id,
req.query.mode,
req.query.ss,
typeof req.headers.range === 'undefined' ? null : req.headers.range,
typeof req.headers.range === 'string' ? req.headers.range : null,
);
stream = info.stream;
const encChild = info.stream.getEncChild();
Expand Down
Expand Up @@ -7,7 +7,7 @@ export const get: Operation = async(req, res) => {
const streams = <StreamsModelInterface> factory.get('StreamsModel');

try {
const list = await streams.getRecordedStreamingM3u8(req.headers.host, req.header('x-forwarded-proto') === 'https', req.params.id, req.query.mode);
const list = await streams.getRecordedStreamingM3u8(req.headers.host!, req.header('x-forwarded-proto') === 'https', req.params.id, req.query.mode);
api.responsePlayList(req, res, list);
} catch (err) {
if (err.message === StreamsModelInterface.recordedIsNotFoundError) {
Expand Down

0 comments on commit d3f3f0c

Please sign in to comment.