Compare commits

..

15 Commits

Author SHA1 Message Date
syuilo
22015044a5 10.22.0 2018-10-17 04:17:19 +09:00
syuilo
61f86dcb2b Resolve #2923
Allow option to disable sending HSTS headers even if https:// is used in url
2018-10-17 04:15:41 +09:00
syuilo
8f3bce6b11 Add some messaging API tests 2018-10-17 04:01:13 +09:00
syuilo
ee736e73a9 Merge pull request #2922 from syuilo/greenkeeper/reconnecting-websocket-4.1.9
Update reconnecting-websocket to the latest version 🚀
2018-10-17 03:54:08 +09:00
greenkeeper[bot]
99f867897e fix(package): update reconnecting-websocket to version 4.1.9 2018-10-16 18:53:19 +00:00
syuilo
c66c5b6e75 Fix bug 2018-10-17 03:47:32 +09:00
syuilo
f25ecc19b9 🎨 2018-10-17 03:41:55 +09:00
syuilo
48e09970f3 Merge pull request #2921 from syuilo/l10n_develop
New Crowdin translations
2018-10-16 22:46:43 +09:00
syuilo
f05cb79604 10.21.3 2018-10-16 22:26:43 +09:00
syuilo
46d3293edd Fix #2920 2018-10-16 22:21:08 +09:00
syuilo
9703d613cf 10.21.2 2018-10-16 20:59:49 +09:00
syuilo
704e217dbb オブジェクトストレージのURLに拡張子を含めるように 2018-10-16 20:59:36 +09:00
syuilo
92ba64c35c New translations ja-JP.yml (German) 2018-10-16 06:11:24 +09:00
syuilo
a8ee51ffd6 New translations ja-JP.yml (German) 2018-10-16 05:51:14 +09:00
syuilo
5538afc61d New translations ja-JP.yml (German) 2018-10-16 05:42:36 +09:00
8 changed files with 104 additions and 22 deletions

View File

@@ -1,8 +1,8 @@
{
"name": "misskey",
"author": "syuilo <i@syuilo.com>",
"version": "10.21.1",
"clientVersion": "1.0.10618",
"version": "10.22.0",
"clientVersion": "1.0.10633",
"codename": "nighthike",
"main": "./built/index.js",
"private": true,
@@ -179,7 +179,7 @@
"qrcode": "1.3.0",
"ratelimiter": "3.2.0",
"recaptcha-promise": "0.1.3",
"reconnecting-websocket": "4.1.8",
"reconnecting-websocket": "4.1.9",
"redis": "2.8.0",
"request": "2.88.0",
"request-promise-native": "1.0.5",

View File

@@ -307,7 +307,7 @@ export default Vue.extend({
display block
width 100%
padding 16px
color #555
color var(--text)
border-top solid 1px rgba(#000, 0.05)
&:hover
@@ -326,6 +326,6 @@ export default Vue.extend({
margin 0
padding 16px
text-align center
color #aaa
color var(--text)
</style>

View File

@@ -2,8 +2,8 @@
<div class="mk-ui" v-hotkey.global="keymap">
<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-sidebar class="sidebar" v-if="navbar != 'top'" ref="sidebar"/>
<div class="content" :class="[{ sidebar: navbar != 'top' }, navbar]">
<x-sidebar class="sidebar" v-if="navbar != 'top'" v-show="!zenMode" ref="sidebar"/>
<div class="content" :class="[{ sidebar: navbar != 'top', zen: zenMode }, navbar]">
<slot></slot>
</div>
<mk-stream-indicator v-if="$store.getters.isSignedIn"/>
@@ -73,7 +73,9 @@ export default Vue.extend({
toggleZenMode() {
this.zenMode = !this.zenMode;
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
padding-right 68px
> .content.zen
padding 0 !important
</style>

View File

@@ -23,6 +23,7 @@ export type Source = {
url: string;
port: number;
https?: { [x: string]: string };
disableHsts?: boolean;
mongodb: {
host: string;
port: number;

View File

@@ -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);
// URLが異なっている場合、同じ画像が以前に異なるURLで登録されていたということなので、
// URLを更新する
if (file.metadata.url !== image.url) {
file = await DriveFile.findOneAndUpdate({ _id: file._id }, {
$set: {
'metadata.url': image.url,
'metadata.uri': image.url
}
}, {
returnNewDocument: true
});
if (file.metadata.isRemote) {
// URLが異なっている場合、同じ画像が以前に異なるURLで登録されていたということなので、
// URLを更新する
if (file.metadata.url !== image.url) {
file = await DriveFile.findOneAndUpdate({ _id: file._id }, {
$set: {
'metadata.url': image.url,
'metadata.uri': image.url
}
}, {
returnNewDocument: true
});
}
}
return file;

View File

@@ -41,7 +41,7 @@ app.use(compress({
// HSTS
// 6months (15552000sec)
if (config.url.startsWith('https')) {
if (config.url.startsWith('https') && !config.disableHsts) {
app.use(async (ctx, next) => {
ctx.set('strict-transport-security', 'max-age=15552000; preload');
await next();

View File

@@ -37,8 +37,10 @@ async function save(path: string, name: string, type: string, hash: string, size
if (config.drive && config.drive.storage == 'minio') {
const minio = new Minio.Client(config.drive.config);
const key = `${config.drive.prefix}/${uuid.v4()}`;
const thumbnailKey = `${config.drive.prefix}/${uuid.v4()}`;
const [ext] = (name.match(/\.([a-zA-Z0-9_-]+)$/) || ['']);
const key = `${config.drive.prefix}/${uuid.v4()}${ext}`;
const thumbnailKey = `${config.drive.prefix}/${uuid.v4()}.jpg`;
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 }`;

View File

@@ -1125,4 +1125,76 @@ describe('API', () => {
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);
}));
});
});