Refactoring

This commit is contained in:
syuilo 2019-02-05 14:14:23 +09:00
parent 9b780dff04
commit 8129d4dc23
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
51 changed files with 68 additions and 68 deletions

View file

@ -6,7 +6,7 @@ import perform from '../../../remote/activitypub/perform';
import { resolvePerson, updatePerson } from '../../../remote/activitypub/models/person';
import { toUnicode } from 'punycode';
import { URL } from 'url';
import { publishApLogStream } from '../../../stream';
import { publishApLogStream } from '../../../services/stream';
import Logger from '../../../misc/logger';
const logger = new Logger('inbox');

View file

@ -7,7 +7,7 @@ import * as promiseAny from 'promise-any';
import config from '../../config';
import { ILocalUser } from '../../models/user';
import { publishApLogStream } from '../../stream';
import { publishApLogStream } from '../../services/stream';
import { apLogger } from './logger';
export const logger = apLogger.createSubLogger('deliver');

View file

@ -2,9 +2,9 @@ import * as mongo from 'mongodb';
import isObjectId from '../../../misc/is-objectid';
import Message from '../../../models/messaging-message';
import { IMessagingMessage as IMessage } from '../../../models/messaging-message';
import { publishMainStream } from '../../../stream';
import { publishMessagingStream } from '../../../stream';
import { publishMessagingIndexStream } from '../../../stream';
import { publishMainStream } from '../../../services/stream';
import { publishMessagingStream } from '../../../services/stream';
import { publishMessagingIndexStream } from '../../../services/stream';
import User from '../../../models/user';
/**

View file

@ -1,7 +1,7 @@
import * as mongo from 'mongodb';
import isObjectId from '../../../misc/is-objectid';
import { default as Notification, INotification } from '../../../models/notification';
import { publishMainStream } from '../../../stream';
import { publishMainStream } from '../../../services/stream';
import Mute from '../../../models/mute';
import User from '../../../models/user';

View file

@ -2,7 +2,7 @@ import $ from 'cafy';
import ID, { transform } from '../../../../../misc/cafy-id';
import DriveFile from '../../../../../models/drive-file';
import del from '../../../../../services/drive/delete-file';
import { publishDriveStream } from '../../../../../stream';
import { publishDriveStream } from '../../../../../services/stream';
import define from '../../../define';
export const meta = {

View file

@ -2,7 +2,7 @@ import $ from 'cafy';
import ID, { transform } from '../../../../../misc/cafy-id';
import DriveFolder from '../../../../../models/drive-folder';
import DriveFile, { validateFileName, pack } from '../../../../../models/drive-file';
import { publishDriveStream } from '../../../../../stream';
import { publishDriveStream } from '../../../../../services/stream';
import define from '../../../define';
import Note from '../../../../../models/note';

View file

@ -1,7 +1,7 @@
import $ from 'cafy';
import ID, { transform } from '../../../../../misc/cafy-id';
import DriveFolder, { isValidFolderName, pack } from '../../../../../models/drive-folder';
import { publishDriveStream } from '../../../../../stream';
import { publishDriveStream } from '../../../../../services/stream';
import define from '../../../define';
export const meta = {

View file

@ -2,7 +2,7 @@ import $ from 'cafy';
import ID, { transform } from '../../../../../misc/cafy-id';
import DriveFolder from '../../../../../models/drive-folder';
import define from '../../../define';
import { publishDriveStream } from '../../../../../stream';
import { publishDriveStream } from '../../../../../services/stream';
import DriveFile from '../../../../../models/drive-file';
export const meta = {

View file

@ -1,7 +1,7 @@
import $ from 'cafy';
import ID, { transform } from '../../../../../misc/cafy-id';
import DriveFolder, { isValidFolderName, pack } from '../../../../../models/drive-folder';
import { publishDriveStream } from '../../../../../stream';
import { publishDriveStream } from '../../../../../services/stream';
import define from '../../../define';
export const meta = {

View file

@ -1,7 +1,7 @@
import $ from 'cafy';
import ID, { transform } from '../../../../../../misc/cafy-id';
import ReversiGame, { pack } from '../../../../../../models/games/reversi/game';
import { publishReversiGameStream } from '../../../../../../stream';
import { publishReversiGameStream } from '../../../../../../services/stream';
import define from '../../../../define';
export const meta = {

View file

@ -3,7 +3,7 @@ import ID, { transform } 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 from '../../../../../models/user';
import { publishMainStream, publishReversiStream } from '../../../../../stream';
import { publishMainStream, publishReversiStream } from '../../../../../services/stream';
import { eighteight } from '../../../../../games/reversi/maps';
import define from '../../../define';

View file

@ -1,5 +1,5 @@
import User from '../../../../models/user';
import { publishMainStream } from '../../../../stream';
import { publishMainStream } from '../../../../services/stream';
import Message from '../../../../models/messaging-message';
import define from '../../define';

View file

@ -1,5 +1,5 @@
import User from '../../../../models/user';
import { publishMainStream } from '../../../../stream';
import { publishMainStream } from '../../../../services/stream';
import NoteUnread from '../../../../models/note-unread';
import define from '../../define';

View file

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

View file

@ -1,7 +1,7 @@
import $ from 'cafy';
import ID, { transform } from '../../../../misc/cafy-id';
import User, { isValidName, isValidDescription, isValidLocation, isValidBirthday, pack } from '../../../../models/user';
import { publishMainStream } from '../../../../stream';
import { publishMainStream } from '../../../../services/stream';
import DriveFile from '../../../../models/drive-file';
import acceptAllFollowRequests from '../../../../services/following/requests/accept-all';
import { publishToFollowers } from '../../../../services/i/update';

View file

@ -1,6 +1,6 @@
import $ from 'cafy';
import User from '../../../../models/user';
import { publishMainStream } from '../../../../stream';
import { publishMainStream } from '../../../../services/stream';
import define from '../../define';
export const meta = {

View file

@ -1,6 +1,6 @@
import $ from 'cafy';
import User, { pack } from '../../../../models/user';
import { publishMainStream } from '../../../../stream';
import { publishMainStream } from '../../../../services/stream';
import define from '../../define';
import * as nodemailer from 'nodemailer';
import fetchMeta from '../../../../misc/fetch-meta';

View file

@ -1,6 +1,6 @@
import $ from 'cafy';
import User from '../../../../models/user';
import { publishMainStream } from '../../../../stream';
import { publishMainStream } from '../../../../services/stream';
import define from '../../define';
export const meta = {

View file

@ -1,6 +1,6 @@
import $ from 'cafy';
import User from '../../../../models/user';
import { publishMainStream } from '../../../../stream';
import { publishMainStream } from '../../../../services/stream';
import define from '../../define';
export const meta = {

View file

@ -1,6 +1,6 @@
import $ from 'cafy';
import User from '../../../../models/user';
import { publishMainStream } from '../../../../stream';
import { publishMainStream } from '../../../../services/stream';
import define from '../../define';
export const meta = {

View file

@ -6,9 +6,9 @@ import User from '../../../../../models/user';
import Mute from '../../../../../models/mute';
import DriveFile from '../../../../../models/drive-file';
import { pack } from '../../../../../models/messaging-message';
import { publishMainStream } from '../../../../../stream';
import { publishMessagingStream, publishMessagingIndexStream } from '../../../../../stream';
import pushSw from '../../../../../push-sw';
import { publishMainStream } from '../../../../../services/stream';
import { publishMessagingStream, publishMessagingIndexStream } from '../../../../../services/stream';
import pushSw from '../../../../../services/push-notification';
import define from '../../../define';
export const meta = {

View file

@ -2,7 +2,7 @@ import $ from 'cafy';
import ID, { transform } from '../../../../../misc/cafy-id';
import Message from '../../../../../models/messaging-message';
import define from '../../../define';
import { publishMessagingStream } from '../../../../../stream';
import { publishMessagingStream } from '../../../../../services/stream';
import * as ms from 'ms';
export const meta = {

View file

@ -4,8 +4,8 @@ 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 '../../../../../stream';
import notify from '../../../../../notify';
import { publishNoteStream } from '../../../../../services/stream';
import notify from '../../../../../services/create-notification';
import define from '../../../define';
import createNote from '../../../../../services/note/create';
import User from '../../../../../models/user';

View file

@ -1,5 +1,5 @@
import Notification from '../../../../models/notification';
import { publishMainStream } from '../../../../stream';
import { publishMainStream } from '../../../../services/stream';
import User from '../../../../models/user';
import define from '../../define';

View file

@ -2,7 +2,7 @@ import $ from 'cafy';
import ID, { transform } from '../../../../../misc/cafy-id';
import UserList from '../../../../../models/user-list';
import User, { pack as packUser } from '../../../../../models/user';
import { publishUserListStream } from '../../../../../stream';
import { publishUserListStream } from '../../../../../services/stream';
import define from '../../../define';
export const meta = {

View file

@ -2,7 +2,7 @@ import $ from 'cafy';
import ID, { transform } from '../../../../../misc/cafy-id';
import UserList from '../../../../../models/user-list';
import User, { pack as packUser, isRemoteUser, fetchProxyAccount } from '../../../../../models/user';
import { publishUserListStream } from '../../../../../stream';
import { publishUserListStream } from '../../../../../services/stream';
import { renderActivity } from '../../../../../remote/activitypub/renderer';
import renderFollow from '../../../../../remote/activitypub/renderer/follow';
import { deliver } from '../../../../../queue';

View file

@ -3,7 +3,7 @@ import ID, { transform } from '../../../../misc/cafy-id';
import define from '../../define';
import User from '../../../../models/user';
import AbuseUserReport from '../../../../models/abuse-user-report';
import { publishAdminStream } from '../../../../stream';
import { publishAdminStream } from '../../../../services/stream';
export const meta = {
desc: {

View file

@ -3,7 +3,7 @@ import * as bcrypt from 'bcryptjs';
import * as speakeasy from 'speakeasy';
import User, { ILocalUser } from '../../../models/user';
import Signin, { pack } from '../../../models/signin';
import { publishMainStream } from '../../../stream';
import { publishMainStream } from '../../../services/stream';
import signin from '../common/signin';
import config from '../../../config';

View file

@ -4,7 +4,7 @@ import * as request from 'request';
import { OAuth2 } from 'oauth';
import User, { pack, ILocalUser } from '../../../models/user';
import config from '../../../config';
import { publishMainStream } from '../../../stream';
import { publishMainStream } from '../../../services/stream';
import redis from '../../../db/redis';
import * as uuid from 'uuid';
import signin from '../common/signin';

View file

@ -4,7 +4,7 @@ import * as request from 'request';
import { OAuth2 } from 'oauth';
import User, { pack, ILocalUser } from '../../../models/user';
import config from '../../../config';
import { publishMainStream } from '../../../stream';
import { publishMainStream } from '../../../services/stream';
import redis from '../../../db/redis';
import * as uuid from 'uuid';
import signin from '../common/signin';

View file

@ -4,7 +4,7 @@ import * as uuid from 'uuid';
import autwh from 'autwh';
import redis from '../../../db/redis';
import User, { pack, ILocalUser } from '../../../models/user';
import { publishMainStream } from '../../../stream';
import { publishMainStream } from '../../../services/stream';
import config from '../../../config';
import signin from '../common/signin';
import fetchMeta from '../../../misc/fetch-meta';

View file

@ -2,7 +2,7 @@ import autobind from 'autobind-decorator';
import * as CRC32 from 'crc-32';
import * as mongo from 'mongodb';
import ReversiGame, { pack } from '../../../../../models/games/reversi/game';
import { publishReversiGameStream } from '../../../../../stream';
import { publishReversiGameStream } from '../../../../../services/stream';
import Reversi from '../../../../../games/reversi/core';
import * as maps from '../../../../../games/reversi/maps';
import Channel from '../../channel';

View file

@ -1,7 +1,7 @@
import autobind from 'autobind-decorator';
import * as mongo from 'mongodb';
import Matching, { pack } from '../../../../../models/games/reversi/matching';
import { publishMainStream } from '../../../../../stream';
import { publishMainStream } from '../../../../../services/stream';
import Channel from '../../channel';
export default class extends Channel {

View file

@ -1,7 +1,7 @@
import User, { isLocalUser, isRemoteUser, pack as packUser, IUser } from '../../models/user';
import Following from '../../models/following';
import FollowRequest from '../../models/follow-request';
import { publishMainStream } from '../../stream';
import { publishMainStream } from '../stream';
import { renderActivity } from '../../remote/activitypub/renderer';
import renderFollow from '../../remote/activitypub/renderer/follow';
import renderUndo from '../../remote/activitypub/renderer/undo';

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 { publishMainStream } from './stream';
import User from './models/user';
import pushSw from './push-sw';
import User from '../models/user';
import pushSw from './push-notification';
export default (
notifiee: mongo.ObjectID,

View file

@ -12,7 +12,7 @@ import * as isSvg from 'is-svg';
import DriveFile, { IMetadata, getDriveFileBucket, IDriveFile } from '../../models/drive-file';
import DriveFolder from '../../models/drive-folder';
import { pack } from '../../models/drive-file';
import { publishMainStream, publishDriveStream } from '../../stream';
import { publishMainStream, publishDriveStream } from '../stream';
import { isLocalUser, IUser, IRemoteUser } from '../../models/user';
import delFile from './delete-file';
import config from '../../config';

View file

@ -1,8 +1,8 @@
import User, { isLocalUser, isRemoteUser, pack as packUser, IUser } from '../../models/user';
import Following from '../../models/following';
import Blocking from '../../models/blocking';
import { publishMainStream } from '../../stream';
import notify from '../../notify';
import { publishMainStream } from '../stream';
import notify from '../../services/create-notification';
import { renderActivity } from '../../remote/activitypub/renderer';
import renderFollow from '../../remote/activitypub/renderer/follow';
import renderAccept from '../../remote/activitypub/renderer/accept';

View file

@ -1,6 +1,6 @@
import User, { isLocalUser, isRemoteUser, pack as packUser, IUser } from '../../models/user';
import Following from '../../models/following';
import { publishMainStream } from '../../stream';
import { publishMainStream } from '../stream';
import { renderActivity } from '../../remote/activitypub/renderer';
import renderFollow from '../../remote/activitypub/renderer/follow';
import renderUndo from '../../remote/activitypub/renderer/undo';

View file

@ -5,7 +5,7 @@ import renderFollow from '../../../remote/activitypub/renderer/follow';
import renderAccept from '../../../remote/activitypub/renderer/accept';
import { deliver } from '../../../queue';
import Following from '../../../models/following';
import { publishMainStream } from '../../../stream';
import { publishMainStream } from '../../stream';
import perUserFollowingChart from '../../../chart/per-user-following';
import Logger from '../../../misc/logger';

View file

@ -4,7 +4,7 @@ import { renderActivity } from '../../../remote/activitypub/renderer';
import renderFollow from '../../../remote/activitypub/renderer/follow';
import renderUndo from '../../../remote/activitypub/renderer/undo';
import { deliver } from '../../../queue';
import { publishMainStream } from '../../../stream';
import { publishMainStream } from '../../stream';
export default async function(followee: IUser, follower: IUser) {
if (isRemoteUser(followee)) {

View file

@ -1,6 +1,6 @@
import User, { isLocalUser, isRemoteUser, pack as packUser, IUser } from '../../../models/user';
import { publishMainStream } from '../../../stream';
import notify from '../../../notify';
import { publishMainStream } from '../../stream';
import notify from '../../../services/create-notification';
import { renderActivity } from '../../../remote/activitypub/renderer';
import renderFollow from '../../../remote/activitypub/renderer/follow';
import { deliver } from '../../../queue';

View file

@ -4,7 +4,7 @@ import { renderActivity } from '../../../remote/activitypub/renderer';
import renderFollow from '../../../remote/activitypub/renderer/follow';
import renderReject from '../../../remote/activitypub/renderer/reject';
import { deliver } from '../../../queue';
import { publishMainStream } from '../../../stream';
import { publishMainStream } from '../../stream';
export default async function(followee: IUser, follower: IUser) {
if (isRemoteUser(follower)) {

View file

@ -1,7 +1,7 @@
import es from '../../db/elasticsearch';
import Note, { pack, INote, IChoice } from '../../models/note';
import User, { isLocalUser, IUser, isRemoteUser, IRemoteUser, ILocalUser } from '../../models/user';
import { publishMainStream, publishHomeTimelineStream, publishLocalTimelineStream, publishHybridTimelineStream, publishGlobalTimelineStream, publishUserListStream, publishHashtagStream } from '../../stream';
import { publishMainStream, publishHomeTimelineStream, publishLocalTimelineStream, publishHybridTimelineStream, publishGlobalTimelineStream, publishUserListStream, publishHashtagStream } from '../stream';
import Following from '../../models/following';
import { deliver } from '../../queue';
import renderNote from '../../remote/activitypub/renderer/note';
@ -9,7 +9,7 @@ import renderCreate from '../../remote/activitypub/renderer/create';
import renderAnnounce from '../../remote/activitypub/renderer/announce';
import { renderActivity } from '../../remote/activitypub/renderer';
import DriveFile, { IDriveFile } from '../../models/drive-file';
import notify from '../../notify';
import notify from '../../services/create-notification';
import NoteWatching from '../../models/note-watching';
import watch from './watch';
import Mute from '../../models/mute';

View file

@ -1,6 +1,6 @@
import Note, { INote } from '../../models/note';
import { IUser, isLocalUser } from '../../models/user';
import { publishNoteStream } from '../../stream';
import { publishNoteStream } from '../stream';
import renderDelete from '../../remote/activitypub/renderer/delete';
import { renderActivity } from '../../remote/activitypub/renderer';
import { deliver } from '../../queue';

View file

@ -2,8 +2,8 @@ import Vote from '../../../models/poll-vote';
import Note, { INote } from '../../../models/note';
import Watching from '../../../models/note-watching';
import watch from '../../../services/note/watch';
import { publishNoteStream } from '../../../stream';
import notify from '../../../notify';
import { publishNoteStream } from '../../stream';
import notify from '../../../services/create-notification';
import { isLocalUser, IUser } from '../../../models/user';
export default (user: IUser, note: INote, choice: number) => new Promise(async (res, rej) => {

View file

@ -1,8 +1,8 @@
import { IUser, isLocalUser, isRemoteUser } from '../../../models/user';
import Note, { INote } from '../../../models/note';
import NoteReaction from '../../../models/note-reaction';
import { publishNoteStream } from '../../../stream';
import notify from '../../../notify';
import { publishNoteStream } from '../../stream';
import notify from '../../create-notification';
import NoteWatching from '../../../models/note-watching';
import watch from '../watch';
import renderLike from '../../../remote/activitypub/renderer/like';

View file

@ -1,7 +1,7 @@
import { IUser, isLocalUser, isRemoteUser } from '../../../models/user';
import Note, { INote } from '../../../models/note';
import Reaction from '../../../models/note-reaction';
import { publishNoteStream } from '../../../stream';
import { publishNoteStream } from '../../stream';
import renderLike from '../../../remote/activitypub/renderer/like';
import renderUndo from '../../../remote/activitypub/renderer/undo';
import { renderActivity } from '../../../remote/activitypub/renderer';

View file

@ -1,6 +1,6 @@
import * as mongo from 'mongodb';
import isObjectId from '../../misc/is-objectid';
import { publishMainStream } from '../../stream';
import { publishMainStream } from '../stream';
import User from '../../models/user';
import NoteUnread from '../../models/note-unread';

View file

@ -2,7 +2,7 @@ import NoteUnread from '../../models/note-unread';
import User, { IUser } from '../../models/user';
import { INote } from '../../models/note';
import Mute from '../../models/mute';
import { publishMainStream } from '../../stream';
import { publishMainStream } from '../stream';
export default async function(user: IUser, note: INote, isSpecified = false) {
//#region ミュートしているなら無視

View file

@ -1,9 +1,9 @@
import * as push from 'web-push';
import * as mongo from 'mongodb';
import Subscription from './models/sw-subscription';
import config from './config';
import fetchMeta from './misc/fetch-meta';
import { IMeta } from './models/meta';
import Subscription from '../models/sw-subscription';
import config from '../config';
import fetchMeta from '../misc/fetch-meta';
import { IMeta } from '../models/meta';
let meta: IMeta = null;

View file

@ -1,5 +1,5 @@
import * as mongo from 'mongodb';
import redis from './db/redis';
import redis from '../db/redis';
import Xev from 'xev';
type ID = string | mongo.ObjectID;