Migrate to tslint 5.1.0
This commit is contained in:
parent
798d1610f0
commit
b095efaee5
16 changed files with 107 additions and 95 deletions
|
@ -49,7 +49,7 @@ module.exports = (params) => new Promise(async (res, rej) => {
|
||||||
day = new Date(day.setSeconds(59));
|
day = new Date(day.setSeconds(59));
|
||||||
day = new Date(day.setMinutes(59));
|
day = new Date(day.setMinutes(59));
|
||||||
day = new Date(day.setHours(23));
|
day = new Date(day.setHours(23));
|
||||||
//day = day.getTime();
|
// day = day.getTime();
|
||||||
|
|
||||||
const count = likes.filter(l =>
|
const count = likes.filter(l =>
|
||||||
l.created_at < day && (l.deleted_at == null || l.deleted_at > day)
|
l.created_at < day && (l.deleted_at == null || l.deleted_at > day)
|
||||||
|
|
|
@ -32,14 +32,14 @@ module.exports = (params, user, app, isSecure) => new Promise(async (res, rej) =
|
||||||
} else {
|
} else {
|
||||||
const select = {};
|
const select = {};
|
||||||
if (key !== null) {
|
if (key !== null) {
|
||||||
select['data.' + key] = true;
|
select[`data.${key}`] = true;
|
||||||
}
|
}
|
||||||
const appdata = await Appdata.findOne({
|
const appdata = await Appdata.findOne({
|
||||||
app_id: app._id,
|
app_id: app._id,
|
||||||
user_id: user._id
|
user_id: user._id
|
||||||
}, {
|
}, {
|
||||||
fields: select
|
fields: select
|
||||||
});
|
});
|
||||||
|
|
||||||
if (appdata) {
|
if (appdata) {
|
||||||
res(appdata.data);
|
res(appdata.data);
|
||||||
|
|
|
@ -37,10 +37,10 @@ module.exports = (params, user, app, isSecure) => new Promise(async (res, rej) =
|
||||||
let set = {};
|
let set = {};
|
||||||
if (data) {
|
if (data) {
|
||||||
Object.entries(data).forEach(([k, v]) => {
|
Object.entries(data).forEach(([k, v]) => {
|
||||||
set['data.' + k] = v;
|
set[`data.${k}`] = v;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
set['data.' + key] = value;
|
set[`data.${key}`] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSecure) {
|
if (isSecure) {
|
||||||
|
@ -63,10 +63,10 @@ module.exports = (params, user, app, isSecure) => new Promise(async (res, rej) =
|
||||||
app_id: app._id,
|
app_id: app._id,
|
||||||
user_id: user._id
|
user_id: user._id
|
||||||
}, {
|
}, {
|
||||||
$set: set
|
$set: set
|
||||||
}), {
|
}), {
|
||||||
upsert: true
|
upsert: true
|
||||||
});
|
});
|
||||||
|
|
||||||
res(204);
|
res(204);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,8 +45,8 @@ module.exports = (params, user, app) => new Promise(async (res, rej) => {
|
||||||
_id: mediaId,
|
_id: mediaId,
|
||||||
user_id: user._id
|
user_id: user._id
|
||||||
}, {
|
}, {
|
||||||
_id: true
|
_id: true
|
||||||
});
|
});
|
||||||
|
|
||||||
if (entity === null) {
|
if (entity === null) {
|
||||||
return rej('file not found');
|
return rej('file not found');
|
||||||
|
@ -79,23 +79,23 @@ module.exports = (params, user, app) => new Promise(async (res, rej) => {
|
||||||
const latestPost = await Post.findOne({
|
const latestPost = await Post.findOne({
|
||||||
user_id: user._id
|
user_id: user._id
|
||||||
}, {
|
}, {
|
||||||
sort: {
|
sort: {
|
||||||
_id: -1
|
_id: -1
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 直近と同じRepost対象かつ引用じゃなかったらエラー
|
// 直近と同じRepost対象かつ引用じゃなかったらエラー
|
||||||
if (latestPost &&
|
if (latestPost &&
|
||||||
latestPost.repost_id &&
|
latestPost.repost_id &&
|
||||||
latestPost.repost_id.equals(repost._id) &&
|
latestPost.repost_id.equals(repost._id) &&
|
||||||
text === undefined && files === null) {
|
text === undefined && files === null) {
|
||||||
return rej('二重Repostです(NEED TRANSLATE)');
|
return rej('二重Repostです(NEED TRANSLATE)');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 直近がRepost対象かつ引用じゃなかったらエラー
|
// 直近がRepost対象かつ引用じゃなかったらエラー
|
||||||
if (latestPost &&
|
if (latestPost &&
|
||||||
latestPost._id.equals(repost._id) &&
|
latestPost._id.equals(repost._id) &&
|
||||||
text === undefined && files === null) {
|
text === undefined && files === null) {
|
||||||
return rej('二重Repostです(NEED TRANSLATE)');
|
return rej('二重Repostです(NEED TRANSLATE)');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,11 +152,11 @@ module.exports = (params, user, app) => new Promise(async (res, rej) => {
|
||||||
repost: user.latest_post.repost_id ? user.latest_post.repost_id.toString() : null,
|
repost: user.latest_post.repost_id ? user.latest_post.repost_id.toString() : null,
|
||||||
media_ids: (user.latest_post.media_ids || []).map(id => id.toString())
|
media_ids: (user.latest_post.media_ids || []).map(id => id.toString())
|
||||||
}, {
|
}, {
|
||||||
text: text,
|
text: text,
|
||||||
reply: inReplyToPost ? inReplyToPost._id.toString() : null,
|
reply: inReplyToPost ? inReplyToPost._id.toString() : null,
|
||||||
repost: repost ? repost._id.toString() : null,
|
repost: repost ? repost._id.toString() : null,
|
||||||
media_ids: (files || []).map(file => file._id.toString())
|
media_ids: (files || []).map(file => file._id.toString())
|
||||||
})) {
|
})) {
|
||||||
return rej('duplicate');
|
return rej('duplicate');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ module.exports = (params, user, app) => new Promise(async (res, rej) => {
|
||||||
// Reponse
|
// Reponse
|
||||||
res(postObj);
|
res(postObj);
|
||||||
|
|
||||||
//--------------------------------
|
// --------------------------------
|
||||||
// Post processes
|
// Post processes
|
||||||
|
|
||||||
User.update({ _id: user._id }, {
|
User.update({ _id: user._id }, {
|
||||||
|
@ -288,17 +288,17 @@ module.exports = (params, user, app) => new Promise(async (res, rej) => {
|
||||||
if (text) {
|
if (text) {
|
||||||
// Analyze
|
// Analyze
|
||||||
const tokens = parse(text);
|
const tokens = parse(text);
|
||||||
/*
|
/*
|
||||||
// Extract a hashtags
|
// Extract a hashtags
|
||||||
const hashtags = tokens
|
const hashtags = tokens
|
||||||
.filter(t => t.type == 'hashtag')
|
.filter(t => t.type == 'hashtag')
|
||||||
.map(t => t.hashtag)
|
.map(t => t.hashtag)
|
||||||
// Drop dupulicates
|
// Drop dupulicates
|
||||||
.filter((v, i, s) => s.indexOf(v) == i);
|
.filter((v, i, s) => s.indexOf(v) == i);
|
||||||
|
|
||||||
// ハッシュタグをデータベースに登録
|
// ハッシュタグをデータベースに登録
|
||||||
registerHashtags(user, hashtags);
|
registerHashtags(user, hashtags);
|
||||||
*/
|
*/
|
||||||
// Extract an '@' mentions
|
// Extract an '@' mentions
|
||||||
const atMentions = tokens
|
const atMentions = tokens
|
||||||
.filter(t => t.type == 'mention')
|
.filter(t => t.type == 'mention')
|
||||||
|
|
|
@ -67,7 +67,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
res();
|
res();
|
||||||
|
|
||||||
const inc = {};
|
const inc = {};
|
||||||
inc['reaction_counts.' + reaction] = 1;
|
inc[`reaction_counts.${reaction}`] = 1;
|
||||||
|
|
||||||
// Increment reactions count
|
// Increment reactions count
|
||||||
await Post.update({ _id: post._id }, {
|
await Post.update({ _id: post._id }, {
|
||||||
|
|
|
@ -42,16 +42,16 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
await Reaction.update({
|
await Reaction.update({
|
||||||
_id: exist._id
|
_id: exist._id
|
||||||
}, {
|
}, {
|
||||||
$set: {
|
$set: {
|
||||||
deleted_at: new Date()
|
deleted_at: new Date()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Send response
|
// Send response
|
||||||
res();
|
res();
|
||||||
|
|
||||||
const dec = {};
|
const dec = {};
|
||||||
dec['reaction_counts.' + exist.reaction] = -1;
|
dec[`reaction_counts.${exist.reaction}`] = -1;
|
||||||
|
|
||||||
// Decrement reactions count
|
// Decrement reactions count
|
||||||
Post.update({ _id: post._id }, {
|
Post.update({ _id: post._id }, {
|
||||||
|
|
|
@ -58,7 +58,7 @@ export default async (req: express.Request, res: express.Response) => {
|
||||||
const hash = bcrypt.hashSync(password, salt);
|
const hash = bcrypt.hashSync(password, salt);
|
||||||
|
|
||||||
// Generate secret
|
// Generate secret
|
||||||
const secret = '!' + rndstr('a-zA-Z0-9', 32);
|
const secret = `!${rndstr('a-zA-Z0-9', 32)}`;
|
||||||
|
|
||||||
// Create account
|
// Create account
|
||||||
const account = await User.insert({
|
const account = await User.insert({
|
||||||
|
|
|
@ -34,10 +34,10 @@ app.get('/', (req, res) => {
|
||||||
*/
|
*/
|
||||||
endpoints.forEach(endpoint =>
|
endpoints.forEach(endpoint =>
|
||||||
endpoint.withFile ?
|
endpoint.withFile ?
|
||||||
app.post('/' + endpoint.name,
|
app.post(`/${endpoint.name}`,
|
||||||
endpoint.withFile ? multer({ dest: 'uploads/' }).single('file') : null,
|
endpoint.withFile ? multer({ dest: 'uploads/' }).single('file') : null,
|
||||||
require('./api-handler').default.bind(null, endpoint)) :
|
require('./api-handler').default.bind(null, endpoint)) :
|
||||||
app.post('/' + endpoint.name,
|
app.post(`/${endpoint.name}`,
|
||||||
require('./api-handler').default.bind(null, endpoint))
|
require('./api-handler').default.bind(null, endpoint))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ module.exports = async (app: express.Application) => {
|
||||||
const handler = new EventEmitter();
|
const handler = new EventEmitter();
|
||||||
|
|
||||||
app.post('/hooks/github', (req, res, next) => {
|
app.post('/hooks/github', (req, res, next) => {
|
||||||
if ((new Buffer(req.headers['x-hub-signature'])).equals(new Buffer('sha1=' + crypto.createHmac('sha1', config.github_bot.hook_secret).update(JSON.stringify(req.body)).digest('hex')))) {
|
if ((new Buffer(req.headers['x-hub-signature'])).equals(new Buffer(`sha1=${crypto.createHmac('sha1', config.github_bot.hook_secret).update(JSON.stringify(req.body)).digest('hex')}`))) {
|
||||||
handler.emit(req.headers['x-github-event'], req.body);
|
handler.emit(req.headers['x-github-event'], req.body);
|
||||||
res.sendStatus(200);
|
res.sendStatus(200);
|
||||||
} else {
|
} else {
|
||||||
|
@ -40,7 +40,7 @@ module.exports = async (app: express.Application) => {
|
||||||
|
|
||||||
// Fetch parent status
|
// Fetch parent status
|
||||||
request({
|
request({
|
||||||
url: parent.url + '/statuses',
|
url: `${parent.url}/statuses`,
|
||||||
headers: {
|
headers: {
|
||||||
'User-Agent': 'misskey'
|
'User-Agent': 'misskey'
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import * as express from 'express';
|
import * as express from 'express';
|
||||||
//import * as Twitter from 'twitter';
|
// import * as Twitter from 'twitter';
|
||||||
//const Twitter = require('twitter');
|
// const Twitter = require('twitter');
|
||||||
import autwh from 'autwh';
|
import autwh from 'autwh';
|
||||||
import redis from '../../db/redis';
|
import redis from '../../db/redis';
|
||||||
import User from '../models/user';
|
import User from '../models/user';
|
||||||
|
@ -14,10 +14,10 @@ module.exports = (app: express.Application) => {
|
||||||
const user = await User.findOneAndUpdate({
|
const user = await User.findOneAndUpdate({
|
||||||
token: res.locals.user
|
token: res.locals.user
|
||||||
}, {
|
}, {
|
||||||
$set: {
|
$set: {
|
||||||
twitter: null
|
twitter: null
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
res.send(`Twitterの連携を解除しました :v:`);
|
res.send(`Twitterの連携を解除しました :v:`);
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ module.exports = (app: express.Application) => {
|
||||||
const twAuth = autwh({
|
const twAuth = autwh({
|
||||||
consumerKey: config.twitter.consumer_key,
|
consumerKey: config.twitter.consumer_key,
|
||||||
consumerSecret: config.twitter.consumer_secret,
|
consumerSecret: config.twitter.consumer_secret,
|
||||||
callbackUrl: config.api_url + '/tw/cb'
|
callbackUrl: `${config.api_url}/tw/cb`
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/connect/twitter', async (req, res): Promise<any> => {
|
app.get('/connect/twitter', async (req, res): Promise<any> => {
|
||||||
|
@ -56,15 +56,15 @@ module.exports = (app: express.Application) => {
|
||||||
const user = await User.findOneAndUpdate({
|
const user = await User.findOneAndUpdate({
|
||||||
token: res.locals.user
|
token: res.locals.user
|
||||||
}, {
|
}, {
|
||||||
$set: {
|
$set: {
|
||||||
twitter: {
|
twitter: {
|
||||||
access_token: result.accessToken,
|
access_token: result.accessToken,
|
||||||
access_token_secret: result.accessTokenSecret,
|
access_token_secret: result.accessTokenSecret,
|
||||||
user_id: result.userId,
|
user_id: result.userId,
|
||||||
screen_name: result.screenName
|
screen_name: result.screenName
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
|
|
||||||
res.send(`Twitter: @${result.screenName} を、Misskey: @${user.username} に接続しました!`);
|
res.send(`Twitter: @${result.screenName} を、Misskey: @${user.username} に接続しました!`);
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ app.use(cors());
|
||||||
/**
|
/**
|
||||||
* Statics
|
* Statics
|
||||||
*/
|
*/
|
||||||
app.use('/assets', express.static(__dirname + '/assets', {
|
app.use('/assets', express.static(`${__dirname}/assets`, {
|
||||||
maxAge: 1000 * 60 * 60 * 24 * 365 // 一年
|
maxAge: 1000 * 60 * 60 * 24 * 365 // 一年
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -33,12 +33,12 @@ app.get('/', (req, res) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/default-avatar.jpg', (req, res) => {
|
app.get('/default-avatar.jpg', (req, res) => {
|
||||||
const file = fs.readFileSync(__dirname + '/assets/avatar.jpg');
|
const file = fs.readFileSync(`${__dirname}/assets/avatar.jpg`);
|
||||||
send(file, 'image/jpeg', req, res);
|
send(file, 'image/jpeg', req, res);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/app-default.jpg', (req, res) => {
|
app.get('/app-default.jpg', (req, res) => {
|
||||||
const file = fs.readFileSync(__dirname + '/assets/dummy.png');
|
const file = fs.readFileSync(`${__dirname}/assets/dummy.png`);
|
||||||
send(file, 'image/png', req, res);
|
send(file, 'image/png', req, res);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ async function raw(data: Buffer, type: string, download: boolean, res: express.R
|
||||||
|
|
||||||
async function thumbnail(data: Buffer, type: string, resize: number, res: express.Response): Promise<any> {
|
async function thumbnail(data: Buffer, type: string, resize: number, res: express.Response): Promise<any> {
|
||||||
if (!/^image\/.*$/.test(type)) {
|
if (!/^image\/.*$/.test(type)) {
|
||||||
data = fs.readFileSync(__dirname + '/assets/dummy.png');
|
data = fs.readFileSync(`${__dirname}/assets/dummy.png`);
|
||||||
}
|
}
|
||||||
|
|
||||||
let g = gm(data);
|
let g = gm(data);
|
||||||
|
@ -64,18 +64,18 @@ async function thumbnail(data: Buffer, type: string, resize: number, res: expres
|
||||||
}
|
}
|
||||||
|
|
||||||
g
|
g
|
||||||
.compress('jpeg')
|
.compress('jpeg')
|
||||||
.quality(80)
|
.quality(80)
|
||||||
.toBuffer('jpeg', (err, img) => {
|
.toBuffer('jpeg', (err, img) => {
|
||||||
if (err !== undefined && err !== null) {
|
if (err !== undefined && err !== null) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
res.sendStatus(500);
|
res.sendStatus(500);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
res.header('Content-Type', 'image/jpeg');
|
res.header('Content-Type', 'image/jpeg');
|
||||||
res.send(img);
|
res.send(img);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function send(data: Buffer, type: string, req: express.Request, res: express.Response): void {
|
function send(data: Buffer, type: string, req: express.Request, res: express.Response): void {
|
||||||
|
@ -97,10 +97,10 @@ app.get('/:id', async (req, res) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const file = await File.findOne({_id: new mongodb.ObjectID(req.params.id)});
|
const file = await File.findOne({ _id: new mongodb.ObjectID(req.params.id) });
|
||||||
|
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
res.status(404).sendFile(__dirname + '/assets/dummy.png');
|
res.status(404).sendFile(`${__dirname} / assets / dummy.png`);
|
||||||
return;
|
return;
|
||||||
} else if (file.data == null) {
|
} else if (file.data == null) {
|
||||||
res.sendStatus(400);
|
res.sendStatus(400);
|
||||||
|
@ -117,10 +117,10 @@ app.get('/:id/:name', async (req, res) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const file = await File.findOne({_id: new mongodb.ObjectID(req.params.id)});
|
const file = await File.findOne({ _id: new mongodb.ObjectID(req.params.id) });
|
||||||
|
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
res.status(404).sendFile(__dirname + '/assets/dummy.png');
|
res.status(404).sendFile(`${__dirname}/assets/dummy.png`);
|
||||||
return;
|
return;
|
||||||
} else if (file.data == null) {
|
} else if (file.data == null) {
|
||||||
res.sendStatus(400);
|
res.sendStatus(400);
|
||||||
|
|
|
@ -13,11 +13,11 @@ app.disable('x-powered-by');
|
||||||
app.locals.cache = true;
|
app.locals.cache = true;
|
||||||
|
|
||||||
app.get('/himasaku.png', (req, res) => {
|
app.get('/himasaku.png', (req, res) => {
|
||||||
res.sendFile(__dirname + '/assets/himasaku.png');
|
res.sendFile(`${__dirname}/assets/himasaku.png`);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('*', (req, res) => {
|
app.get('*', (req, res) => {
|
||||||
res.sendFile(__dirname + '/assets/index.html');
|
res.sendFile(`${__dirname}/assets/index.html`);
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = app;
|
module.exports = app;
|
||||||
|
|
|
@ -12,7 +12,7 @@ import * as os from 'os';
|
||||||
import * as cluster from 'cluster';
|
import * as cluster from 'cluster';
|
||||||
import * as debug from 'debug';
|
import * as debug from 'debug';
|
||||||
import * as chalk from 'chalk';
|
import * as chalk from 'chalk';
|
||||||
//import portUsed = require('tcp-port-used');
|
// import portUsed = require('tcp-port-used');
|
||||||
import isRoot = require('is-root');
|
import isRoot = require('is-root');
|
||||||
import { master } from 'accesses';
|
import { master } from 'accesses';
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ export default class extends ev.EventEmitter {
|
||||||
|
|
||||||
private render(): string {
|
private render(): string {
|
||||||
const width = 30;
|
const width = 30;
|
||||||
const t = this.text ? this.text + ' ' : '';
|
const t = this.text ? `${this.text} ` : '';
|
||||||
|
|
||||||
const v = Math.floor((this.value / this.max) * width);
|
const v = Math.floor((this.value / this.max) * width);
|
||||||
const vs = new Array(v + 1).join('*');
|
const vs = new Array(v + 1).join('*');
|
||||||
|
@ -61,7 +61,7 @@ export default class extends ev.EventEmitter {
|
||||||
const ps = new Array(p + 1).join(' ');
|
const ps = new Array(p + 1).join(' ');
|
||||||
|
|
||||||
const percentage = Math.floor((this.value / this.max) * 100);
|
const percentage = Math.floor((this.value / this.max) * 100);
|
||||||
const percentages = chalk.gray(`(${percentage}%)`);
|
const percentages = chalk.gray(`(${percentage} %)`);
|
||||||
|
|
||||||
let i: string;
|
let i: string;
|
||||||
switch (this.indicator) {
|
switch (this.indicator) {
|
||||||
|
@ -72,7 +72,7 @@ export default class extends ev.EventEmitter {
|
||||||
case null: i = '+'; break;
|
case null: i = '+'; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return `${i} ${t}[${vs}${ps}] ${this.value}/${this.max} ${percentages}`;
|
return `${i} ${t}[${vs}${ps}] ${this.value} / ${this.max} ${percentages}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,8 +38,8 @@ app.use((req, res, next) => {
|
||||||
* Static assets
|
* Static assets
|
||||||
*/
|
*/
|
||||||
app.use(favicon(`${__dirname}/assets/favicon.ico`));
|
app.use(favicon(`${__dirname}/assets/favicon.ico`));
|
||||||
app.get('/manifest.json', (req, res) => res.sendFile(__dirname + '/assets/manifest.json'));
|
app.get('/manifest.json', (req, res) => res.sendFile(`${__dirname}/assets/manifest.json`));
|
||||||
app.get('/apple-touch-icon.png', (req, res) => res.sendFile(__dirname + '/assets/apple-touch-icon.png'));
|
app.get('/apple-touch-icon.png', (req, res) => res.sendFile(`${__dirname}/assets/apple-touch-icon.png`));
|
||||||
app.use('/assets', express.static(`${__dirname}/assets`, {
|
app.use('/assets', express.static(`${__dirname}/assets`, {
|
||||||
maxAge: ms('7 days')
|
maxAge: ms('7 days')
|
||||||
}));
|
}));
|
||||||
|
@ -47,7 +47,7 @@ app.use('/assets', express.static(`${__dirname}/assets`, {
|
||||||
/**
|
/**
|
||||||
* Common API
|
* Common API
|
||||||
*/
|
*/
|
||||||
app.get(/\/api:url/, require('./service/url-preview'));
|
app.get(/\/api:url/, require('./service/url-preview'));
|
||||||
app.post(/\/api:rss/, require('./service/rss-proxy'));
|
app.post(/\/api:rss/, require('./service/rss-proxy'));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -74,7 +74,7 @@ app.use(subdomain({
|
||||||
*/
|
*/
|
||||||
app.use(require('./about')); // about docs
|
app.use(require('./about')); // about docs
|
||||||
app.get('/@/auth/*', serveApp('auth')); // authorize form
|
app.get('/@/auth/*', serveApp('auth')); // authorize form
|
||||||
app.get('/@/dev/*', serveApp('dev')); // developer center
|
app.get('/@/dev/*', serveApp('dev')); // developer center
|
||||||
app.get('*', serveApp('client')); // client
|
app.get('*', serveApp('client')); // client
|
||||||
|
|
||||||
module.exports = app;
|
module.exports = app;
|
||||||
|
|
16
tslint.json
16
tslint.json
|
@ -63,6 +63,7 @@
|
||||||
true,
|
true,
|
||||||
"check-function-in-method"
|
"check-function-in-method"
|
||||||
],
|
],
|
||||||
|
"no-misused-new": true,
|
||||||
"no-null-keyword": false,
|
"no-null-keyword": false,
|
||||||
"no-shadowed-variable": false,
|
"no-shadowed-variable": false,
|
||||||
"no-string-literal": false,
|
"no-string-literal": false,
|
||||||
|
@ -92,7 +93,10 @@
|
||||||
"no-default-export": false,
|
"no-default-export": false,
|
||||||
"no-mergeable-namespace": true,
|
"no-mergeable-namespace": true,
|
||||||
"no-require-imports": false,
|
"no-require-imports": false,
|
||||||
|
"no-reference-import": true,
|
||||||
"no-trailing-whitespace": true,
|
"no-trailing-whitespace": true,
|
||||||
|
"no-unnecessary-callback-wrapper": true,
|
||||||
|
"no-unnecessary-initializer": true,
|
||||||
"object-literal-sort-keys": false,
|
"object-literal-sort-keys": false,
|
||||||
"trailing-comma": true,
|
"trailing-comma": true,
|
||||||
// Style
|
// Style
|
||||||
|
@ -102,8 +106,12 @@
|
||||||
"statements"
|
"statements"
|
||||||
],
|
],
|
||||||
"arrow-parens": false,
|
"arrow-parens": false,
|
||||||
|
"arrow-return-shorthand": true,
|
||||||
"class-name": true,
|
"class-name": true,
|
||||||
"comment-format": false,
|
"comment-format": [
|
||||||
|
true,
|
||||||
|
"check-space"
|
||||||
|
],
|
||||||
"interface-name": false,
|
"interface-name": false,
|
||||||
"jsdoc-format": true,
|
"jsdoc-format": true,
|
||||||
"match-default-export-name": false,
|
"match-default-export-name": false,
|
||||||
|
@ -122,6 +130,9 @@
|
||||||
],
|
],
|
||||||
"one-variable-per-declaration": true,
|
"one-variable-per-declaration": true,
|
||||||
"ordered-imports": false,
|
"ordered-imports": false,
|
||||||
|
"prefer-function-over-method": true,
|
||||||
|
"prefer-method-signature": true,
|
||||||
|
"prefer-template": true,
|
||||||
"quotemark": [
|
"quotemark": [
|
||||||
true,
|
true,
|
||||||
"single",
|
"single",
|
||||||
|
@ -135,7 +146,8 @@
|
||||||
"check-decl",
|
"check-decl",
|
||||||
"check-operator",
|
"check-operator",
|
||||||
"check-separator",
|
"check-separator",
|
||||||
"check-type"
|
"check-type",
|
||||||
|
"check-preblock"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue