Migrate to Vue3 (#6587)

* Update reaction.vue

* fix  bug

* wip

* wip

* wjio

* wip

* Revert "wip"

This reverts commit e427f2160adf4e8a4147006e25a89854edab0033.

* wip

* wip

* wip

* Update init.ts

* Update drive-window.vue

* wip

* wip

* Use PascalCase for components

* Use PascalCase for components

* update dep

* wip

* wip

* wip

* Update init.ts

* wip

* Update paging.ts

* Update test.vue

* watch deep

* wip

* lint

* wip

* wip

* wip

* wip

* wiop

* wip

* Update webpack.config.ts

* alllow null poll

* wip

* wip

* wip

* wiop

* UI redesign & refactor (#6714)

* wip

* wip

* wip

* wip

* wip

* Update drive.vue

* Update word-mute.vue

* wip

* wip

* wip

* clean up

* wip

* Update default.vue

* wip

* Update notes.vue

* Update mfm.ts

* Update index.home.vue

* Update post-form.vue

* Update post-form-attaches.vue

* wip

* Update post-form.vue

* Update sidebar.vue

* wip

* wip

* Update index.vue

* wip

* Update default.vue

* Update index.vue

* Update index.vue

* wip

* Update post-form-attaches.vue

* Update note.vue

* wip

* clean up

* Update notes.vue

* wip

* wip

* Update ja-JP.yml

* wip

* wip

* Update index.vue

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Update default.vue

* wip

* Update _dark.json5

* wip

* wip

* wip

* clean up

* wip

* wip

* Update index.vue

* Update test.vue

* wip

* wip

* fix

* wip

* wip

* wip

* wip

* clena yop

* wip

* wip

* Update store.ts

* Update messaging-room.vue

* Update default.widgets.vue

* fix

* wip

* wip

* Update modal.vue

* wip

* Update os.ts

* Update os.ts

* Update deck.vue

* Update init.ts

* wip

* Update ja-JP.yml

* v-sizeは単にwindowのresizeを監視するだけで良いかもしれない

* Update modal.vue

* wip

* Update tooltip.ts

* wip

* wip

* wip

* wip

* wip

* Update image-viewer.vue

* wip

* wip

* Update style.scss

* Update style.scss

* Update visitor.vue

* wip

* Update init.ts

* Update init.ts

* wip

* wip

* Update visitor.vue

* Update visitor.vue

* Update visitor.vue

* Update visitor.vue

* wip

* wip

* Update modal.vue

* Update header.vue

* Update menu.vue

* Update about.vue

* Update about-misskey.vue

* wip

* wip

* Update visitor.vue

* Update tooltip.ts

* wip

* Update drive.vue

* wip

* Update style.scss

* Update header.vue

* wip

* wip

* Update users.user.vue

* Update announcements.vue

* wip

* wip

* wip

* Update emojis.vue

* wip

* Update emojis.vue

* Update style.scss

* Update users.vue

* wip

* Update style.scss

* wip

* Update welcome.entrance.vue

* Update radio.vue

* Update size.ts

* Update emoji-edit-dialog.vue

* wip

* Update emojis.vue

* wip

* Update emojis.vue

* Update emojis.vue

* Update emojis.vue

* wip

* wip

* wip

* wip

* Update file-dialog.vue

* wip

* wip

* Update token-generate-window.vue

* Update notification-setting-window.vue

* wip

* wip

* Update _error_.vue

* Update ja-JP.yml

* wip

* wip

* Update store.ts

* Update emojis.vue

* Update emojis.vue

* Update emojis.vue

* Update announcements.vue

* Update store.ts

* wip

* Update page-editor.vue

* wip

* wip

* Update modal.vue

* wip

* Update select-file.ts

* Update timeline.vue

* Update emojis.vue

* Update os.ts

* wip

* Update user-select.vue

* Update mfm.ts

* Update get-file-info.ts

* Update drive.vue

* Update init.ts

* Update mfm.ts

* wip

* wip

* Update window.vue

* Update note.vue

* wip

* wip

* Update user-info.vue

* wip

* wip

* wip

* wip

* wip

* Update header.vue

* Update header.vue

* wip

* Update explore.vue

* wip

* wip

* wip

* Update webpack.config.ts

* wip

* wip

* wip

* wip

* wip

* wip

* Update autocomplete.ts

* wip

* wip

* wip

* Update toast.vue

* wip

* Update post-form-dialog.vue

* wip

* wip

* wip

* wip

* wip

* Update users.vue

* wip

* Update explore.vue

* wip

* wip

* wip

* Update package.json

* wip

* Update icon-dialog.vue

* wip

* wip

* Update user-preview.ts

* wip

* wip

* wip

* wip

* wip

* Update instance.vue

* Update user-name.vue

* Update federation.vue

* Update instance.vue

* wip

* wip

* Update tag.vue

* wip

* wip

* wip

* wip

* wip

* Update instance.vue

* wip

* Update os.ts

* Update os.ts

* wip

* wip

* wip

* Update router.ts

* wip

* Update init.ts

* Update note.vue

* Update messages.vue

* wip

* wip

* wip

* wip

* wip

* google

* wip

* wip

* wip

* wip

* Update theme-editor.vue

* wip

* wip

* Update room.vue

* Update channel-editor.vue

* wip

* Update window.vue

* Update window.vue

* wip

* Update window.vue

* Update window.vue

* wip

* Update menu.vue

* wip

* wip

* wip

* wip

* Update messaging-room.vue

* wip

* Update post-form.vue

* Update default.widgets.vue

* Update window.vue

* wip
This commit is contained in:
syuilo 2020-10-17 20:12:00 +09:00 committed by GitHub
parent a40f38b2b5
commit 7199e6f4e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
357 changed files with 15053 additions and 12496 deletions

View file

@ -1,7 +1,8 @@
import $ from 'cafy';
import define from '../../../define';
import { fallback } from '../../../../../prelude/symbol';
import { DriveFiles } from '../../../../../models';
import { makePaginationQuery } from '../../../common/make-pagination-query';
import { ID } from '../../../../../misc/cafy-id';
export const meta = {
tags: ['admin'],
@ -15,18 +16,16 @@ export const meta = {
default: 10
},
offset: {
validator: $.optional.num.min(0),
default: 0
sinceId: {
validator: $.optional.type(ID),
},
sort: {
validator: $.optional.str.or([
'+createdAt',
'-createdAt',
'+size',
'-size',
]),
untilId: {
validator: $.optional.type(ID),
},
type: {
validator: $.optional.nullable.str.match(/^[a-zA-Z\/\-*]+$/)
},
origin: {
@ -36,30 +35,37 @@ export const meta = {
'remote',
]),
default: 'local'
}
},
hostname: {
validator: $.optional.nullable.str,
default: null
},
}
};
const sort: any = { // < https://github.com/Microsoft/TypeScript/issues/1863
'+createdAt': { createdAt: -1 },
'-createdAt': { createdAt: 1 },
'+size': { size: -1 },
'-size': { size: 1 },
[fallback]: { id: -1 }
};
export default define(meta, async (ps, me) => {
const q = {} as any;
const query = makePaginationQuery(DriveFiles.createQueryBuilder('file'), ps.sinceId, ps.untilId);
if (ps.origin === 'local') q['userHost'] = null;
if (ps.origin === 'remote') q['userHost'] = { $ne: null };
if (ps.origin === 'local') {
query.andWhere('file.userHost IS NULL');
} else if (ps.origin === 'remote') {
query.andWhere('file.userHost IS NOT NULL');
}
const files = await DriveFiles.find({
where: q,
take: ps.limit!,
order: sort[ps.sort!] || sort[fallback],
skip: ps.offset
});
if (ps.hostname) {
query.andWhere('file.userHost = :hostname', { hostname: ps.hostname });
}
if (ps.type) {
if (ps.type.endsWith('/*')) {
query.andWhere('file.type like :type', { type: ps.type.replace('/*', '/') + '%' });
} else {
query.andWhere('file.type = :type', { type: ps.type });
}
}
const files = await query.take(ps.limit!).getMany();
return await DriveFiles.packMany(files, { detail: true, withUser: true, self: true });
});

View file

@ -12,7 +12,11 @@ export const meta = {
params: {
fileId: {
validator: $.type(ID),
validator: $.optional.type(ID),
},
url: {
validator: $.optional.str,
},
},
@ -26,7 +30,15 @@ export const meta = {
};
export default define(meta, async (ps, me) => {
const file = await DriveFiles.findOne(ps.fileId);
const file = ps.fileId ? await DriveFiles.findOne(ps.fileId) : await DriveFiles.findOne({
where: [{
url: ps.url
}, {
thumbnailUrl: ps.url
}, {
webpublicUrl: ps.url
}]
});
if (file == null) {
throw new ApiError(meta.errors.noSuchFile);

View file

@ -16,6 +16,11 @@ export const meta = {
requireModerator: true,
params: {
query: {
validator: $.optional.nullable.str,
default: null as any
},
host: {
validator: $.optional.nullable.str,
default: null as any
@ -45,9 +50,12 @@ export default define(meta, async (ps) => {
q.andWhere(`emoji.host = :host`, { host: toPuny(ps.host) });
}
if (ps.query) {
q.andWhere('emoji.name like :query', { query: '%' + ps.query + '%' });
}
const emojis = await q
.orderBy('emoji.category', 'ASC')
.orderBy('emoji.name', 'ASC')
.orderBy('emoji.id', 'DESC')
.take(ps.limit!)
.getMany();

View file

@ -3,6 +3,7 @@ import define from '../../../define';
import { Emojis } from '../../../../../models';
import { makePaginationQuery } from '../../../common/make-pagination-query';
import { ID } from '../../../../../misc/cafy-id';
import { Emoji } from '../../../../../models/entities/emoji';
export const meta = {
desc: {
@ -15,6 +16,11 @@ export const meta = {
requireModerator: true,
params: {
query: {
validator: $.optional.nullable.str,
default: null as any
},
limit: {
validator: $.optional.num.range(1, 100),
default: 10
@ -31,10 +37,26 @@ export const meta = {
};
export default define(meta, async (ps) => {
const emojis = await makePaginationQuery(Emojis.createQueryBuilder('emoji'), ps.sinceId, ps.untilId)
.andWhere(`emoji.host IS NULL`)
.take(ps.limit!)
.getMany();
const q = makePaginationQuery(Emojis.createQueryBuilder('emoji'), ps.sinceId, ps.untilId)
.andWhere(`emoji.host IS NULL`);
let emojis: Emoji[];
if (ps.query) {
//q.andWhere('emoji.name ILIKE :q', { q: `%${ps.query}%` });
//const emojis = await q.take(ps.limit!).getMany();
emojis = await q.getMany();
emojis = emojis.filter(emoji =>
emoji.name.includes(ps.query) ||
emoji.aliases.some(a => a.includes(ps.query)) ||
emoji.category?.includes(ps.query));
emojis.splice(ps.limit! + 1);
} else {
emojis = await q.take(ps.limit!).getMany();
}
return Emojis.packMany(emojis);
});

View file

@ -4,6 +4,7 @@ import { getConnection } from 'typeorm';
export const meta = {
requireCredential: true as const,
requireAdmin: true,
requireModerator: true,
desc: {
'en-US': 'Get table stats'

View file

@ -7,6 +7,7 @@ import redis from '../../../../db/redis';
export const meta = {
requireCredential: true as const,
requireAdmin: true,
requireModerator: true,
desc: {
},

View file

@ -36,7 +36,7 @@ export const meta = {
},
type: {
validator: $.optional.str.match(/^[a-zA-Z\/\-*]+$/)
validator: $.optional.nullable.str.match(/^[a-zA-Z\/\-*]+$/)
}
},

View file

@ -91,6 +91,7 @@ export default define(meta, async (ps, user) => {
return await DriveFiles.pack(file, {
detail: true,
withUser: true,
self: true
});
});

View file

@ -4,6 +4,7 @@ import * as ms from 'ms';
import uploadFromUrl from '../../../../../services/drive/upload-from-url';
import define from '../../../define';
import { DriveFiles } from '../../../../../models';
import { publishMainStream } from '../../../../../services/stream';
export const meta = {
desc: {
@ -41,6 +42,16 @@ export const meta = {
}
},
comment: {
validator: $.optional.nullable.str,
default: null as any,
},
marker: {
validator: $.optional.nullable.str,
default: null as any,
},
force: {
validator: $.optional.bool,
default: false,
@ -52,5 +63,12 @@ export const meta = {
};
export default define(meta, async (ps, user) => {
return await DriveFiles.pack(await uploadFromUrl(ps.url, user, ps.folderId, null, ps.isSensitive, ps.force), { self: true });
uploadFromUrl(ps.url, user, ps.folderId, null, ps.isSensitive, ps.force, false, ps.comment).then(file => {
DriveFiles.pack(file, { self: true }).then(packedFile => {
publishMainStream(user.id, 'urlUploadFinished', {
marker: ps.marker,
file: packedFile
});
});
});
});

View file

@ -150,7 +150,7 @@ export const meta = {
},
poll: {
validator: $.optional.obj({
validator: $.optional.nullable.obj({
choices: $.arr($.str)
.unique()
.range(2, 10)

View file

@ -1,6 +1,6 @@
import $ from 'cafy';
import define from '../../define';
import { Users } from '../../../../models';
import { UserProfiles, Users } from '../../../../models';
import { User } from '../../../../models/entities/user';
export const meta = {
@ -65,7 +65,7 @@ export const meta = {
};
export default define(meta, async (ps, me) => {
const isUsername = ps.localOnly ? Users.validateLocalUsername.ok(ps.query.replace('@', '')) : Users.validateRemoteUsername.ok(ps.query.replace('@', ''));
const isUsername = ps.query.startsWith('@');
let users: User[] = [];
@ -90,6 +90,37 @@ export default define(meta, async (ps, me) => {
.take(ps.limit! - users.length)
.getMany();
users = users.concat(otherUsers);
}
} else {
const profQuery = UserProfiles.createQueryBuilder('prof')
.select('prof.userId')
.where('prof.userHost IS NULL')
.andWhere('prof.description ilike :query', { query: '%' + ps.query + '%' });
users = await Users.createQueryBuilder('user')
.where(`user.id IN (${ profQuery.getQuery() })`)
.setParameters(profQuery.getParameters())
.andWhere('user.updatedAt IS NOT NULL')
.orderBy('user.updatedAt', 'DESC')
.take(ps.limit!)
.skip(ps.offset)
.getMany();
if (users.length < ps.limit! && !ps.localOnly) {
const profQuery2 = UserProfiles.createQueryBuilder('prof')
.select('prof.userId')
.where('prof.userHost IS NOT NULL')
.andWhere('prof.description ilike :query', { query: '%' + ps.query + '%' });
const otherUsers = await Users.createQueryBuilder('user')
.where(`user.id IN (${ profQuery2.getQuery() })`)
.setParameters(profQuery2.getParameters())
.andWhere('user.updatedAt IS NOT NULL')
.orderBy('user.updatedAt', 'DESC')
.take(ps.limit! - users.length)
.getMany();
users = users.concat(otherUsers);
}
}