summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2019-05-03 18:58:54 +0900
committersyuilo <syuilotan@yahoo.co.jp>2019-05-03 18:58:54 +0900
commit12cd2709d6764986f01d1dbcb394f40c43a74c71 (patch)
tree6828868f93984839363773a0cdcf4284719e7b26 /src
parentMerge branch 'develop' (diff)
parent11.10.0 (diff)
downloadmisskey-12cd2709d6764986f01d1dbcb394f40c43a74c71.tar.gz
misskey-12cd2709d6764986f01d1dbcb394f40c43a74c71.tar.bz2
misskey-12cd2709d6764986f01d1dbcb394f40c43a74c71.zip
Merge branch 'develop'
Diffstat (limited to 'src')
-rw-r--r--src/client/app/common/views/components/page-editor/page-editor.blocks.vue2
-rw-r--r--src/client/app/common/views/components/page-editor/page-editor.container.vue15
-rw-r--r--src/client/app/common/views/components/settings/profile.vue17
-rw-r--r--src/client/app/mios.ts7
-rw-r--r--src/client/app/sw.js36
-rw-r--r--src/misc/aiscript/evaluator.ts1
-rw-r--r--src/misc/aiscript/index.ts1
-rw-r--r--src/models/entities/user-profile.ts12
-rw-r--r--src/models/repositories/user.ts2
-rw-r--r--src/queue/processors/db/export-blocking.ts2
-rw-r--r--src/queue/processors/db/export-following.ts2
-rw-r--r--src/queue/processors/db/export-mute.ts2
-rw-r--r--src/queue/processors/db/export-notes.ts2
-rw-r--r--src/queue/processors/db/export-user-lists.ts2
-rw-r--r--src/queue/processors/db/import-following.ts3
-rw-r--r--src/server/api/service/discord.ts8
-rw-r--r--src/server/api/service/github.ts8
-rw-r--r--src/server/api/service/twitter.ts8
-rw-r--r--src/services/drive/add-file.ts2
19 files changed, 49 insertions, 83 deletions
diff --git a/src/client/app/common/views/components/page-editor/page-editor.blocks.vue b/src/client/app/common/views/components/page-editor/page-editor.blocks.vue
index 894feb34cc..266b6d6b21 100644
--- a/src/client/app/common/views/components/page-editor/page-editor.blocks.vue
+++ b/src/client/app/common/views/components/page-editor/page-editor.blocks.vue
@@ -1,5 +1,5 @@
<template>
-<x-draggable tag="div" :list="blocks" handle=".drag-handle" :group="{ name: 'blocks' }" animation="150">
+<x-draggable tag="div" :list="blocks" handle=".drag-handle" :group="{ name: 'blocks' }" animation="150" swap-threshold="0.5">
<component v-for="block in blocks" :is="'x-' + block.type" :value="block" @input="updateItem" @remove="removeItem" :key="block.id" :ai-script="aiScript"/>
</x-draggable>
</template>
diff --git a/src/client/app/common/views/components/page-editor/page-editor.container.vue b/src/client/app/common/views/components/page-editor/page-editor.container.vue
index 4127cd39e0..a3a501afb4 100644
--- a/src/client/app/common/views/components/page-editor/page-editor.container.vue
+++ b/src/client/app/common/views/components/page-editor/page-editor.container.vue
@@ -1,12 +1,15 @@
<template>
-<div class="cpjygsrt" :class="{ error: error != null, warn: warn != null, draggable }">
- <header class="drag-handle">
+<div class="cpjygsrt" :class="{ error: error != null, warn: warn != null }">
+ <header>
<div class="title"><slot name="header"></slot></div>
<div class="buttons">
<slot name="func"></slot>
<button v-if="removable" @click="remove()">
<fa :icon="faTrashAlt"/>
</button>
+ <button v-if="draggable" class="drag-handle">
+ <fa :icon="faBars"/>
+ </button>
<button @click="toggleContent(!showBody)">
<template v-if="showBody"><fa icon="angle-up"/></template>
<template v-else><fa icon="angle-down"/></template>
@@ -23,6 +26,7 @@
<script lang="ts">
import Vue from 'vue';
+import { faBars } from '@fortawesome/free-solid-svg-icons';
import { faTrashAlt } from '@fortawesome/free-regular-svg-icons';
import i18n from '../../../../i18n';
@@ -54,7 +58,7 @@ export default Vue.extend({
data() {
return {
showBody: this.expanded,
- faTrashAlt
+ faTrashAlt, faBars
};
},
methods: {
@@ -124,9 +128,8 @@ export default Vue.extend({
&:active
color var(--faceTextButtonActive)
- &.draggable
- > header
- cursor move
+ .drag-handle
+ cursor move
> .warn
color #b19e49
diff --git a/src/client/app/common/views/components/settings/profile.vue b/src/client/app/common/views/components/settings/profile.vue
index c1ecfafe16..a22fd6df98 100644
--- a/src/client/app/common/views/components/settings/profile.vue
+++ b/src/client/app/common/views/components/settings/profile.vue
@@ -290,12 +290,17 @@ export default Vue.extend({
this.exportTarget == 'mute' ? 'i/export-mute' :
this.exportTarget == 'blocking' ? 'i/export-blocking' :
this.exportTarget == 'user-lists' ? 'i/export-user-lists' :
- null, {});
-
- this.$root.dialog({
- type: 'info',
- text: this.$t('export-requested')
- });
+ null, {}).then(() => {
+ this.$root.dialog({
+ type: 'info',
+ text: this.$t('export-requested')
+ });
+ }).catch((e: any) => {
+ this.$root.dialog({
+ type: 'error',
+ text: e.message
+ });
+ });
},
doImport() {
diff --git a/src/client/app/mios.ts b/src/client/app/mios.ts
index 191b72e5bf..3ebee35804 100644
--- a/src/client/app/mios.ts
+++ b/src/client/app/mios.ts
@@ -173,9 +173,10 @@ export default class MiOS extends EventEmitter {
// Init service worker
if (this.shouldRegisterSw) {
- this.getMeta().then(data => {
- this.registerSw(data.swPublickey);
- });
+ // #4813
+ //this.getMeta().then(data => {
+ // this.registerSw(data.swPublickey);
+ //});
}
};
diff --git a/src/client/app/sw.js b/src/client/app/sw.js
index ccf6dc818e..92f2ac8284 100644
--- a/src/client/app/sw.js
+++ b/src/client/app/sw.js
@@ -3,12 +3,6 @@
*/
import composeNotification from './common/scripts/compose-notification';
-import { erase } from '../../prelude/array';
-
-// キャッシュするリソース
-const cachee = [
- '/'
-];
// インストールされたとき
self.addEventListener('install', ev => {
@@ -16,31 +10,9 @@ self.addEventListener('install', ev => {
ev.waitUntil(Promise.all([
self.skipWaiting(), // Force activate
- caches.open(_VERSION_).then(cache => cache.addAll(cachee)) // Cache
]));
});
-// アクティベートされたとき
-self.addEventListener('activate', ev => {
- // Clean up old caches
- ev.waitUntil(
- caches.keys().then(keys => Promise.all(
- erase(_VERSION_, keys)
- .map(key => caches.delete(key))
- ))
- );
-});
-
-// リクエストが発生したとき
-self.addEventListener('fetch', ev => {
- ev.respondWith(
- // キャッシュがあるか確認してあればそれを返す
- caches.match(ev.request).then(response =>
- response || fetch(ev.request)
- )
- );
-});
-
// プッシュ通知を受け取ったとき
self.addEventListener('push', ev => {
// クライアント取得
@@ -59,11 +31,3 @@ self.addEventListener('push', ev => {
});
}));
});
-
-self.addEventListener('message', ev => {
- if (ev.data == 'clear') {
- caches.keys().then(keys => {
- for (const key of keys) caches.delete(key);
- });
- }
-});
diff --git a/src/misc/aiscript/evaluator.ts b/src/misc/aiscript/evaluator.ts
index 2bc866dc43..6beb320442 100644
--- a/src/misc/aiscript/evaluator.ts
+++ b/src/misc/aiscript/evaluator.ts
@@ -160,6 +160,7 @@ export class ASEvaluator {
subtract: (a: number, b: number) => a - b,
multiply: (a: number, b: number) => a * b,
divide: (a: number, b: number) => a / b,
+ remind: (a: number, b: number) => a % b,
strLen: (a: string) => a.length,
strPick: (a: string, b: number) => a[b - 1],
strReplace: (a: string, b: string, c: string) => a.split(b).join(c),
diff --git a/src/misc/aiscript/index.ts b/src/misc/aiscript/index.ts
index 711cfb41eb..1ce09b7bdb 100644
--- a/src/misc/aiscript/index.ts
+++ b/src/misc/aiscript/index.ts
@@ -57,6 +57,7 @@ export const funcDefs: Record<string, { in: any[]; out: any; category: string; i
subtract: { in: ['number', 'number'], out: 'number', category: 'operation', icon: faMinus, },
multiply: { in: ['number', 'number'], out: 'number', category: 'operation', icon: faTimes, },
divide: { in: ['number', 'number'], out: 'number', category: 'operation', icon: faDivide, },
+ remind: { in: ['number', 'number'], out: 'number', category: 'operation', icon: faDivide, },
eq: { in: [0, 0], out: 'boolean', category: 'comparison', icon: faEquals, },
notEq: { in: [0, 0], out: 'boolean', category: 'comparison', icon: faNotEqual, },
gt: { in: ['number', 'number'], out: 'boolean', category: 'comparison', icon: faGreaterThan, },
diff --git a/src/models/entities/user-profile.ts b/src/models/entities/user-profile.ts
index a2d7b8d2c2..16e5d5b9e0 100644
--- a/src/models/entities/user-profile.ts
+++ b/src/models/entities/user-profile.ts
@@ -144,10 +144,10 @@ export class UserProfile {
})
public githubAccessToken: string | null;
- @Column('integer', {
- nullable: true, default: null,
+ @Column('varchar', {
+ length: 64, nullable: true, default: null,
})
- public githubId: number | null;
+ public githubId: string | null;
@Column('varchar', {
length: 64, nullable: true, default: null,
@@ -169,10 +169,10 @@ export class UserProfile {
})
public discordRefreshToken: string | null;
- @Column('integer', {
- nullable: true, default: null,
+ @Column('varchar', {
+ length: 64, nullable: true, default: null,
})
- public discordExpiresDate: number | null;
+ public discordExpiresDate: string | null;
@Column('varchar', {
length: 64, nullable: true, default: null,
diff --git a/src/models/repositories/user.ts b/src/models/repositories/user.ts
index eab3acc8e7..68a742d35f 100644
--- a/src/models/repositories/user.ts
+++ b/src/models/repositories/user.ts
@@ -127,6 +127,7 @@ export class UserRepository extends Repository<User> {
pinnedNotes: Notes.packMany(pins.map(pin => pin.noteId), meId, {
detail: true
}),
+ twoFactorEnabled: profile!.twoFactorEnabled,
} : {}),
...(opts.detail && meId === user.id ? {
@@ -135,7 +136,6 @@ export class UserRepository extends Repository<User> {
autoWatch: profile!.autoWatch,
alwaysMarkNsfw: profile!.alwaysMarkNsfw,
carefulBot: profile!.carefulBot,
- twoFactorEnabled: profile!.twoFactorEnabled,
hasUnreadMessagingMessage: MessagingMessages.count({
where: {
recipientId: user.id,
diff --git a/src/queue/processors/db/export-blocking.ts b/src/queue/processors/db/export-blocking.ts
index c4b8c9438d..0504ab8c30 100644
--- a/src/queue/processors/db/export-blocking.ts
+++ b/src/queue/processors/db/export-blocking.ts
@@ -85,7 +85,7 @@ export async function exportBlocking(job: Bull.Job, done: any): Promise<void> {
logger.succ(`Exported to: ${path}`);
const fileName = 'blocking-' + dateFormat(new Date(), 'yyyy-mm-dd-HH-MM-ss') + '.csv';
- const driveFile = await addFile(user, path, fileName);
+ const driveFile = await addFile(user, path, fileName, null, null, true);
logger.succ(`Exported to: ${driveFile.id}`);
cleanup();
diff --git a/src/queue/processors/db/export-following.ts b/src/queue/processors/db/export-following.ts
index 9fab5bb21a..996ef6310d 100644
--- a/src/queue/processors/db/export-following.ts
+++ b/src/queue/processors/db/export-following.ts
@@ -85,7 +85,7 @@ export async function exportFollowing(job: Bull.Job, done: any): Promise<void> {
logger.succ(`Exported to: ${path}`);
const fileName = 'following-' + dateFormat(new Date(), 'yyyy-mm-dd-HH-MM-ss') + '.csv';
- const driveFile = await addFile(user, path, fileName);
+ const driveFile = await addFile(user, path, fileName, null, null, true);
logger.succ(`Exported to: ${driveFile.id}`);
cleanup();
diff --git a/src/queue/processors/db/export-mute.ts b/src/queue/processors/db/export-mute.ts
index b957b48b20..5531553220 100644
--- a/src/queue/processors/db/export-mute.ts
+++ b/src/queue/processors/db/export-mute.ts
@@ -85,7 +85,7 @@ export async function exportMute(job: Bull.Job, done: any): Promise<void> {
logger.succ(`Exported to: ${path}`);
const fileName = 'mute-' + dateFormat(new Date(), 'yyyy-mm-dd-HH-MM-ss') + '.csv';
- const driveFile = await addFile(user, path, fileName);
+ const driveFile = await addFile(user, path, fileName, null, null, true);
logger.succ(`Exported to: ${driveFile.id}`);
cleanup();
diff --git a/src/queue/processors/db/export-notes.ts b/src/queue/processors/db/export-notes.ts
index d03a216a59..94a4302e05 100644
--- a/src/queue/processors/db/export-notes.ts
+++ b/src/queue/processors/db/export-notes.ts
@@ -108,7 +108,7 @@ export async function exportNotes(job: Bull.Job, done: any): Promise<void> {
logger.succ(`Exported to: ${path}`);
const fileName = 'notes-' + dateFormat(new Date(), 'yyyy-mm-dd-HH-MM-ss') + '.json';
- const driveFile = await addFile(user, path, fileName);
+ const driveFile = await addFile(user, path, fileName, null, null, true);
logger.succ(`Exported to: ${driveFile.id}`);
cleanup();
diff --git a/src/queue/processors/db/export-user-lists.ts b/src/queue/processors/db/export-user-lists.ts
index 5cd978c1aa..447cdaa174 100644
--- a/src/queue/processors/db/export-user-lists.ts
+++ b/src/queue/processors/db/export-user-lists.ts
@@ -62,7 +62,7 @@ export async function exportUserLists(job: Bull.Job, done: any): Promise<void> {
logger.succ(`Exported to: ${path}`);
const fileName = 'user-lists-' + dateFormat(new Date(), 'yyyy-mm-dd-HH-MM-ss') + '.csv';
- const driveFile = await addFile(user, path, fileName);
+ const driveFile = await addFile(user, path, fileName, null, null, true);
logger.succ(`Exported to: ${driveFile.id}`);
cleanup();
diff --git a/src/queue/processors/db/import-following.ts b/src/queue/processors/db/import-following.ts
index 8de3193e46..ff4ff6b6ab 100644
--- a/src/queue/processors/db/import-following.ts
+++ b/src/queue/processors/db/import-following.ts
@@ -35,7 +35,8 @@ export async function importFollowing(job: Bull.Job, done: any): Promise<void> {
linenum++;
try {
- const { username, host } = parseAcct(line.trim());
+ const acct = line.split(',')[0].trim();
+ const { username, host } = parseAcct(acct);
let target = isSelfHost(host!) ? await Users.findOne({
host: null,
diff --git a/src/server/api/service/discord.ts b/src/server/api/service/discord.ts
index ac4d9a5601..29da17dd9e 100644
--- a/src/server/api/service/discord.ts
+++ b/src/server/api/service/discord.ts
@@ -203,12 +203,8 @@ router.get('/dc/cb', async ctx => {
}
const profile = await UserProfiles.createQueryBuilder()
- .where('discord @> :discord', {
- discord: {
- id: id,
- },
- })
- .andWhere('userHost IS NULL')
+ .where('"discordId" = :id', { id: id })
+ .andWhere('"userHost" IS NULL')
.getOne();
if (profile == null) {
diff --git a/src/server/api/service/github.ts b/src/server/api/service/github.ts
index 4f287406d1..de1e15f079 100644
--- a/src/server/api/service/github.ts
+++ b/src/server/api/service/github.ts
@@ -193,12 +193,8 @@ router.get('/gh/cb', async ctx => {
}
const link = await UserProfiles.createQueryBuilder()
- .where('github @> :github', {
- github: {
- id: id,
- },
- })
- .andWhere('userHost IS NULL')
+ .where('"githubId" = :id', { id: id })
+ .andWhere('"userHost" IS NULL')
.getOne();
if (link == null) {
diff --git a/src/server/api/service/twitter.ts b/src/server/api/service/twitter.ts
index 3a5800f00b..55369d0aee 100644
--- a/src/server/api/service/twitter.ts
+++ b/src/server/api/service/twitter.ts
@@ -141,12 +141,8 @@ router.get('/tw/cb', async ctx => {
const result = await twAuth!.done(JSON.parse(twCtx), ctx.query.oauth_verifier);
const link = await UserProfiles.createQueryBuilder()
- .where('twitter @> :twitter', {
- twitter: {
- userId: result.userId,
- },
- })
- .andWhere('userHost IS NULL')
+ .where('"twitterUserId" = :id', { id: result.userId })
+ .andWhere('"userHost" IS NULL')
.getOne();
if (link == null) {
diff --git a/src/services/drive/add-file.ts b/src/services/drive/add-file.ts
index 4cb36adbfc..c67ee475a8 100644
--- a/src/services/drive/add-file.ts
+++ b/src/services/drive/add-file.ts
@@ -393,6 +393,8 @@ export default async function(
if (isLink) {
file.url = url;
+ file.thumbnailUrl = url;
+ file.webpublicUrl = url;
}
}