This commit is contained in:
syuilo
2018-03-28 16:46:11 +09:00
parent 3d5cdb8d2d
commit 1acc30822d
90 changed files with 286 additions and 286 deletions

View File

@@ -297,7 +297,7 @@ class TlContext extends Context {
private async getTl() {
const tl = await require('../endpoints/posts/timeline')({
limit: 5,
until_id: this.next ? this.next : undefined
untilId: this.next ? this.next : undefined
}, this.bot.user);
if (tl.length > 0) {
@@ -349,7 +349,7 @@ class NotificationsContext extends Context {
private async getNotifications() {
const notifications = await require('../endpoints/i/notifications')({
limit: 5,
until_id: this.next ? this.next : undefined
untilId: this.next ? this.next : undefined
}, this.bot.user);
if (notifications.length > 0) {

View File

@@ -130,7 +130,7 @@ class LineBot extends BotCore {
altText: await super.showUserCommand(q),
template: {
type: 'buttons',
thumbnailImageUrl: `${user.avatar_url}?thumbnail&size=1024`,
thumbnailImageUrl: `${user.avatarUrl}?thumbnail&size=1024`,
title: `${user.name} (@${acct})`,
text: user.description || '(no description)',
actions: actions

View File

@@ -289,7 +289,7 @@ const endpoints: Endpoint[] = [
kind: 'notification-write'
},
{
name: 'notifications/mark_as_read_all',
name: 'notifications/markAsRead_all',
withCredential: true,
kind: 'notification-write'
},

View File

@@ -40,7 +40,7 @@ import App, { isValidNameId, pack } from '../../models/app';
* type: string
* collectionFormat: csv
* -
* name: callback_url
* name: callbackUrl
* description: URL called back after authentication
* in: formData
* required: false
@@ -82,10 +82,10 @@ module.exports = async (params, user) => new Promise(async (res, rej) => {
const [permission, permissionErr] = $(params.permission).array('string').unique().$;
if (permissionErr) return rej('invalid permission param');
// Get 'callback_url' parameter
// Get 'callbackUrl' parameter
// TODO: Check it is valid url
const [callbackUrl = null, callbackUrlErr] = $(params.callback_url).optional.nullable.string().$;
if (callbackUrlErr) return rej('invalid callback_url param');
const [callbackUrl = null, callbackUrlErr] = $(params.callbackUrl).optional.nullable.string().$;
if (callbackUrlErr) return rej('invalid callbackUrl param');
// Generate secret
const secret = rndstr('a-zA-Z0-9', 32);
@@ -99,7 +99,7 @@ module.exports = async (params, user) => new Promise(async (res, rej) => {
nameIdLower: nameId.toLowerCase(),
description: description,
permission: permission,
callback_url: callbackUrl,
callbackUrl: callbackUrl,
secret: secret
});

View File

@@ -14,7 +14,7 @@ import config from '../../../../conf';
* summary: Generate a session
* parameters:
* -
* name: app_secret
* name: appSecret
* description: App Secret
* in: formData
* required: true
@@ -45,9 +45,9 @@ import config from '../../../../conf';
* @return {Promise<any>}
*/
module.exports = (params) => new Promise(async (res, rej) => {
// Get 'app_secret' parameter
const [appSecret, appSecretErr] = $(params.app_secret).string().$;
if (appSecretErr) return rej('invalid app_secret param');
// Get 'appSecret' parameter
const [appSecret, appSecretErr] = $(params.appSecret).string().$;
if (appSecretErr) return rej('invalid appSecret param');
// Lookup app
const app = await App.findOne({

View File

@@ -14,7 +14,7 @@ import { pack } from '../../../models/user';
* summary: Get an access token(userkey)
* parameters:
* -
* name: app_secret
* name: appSecret
* description: App Secret
* in: formData
* required: true
@@ -50,9 +50,9 @@ import { pack } from '../../../models/user';
* @return {Promise<any>}
*/
module.exports = (params) => new Promise(async (res, rej) => {
// Get 'app_secret' parameter
const [appSecret, appSecretErr] = $(params.app_secret).string().$;
if (appSecretErr) return rej('invalid app_secret param');
// Get 'appSecret' parameter
const [appSecret, appSecretErr] = $(params.appSecret).string().$;
if (appSecretErr) return rej('invalid appSecret param');
// Lookup app
const app = await App.findOne({

View File

@@ -16,17 +16,17 @@ module.exports = (params, me) => new Promise(async (res, rej) => {
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
if (limitErr) return rej('invalid limit param');
// Get 'since_id' parameter
const [sinceId, sinceIdErr] = $(params.since_id).optional.id().$;
if (sinceIdErr) return rej('invalid since_id param');
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.id().$;
if (sinceIdErr) return rej('invalid sinceId param');
// Get 'until_id' parameter
const [untilId, untilIdErr] = $(params.until_id).optional.id().$;
if (untilIdErr) return rej('invalid until_id param');
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.id().$;
if (untilIdErr) return rej('invalid untilId param');
// Check if both of since_id and until_id is specified
// Check if both of sinceId and untilId is specified
if (sinceId && untilId) {
return rej('cannot set since_id and until_id');
return rej('cannot set sinceId and untilId');
}
// Construct query

View File

@@ -17,17 +17,17 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
const [limit = 1000, limitErr] = $(params.limit).optional.number().range(1, 1000).$;
if (limitErr) return rej('invalid limit param');
// Get 'since_id' parameter
const [sinceId, sinceIdErr] = $(params.since_id).optional.id().$;
if (sinceIdErr) return rej('invalid since_id param');
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.id().$;
if (sinceIdErr) return rej('invalid sinceId param');
// Get 'until_id' parameter
const [untilId, untilIdErr] = $(params.until_id).optional.id().$;
if (untilIdErr) return rej('invalid until_id param');
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.id().$;
if (untilIdErr) return rej('invalid untilId param');
// Check if both of since_id and until_id is specified
// Check if both of sinceId and untilId is specified
if (sinceId && untilId) {
return rej('cannot set since_id and until_id');
return rej('cannot set sinceId and untilId');
}
// Get 'channelId' parameter

View File

@@ -17,17 +17,17 @@ module.exports = async (params, user, app) => {
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
if (limitErr) throw 'invalid limit param';
// Get 'since_id' parameter
const [sinceId, sinceIdErr] = $(params.since_id).optional.id().$;
if (sinceIdErr) throw 'invalid since_id param';
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.id().$;
if (sinceIdErr) throw 'invalid sinceId param';
// Get 'until_id' parameter
const [untilId, untilIdErr] = $(params.until_id).optional.id().$;
if (untilIdErr) throw 'invalid until_id param';
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.id().$;
if (untilIdErr) throw 'invalid untilId param';
// Check if both of since_id and until_id is specified
// Check if both of sinceId and untilId is specified
if (sinceId && untilId) {
throw 'cannot set since_id and until_id';
throw 'cannot set sinceId and untilId';
}
// Get 'folderId' parameter

View File

@@ -17,17 +17,17 @@ module.exports = (params, user, app) => new Promise(async (res, rej) => {
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
if (limitErr) return rej('invalid limit param');
// Get 'since_id' parameter
const [sinceId, sinceIdErr] = $(params.since_id).optional.id().$;
if (sinceIdErr) return rej('invalid since_id param');
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.id().$;
if (sinceIdErr) return rej('invalid sinceId param');
// Get 'until_id' parameter
const [untilId, untilIdErr] = $(params.until_id).optional.id().$;
if (untilIdErr) return rej('invalid until_id param');
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.id().$;
if (untilIdErr) return rej('invalid untilId param');
// Check if both of since_id and until_id is specified
// Check if both of sinceId and untilId is specified
if (sinceId && untilId) {
return rej('cannot set since_id and until_id');
return rej('cannot set sinceId and untilId');
}
// Get 'folderId' parameter

View File

@@ -16,17 +16,17 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
if (limitErr) return rej('invalid limit param');
// Get 'since_id' parameter
const [sinceId, sinceIdErr] = $(params.since_id).optional.id().$;
if (sinceIdErr) return rej('invalid since_id param');
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.id().$;
if (sinceIdErr) return rej('invalid sinceId param');
// Get 'until_id' parameter
const [untilId, untilIdErr] = $(params.until_id).optional.id().$;
if (untilIdErr) return rej('invalid until_id param');
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.id().$;
if (untilIdErr) return rej('invalid untilId param');
// Check if both of since_id and until_id is specified
// Check if both of sinceId and untilId is specified
if (sinceId && untilId) {
return rej('cannot set since_id and until_id');
return rej('cannot set sinceId and untilId');
}
// Get 'type' parameter

View File

@@ -13,13 +13,13 @@ import User from '../../models/user';
* @return {Promise<any>}
*/
module.exports = async (params, user) => new Promise(async (res, rej) => {
// Get 'current_password' parameter
const [currentPassword, currentPasswordErr] = $(params.current_password).string().$;
if (currentPasswordErr) return rej('invalid current_password param');
// Get 'currentPasword' parameter
const [currentPassword, currentPasswordErr] = $(params.currentPasword).string().$;
if (currentPasswordErr) return rej('invalid currentPasword param');
// Get 'new_password' parameter
const [newPassword, newPasswordErr] = $(params.new_password).string().$;
if (newPasswordErr) return rej('invalid new_password param');
// Get 'newPassword' parameter
const [newPassword, newPasswordErr] = $(params.newPassword).string().$;
if (newPasswordErr) return rej('invalid newPassword param');
// Compare password
const same = await bcrypt.compare(currentPassword, user.account.password);

View File

@@ -21,9 +21,9 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
$(params.following).optional.boolean().$;
if (followingError) return rej('invalid following param');
// Get 'mark_as_read' parameter
const [markAsRead = true, markAsReadErr] = $(params.mark_as_read).optional.boolean().$;
if (markAsReadErr) return rej('invalid mark_as_read param');
// Get 'markAsRead' parameter
const [markAsRead = true, markAsReadErr] = $(params.markAsRead).optional.boolean().$;
if (markAsReadErr) return rej('invalid markAsRead param');
// Get 'type' parameter
const [type, typeErr] = $(params.type).optional.array('string').unique().$;
@@ -33,17 +33,17 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
if (limitErr) return rej('invalid limit param');
// Get 'since_id' parameter
const [sinceId, sinceIdErr] = $(params.since_id).optional.id().$;
if (sinceIdErr) return rej('invalid since_id param');
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.id().$;
if (sinceIdErr) return rej('invalid sinceId param');
// Get 'until_id' parameter
const [untilId, untilIdErr] = $(params.until_id).optional.id().$;
if (untilIdErr) return rej('invalid until_id param');
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.id().$;
if (untilIdErr) return rej('invalid untilId param');
// Check if both of since_id and until_id is specified
// Check if both of sinceId and untilId is specified
if (sinceId && untilId) {
return rej('cannot set since_id and until_id');
return rej('cannot set sinceId and untilId');
}
const mute = await Mute.find({

View File

@@ -16,17 +16,17 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
if (limitErr) return rej('invalid limit param');
// Get 'since_id' parameter
const [sinceId, sinceIdErr] = $(params.since_id).optional.id().$;
if (sinceIdErr) return rej('invalid since_id param');
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.id().$;
if (sinceIdErr) return rej('invalid sinceId param');
// Get 'until_id' parameter
const [untilId, untilIdErr] = $(params.until_id).optional.id().$;
if (untilIdErr) return rej('invalid until_id param');
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.id().$;
if (untilIdErr) return rej('invalid untilId param');
// Check if both of since_id and until_id is specified
// Check if both of sinceId and untilId is specified
if (sinceId && untilId) {
return rej('cannot set since_id and until_id');
return rej('cannot set sinceId and untilId');
}
const query = {

View File

@@ -51,10 +51,10 @@ module.exports = async (params, user, _, isSecure) => new Promise(async (res, re
if (isBotErr) return rej('invalid isBot param');
if (isBot != null) user.account.isBot = isBot;
// Get 'auto_watch' parameter
const [autoWatch, autoWatchErr] = $(params.auto_watch).optional.boolean().$;
if (autoWatchErr) return rej('invalid auto_watch param');
if (autoWatch != null) user.account.settings.auto_watch = autoWatch;
// Get 'autoWatch' parameter
const [autoWatch, autoWatchErr] = $(params.autoWatch).optional.boolean().$;
if (autoWatchErr) return rej('invalid autoWatch param');
if (autoWatch != null) user.account.settings.autoWatch = autoWatch;
await User.update(user._id, {
$set: {

View File

@@ -32,25 +32,25 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
return rej('user not found');
}
// Get 'mark_as_read' parameter
const [markAsRead = true, markAsReadErr] = $(params.mark_as_read).optional.boolean().$;
if (markAsReadErr) return rej('invalid mark_as_read param');
// Get 'markAsRead' parameter
const [markAsRead = true, markAsReadErr] = $(params.markAsRead).optional.boolean().$;
if (markAsReadErr) return rej('invalid markAsRead param');
// Get 'limit' parameter
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
if (limitErr) return rej('invalid limit param');
// Get 'since_id' parameter
const [sinceId, sinceIdErr] = $(params.since_id).optional.id().$;
if (sinceIdErr) return rej('invalid since_id param');
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.id().$;
if (sinceIdErr) return rej('invalid sinceId param');
// Get 'until_id' parameter
const [untilId, untilIdErr] = $(params.until_id).optional.id().$;
if (untilIdErr) return rej('invalid until_id param');
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.id().$;
if (untilIdErr) return rej('invalid untilId param');
// Check if both of since_id and until_id is specified
// Check if both of sinceId and untilId is specified
if (sinceId && untilId) {
return rej('cannot set since_id and until_id');
return rej('cannot set sinceId and untilId');
}
const query = {

View File

@@ -10,17 +10,17 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
if (limitErr) return rej('invalid limit param');
// Get 'since_id' parameter
const [sinceId, sinceIdErr] = $(params.since_id).optional.id().$;
if (sinceIdErr) return rej('invalid since_id param');
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.id().$;
if (sinceIdErr) return rej('invalid sinceId param');
// Get 'until_id' parameter
const [untilId, untilIdErr] = $(params.until_id).optional.id().$;
if (untilIdErr) return rej('invalid until_id param');
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.id().$;
if (untilIdErr) return rej('invalid untilId param');
// Check if both of since_id and until_id is specified
// Check if both of sinceId and untilId is specified
if (sinceId && untilId) {
return rej('cannot set since_id and until_id');
return rej('cannot set sinceId and untilId');
}
const q: any = my ? {

View File

@@ -35,17 +35,17 @@ module.exports = (params) => new Promise(async (res, rej) => {
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
if (limitErr) return rej('invalid limit param');
// Get 'since_id' parameter
const [sinceId, sinceIdErr] = $(params.since_id).optional.id().$;
if (sinceIdErr) return rej('invalid since_id param');
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.id().$;
if (sinceIdErr) return rej('invalid sinceId param');
// Get 'until_id' parameter
const [untilId, untilIdErr] = $(params.until_id).optional.id().$;
if (untilIdErr) return rej('invalid until_id param');
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.id().$;
if (untilIdErr) return rej('invalid untilId param');
// Check if both of since_id and until_id is specified
// Check if both of sinceId and untilId is specified
if (sinceId && untilId) {
return rej('cannot set since_id and until_id');
return rej('cannot set sinceId and untilId');
}
// Construct query

View File

@@ -392,7 +392,7 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => {
});
// この投稿をWatchする
if ((user.account as ILocalAccount).settings.auto_watch !== false) {
if ((user.account as ILocalAccount).settings.autoWatch !== false) {
watch(user._id, reply);
}

View File

@@ -23,17 +23,17 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
if (limitErr) return rej('invalid limit param');
// Get 'since_id' parameter
const [sinceId, sinceIdErr] = $(params.since_id).optional.id().$;
if (sinceIdErr) return rej('invalid since_id param');
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.id().$;
if (sinceIdErr) return rej('invalid sinceId param');
// Get 'until_id' parameter
const [untilId, untilIdErr] = $(params.until_id).optional.id().$;
if (untilIdErr) return rej('invalid until_id param');
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.id().$;
if (untilIdErr) return rej('invalid untilId param');
// Check if both of since_id and until_id is specified
// Check if both of sinceId and untilId is specified
if (sinceId && untilId) {
return rej('cannot set since_id and until_id');
return rej('cannot set sinceId and untilId');
}
// Construct query

View File

@@ -100,7 +100,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
});
// この投稿をWatchする
if (user.account.settings.auto_watch !== false) {
if (user.account.settings.autoWatch !== false) {
watch(user._id, post);
}
});

View File

@@ -116,7 +116,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
});
// この投稿をWatchする
if (user.account.settings.auto_watch !== false) {
if (user.account.settings.autoWatch !== false) {
watch(user._id, post);
}
});

View File

@@ -20,17 +20,17 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
if (limitErr) return rej('invalid limit param');
// Get 'since_id' parameter
const [sinceId, sinceIdErr] = $(params.since_id).optional.id().$;
if (sinceIdErr) return rej('invalid since_id param');
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.id().$;
if (sinceIdErr) return rej('invalid sinceId param');
// Get 'until_id' parameter
const [untilId, untilIdErr] = $(params.until_id).optional.id().$;
if (untilIdErr) return rej('invalid until_id param');
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.id().$;
if (untilIdErr) return rej('invalid untilId param');
// Check if both of since_id and until_id is specified
// Check if both of sinceId and untilId is specified
if (sinceId && untilId) {
return rej('cannot set since_id and until_id');
return rej('cannot set sinceId and untilId');
}
// Lookup post

View File

@@ -61,13 +61,13 @@ module.exports = (params, me) => new Promise(async (res, rej) => {
const [poll = null, pollErr] = $(params.poll).optional.nullable.boolean().$;
if (pollErr) return rej('invalid poll param');
// Get 'since_date' parameter
const [sinceDate, sinceDateErr] = $(params.since_date).optional.number().$;
if (sinceDateErr) throw 'invalid since_date param';
// Get 'sinceDate' parameter
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().$;
if (sinceDateErr) throw 'invalid sinceDate param';
// Get 'until_date' parameter
const [untilDate, untilDateErr] = $(params.until_date).optional.number().$;
if (untilDateErr) throw 'invalid until_date param';
// Get 'untilDate' parameter
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().$;
if (untilDateErr) throw 'invalid untilDate param';
// Get 'offset' parameter
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).$;

View File

@@ -22,25 +22,25 @@ module.exports = async (params, user, app) => {
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
if (limitErr) throw 'invalid limit param';
// Get 'since_id' parameter
const [sinceId, sinceIdErr] = $(params.since_id).optional.id().$;
if (sinceIdErr) throw 'invalid since_id param';
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.id().$;
if (sinceIdErr) throw 'invalid sinceId param';
// Get 'until_id' parameter
const [untilId, untilIdErr] = $(params.until_id).optional.id().$;
if (untilIdErr) throw 'invalid until_id param';
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.id().$;
if (untilIdErr) throw 'invalid untilId param';
// Get 'since_date' parameter
const [sinceDate, sinceDateErr] = $(params.since_date).optional.number().$;
if (sinceDateErr) throw 'invalid since_date param';
// Get 'sinceDate' parameter
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().$;
if (sinceDateErr) throw 'invalid sinceDate param';
// Get 'until_date' parameter
const [untilDate, untilDateErr] = $(params.until_date).optional.number().$;
if (untilDateErr) throw 'invalid until_date param';
// Get 'untilDate' parameter
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().$;
if (untilDateErr) throw 'invalid untilDate param';
// Check if only one of since_id, until_id, since_date, until_date specified
// Check if only one of sinceId, untilId, sinceDate, untilDate specified
if ([sinceId, untilId, sinceDate, untilDate].filter(x => x != null).length > 1) {
throw 'only one of since_id, until_id, since_date, until_date can be specified';
throw 'only one of sinceId, untilId, sinceDate, untilDate can be specified';
}
const { followingIds, watchingChannelIds, mutedUserIds } = await rap({

View File

@@ -46,25 +46,25 @@ module.exports = (params, me) => new Promise(async (res, rej) => {
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
if (limitErr) return rej('invalid limit param');
// Get 'since_id' parameter
const [sinceId, sinceIdErr] = $(params.since_id).optional.id().$;
if (sinceIdErr) return rej('invalid since_id param');
// Get 'sinceId' parameter
const [sinceId, sinceIdErr] = $(params.sinceId).optional.id().$;
if (sinceIdErr) return rej('invalid sinceId param');
// Get 'until_id' parameter
const [untilId, untilIdErr] = $(params.until_id).optional.id().$;
if (untilIdErr) return rej('invalid until_id param');
// Get 'untilId' parameter
const [untilId, untilIdErr] = $(params.untilId).optional.id().$;
if (untilIdErr) return rej('invalid untilId param');
// Get 'since_date' parameter
const [sinceDate, sinceDateErr] = $(params.since_date).optional.number().$;
if (sinceDateErr) throw 'invalid since_date param';
// Get 'sinceDate' parameter
const [sinceDate, sinceDateErr] = $(params.sinceDate).optional.number().$;
if (sinceDateErr) throw 'invalid sinceDate param';
// Get 'until_date' parameter
const [untilDate, untilDateErr] = $(params.until_date).optional.number().$;
if (untilDateErr) throw 'invalid until_date param';
// Get 'untilDate' parameter
const [untilDate, untilDateErr] = $(params.untilDate).optional.number().$;
if (untilDateErr) throw 'invalid untilDate param';
// Check if only one of since_id, until_id, since_date, until_date specified
// Check if only one of sinceId, untilId, sinceDate, untilDate specified
if ([sinceId, untilId, sinceDate, untilDate].filter(x => x != null).length > 1) {
throw 'only one of since_id, until_id, since_date, until_date can be specified';
throw 'only one of sinceId, untilId, sinceDate, untilDate can be specified';
}
const q = userId !== undefined

View File

@@ -195,11 +195,11 @@ export const pack = (
}
}
_user.avatar_url = _user.avatarId != null
_user.avatarUrl = _user.avatarId != null
? `${config.drive_url}/${_user.avatarId}`
: `${config.drive_url}/default-avatar.jpg`;
_user.banner_url = _user.bannerId != null
_user.bannerUrl = _user.bannerId != null
? `${config.drive_url}/${_user.bannerId}`
: null;

View File

@@ -137,7 +137,7 @@ export default async (req: express.Request, res: express.Response) => {
weight: null
},
settings: {
auto_watch: true
autoWatch: true
},
clientSettings: {
home: homeData