Refactorng

This commit is contained in:
syuilo 2018-07-07 19:19:00 +09:00
parent 865fd25af1
commit aa4ef6745a
132 changed files with 180 additions and 212 deletions

View file

@ -1,6 +1,6 @@
import getNoteSummary from '../../../../renderers/get-note-summary';
import getReactionEmoji from '../../../../renderers/get-reaction-emoji';
import getUserName from '../../../../renderers/get-user-name';
import getNoteSummary from '../../../../misc/get-note-summary';
import getReactionEmoji from '../../../../misc/get-reaction-emoji';
import getUserName from '../../../../misc/get-user-name';
type Notification = {
title: string;

View file

@ -51,7 +51,7 @@
<script lang="ts">
import Vue from 'vue';
import getAcct from '../../../../../acct/render';
import getAcct from '../../../../../misc/acct/render';
export default Vue.extend({
props: {

View file

@ -1,7 +1,7 @@
import Vue from 'vue';
import * as emojilib from 'emojilib';
import parse from '../../../../../mfm/parse';
import getAcct from '../../../../../acct/render';
import getAcct from '../../../../../misc/acct/render';
import { url } from '../../../config';
import MkUrl from './url.vue';
import MkGoogle from './google.vue';

View file

@ -1,6 +1,6 @@
import Vue from 'vue';
import getAcct from '../../../../../acct/render';
import getUserName from '../../../../../renderers/get-user-name';
import getAcct from '../../../../../misc/acct/render';
import getUserName from '../../../../../misc/get-user-name';
Vue.filter('acct', user => {
return getAcct(user);

View file

@ -31,8 +31,8 @@
<script lang="ts">
import Vue from 'vue';
import parseAcct from '../../../../../acct/parse';
import getUserName from '../../../../../renderers/get-user-name';
import parseAcct from '../../../../../misc/acct/parse';
import getUserName from '../../../../../misc/get-user-name';
import Progress from '../../../common/scripts/loading';
export default Vue.extend({

View file

@ -8,7 +8,7 @@
<script lang="ts">
import Vue from 'vue';
import { url } from '../../../config';
import getAcct from '../../../../../acct/render';
import getAcct from '../../../../../misc/acct/render';
export default Vue.extend({
props: ['user'],

View file

@ -34,7 +34,7 @@
<script lang="ts">
import Vue from 'vue';
import { url } from '../../../config';
import getNoteSummary from '../../../../../renderers/get-note-summary';
import getNoteSummary from '../../../../../misc/get-note-summary';
import XNote from './notes.note.vue';

View file

@ -110,7 +110,7 @@
<script lang="ts">
import Vue from 'vue';
import getNoteSummary from '../../../../../renderers/get-note-summary';
import getNoteSummary from '../../../../../misc/get-note-summary';
export default Vue.extend({
data() {

View file

@ -27,7 +27,7 @@
<script lang="ts">
import Vue from 'vue';
import * as anime from 'animejs';
import parseAcct from '../../../../../acct/parse';
import parseAcct from '../../../../../misc/acct/parse';
export default Vue.extend({
props: {

View file

@ -81,7 +81,7 @@
<script lang="ts">
import Vue from 'vue';
import getNoteSummary from '../../../../../../renderers/get-note-summary';
import getNoteSummary from '../../../../../../misc/get-note-summary';
import XNote from './deck.note.vue';
export default Vue.extend({

View file

@ -7,8 +7,8 @@
<script lang="ts">
import Vue from 'vue';
import Progress from '../../../common/scripts/loading';
import parseAcct from '../../../../../acct/parse';
import getUserName from '../../../../../renderers/get-user-name';
import parseAcct from '../../../../../misc/acct/parse';
import getUserName from '../../../../../misc/get-user-name';
export default Vue.extend({
data() {

View file

@ -27,8 +27,8 @@
<script lang="ts">
import Vue from 'vue';
import parseAcct from '../../../../../../acct/parse';
import getUserName from '../../../../../../renderers/get-user-name';
import parseAcct from '../../../../../../misc/acct/parse';
import getUserName from '../../../../../../misc/get-user-name';
import Progress from '../../../../common/scripts/loading';
import XHeader from './user.header.vue';
import XTimeline from './user.timeline.vue';

View file

@ -14,7 +14,7 @@
<script lang="ts">
import Vue from 'vue';
import summary from '../../../../../renderers/get-note-summary';
import summary from '../../../../../misc/get-note-summary';
export default Vue.extend({
props: ['note'],

View file

@ -37,7 +37,7 @@
<script lang="ts">
import Vue from 'vue';
import getNoteSummary from '../../../../../renderers/get-note-summary';
import getNoteSummary from '../../../../../misc/get-note-summary';
const displayLimit = 30;

View file

@ -66,7 +66,7 @@
<script lang="ts">
import Vue from 'vue';
import getNoteSummary from '../../../../../renderers/get-note-summary';
import getNoteSummary from '../../../../../misc/get-note-summary';
export default Vue.extend({
props: ['notification'],

View file

@ -81,7 +81,7 @@
<script lang="ts">
import Vue from 'vue';
import getNoteSummary from '../../../../../renderers/get-note-summary';
import getNoteSummary from '../../../../../misc/get-note-summary';
export default Vue.extend({
props: ['notification'],

View file

@ -19,8 +19,8 @@
<script lang="ts">
import Vue from 'vue';
import Progress from '../../../common/scripts/loading';
import parseAcct from '../../../../../acct/parse';
import getUserName from '../../../../../renderers/get-user-name';
import parseAcct from '../../../../../misc/acct/parse';
import getUserName from '../../../../../misc/get-user-name';
export default Vue.extend({
data() {

View file

@ -19,7 +19,7 @@
<script lang="ts">
import Vue from 'vue';
import Progress from '../../../common/scripts/loading';
import parseAcct from '../../../../../acct/parse';
import parseAcct from '../../../../../misc/acct/parse';
export default Vue.extend({
data() {

View file

@ -10,7 +10,7 @@
<script lang="ts">
import Vue from 'vue';
import parseAcct from '../../../../../acct/parse';
import parseAcct from '../../../../../misc/acct/parse';
export default Vue.extend({
data() {

View file

@ -7,7 +7,7 @@
<script lang="ts">
import Vue from 'vue';
import getAcct from '../../../../../acct/render';
import getAcct from '../../../../../misc/acct/render';
export default Vue.extend({
mounted() {

View file

@ -64,7 +64,7 @@
<script lang="ts">
import Vue from 'vue';
import * as age from 's-age';
import parseAcct from '../../../../../acct/parse';
import parseAcct from '../../../../../misc/acct/parse';
import Progress from '../../../common/scripts/loading';
import XHome from './user/home.vue';

View file

@ -12,19 +12,17 @@ import chalk from 'chalk';
import isRoot = require('is-root');
import Xev from 'xev';
import Logger from './utils/logger';
import ProgressBar from './utils/cli/progressbar';
import EnvironmentInfo from './utils/environmentInfo';
import MachineInfo from './utils/machineInfo';
import DependencyInfo from './utils/dependencyInfo';
import Logger from './misc/logger';
import ProgressBar from './misc/cli/progressbar';
import EnvironmentInfo from './misc/environmentInfo';
import MachineInfo from './misc/machineInfo';
import DependencyInfo from './misc/dependencyInfo';
import serverStats from './daemons/server-stats';
import notesStats from './daemons/notes-stats';
import db from './db/mongodb';
import loadConfig from './config/load';
import { Config } from './config/types';
import parseOpt from './parse-opt';
const clusterLog = debug('misskey:cluster');
const ev = new Xev();
@ -44,23 +42,21 @@ main();
* Init process
*/
function main() {
const opt = parseOpt(process.argv, 2);
if (cluster.isMaster) {
masterMain(opt);
masterMain();
ev.mount();
serverStats();
notesStats();
} else {
workerMain(opt);
workerMain();
}
}
/**
* Init master process
*/
async function masterMain(opt: any) {
async function masterMain() {
let config: Config;
try {
@ -75,32 +71,24 @@ async function masterMain(opt: any) {
Logger.info(chalk.green('Successfully initialized :)'));
spawnWorkers(() => {
if (!opt['only-processor']) {
Logger.info(chalk.bold.green(
`Now listening on port ${chalk.underline(config.port.toString())}`));
Logger.info(chalk.bold.green(
`Now listening on port ${chalk.underline(config.port.toString())}`));
Logger.info(chalk.bold.green(config.url));
}
Logger.info(chalk.bold.green(config.url));
if (!opt['only-server']) {
Logger.info(chalk.bold.green('Now processing jobs'));
}
Logger.info(chalk.bold.green('Now processing jobs'));
});
}
/**
* Init worker process
*/
async function workerMain(opt: any) {
if (!opt['only-processor']) {
// start server
await require('./server').default();
}
async function workerMain() {
// start server
await require('./server').default();
if (!opt['only-server']) {
// start processor
require('./queue').default();
}
// start processor
require('./queue').default();
// Send a 'ready' message to parent process
process.send('ready');

View file

@ -1,7 +1,7 @@
/**
* Mention
*/
import parseAcct from '../../../acct/parse';
import parseAcct from '../../../misc/acct/parse';
export type TextElementMention = {
type: 'mention'

View file

@ -1,4 +1,4 @@
import { IUser } from '../models/user';
import { IUser } from '../../models/user';
export default (user: IUser) => {
return user.host === null ? user.username : `${user.username}@${user.host}`;

View file

@ -1,4 +1,4 @@
import getUserName from './get-user-name
import getUserName from './get-user-name';
import getNoteSummary from './get-note-summary';
import getReactionEmoji from './get-reaction-emoji';

View file

@ -1,5 +1,5 @@
import { IUser, isLocalUser } from '../models/user';
import getAcct from '../acct/render';
import getAcct from '../misc/acct/render';
import getUserName from './get-user-name';
/**

View file

@ -1,10 +1,10 @@
import * as mongo from 'mongodb';
import Notification from '../models/notification';
import Mute from '../models/mute';
import { pack } from '../models/notification';
import Notification from './models/notification';
import Mute from './models/mute';
import { pack } from './models/notification';
import stream from './stream';
import User from '../models/user';
import pushSw from './push-sw
import User from './models/user';
import pushSw from './push-sw';
export default (
notifiee: mongo.ObjectID,

View file

@ -1,17 +0,0 @@
import * as nopt from 'nopt';
export default (vector: any, index: any) => {
const parsed = nopt({
'only-processor': Boolean,
'only-server': Boolean
}, {
p: ['--only-processor'],
s: ['--only-server']
}, vector, index);
if (parsed['only-processor'] && parsed['only-server']) {
throw 'only-processor option and only-server option cannot be set at the same time';
}
return parsed;
};

View file

@ -1,7 +1,7 @@
const push = require('web-push');
import * as mongo from 'mongodb';
import Subscription from '../models/sw-subscription';
import config from '../config';
import Subscription from './models/sw-subscription';
import config from './config';
if (config.sw) {
// アプリケーションの連絡先と、サーバーサイドの鍵ペアの情報を登録

View file

@ -2,7 +2,7 @@ import * as kue from 'kue';
import * as debug from 'debug';
const httpSignature = require('http-signature');
import parseAcct from '../../../acct/parse';
import parseAcct from '../../../misc/acct/parse';
import User, { IRemoteUser } from '../../../models/user';
import perform from '../../../remote/activitypub/perform';
import { resolvePerson } from '../../../remote/activitypub/models/person';

View file

@ -11,7 +11,6 @@ import renderNote from '../remote/activitypub/renderer/note';
import renderKey from '../remote/activitypub/renderer/key';
import renderPerson from '../remote/activitypub/renderer/person';
import renderOrderedCollection from '../remote/activitypub/renderer/ordered-collection';
import parseAcct from '../acct/parse';
import config from '../config';
// Init router

View file

@ -1,9 +1,9 @@
import * as mongo from 'mongodb';
import Message from '../../../models/messaging-message';
import { IMessagingMessage as IMessage } from '../../../models/messaging-message';
import publishUserStream from '../../../publishers/stream';
import { publishMessagingStream } from '../../../publishers/stream';
import { publishMessagingIndexStream } from '../../../publishers/stream';
import publishUserStream from '../../../stream';
import { publishMessagingStream } from '../../../stream';
import { publishMessagingIndexStream } from '../../../stream';
import User from '../../../models/user';
/**

View file

@ -1,6 +1,6 @@
import * as mongo from 'mongodb';
import { default as Notification, INotification } from '../../../models/notification';
import publishUserStream from '../../../publishers/stream';
import publishUserStream from '../../../stream';
import Mute from '../../../models/mute';
import User from '../../../models/user';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
import User from '../../../../../models/user';
import Note from '../../../../../models/note';

View file

@ -1,7 +1,7 @@
/**
* Module dependencies
*/
import $ from 'cafy'; import ID from '../../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
import User from '../../../../../models/user';
import FollowedLog from '../../../../../models/followed-log';

View file

@ -1,7 +1,7 @@
/**
* Module dependencies
*/
import $ from 'cafy'; import ID from '../../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
import User from '../../../../../models/user';
import FollowingLog from '../../../../../models/following-log';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
import User from '../../../../../models/user';
import Note from '../../../../../models/note';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
import User from '../../../../../models/user';
import Reaction from '../../../../../models/note-reaction';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
import App, { pack, IApp } from '../../../../models/app';
import { ILocalUser } from '../../../../models/user';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
import DriveFile, { pack } from '../../../../models/drive-file';
import { ILocalUser } from '../../../../models/user';

View file

@ -1,5 +1,5 @@
import * as fs from 'fs';
import $ from 'cafy'; import ID from '../../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
import { validateFileName, pack } from '../../../../../models/drive-file';
import create from '../../../../../services/drive/add-file';
import { ILocalUser } from '../../../../../models/user';

View file

@ -1,7 +1,7 @@
import $ from 'cafy'; import ID from '../../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
import DriveFile from '../../../../../models/drive-file';
import del from '../../../../../services/drive/delete-file';
import { publishDriveStream } from '../../../../../publishers/stream';
import { publishDriveStream } from '../../../../../stream';
import { ILocalUser } from '../../../../../models/user';
/**

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
import DriveFile, { pack } from '../../../../../models/drive-file';
import { ILocalUser } from '../../../../../models/user';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
import DriveFile, { pack } from '../../../../../models/drive-file';
import { ILocalUser } from '../../../../../models/user';

View file

@ -1,7 +1,7 @@
import $ from 'cafy'; import ID from '../../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
import DriveFolder from '../../../../../models/drive-folder';
import DriveFile, { validateFileName, pack } from '../../../../../models/drive-file';
import { publishDriveStream } from '../../../../../publishers/stream';
import { publishDriveStream } from '../../../../../stream';
import { ILocalUser } from '../../../../../models/user';
/**

View file

@ -1,7 +1,7 @@
/**
* Module dependencies
*/
import $ from 'cafy'; import ID from '../../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
import { pack } from '../../../../../models/drive-file';
import uploadFromUrl from '../../../../../services/drive/upload-from-url';
import { ILocalUser } from '../../../../../models/user';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
import DriveFolder, { pack } from '../../../../models/drive-folder';
import { ILocalUser } from '../../../../models/user';

View file

@ -1,6 +1,6 @@
import $ from 'cafy'; import ID from '../../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
import DriveFolder, { isValidFolderName, pack } from '../../../../../models/drive-folder';
import { publishDriveStream } from '../../../../../publishers/stream';
import { publishDriveStream } from '../../../../../stream';
import { ILocalUser } from '../../../../../models/user';
/**

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
import DriveFolder, { pack } from '../../../../../models/drive-folder';
import { ILocalUser } from '../../../../../models/user';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
import DriveFolder, { pack } from '../../../../../models/drive-folder';
import { ILocalUser } from '../../../../../models/user';

View file

@ -1,6 +1,6 @@
import $ from 'cafy'; import ID from '../../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
import DriveFolder, { isValidFolderName, pack } from '../../../../../models/drive-folder';
import { publishDriveStream } from '../../../../../publishers/stream';
import { publishDriveStream } from '../../../../../stream';
import { ILocalUser } from '../../../../../models/user';
/**

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
import DriveFile, { pack } from '../../../../models/drive-file';
import { ILocalUser } from '../../../../models/user';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
import User, { pack, ILocalUser } from '../../../../models/user';
import Following from '../../../../models/following';
import create from '../../../../services/following/create';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
import User, { pack, ILocalUser } from '../../../../models/user';
import Following from '../../../../models/following';
import deleteFollowing from '../../../../services/following/delete';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
import acceptFollowRequest from '../../../../../services/following/requests/accept';
import User, { ILocalUser } from '../../../../../models/user';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
import cancelFollowRequest from '../../../../../services/following/requests/cancel';
import User, { pack, ILocalUser } from '../../../../../models/user';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
import rejectFollowRequest from '../../../../../services/following/requests/reject';
import User, { ILocalUser } from '../../../../../models/user';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
import Following from '../../../../models/following';
import { ILocalUser } from '../../../../models/user';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
import Following from '../../../../models/following';
import { ILocalUser } from '../../../../models/user';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
import ReversiGame, { pack } from '../../../../../models/games/reversi/game';
import { ILocalUser } from '../../../../../models/user';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../../../misc/cafy-id';
import ReversiGame, { pack } from '../../../../../../models/games/reversi/game';
import Reversi from '../../../../../../games/reversi/core';
import { ILocalUser } from '../../../../../../models/user';

View file

@ -1,8 +1,8 @@
import $ from 'cafy'; import ID from '../../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
import Matching, { pack as packMatching } from '../../../../../models/games/reversi/matching';
import ReversiGame, { pack as packGame } from '../../../../../models/games/reversi/game';
import User, { ILocalUser } from '../../../../../models/user';
import publishUserStream, { publishReversiStream } from '../../../../../publishers/stream';
import publishUserStream, { publishReversiStream } from '../../../../../stream';
import { eighteight } from '../../../../../games/reversi/maps';
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
import Favorite, { pack } from '../../../../models/favorite';
import { ILocalUser } from '../../../../models/user';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
import Notification from '../../../../models/notification';
import Mute from '../../../../models/mute';
import { pack } from '../../../../models/notification';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
import User, { ILocalUser } from '../../../../models/user';
import Note from '../../../../models/note';
import { pack } from '../../../../models/user';

View file

@ -1,7 +1,7 @@
import $ from 'cafy';
import * as bcrypt from 'bcryptjs';
import User, { ILocalUser } from '../../../../models/user';
import event from '../../../../publishers/stream';
import event from '../../../../stream';
import generateUserToken from '../../common/generate-native-user-token';
/**

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
import Signin, { pack } from '../../../../models/signin';
import { ILocalUser } from '../../../../models/user';

View file

@ -1,6 +1,6 @@
import $ from 'cafy'; import ID from '../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
import User, { isValidName, isValidDescription, isValidLocation, isValidBirthday, pack, ILocalUser } from '../../../../models/user';
import event from '../../../../publishers/stream';
import event from '../../../../stream';
import DriveFile from '../../../../models/drive-file';
import acceptAllFollowRequests from '../../../../services/following/requests/accept-all';
import { IApp } from '../../../../models/app';

View file

@ -1,6 +1,6 @@
import $ from 'cafy';
import User, { ILocalUser } from '../../../../models/user';
import event from '../../../../publishers/stream';
import event from '../../../../stream';
/**
* Update myself

View file

@ -1,16 +1,15 @@
import $ from 'cafy';
import User, { ILocalUser } from '../../../../models/user';
import event from '../../../../publishers/stream';
import event from '../../../../stream';
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'home' parameter
const [home, homeErr] = $.arr(
$.obj.strict()
.have('name', $.str)
.have('id', $.str)
.have('place', $.str)
.have('data', $.obj))
.get(params.home);
const [home, homeErr] = $.arr($.obj({
name: $.str,
id: $.str,
place: $.str,
data: $.obj()
}).strict()).get(params.home);
if (homeErr) return rej('invalid home param');
await User.update(user._id, {

View file

@ -1,15 +1,14 @@
import $ from 'cafy';
import User, { ILocalUser } from '../../../../models/user';
import event from '../../../../publishers/stream';
import event from '../../../../stream';
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'home' parameter
const [home, homeErr] = $.arr(
$.obj.strict()
.have('name', $.str)
.have('id', $.str)
.have('data', $.obj))
.get(params.home);
const [home, homeErr] = $.arr($.obj({
name: $.str,
id: $.str,
data: $.obj()
}).strict()).get(params.home);
if (homeErr) return rej('invalid home param');
await User.update(user._id, {

View file

@ -1,6 +1,6 @@
import $ from 'cafy';
import User, { ILocalUser } from '../../../../models/user';
import event from '../../../../publishers/stream';
import event from '../../../../stream';
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'id' parameter
@ -8,7 +8,7 @@ export default async (params: any, user: ILocalUser) => new Promise(async (res,
if (idErr) return rej('invalid id param');
// Get 'data' parameter
const [data, dataErr] = $.obj.get(params.data);
const [data, dataErr] = $.obj().get(params.data);
if (dataErr) return rej('invalid data param');
if (id == null && data == null) return rej('you need to set id and data params if home param unset');

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
import Message from '../../../../models/messaging-message';
import User, { ILocalUser } from '../../../../models/user';
import { pack } from '../../../../models/messaging-message';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
import Message from '../../../../../models/messaging-message';
import { isValidText } from '../../../../../models/messaging-message';
import History from '../../../../../models/messaging-history';
@ -6,9 +6,9 @@ import User, { ILocalUser } from '../../../../../models/user';
import Mute from '../../../../../models/mute';
import DriveFile from '../../../../../models/drive-file';
import { pack } from '../../../../../models/messaging-message';
import publishUserStream from '../../../../../publishers/stream';
import { publishMessagingStream, publishMessagingIndexStream } from '../../../../../publishers/stream';
import pushSw from '../../../../../publishers/push-sw';
import publishUserStream from '../../../../../stream';
import { publishMessagingStream, publishMessagingIndexStream } from '../../../../../stream';
import pushSw from '../../../../../push-sw';
import config from '../../../../../config';
/**
@ -116,7 +116,7 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
}, 3000);
// Register to search database
if (message.text && config.elasticsearch.enable) {
if (message.text && config.elasticsearch) {
const es = require('../../../db/elasticsearch');
es.index({

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
import User, { ILocalUser } from '../../../../models/user';
import Mute from '../../../../models/mute';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
import User, { ILocalUser } from '../../../../models/user';
import Mute from '../../../../models/mute';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
import Mute from '../../../../models/mute';
import { pack, ILocalUser } from '../../../../models/user';
import { getFriendIds } from '../../common/get-friends';

View file

@ -1,7 +1,7 @@
/**
* Module dependencies
*/
import $ from 'cafy'; import ID from '../../../cafy-id';
import $ from 'cafy'; import ID from '../../../misc/cafy-id';
import Note, { pack } from '../../../models/note';
/**

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
import Note, { pack, INote } from '../../../../models/note';
import { ILocalUser } from '../../../../models/user';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
import Note, { INote, isValidText, isValidCw, pack } from '../../../../models/note';
import User, { ILocalUser, IUser } from '../../../../models/user';
import DriveFile, { IDriveFile } from '../../../../models/drive-file';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
import Note from '../../../../models/note';
import deleteNote from '../../../../services/note/delete';
import { ILocalUser } from '../../../../models/user';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
import Favorite from '../../../../../models/favorite';
import Note from '../../../../../models/note';
import { ILocalUser } from '../../../../../models/user';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
import Favorite from '../../../../../models/favorite';
import Note from '../../../../../models/note';
import { ILocalUser } from '../../../../../models/user';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
import Note from '../../../../models/note';
import Mute from '../../../../models/mute';
import { pack } from '../../../../models/note';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
import Note from '../../../../models/note';
import Mute from '../../../../models/mute';
import { pack } from '../../../../models/note';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
import Note from '../../../../models/note';
import { getFriendIds } from '../../common/get-friends';
import { pack } from '../../../../models/note';

View file

@ -1,10 +1,10 @@
import $ from 'cafy'; import ID from '../../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
import Vote from '../../../../../models/poll-vote';
import Note from '../../../../../models/note';
import Watching from '../../../../../models/note-watching';
import watch from '../../../../../services/note/watch';
import { publishNoteStream } from '../../../../../publishers/stream';
import notify from '../../../../../publishers/notify';
import { publishNoteStream } from '../../../../../stream';
import notify from '../../../../..//notify';
import { ILocalUser } from '../../../../../models/user';
/**

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
import Note from '../../../../models/note';
import Reaction, { pack } from '../../../../models/note-reaction';
import { ILocalUser } from '../../../../models/user';

View file

@ -1,4 +1,4 @@
import $ from 'cafy'; import ID from '../../../../../cafy-id';
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
import Note from '../../../../../models/note';
import create from '../../../../../services/note/reaction/create';
import { validateReaction } from '../../../../../models/note-reaction';

Some files were not shown because too many files have changed in this diff Show more