Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
22015044a5 | ||
![]() |
61f86dcb2b | ||
![]() |
8f3bce6b11 | ||
![]() |
ee736e73a9 | ||
![]() |
99f867897e | ||
![]() |
c66c5b6e75 | ||
![]() |
f25ecc19b9 | ||
![]() |
48e09970f3 | ||
![]() |
f05cb79604 | ||
![]() |
46d3293edd | ||
![]() |
9703d613cf | ||
![]() |
704e217dbb | ||
![]() |
92ba64c35c | ||
![]() |
a8ee51ffd6 | ||
![]() |
5538afc61d |
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "misskey",
|
"name": "misskey",
|
||||||
"author": "syuilo <i@syuilo.com>",
|
"author": "syuilo <i@syuilo.com>",
|
||||||
"version": "10.21.1",
|
"version": "10.22.0",
|
||||||
"clientVersion": "1.0.10618",
|
"clientVersion": "1.0.10633",
|
||||||
"codename": "nighthike",
|
"codename": "nighthike",
|
||||||
"main": "./built/index.js",
|
"main": "./built/index.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
@@ -179,7 +179,7 @@
|
|||||||
"qrcode": "1.3.0",
|
"qrcode": "1.3.0",
|
||||||
"ratelimiter": "3.2.0",
|
"ratelimiter": "3.2.0",
|
||||||
"recaptcha-promise": "0.1.3",
|
"recaptcha-promise": "0.1.3",
|
||||||
"reconnecting-websocket": "4.1.8",
|
"reconnecting-websocket": "4.1.9",
|
||||||
"redis": "2.8.0",
|
"redis": "2.8.0",
|
||||||
"request": "2.88.0",
|
"request": "2.88.0",
|
||||||
"request-promise-native": "1.0.5",
|
"request-promise-native": "1.0.5",
|
||||||
|
@@ -307,7 +307,7 @@ export default Vue.extend({
|
|||||||
display block
|
display block
|
||||||
width 100%
|
width 100%
|
||||||
padding 16px
|
padding 16px
|
||||||
color #555
|
color var(--text)
|
||||||
border-top solid 1px rgba(#000, 0.05)
|
border-top solid 1px rgba(#000, 0.05)
|
||||||
|
|
||||||
&:hover
|
&:hover
|
||||||
@@ -326,6 +326,6 @@ export default Vue.extend({
|
|||||||
margin 0
|
margin 0
|
||||||
padding 16px
|
padding 16px
|
||||||
text-align center
|
text-align center
|
||||||
color #aaa
|
color var(--text)
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
@@ -2,8 +2,8 @@
|
|||||||
<div class="mk-ui" v-hotkey.global="keymap">
|
<div class="mk-ui" v-hotkey.global="keymap">
|
||||||
<div class="bg" v-if="$store.getters.isSignedIn && $store.state.i.wallpaperUrl" :style="style"></div>
|
<div class="bg" v-if="$store.getters.isSignedIn && $store.state.i.wallpaperUrl" :style="style"></div>
|
||||||
<x-header class="header" v-if="navbar == 'top'" v-show="!zenMode" ref="header"/>
|
<x-header class="header" v-if="navbar == 'top'" v-show="!zenMode" ref="header"/>
|
||||||
<x-sidebar class="sidebar" v-if="navbar != 'top'" ref="sidebar"/>
|
<x-sidebar class="sidebar" v-if="navbar != 'top'" v-show="!zenMode" ref="sidebar"/>
|
||||||
<div class="content" :class="[{ sidebar: navbar != 'top' }, navbar]">
|
<div class="content" :class="[{ sidebar: navbar != 'top', zen: zenMode }, navbar]">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
<mk-stream-indicator v-if="$store.getters.isSignedIn"/>
|
<mk-stream-indicator v-if="$store.getters.isSignedIn"/>
|
||||||
@@ -73,7 +73,9 @@ export default Vue.extend({
|
|||||||
toggleZenMode() {
|
toggleZenMode() {
|
||||||
this.zenMode = !this.zenMode;
|
this.zenMode = !this.zenMode;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$store.commit('setUiHeaderHeight', this.$refs.header.$el.offsetHeight);
|
if (this.$refs.header) {
|
||||||
|
this.$store.commit('setUiHeaderHeight', this.$refs.header.$el.offsetHeight);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -102,4 +104,7 @@ export default Vue.extend({
|
|||||||
> .content.sidebar.right
|
> .content.sidebar.right
|
||||||
padding-right 68px
|
padding-right 68px
|
||||||
|
|
||||||
|
> .content.zen
|
||||||
|
padding 0 !important
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
@@ -23,6 +23,7 @@ export type Source = {
|
|||||||
url: string;
|
url: string;
|
||||||
port: number;
|
port: number;
|
||||||
https?: { [x: string]: string };
|
https?: { [x: string]: string };
|
||||||
|
disableHsts?: boolean;
|
||||||
mongodb: {
|
mongodb: {
|
||||||
host: string;
|
host: string;
|
||||||
port: number;
|
port: number;
|
||||||
|
@@ -26,17 +26,19 @@ export async function createImage(actor: IRemoteUser, value: any): Promise<IDriv
|
|||||||
|
|
||||||
let file = await uploadFromUrl(image.url, actor, null, image.url, image.sensitive);
|
let file = await uploadFromUrl(image.url, actor, null, image.url, image.sensitive);
|
||||||
|
|
||||||
// URLが異なっている場合、同じ画像が以前に異なるURLで登録されていたということなので、
|
if (file.metadata.isRemote) {
|
||||||
// URLを更新する
|
// URLが異なっている場合、同じ画像が以前に異なるURLで登録されていたということなので、
|
||||||
if (file.metadata.url !== image.url) {
|
// URLを更新する
|
||||||
file = await DriveFile.findOneAndUpdate({ _id: file._id }, {
|
if (file.metadata.url !== image.url) {
|
||||||
$set: {
|
file = await DriveFile.findOneAndUpdate({ _id: file._id }, {
|
||||||
'metadata.url': image.url,
|
$set: {
|
||||||
'metadata.uri': image.url
|
'metadata.url': image.url,
|
||||||
}
|
'metadata.uri': image.url
|
||||||
}, {
|
}
|
||||||
returnNewDocument: true
|
}, {
|
||||||
});
|
returnNewDocument: true
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return file;
|
return file;
|
||||||
|
@@ -41,7 +41,7 @@ app.use(compress({
|
|||||||
|
|
||||||
// HSTS
|
// HSTS
|
||||||
// 6months (15552000sec)
|
// 6months (15552000sec)
|
||||||
if (config.url.startsWith('https')) {
|
if (config.url.startsWith('https') && !config.disableHsts) {
|
||||||
app.use(async (ctx, next) => {
|
app.use(async (ctx, next) => {
|
||||||
ctx.set('strict-transport-security', 'max-age=15552000; preload');
|
ctx.set('strict-transport-security', 'max-age=15552000; preload');
|
||||||
await next();
|
await next();
|
||||||
|
@@ -37,8 +37,10 @@ async function save(path: string, name: string, type: string, hash: string, size
|
|||||||
if (config.drive && config.drive.storage == 'minio') {
|
if (config.drive && config.drive.storage == 'minio') {
|
||||||
const minio = new Minio.Client(config.drive.config);
|
const minio = new Minio.Client(config.drive.config);
|
||||||
|
|
||||||
const key = `${config.drive.prefix}/${uuid.v4()}`;
|
const [ext] = (name.match(/\.([a-zA-Z0-9_-]+)$/) || ['']);
|
||||||
const thumbnailKey = `${config.drive.prefix}/${uuid.v4()}`;
|
|
||||||
|
const key = `${config.drive.prefix}/${uuid.v4()}${ext}`;
|
||||||
|
const thumbnailKey = `${config.drive.prefix}/${uuid.v4()}.jpg`;
|
||||||
|
|
||||||
const baseUrl = config.drive.baseUrl
|
const baseUrl = config.drive.baseUrl
|
||||||
|| `${ config.drive.config.useSSL ? 'https' : 'http' }://${ config.drive.config.endPoint }${ config.drive.config.port ? `:${config.drive.config.port}` : '' }/${ config.drive.bucket }`;
|
|| `${ config.drive.config.useSSL ? 'https' : 'http' }://${ config.drive.config.endPoint }${ config.drive.config.port ? `:${config.drive.config.port}` : '' }/${ config.drive.bucket }`;
|
||||||
|
72
test/api.ts
72
test/api.ts
@@ -1125,4 +1125,76 @@ describe('API', () => {
|
|||||||
expect(res).have.status(400);
|
expect(res).have.status(400);
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('messaging/messages/create', () => {
|
||||||
|
it('メッセージを送信できる', async(async () => {
|
||||||
|
const alice = await signup({ username: 'alice' });
|
||||||
|
const bob = await signup({ username: 'bob' });
|
||||||
|
|
||||||
|
const res = await request('/messaging/messages/create', {
|
||||||
|
userId: bob.id,
|
||||||
|
text: 'test'
|
||||||
|
}, alice);
|
||||||
|
|
||||||
|
expect(res).have.status(200);
|
||||||
|
expect(res.body).be.a('object');
|
||||||
|
expect(res.body).have.property('text').eql('test');
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('自分自身にはメッセージを送信できない', async(async () => {
|
||||||
|
const alice = await signup({ username: 'alice' });
|
||||||
|
|
||||||
|
const res = await request('/messaging/messages/create', {
|
||||||
|
userId: alice.id,
|
||||||
|
text: 'Yo'
|
||||||
|
}, alice);
|
||||||
|
|
||||||
|
expect(res).have.status(400);
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('存在しないユーザーにはメッセージを送信できない', async(async () => {
|
||||||
|
const alice = await signup({ username: 'alice' });
|
||||||
|
|
||||||
|
const res = await request('/messaging/messages/create', {
|
||||||
|
userId: '000000000000000000000000',
|
||||||
|
text: 'test'
|
||||||
|
}, alice);
|
||||||
|
|
||||||
|
expect(res).have.status(400);
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('不正なユーザーIDで怒られる', async(async () => {
|
||||||
|
const alice = await signup({ username: 'alice' });
|
||||||
|
|
||||||
|
const res = await request('/messaging/messages/create', {
|
||||||
|
userId: 'foo',
|
||||||
|
text: 'test'
|
||||||
|
}, alice);
|
||||||
|
|
||||||
|
expect(res).have.status(400);
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('テキストが無くて怒られる', async(async () => {
|
||||||
|
const alice = await signup({ username: 'alice' });
|
||||||
|
const bob = await signup({ username: 'bob' });
|
||||||
|
|
||||||
|
const res = await request('/messaging/messages/create', {
|
||||||
|
userId: bob.id
|
||||||
|
}, alice);
|
||||||
|
|
||||||
|
expect(res).have.status(400);
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('文字数オーバーで怒られる', async(async () => {
|
||||||
|
const alice = await signup({ username: 'alice' });
|
||||||
|
const bob = await signup({ username: 'bob' });
|
||||||
|
|
||||||
|
const res = await request('/messaging/messages/create', {
|
||||||
|
userId: bob.id,
|
||||||
|
text: '!'.repeat(1001)
|
||||||
|
}, alice);
|
||||||
|
|
||||||
|
expect(res).have.status(400);
|
||||||
|
}));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user